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/12/17 10:27:37 UTC

[01/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Repository: zest-java
Updated Branches:
  refs/heads/develop 05439b735 -> e0e1d7d4f


http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypedFragmentAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypedFragmentAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypedFragmentAppliesToFilter.java
deleted file mode 100644
index a5dc802..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypedFragmentAppliesToFilter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class TypedFragmentAppliesToFilter
-    implements AppliesToFilter
-{
-    @Override
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return method.getDeclaringClass().isAssignableFrom( fragmentClass );
-    }
-}


[81/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.


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

Branch: refs/heads/develop
Commit: e0e1d7d4fa303d1d5e3ced606f4c62ac9d7bf9c5
Parents: e08a8d8
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Dec 17 17:23:21 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Dec 17 17:23:27 2016 +0800

----------------------------------------------------------------------
 .../apache/polygene/gradle/doc/XsltTask.groovy  |  11 +-
 .../gradle/release/ModuleReleaseSpec.groovy     |  23 +-
 .../org/apache/zest/gradle/doc/XsltTask.groovy  | 100 -----
 .../gradle/release/ModuleReleaseSpec.groovy     |  53 ---
 .../gradle/release/ModuleReleaseSpecTest.groovy | 118 ++++++
 .../gradle/release/ModuleReleaseSpecTest.groovy | 118 ------
 .../composite/InterfaceDefaultMethodsTest.java  |  12 +-
 .../polygene/test/indexing/model/Address.java   |   2 +-
 .../polygene/library/appbrowser/Browser.java    | 109 +++++
 .../library/appbrowser/BrowserException.java    |  29 ++
 .../polygene/library/appbrowser/Formatter.java  |  34 ++
 .../library/appbrowser/FormatterFactory.java    |  25 ++
 .../appbrowser/json/AbstractJsonFormatter.java  |  85 ++++
 .../json/ApplicationModelFormatter.java         |  56 +++
 .../library/appbrowser/json/ArrayFormatter.java |  56 +++
 .../json/CompositeMethodModelFormatter.java     |  54 +++
 .../json/ConstructorModelFormatter.java         |  53 +++
 .../appbrowser/json/EntityModelFormatter.java   |  56 +++
 .../json/InjectedFieldModelFormatter.java       |  60 +++
 .../appbrowser/json/JsonFormatterFactory.java   | 107 +++++
 .../appbrowser/json/LayerModelFormatter.java    |  62 +++
 .../appbrowser/json/MixinModelFormatter.java    |  53 +++
 .../appbrowser/json/ModuleModelFormatter.java   |  54 +++
 .../library/appbrowser/json/NullFormatter.java  |  48 +++
 .../appbrowser/json/ObjectModelFormatter.java   |  53 +++
 .../appbrowser/json/ServiceModelFormatter.java  |  61 +++
 .../appbrowser/json/ValueModelFormatter.java    |  55 +++
 .../apache/zest/library/appbrowser/Browser.java | 109 -----
 .../library/appbrowser/BrowserException.java    |  29 --
 .../zest/library/appbrowser/Formatter.java      |  34 --
 .../library/appbrowser/FormatterFactory.java    |  25 --
 .../appbrowser/json/AbstractJsonFormatter.java  |  85 ----
 .../json/ApplicationModelFormatter.java         |  56 ---
 .../library/appbrowser/json/ArrayFormatter.java |  56 ---
 .../json/CompositeMethodModelFormatter.java     |  54 ---
 .../json/ConstructorModelFormatter.java         |  53 ---
 .../appbrowser/json/EntityModelFormatter.java   |  56 ---
 .../json/InjectedFieldModelFormatter.java       |  60 ---
 .../appbrowser/json/JsonFormatterFactory.java   | 107 -----
 .../appbrowser/json/LayerModelFormatter.java    |  62 ---
 .../appbrowser/json/MixinModelFormatter.java    |  53 ---
 .../appbrowser/json/ModuleModelFormatter.java   |  54 ---
 .../library/appbrowser/json/NullFormatter.java  |  48 ---
 .../appbrowser/json/ObjectModelFormatter.java   |  53 ---
 .../appbrowser/json/ServiceModelFormatter.java  |  61 ---
 .../appbrowser/json/ValueModelFormatter.java    |  55 ---
 .../library/appbrowser/AppBrowserTest.java      | 167 ++++++++
 .../zest/library/appbrowser/AppBrowserTest.java | 167 --------
 .../http/VirtualHostJettyServiceTest.java       |  91 +++++
 .../library/http/dns/LocalManagedDns.java       | 125 ++++++
 .../http/dns/LocalManagedDnsDescriptor.java     |  48 +++
 .../http/VirtualHostJettyServiceTest.java       |  91 -----
 .../zest/library/http/dns/LocalManagedDns.java  | 125 ------
 .../http/dns/LocalManagedDnsDescriptor.java     |  48 ---
 ...un.net.spi.nameservice.NameServiceDescriptor |   2 +-
 .../jdbm/JdbmEntityStorePerformanceTest.java    |  72 ++++
 .../MemoryEntityStorePerformanceTest.java       |  60 +++
 .../sql/DerbySQLEntityStorePerformanceTest.java | 126 ++++++
 .../PostgreSQLEntityStorePerformanceTest.java   | 154 +++++++
 .../indexing/rdf/QueryPerformanceTest.java      | 399 +++++++++++++++++++
 .../CompositeCreationPerformanceTest.java       | 287 +++++++++++++
 .../composite/InvocationPerformanceTest.java    | 204 ++++++++++
 .../PropertyMixinInvocationPerformanceTest.java | 134 +++++++
 .../object/ObjectCreationPerformanceTest.java   |  71 ++++
 .../ServiceInvocationPerformanceTest.java       | 113 ++++++
 .../jdbm/JdbmEntityStorePerformanceTest.java    |  72 ----
 .../MemoryEntityStorePerformanceTest.java       |  60 ---
 .../sql/DerbySQLEntityStorePerformanceTest.java | 126 ------
 .../PostgreSQLEntityStorePerformanceTest.java   | 154 -------
 .../indexing/rdf/QueryPerformanceTest.java      | 399 -------------------
 .../CompositeCreationPerformanceTest.java       | 287 -------------
 .../composite/InvocationPerformanceTest.java    | 204 ----------
 .../PropertyMixinInvocationPerformanceTest.java | 134 -------
 .../object/ObjectCreationPerformanceTest.java   |  71 ----
 .../ServiceInvocationPerformanceTest.java       | 113 ------
 .../jdbm/JdbmEntityStoreService.properties      |  25 ++
 .../rdf/repository/rdf-indexing.properties      |  22 +
 .../jdbm/JdbmEntityStoreService.properties      |  25 --
 .../rdf/repository/rdf-indexing.properties      |  22 -
 tools/generator-polygene/app/index.js           | 317 +++++++++++++++
 .../app/templates/ConfigModule/bootstrap.tmpl   |  41 ++
 .../templates/ConfigurationLayer/bootstrap.tmpl |  46 +++
 .../templates/ConnectivityLayer/bootstrap.tmpl  |  41 ++
 .../app/templates/CrudModule/bootstrap.tmpl     |  38 ++
 .../app/templates/DomainLayer/bootstrap.tmpl    |  46 +++
 .../FileConfigurationModule/bootstrap.tmpl      |  41 ++
 .../app/templates/Heroes/Hero.tmpl              |  28 ++
 .../app/templates/Heroes/app.tmpl               | 103 +++++
 .../app/templates/Heroes/bootstrap.tmpl         |  68 ++++
 .../app/templates/Heroes/web.tmpl               |  54 +++
 .../Heroes/webapp/app/app.component.css         |  34 ++
 .../Heroes/webapp/app/app.component.js          |  41 ++
 .../Heroes/webapp/app/app.component.js.map      |   1 +
 .../Heroes/webapp/app/app.component.ts          |  37 ++
 .../Heroes/webapp/app/dashboard.component.css   |  67 ++++
 .../Heroes/webapp/app/dashboard.component.html  |  15 +
 .../Heroes/webapp/app/dashboard.component.js    |  38 ++
 .../webapp/app/dashboard.component.js.map       |   1 +
 .../Heroes/webapp/app/dashboard.component.ts    |  31 ++
 .../Heroes/webapp/app/hero-detail.component.css |  36 ++
 .../webapp/app/hero-detail.component.html       |  16 +
 .../Heroes/webapp/app/hero-detail.component.js  |  37 ++
 .../webapp/app/hero-detail.component.js.map     |   1 +
 .../Heroes/webapp/app/hero-detail.component.ts  |  34 ++
 .../app/templates/Heroes/webapp/app/hero.js     |  13 +
 .../app/templates/Heroes/webapp/app/hero.js.map |   1 +
 .../templates/Heroes/webapp/app/hero.service.js |  30 ++
 .../Heroes/webapp/app/hero.service.js.map       |   1 +
 .../templates/Heroes/webapp/app/hero.service.ts |  22 +
 .../app/templates/Heroes/webapp/app/hero.ts     |  11 +
 .../Heroes/webapp/app/heroes.component.css      |  66 +++
 .../Heroes/webapp/app/heroes.component.html     |  21 +
 .../Heroes/webapp/app/heroes.component.js       |  42 ++
 .../Heroes/webapp/app/heroes.component.js.map   |   1 +
 .../Heroes/webapp/app/heroes.component.ts       |  39 ++
 .../app/templates/Heroes/webapp/app/main.js     |  15 +
 .../app/templates/Heroes/webapp/app/main.js.map |   1 +
 .../app/templates/Heroes/webapp/app/main.ts     |  16 +
 .../templates/Heroes/webapp/app/mock-heroes.js  |  19 +
 .../Heroes/webapp/app/mock-heroes.js.map        |   1 +
 .../templates/Heroes/webapp/app/mock-heroes.ts  |  21 +
 .../app/templates/Heroes/webapp/index.html      |  41 ++
 .../app/templates/Heroes/webapp/styles.css      | 149 +++++++
 .../InfrastructureLayer/bootstrap.tmpl          |  55 +++
 .../JacksonSerializationModule/bootstrap.tmpl   |  53 +++
 .../templates/NoCachingModule/bootstrap.tmpl    |  46 +++
 .../templates/RDFIndexingModule/bootstrap.tmpl  |  50 +++
 .../HardcodedSecurityRepositoryMixin.tmpl       |  54 +++
 .../RestApiModule/SecurityRepository.tmpl       |  36 ++
 .../templates/RestApiModule/SimpleEnroler.tmpl  |  52 +++
 .../templates/RestApiModule/SimpleVerifier.tmpl |  46 +++
 .../app/templates/RestApiModule/bootstrap.tmpl  |  56 +++
 .../HardcodedSecurityRepositoryMixin.tmpl       |  51 +++
 .../SecurityModule/SecurityRepository.tmpl      |  35 ++
 .../app/templates/SecurityModule/bootstrap.tmpl |  46 +++
 .../app/templates/StorageModule/bootstrap.tmpl  |  51 +++
 .../app/templates/buildtool/gradle-app.tmpl     |  41 ++
 .../templates/buildtool/gradle-bootstrap.tmpl   |  36 ++
 .../app/templates/buildtool/gradle-model.tmpl   |  23 ++
 .../app/templates/buildtool/gradle-rest.tmpl    |  27 ++
 .../app/templates/buildtool/gradle-root.tmpl    |  46 +++
 .../app/templates/buildtool/gradle-wrapper.jar_ | Bin 0 -> 51348 bytes
 .../buildtool/gradle-wrapper.properties_        |  24 ++
 .../app/templates/buildtool/gradlew-bat.tmpl    | 109 +++++
 .../app/templates/buildtool/gradlew.tmpl        | 183 +++++++++
 .../app/templates/buildtool/settings.tmpl       |  41 ++
 tools/generator-polygene/package.json           |  14 +
 tools/generator-zest/app/index.js               | 317 ---------------
 .../app/templates/ConfigModule/bootstrap.tmpl   |  41 --
 .../templates/ConfigurationLayer/bootstrap.tmpl |  46 ---
 .../templates/ConnectivityLayer/bootstrap.tmpl  |  41 --
 .../app/templates/CrudModule/bootstrap.tmpl     |  38 --
 .../app/templates/DomainLayer/bootstrap.tmpl    |  46 ---
 .../FileConfigurationModule/bootstrap.tmpl      |  41 --
 .../app/templates/Heroes/Hero.tmpl              |  28 --
 .../app/templates/Heroes/app.tmpl               | 103 -----
 .../app/templates/Heroes/bootstrap.tmpl         |  68 ----
 .../app/templates/Heroes/web.tmpl               |  54 ---
 .../Heroes/webapp/app/app.component.css         |  34 --
 .../Heroes/webapp/app/app.component.js          |  41 --
 .../Heroes/webapp/app/app.component.js.map      |   1 -
 .../Heroes/webapp/app/app.component.ts          |  37 --
 .../Heroes/webapp/app/dashboard.component.css   |  67 ----
 .../Heroes/webapp/app/dashboard.component.html  |  15 -
 .../Heroes/webapp/app/dashboard.component.js    |  38 --
 .../webapp/app/dashboard.component.js.map       |   1 -
 .../Heroes/webapp/app/dashboard.component.ts    |  31 --
 .../Heroes/webapp/app/hero-detail.component.css |  36 --
 .../webapp/app/hero-detail.component.html       |  16 -
 .../Heroes/webapp/app/hero-detail.component.js  |  37 --
 .../webapp/app/hero-detail.component.js.map     |   1 -
 .../Heroes/webapp/app/hero-detail.component.ts  |  34 --
 .../app/templates/Heroes/webapp/app/hero.js     |  13 -
 .../app/templates/Heroes/webapp/app/hero.js.map |   1 -
 .../templates/Heroes/webapp/app/hero.service.js |  30 --
 .../Heroes/webapp/app/hero.service.js.map       |   1 -
 .../templates/Heroes/webapp/app/hero.service.ts |  22 -
 .../app/templates/Heroes/webapp/app/hero.ts     |  11 -
 .../Heroes/webapp/app/heroes.component.css      |  66 ---
 .../Heroes/webapp/app/heroes.component.html     |  21 -
 .../Heroes/webapp/app/heroes.component.js       |  42 --
 .../Heroes/webapp/app/heroes.component.js.map   |   1 -
 .../Heroes/webapp/app/heroes.component.ts       |  39 --
 .../app/templates/Heroes/webapp/app/main.js     |  15 -
 .../app/templates/Heroes/webapp/app/main.js.map |   1 -
 .../app/templates/Heroes/webapp/app/main.ts     |  16 -
 .../templates/Heroes/webapp/app/mock-heroes.js  |  19 -
 .../Heroes/webapp/app/mock-heroes.js.map        |   1 -
 .../templates/Heroes/webapp/app/mock-heroes.ts  |  21 -
 .../app/templates/Heroes/webapp/index.html      |  41 --
 .../app/templates/Heroes/webapp/styles.css      | 149 -------
 .../InfrastructureLayer/bootstrap.tmpl          |  55 ---
 .../JacksonSerializationModule/bootstrap.tmpl   |  53 ---
 .../templates/NoCachingModule/bootstrap.tmpl    |  46 ---
 .../templates/RdfIndexingModule/bootstrap.tmpl  |  50 ---
 .../HardcodedSecurityRepositoryMixin.tmpl       |  54 ---
 .../RestApiModule/SecurityRepository.tmpl       |  36 --
 .../templates/RestApiModule/SimpleEnroler.tmpl  |  52 ---
 .../templates/RestApiModule/SimpleVerifier.tmpl |  46 ---
 .../app/templates/RestApiModule/bootstrap.tmpl  |  56 ---
 .../HardcodedSecurityRepositoryMixin.tmpl       |  51 ---
 .../SecurityModule/SecurityRepository.tmpl      |  35 --
 .../app/templates/SecurityModule/bootstrap.tmpl |  46 ---
 .../app/templates/StorageModule/bootstrap.tmpl  |  51 ---
 .../app/templates/buildtool/gradle-app.tmpl     |  41 --
 .../templates/buildtool/gradle-bootstrap.tmpl   |  36 --
 .../app/templates/buildtool/gradle-model.tmpl   |  23 --
 .../app/templates/buildtool/gradle-rest.tmpl    |  27 --
 .../app/templates/buildtool/gradle-root.tmpl    |  46 ---
 .../app/templates/buildtool/gradle-wrapper.jar_ | Bin 51348 -> 0 bytes
 .../buildtool/gradle-wrapper.properties_        |  24 --
 .../app/templates/buildtool/gradlew-bat.tmpl    | 109 -----
 .../app/templates/buildtool/gradlew.tmpl        | 183 ---------
 .../app/templates/buildtool/settings.tmpl       |  41 --
 tools/generator-zest/package.json               |  14 -
 .../idea/PolygeneApplicationComponent.java      | 133 +++++++
 .../common/PolygeneAppliesToConstants.java      |  33 ++
 .../appliesTo/common/PolygeneAppliesToUtil.java | 138 +++++++
 ...ToAnnotationDeclaredCorrectlyInspection.java | 294 ++++++++++++++
 .../AbstractCreateElementActionBase.java        | 153 +++++++
 .../actions/PolygeneCreateActionGroup.java      |  82 ++++
 .../plugin/idea/common/facet/PolygeneFacet.java |  50 +++
 .../facet/PolygeneFacetConfiguration.java       |  56 +++
 .../idea/common/facet/PolygeneFacetType.java    | 122 ++++++
 .../common/facet/ui/PolygeneFacetEditorTab.java |  72 ++++
 .../idea/common/inspections/AbstractFix.java    |  51 +++
 .../common/inspections/AbstractInspection.java  |  62 +++
 .../common/intentions/AbstractIntention.java    | 132 ++++++
 .../idea/common/psi/PsiAnnotationUtil.java      |  97 +++++
 .../plugin/idea/common/psi/PsiClassUtil.java    | 134 +++++++
 .../psi/search/GlobalSearchScopeUtil.java       |  67 ++++
 .../common/resource/PolygeneResourceBundle.java |  68 ++++
 .../plugin/idea/common/vfs/VirtualFileUtil.java |  73 ++++
 ...teConcernFromMixinTypeOrCompositeAction.java |  62 +++
 .../CreateConcernOfInPackageAction.java         | 121 ++++++
 .../common/PolygeneConcernConstants.java        |  40 ++
 .../concerns/common/PolygeneConcernUtil.java    | 228 +++++++++++
 ...nsAnnotationDeclaredCorrectlyInspection.java | 175 ++++++++
 .../intentions/add/AddConcernOnType.java        | 140 +++++++
 ...larationOnFieldAndConstructorInspection.java |  92 +++++
 ...nAnnotationDeclarationOnFieldInspection.java | 141 +++++++
 .../PolygeneInvocationAnnotationConstants.java  |  32 ++
 .../PolygeneInvocationAnnotationUtil.java       | 129 ++++++
 ...onAnnotationDeclaredCorrectlyInspection.java | 121 ++++++
 .../PolygeneServiceAnnotationConstants.java     |  32 ++
 .../common/PolygeneServiceAnnotationUtil.java   |  99 +++++
 ...ceAnnotationDeclaredCorrectlyInspection.java | 112 ++++++
 .../PolygeneStructureAnnotationConstants.java   |  53 +++
 .../common/PolygeneStructureAnnotationUtil.java | 124 ++++++
 .../common/ReplaceWithStructureAnnotation.java  |  49 +++
 ...reAnnotationDeclaredCorrectlyInspection.java |  92 +++++
 .../mixins/common/PolygeneMixinConstants.java   |  32 ++
 .../idea/mixins/common/PolygeneMixinUtil.java   | 196 +++++++++
 .../inspections/MixinImplementsMixinType.java   | 190 +++++++++
 .../MixinsAnnotationDeclaredOnMixinType.java    |  92 +++++
 .../common/PolygeneSideEffectConstants.java     |  35 ++
 .../common/PolygeneSideEffectUtil.java          | 188 +++++++++
 ...tsAnnotationDeclaredCorrectlyInspection.java | 177 ++++++++
 .../idea/PolygeneApplicationComponent.java      | 133 -------
 .../common/PolygeneAppliesToConstants.java      |  33 --
 .../appliesTo/common/PolygeneAppliesToUtil.java | 138 -------
 ...ToAnnotationDeclaredCorrectlyInspection.java | 294 --------------
 .../AbstractCreateElementActionBase.java        | 153 -------
 .../actions/PolygeneCreateActionGroup.java      |  82 ----
 .../plugin/idea/common/facet/PolygeneFacet.java |  50 ---
 .../facet/PolygeneFacetConfiguration.java       |  56 ---
 .../idea/common/facet/PolygeneFacetType.java    | 122 ------
 .../common/facet/ui/PolygeneFacetEditorTab.java |  72 ----
 .../idea/common/inspections/AbstractFix.java    |  51 ---
 .../common/inspections/AbstractInspection.java  |  62 ---
 .../common/intentions/AbstractIntention.java    | 132 ------
 .../idea/common/psi/PsiAnnotationUtil.java      |  97 -----
 .../plugin/idea/common/psi/PsiClassUtil.java    | 134 -------
 .../psi/search/GlobalSearchScopeUtil.java       |  67 ----
 .../common/resource/PolygeneResourceBundle.java |  68 ----
 .../plugin/idea/common/vfs/VirtualFileUtil.java |  73 ----
 ...teConcernFromMixinTypeOrCompositeAction.java |  62 ---
 .../CreateConcernOfInPackageAction.java         | 121 ------
 .../common/PolygeneConcernConstants.java        |  40 --
 .../concerns/common/PolygeneConcernUtil.java    | 228 -----------
 ...nsAnnotationDeclaredCorrectlyInspection.java | 175 --------
 .../intentions/add/AddConcernOnType.java        | 140 -------
 ...larationOnFieldAndConstructorInspection.java |  92 -----
 ...nAnnotationDeclarationOnFieldInspection.java | 141 -------
 .../PolygeneInvocationAnnotationConstants.java  |  32 --
 .../PolygeneInvocationAnnotationUtil.java       | 129 ------
 ...onAnnotationDeclaredCorrectlyInspection.java | 121 ------
 .../PolygeneServiceAnnotationConstants.java     |  32 --
 .../common/PolygeneServiceAnnotationUtil.java   |  99 -----
 ...ceAnnotationDeclaredCorrectlyInspection.java | 112 ------
 .../PolygeneStructureAnnotationConstants.java   |  53 ---
 .../common/PolygeneStructureAnnotationUtil.java | 124 ------
 .../common/ReplaceWithStructureAnnotation.java  |  49 ---
 ...reAnnotationDeclaredCorrectlyInspection.java |  92 -----
 .../mixins/common/PolygeneMixinConstants.java   |  32 --
 .../idea/mixins/common/PolygeneMixinUtil.java   | 196 ---------
 .../inspections/MixinImplementsMixinType.java   | 190 ---------
 .../MixinsAnnotationDeclaredOnMixinType.java    |  92 -----
 .../common/PolygeneSideEffectConstants.java     |  35 --
 .../common/PolygeneSideEffectUtil.java          | 188 ---------
 ...tsAnnotationDeclaredCorrectlyInspection.java | 177 --------
 .../resource/PolygeneResourceBundle.properties  | 164 ++++++++
 .../resource/PolygeneResourceBundle.properties  | 164 --------
 303 files changed, 10983 insertions(+), 11132 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
index 19ee6e0..87c7937 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
@@ -19,9 +19,9 @@ package org.apache.polygene.gradle.doc
 
 import groovy.transform.CompileStatic
 import org.gradle.api.file.EmptyFileVisitor
+import org.gradle.api.tasks.Input
 import org.gradle.api.tasks.SourceTask
 import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.Optional
 import org.gradle.api.tasks.InputFile
 import org.gradle.api.tasks.TaskAction
 import org.gradle.api.file.FileVisitDetails
@@ -71,11 +71,10 @@ class XsltTask extends SourceTask
 {
 
   @OutputDirectory
-  @Optional
   File destDir
 
-  @Optional
-  String extension
+  @Input
+  String extension = 'html'
 
   @InputFile
   File stylesheetFile
@@ -92,10 +91,6 @@ class XsltTask extends SourceTask
       {
         // Remove the extension from the file name
         def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
-        if( extension == null )
-        {
-          extension = 'html'
-        }
         name += '.' + extension
         def destFile = new File( destDir, name )
         transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
index 13cbe09..c80c6bd 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
@@ -21,7 +21,7 @@ import org.gradle.api.Project
 
 class ModuleReleaseSpec
 {
-  def boolean satisfiedBy( Project project )
+  boolean satisfiedBy( Project project )
   {
     def devStatusFile = new File( project.projectDir, "dev-status.xml" )
     if( !devStatusFile.exists() )
@@ -29,12 +29,21 @@ class ModuleReleaseSpec
       return false
     }
     def module = new XmlSlurper().parse( devStatusFile )
-    def codebase = module.status.codebase.text()
-    def docs = module.status.documentation.text()
-    def tests = module.status.unittests.text()
-    def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
-    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
-    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
+    def codebase = module.status.codebase.text() as String
+    def docs = module.status.documentation.text() as String
+    def tests = module.status.unittests.text() as String
+    return satisfiedBy( codebase, docs, tests )
+  }
+
+  boolean satisfiedBy( String codebase, String docs, String tests )
+  {
+    def satisfied = ( codebase == 'none' && docs == 'complete' )
+    satisfied |= ( codebase == 'early'
+            && ( docs == 'complete' || docs == 'good' )
+            && ( tests == 'complete' || tests == 'good' ) )
+    satisfied |= ( codebase == 'beta'
+            && ( docs == 'complete' || docs == 'good' || docs == 'brief' )
+            && ( tests == 'complete' || tests == 'good' || tests == 'some' ) )
     satisfied |= ( codebase == 'stable' )
     satisfied |= ( codebase == 'mature' )
     // TODO Add a task to report this easily

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
deleted file mode 100644
index 333acf0..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.doc
-
-import groovy.transform.CompileStatic
-import org.gradle.api.file.EmptyFileVisitor
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.SourceTask
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.file.FileVisitDetails
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.stream.StreamResult
-import javax.xml.transform.stream.StreamSource
-
-/**
- *  Gradle task for running a set of one or more
- *  files through an XSLT transform.  A styleSheet
- *  file must be specified.  The source file(s) are
- *  configured just like any other source task:
- *     source <file>
- *       ...or...
- *     source <directory>
- *       ...and then optionally...
- *     include '*.xml'
- *     exclude, etc.
- *
- *  One of destDir or destFile must be specified, though if
- *  there are multiple source files then destFile will just
- *  keep getting rewritten.
- *
- *  The extension is stripped from the source files and the
- *  specified extension is appended (whether it is set or not)
- *  it defaults to no extension.
- *
- *  Example task formatting a check style report:
- *
- *  task checkstyleReport(type: XsltTask, dependsOn: check) {
- *      source project.checkstyleResultsDir
- *      include '*.xml'
- *
- *      destDir = project.checkstyleResultsDir
- *      extension = 'html'
- *
- *      stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
- * }
- *
- *  The above definition requires that the specified XSL file be
- *  copied in with the other checkstyle configuration files.  (The
- *  file in the example is part of the checkstyle distribution.)
- *
- */
-@CompileStatic
-class XsltTask extends SourceTask
-{
-
-  @OutputDirectory
-  File destDir
-
-  @Input
-  String extension = 'html'
-
-  @InputFile
-  File stylesheetFile
-
-  @TaskAction
-  def transform()
-  {
-    def factory = TransformerFactory.newInstance()
-    def transformer = factory.newTransformer( new StreamSource( stylesheetFile ) );
-
-    getSource().visit( new EmptyFileVisitor() {
-      @Override
-      void visitFile( FileVisitDetails fvd )
-      {
-        // Remove the extension from the file name
-        def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
-        name += '.' + extension
-        def destFile = new File( destDir, name )
-        transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
-      }
-    } )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
deleted file mode 100644
index 199808a..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import org.gradle.api.Project
-
-class ModuleReleaseSpec
-{
-  boolean satisfiedBy( Project project )
-  {
-    def devStatusFile = new File( project.projectDir, "dev-status.xml" )
-    if( !devStatusFile.exists() )
-    {
-      return false
-    }
-    def module = new XmlSlurper().parse( devStatusFile )
-    def codebase = module.status.codebase.text() as String
-    def docs = module.status.documentation.text() as String
-    def tests = module.status.unittests.text() as String
-    return satisfiedBy( codebase, docs, tests )
-  }
-
-  boolean satisfiedBy( String codebase, String docs, String tests )
-  {
-    def satisfied = ( codebase == 'none' && docs == 'complete' )
-    satisfied |= ( codebase == 'early'
-      && ( docs == 'complete' || docs == 'good' )
-      && ( tests == 'complete' || tests == 'good' ) )
-    satisfied |= ( codebase == 'beta'
-      && ( docs == 'complete' || docs == 'good' || docs == 'brief' )
-      && ( tests == 'complete' || tests == 'good' || tests == 'some' ) )
-    satisfied |= ( codebase == 'stable' )
-    satisfied |= ( codebase == 'mature' )
-    // TODO Add a task to report this easily
-    // println "$project.name($satisfied) -> $codebase, $docs, $tests"
-    return satisfied
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy b/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
new file mode 100644
index 0000000..6ca353d
--- /dev/null
+++ b/buildSrc/src/test/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpecTest.groovy
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release
+
+import spock.lang.Specification
+import spock.lang.Unroll
+
+class ModuleReleaseSpecTest extends Specification
+{
+  @Unroll
+  def "codebase(#code) docs(#docs) tests(#tests) -> #expected"()
+  {
+    expect:
+    new ModuleReleaseSpec().satisfiedBy( code, docs, tests ) == expected
+
+    where:
+    code     | docs       | tests      | expected
+    'none'   | 'none'     | 'none'     | false
+    'none'   | 'none'     | 'some'     | false
+    'none'   | 'none'     | 'good'     | false
+    'none'   | 'none'     | 'complete' | false
+    'none'   | 'brief'    | 'none'     | false
+    'none'   | 'brief'    | 'some'     | false
+    'none'   | 'brief'    | 'good'     | false
+    'none'   | 'brief'    | 'complete' | false
+    'none'   | 'good'     | 'none'     | false
+    'none'   | 'good'     | 'some'     | false
+    'none'   | 'good'     | 'good'     | false
+    'none'   | 'good'     | 'complete' | false
+    'none'   | 'complete' | 'none'     | true
+    'none'   | 'complete' | 'some'     | true
+    'none'   | 'complete' | 'good'     | true
+    'none'   | 'complete' | 'complete' | true
+
+    'early'  | 'none'     | 'none'     | false
+    'early'  | 'none'     | 'some'     | false
+    'early'  | 'none'     | 'good'     | false
+    'early'  | 'none'     | 'complete' | false
+    'early'  | 'brief'    | 'none'     | false
+    'early'  | 'brief'    | 'some'     | false
+    'early'  | 'brief'    | 'good'     | false
+    'early'  | 'brief'    | 'complete' | false
+    'early'  | 'good'     | 'none'     | false
+    'early'  | 'good'     | 'some'     | false
+    'early'  | 'good'     | 'good'     | true
+    'early'  | 'good'     | 'complete' | true
+    'early'  | 'complete' | 'none'     | false
+    'early'  | 'complete' | 'some'     | false
+    'early'  | 'complete' | 'good'     | true
+    'early'  | 'complete' | 'complete' | true
+
+    'beta'   | 'none'     | 'none'     | false
+    'beta'   | 'none'     | 'some'     | false
+    'beta'   | 'none'     | 'good'     | false
+    'beta'   | 'none'     | 'complete' | false
+    'beta'   | 'brief'    | 'none'     | false
+    'beta'   | 'brief'    | 'some'     | true
+    'beta'   | 'brief'    | 'good'     | true
+    'beta'   | 'brief'    | 'complete' | true
+    'beta'   | 'good'     | 'none'     | false
+    'beta'   | 'good'     | 'some'     | true
+    'beta'   | 'good'     | 'good'     | true
+    'beta'   | 'good'     | 'complete' | true
+    'beta'   | 'complete' | 'none'     | false
+    'beta'   | 'complete' | 'some'     | true
+    'beta'   | 'complete' | 'good'     | true
+    'beta'   | 'complete' | 'complete' | true
+
+    'stable' | 'none'     | 'none'     | true
+    'stable' | 'none'     | 'some'     | true
+    'stable' | 'none'     | 'good'     | true
+    'stable' | 'none'     | 'complete' | true
+    'stable' | 'brief'    | 'none'     | true
+    'stable' | 'brief'    | 'some'     | true
+    'stable' | 'brief'    | 'good'     | true
+    'stable' | 'brief'    | 'complete' | true
+    'stable' | 'good'     | 'none'     | true
+    'stable' | 'good'     | 'some'     | true
+    'stable' | 'good'     | 'good'     | true
+    'stable' | 'good'     | 'complete' | true
+    'stable' | 'complete' | 'none'     | true
+    'stable' | 'complete' | 'some'     | true
+    'stable' | 'complete' | 'good'     | true
+    'stable' | 'complete' | 'complete' | true
+
+    'mature' | 'none'     | 'none'     | true
+    'mature' | 'none'     | 'some'     | true
+    'mature' | 'none'     | 'good'     | true
+    'mature' | 'none'     | 'complete' | true
+    'mature' | 'brief'    | 'none'     | true
+    'mature' | 'brief'    | 'some'     | true
+    'mature' | 'brief'    | 'good'     | true
+    'mature' | 'brief'    | 'complete' | true
+    'mature' | 'good'     | 'none'     | true
+    'mature' | 'good'     | 'some'     | true
+    'mature' | 'good'     | 'good'     | true
+    'mature' | 'good'     | 'complete' | true
+    'mature' | 'complete' | 'none'     | true
+    'mature' | 'complete' | 'some'     | true
+    'mature' | 'complete' | 'good'     | true
+    'mature' | 'complete' | 'complete' | true
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy b/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
deleted file mode 100644
index edd22b9..0000000
--- a/buildSrc/src/test/groovy/org/apache/zest/gradle/release/ModuleReleaseSpecTest.groovy
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import spock.lang.Specification
-import spock.lang.Unroll
-
-class ModuleReleaseSpecTest extends Specification
-{
-  @Unroll
-  def "codebase(#code) docs(#docs) tests(#tests) -> #expected"()
-  {
-    expect:
-    new ModuleReleaseSpec().satisfiedBy( code, docs, tests ) == expected
-
-    where:
-    code     | docs       | tests      | expected
-    'none'   | 'none'     | 'none'     | false
-    'none'   | 'none'     | 'some'     | false
-    'none'   | 'none'     | 'good'     | false
-    'none'   | 'none'     | 'complete' | false
-    'none'   | 'brief'    | 'none'     | false
-    'none'   | 'brief'    | 'some'     | false
-    'none'   | 'brief'    | 'good'     | false
-    'none'   | 'brief'    | 'complete' | false
-    'none'   | 'good'     | 'none'     | false
-    'none'   | 'good'     | 'some'     | false
-    'none'   | 'good'     | 'good'     | false
-    'none'   | 'good'     | 'complete' | false
-    'none'   | 'complete' | 'none'     | true
-    'none'   | 'complete' | 'some'     | true
-    'none'   | 'complete' | 'good'     | true
-    'none'   | 'complete' | 'complete' | true
-
-    'early'  | 'none'     | 'none'     | false
-    'early'  | 'none'     | 'some'     | false
-    'early'  | 'none'     | 'good'     | false
-    'early'  | 'none'     | 'complete' | false
-    'early'  | 'brief'    | 'none'     | false
-    'early'  | 'brief'    | 'some'     | false
-    'early'  | 'brief'    | 'good'     | false
-    'early'  | 'brief'    | 'complete' | false
-    'early'  | 'good'     | 'none'     | false
-    'early'  | 'good'     | 'some'     | false
-    'early'  | 'good'     | 'good'     | true
-    'early'  | 'good'     | 'complete' | true
-    'early'  | 'complete' | 'none'     | false
-    'early'  | 'complete' | 'some'     | false
-    'early'  | 'complete' | 'good'     | true
-    'early'  | 'complete' | 'complete' | true
-
-    'beta'   | 'none'     | 'none'     | false
-    'beta'   | 'none'     | 'some'     | false
-    'beta'   | 'none'     | 'good'     | false
-    'beta'   | 'none'     | 'complete' | false
-    'beta'   | 'brief'    | 'none'     | false
-    'beta'   | 'brief'    | 'some'     | true
-    'beta'   | 'brief'    | 'good'     | true
-    'beta'   | 'brief'    | 'complete' | true
-    'beta'   | 'good'     | 'none'     | false
-    'beta'   | 'good'     | 'some'     | true
-    'beta'   | 'good'     | 'good'     | true
-    'beta'   | 'good'     | 'complete' | true
-    'beta'   | 'complete' | 'none'     | false
-    'beta'   | 'complete' | 'some'     | true
-    'beta'   | 'complete' | 'good'     | true
-    'beta'   | 'complete' | 'complete' | true
-
-    'stable' | 'none'     | 'none'     | true
-    'stable' | 'none'     | 'some'     | true
-    'stable' | 'none'     | 'good'     | true
-    'stable' | 'none'     | 'complete' | true
-    'stable' | 'brief'    | 'none'     | true
-    'stable' | 'brief'    | 'some'     | true
-    'stable' | 'brief'    | 'good'     | true
-    'stable' | 'brief'    | 'complete' | true
-    'stable' | 'good'     | 'none'     | true
-    'stable' | 'good'     | 'some'     | true
-    'stable' | 'good'     | 'good'     | true
-    'stable' | 'good'     | 'complete' | true
-    'stable' | 'complete' | 'none'     | true
-    'stable' | 'complete' | 'some'     | true
-    'stable' | 'complete' | 'good'     | true
-    'stable' | 'complete' | 'complete' | true
-
-    'mature' | 'none'     | 'none'     | true
-    'mature' | 'none'     | 'some'     | true
-    'mature' | 'none'     | 'good'     | true
-    'mature' | 'none'     | 'complete' | true
-    'mature' | 'brief'    | 'none'     | true
-    'mature' | 'brief'    | 'some'     | true
-    'mature' | 'brief'    | 'good'     | true
-    'mature' | 'brief'    | 'complete' | true
-    'mature' | 'good'     | 'none'     | true
-    'mature' | 'good'     | 'some'     | true
-    'mature' | 'good'     | 'good'     | true
-    'mature' | 'good'     | 'complete' | true
-    'mature' | 'complete' | 'none'     | true
-    'mature' | 'complete' | 'some'     | true
-    'mature' | 'complete' | 'good'     | true
-    'mature' | 'complete' | 'complete' | true
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
index e2aed7a..2d0a58f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsTest.java
@@ -101,7 +101,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
                            DefaultMethodsSideEffects.class );
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void defaultMethods()
     {
@@ -109,7 +109,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
         assertThat( composite.sayHello( "John" ), equalTo( "Hello, John!" ) );
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void overrideDefaultMethods()
     {
@@ -117,7 +117,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
         assertThat( composite.sayHello( "John" ), equalTo( "Hello, overridden John!" ) );
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void mixinDefaultMethods()
     {
@@ -125,7 +125,7 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
         assertThat( composite.sayHello( "John" ), equalTo( "Hello, mixed in John!" ) );
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void defaultMethodsConstraints()
     {
@@ -140,14 +140,14 @@ public class InterfaceDefaultMethodsTest extends AbstractPolygeneTest
         }
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void defaultMethodsConcerns()
     {
         fail( "Test not implemented" );
     }
 
-    @Ignore( "ZEST-120" )
+    @Ignore( "POLYGENE-120" )
     @Test
     public void defaultMethodsSideEffects()
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
index 8eed9b3..74fc845 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/model/Address.java
@@ -22,7 +22,7 @@ package org.apache.polygene.test.indexing.model;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.value.ValueComposite;
 
-public interface Address extends ValueComposite // necessary, @See ZEST-137
+public interface Address extends ValueComposite // necessary, @See POLYGENE-137
 {
     Property<String> line1();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
new file mode 100644
index 0000000..29c3d0f
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Browser.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser;
+
+import java.util.Stack;
+import org.json.JSONException;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+
+public class Browser
+{
+    private final ApplicationDescriptor application;
+    private final FormatterFactory factory;
+    private final Stack<Formatter> stack = new Stack<>();
+
+    public Browser( ApplicationDescriptor application, FormatterFactory factory )
+    {
+        this.application = application;
+        this.factory = factory;
+    }
+
+    public void toJson()
+        throws BrowserException
+    {
+        application.accept( new HierarchicalVisitor<Object, Object, BrowserException>()
+        {
+            @Override
+            public boolean visitEnter( Object visited )
+                throws BrowserException
+            {
+                String simpleName = visited.getClass().getSimpleName();
+                Formatter formatter = factory.create( simpleName );
+                stack.push(formatter);
+                if( formatter == null )
+                {
+                    System.err.println( "Unknown application component: " + visited.getClass() );
+                    return false;
+                }
+                try
+                {
+                    formatter.enter( visited );
+                }
+                catch( JSONException e )
+                {
+                    throw new BrowserException( "Formatting failed.", e );
+                }
+                return true;
+            }
+
+            @Override
+            public boolean visitLeave( Object visited )
+                throws BrowserException
+            {
+                Formatter formatter = stack.pop();
+                if( formatter == null )
+                {
+                    System.err.println( "Unknown application component: " + visited.getClass() );
+                    return false;
+                }
+                try
+                {
+                    formatter.leave( visited );
+                }
+                catch( JSONException e )
+                {
+                    throw new BrowserException( "Formatting failed.", e );
+                }
+                return true;
+            }
+
+            @Override
+            public boolean visit( Object visited )
+                throws BrowserException
+            {
+                Formatter formatter = stack.peek();
+                if( formatter == null )
+                {
+                    System.err.println( "Unknown application component: " + visited.getClass() );
+                    return false;
+                }
+                try
+                {
+                    formatter.visit( visited );
+                }
+                catch( JSONException e )
+                {
+                    throw new BrowserException( "Formatting failed.", e );
+                }
+                return true;
+            }
+        } );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
new file mode 100644
index 0000000..126c198
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/BrowserException.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser;
+
+import org.json.JSONException;
+
+public class BrowserException extends RuntimeException
+{
+    public BrowserException( String message, JSONException exception )
+    {
+        super( message, exception);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
new file mode 100644
index 0000000..19355a7
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/Formatter.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser;
+
+import org.json.JSONException;
+
+public interface Formatter<NODE, LEAF>
+{
+
+    void enter( NODE visited )
+        throws JSONException;
+
+    void leave( NODE visited )
+        throws JSONException;
+
+    void visit( LEAF visited )
+        throws JSONException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
new file mode 100644
index 0000000..d996e2a
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/FormatterFactory.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser;
+
+public interface FormatterFactory
+{
+
+    Formatter create( String componentType );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
new file mode 100644
index 0000000..7682097
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/AbstractJsonFormatter.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public abstract class AbstractJsonFormatter<NODE,LEAF>
+    implements Formatter<NODE, LEAF>
+{
+    private final JSONWriter writer;
+
+    public AbstractJsonFormatter( JSONWriter writer )
+    {
+        this.writer = writer;
+    }
+
+    protected void field( String name, String value )
+        throws JSONException
+    {
+        writer.key( name ).value(value);
+    }
+
+    protected void field( String name, boolean value )
+        throws JSONException
+    {
+        writer.key( name ).value(value);
+    }
+
+    protected void array( String name )
+        throws JSONException
+    {
+        writer.key(name);
+        writer.array();
+    }
+
+    protected void endArray()
+        throws JSONException
+    {
+        writer.endArray();
+    }
+
+    protected void object()
+        throws JSONException
+    {
+        writer.object();
+    }
+
+    protected void object(String name)
+        throws JSONException
+    {
+        writer.key(name);
+        writer.object();
+    }
+
+    protected void endObject()
+        throws JSONException
+    {
+        writer.endObject();
+    }
+
+    protected void value( Object value )
+        throws JSONException
+    {
+        writer.value( value );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
new file mode 100644
index 0000000..c862021
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ApplicationModelFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ApplicationModelFormatter extends AbstractJsonFormatter<ApplicationDescriptor, Void>
+{
+
+    public ApplicationModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( ApplicationDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "name", visited.name() );
+        array("layers");
+    }
+
+    @Override
+    public void leave( ApplicationDescriptor visited )
+        throws JSONException
+    {
+        endArray();
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
new file mode 100644
index 0000000..6c315d0
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ArrayFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ArrayFormatter extends AbstractJsonFormatter
+    implements Formatter
+{
+    private final String name;
+
+    public ArrayFormatter( JSONWriter writer, String name )
+    {
+        super(writer);
+        this.name = name;
+    }
+
+    @Override
+    public void enter( Object visited )
+        throws JSONException
+    {
+        array(name);
+    }
+
+    @Override
+    public void leave( Object visited )
+        throws JSONException
+    {
+        endArray();
+    }
+
+    @Override
+    public void visit( Object visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
new file mode 100644
index 0000000..e4328ea
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/CompositeMethodModelFormatter.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.MethodDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class CompositeMethodModelFormatter extends AbstractJsonFormatter<MethodDescriptor, Void>
+{
+    public CompositeMethodModelFormatter( JSONWriter writer )
+    {
+        super(writer);
+    }
+
+    @Override
+    public void enter( MethodDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field("method", visited.method().getName() );
+    }
+
+    @Override
+    public void leave( MethodDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
new file mode 100644
index 0000000..8f864dd
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ConstructorModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.ConstructorDescriptor;
+
+public class ConstructorModelFormatter extends AbstractJsonFormatter<ConstructorDescriptor,Void>
+{
+    public ConstructorModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( ConstructorDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "name", visited.constructor().getName() );
+    }
+
+    @Override
+    public void leave( ConstructorDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
new file mode 100644
index 0000000..70d0d9e
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/EntityModelFormatter.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.entity.EntityDescriptor;
+
+public class EntityModelFormatter extends AbstractJsonFormatter<EntityDescriptor, Void>
+{
+
+    public EntityModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( EntityDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "type", visited.primaryType().getName() );
+        field( "visibility", visited.visibility().toString() );
+        field( "queryable", visited.queryable() );
+    }
+
+    @Override
+    public void leave( EntityDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
new file mode 100644
index 0000000..75a216e
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/InjectedFieldModelFormatter.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.composite.DependencyDescriptor;
+import org.apache.polygene.api.composite.InjectedFieldDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class InjectedFieldModelFormatter extends AbstractJsonFormatter<InjectedFieldDescriptor, DependencyDescriptor>
+{
+    public InjectedFieldModelFormatter( JSONWriter writer )
+    {
+        super(writer);
+    }
+
+    @Override
+    public void enter( InjectedFieldDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field("name", visited.field().getName() );
+//        field( "optional", visited.optional() );
+//        field( "injectedclass", visited.injectedClass().getName() );
+//        field( "injectedannotation", visited.injectionAnnotation().toString() );
+//        field( "injectedtype", visited.injectionType().toString() );
+//        field( "rawinjectectiontype", visited.rawInjectionType().getName() );
+    }
+
+    @Override
+    public void leave( InjectedFieldDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( DependencyDescriptor visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
new file mode 100644
index 0000000..5c7748a
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/JsonFormatterFactory.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import java.io.Writer;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+import org.apache.polygene.library.appbrowser.FormatterFactory;
+
+public class JsonFormatterFactory
+    implements FormatterFactory
+{
+    private static final NullFormatter NULL_FORMATTER = new NullFormatter();
+    private final JSONWriter writer;
+
+    public JsonFormatterFactory(Writer destination)
+    {
+        writer = new JSONWriter( destination );
+    }
+
+    @Override
+    public Formatter create( String componentType )
+    {
+        if( componentType.equalsIgnoreCase( "ApplicationModel" ))
+            return new ApplicationModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "LayerModel" ))
+            return new LayerModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "ModuleModel" ))
+            return new ModuleModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "TransientsModel" ))
+            return new ArrayFormatter(writer, "transients");
+        if( componentType.equalsIgnoreCase( "EntitiesModel" ))
+            return new ArrayFormatter(writer, "entities");
+        if( componentType.equalsIgnoreCase( "ServicesModel" ))
+            return new ArrayFormatter(writer, "services");
+        if( componentType.equalsIgnoreCase( "ServiceModel" ))
+            return new ServiceModelFormatter
+                (writer);
+        if( componentType.equalsIgnoreCase( "ValuesModel" ))
+            return new ArrayFormatter(writer, "values");
+        if( componentType.equalsIgnoreCase( "ValueModel" ))
+            return new ValueModelFormatter(writer);
+        if( componentType.equalsIgnoreCase( "ValueStateModel" ))
+            return NULL_FORMATTER;
+        if( componentType.equalsIgnoreCase( "EntityModel" ))
+            return new EntityModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "CompositeMethodsModel" ))
+            return new ArrayFormatter( writer, "methods" );
+        if( componentType.equalsIgnoreCase( "CompositeMethodModel" ))
+            return new CompositeMethodModelFormatter(writer);
+        if( componentType.equalsIgnoreCase( "ObjectsModel" ))
+            return new ArrayFormatter( writer, "objects" );
+        if( componentType.equalsIgnoreCase( "ConstraintsModel" ))
+            return new ArrayFormatter( writer, "constraints" );
+        if( componentType.equalsIgnoreCase( "SideEffectsModel" ))
+            return new ArrayFormatter( writer, "sideeffects" );
+        if( componentType.equalsIgnoreCase( "ConcernsModel" ))
+            return new ArrayFormatter( writer, "concerns" );
+        if( componentType.equalsIgnoreCase( "PropertiesModel" ))
+            return new ArrayFormatter( writer, "properties" );
+        if( componentType.equalsIgnoreCase( "ConstructorsModel" ))
+            return new ArrayFormatter( writer, "constructors" );
+        if( componentType.equalsIgnoreCase( "ConstructorModel" ))
+            return new ConstructorModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "EntityMixinsModel" ))
+            return new ArrayFormatter( writer, "mixins" );
+        if( componentType.equalsIgnoreCase( "MixinsModel" ))
+            return new ArrayFormatter( writer, "mixins" );
+        if( componentType.equalsIgnoreCase( "MixinModel" ))
+            return new MixinModelFormatter( writer );
+        if( componentType.equalsIgnoreCase( "AssociationsModel" ))
+            return new ArrayFormatter( writer, "associations" );
+        if( componentType.equalsIgnoreCase( "ManyAssociationsModel" ))
+            return new ArrayFormatter( writer, "manyassociations" );
+        if( componentType.equalsIgnoreCase( "InjectedFieldsModel" ))
+            return new ArrayFormatter( writer, "injectedfields" );
+        if( componentType.equalsIgnoreCase( "InjectedFieldModel" ))
+            return new InjectedFieldModelFormatter(writer);
+        if( componentType.equalsIgnoreCase( "InjectedMethodsModel" ))
+            return new ArrayFormatter( writer, "injectedmethods" );
+        if( componentType.equalsIgnoreCase( "InjectedParametersModel" ))
+            return new ArrayFormatter( writer, "injectedparameters" );
+        if( componentType.equalsIgnoreCase( "EntityStateModel" ))
+            return NULL_FORMATTER;
+        if( componentType.equalsIgnoreCase( "ObjectModel" ))
+            return new ObjectModelFormatter(writer);
+        if( componentType.equalsIgnoreCase( "ImportedServicesModel" ))
+            return NULL_FORMATTER;
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
new file mode 100644
index 0000000..f55c475
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/LayerModelFormatter.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.UsedLayersDescriptor;
+
+public class LayerModelFormatter extends AbstractJsonFormatter<LayerDescriptor, Void>
+{
+    public LayerModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( LayerDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "name", visited.name() );
+        array( "uses" );
+        UsedLayersDescriptor usedLayersDescriptor = visited.usedLayers();
+        for( LayerDescriptor used : usedLayersDescriptor.layers() )
+        {
+            value( used.name() );
+        }
+        endArray();
+        array( "modules" );
+    }
+
+    @Override
+    public void leave( LayerDescriptor visited )
+        throws JSONException
+    {
+        endArray();
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
new file mode 100644
index 0000000..3254e58
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/MixinModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.mixin.MixinDescriptor;
+
+public class MixinModelFormatter extends AbstractJsonFormatter<MixinDescriptor, Void>
+{
+    public MixinModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( MixinDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "mixin", visited.mixinClass().getName() );
+    }
+
+    @Override
+    public void leave( MixinDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
new file mode 100644
index 0000000..1ea5c34
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ModuleModelFormatter.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ModuleModelFormatter extends AbstractJsonFormatter<ModuleDescriptor, Void>
+{
+
+    public ModuleModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( ModuleDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "name", visited.name() );
+    }
+
+    @Override
+    public void leave( ModuleDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
new file mode 100644
index 0000000..6cb3e59
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/NullFormatter.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class NullFormatter
+    implements Formatter<Object, Object>
+{
+    @Override
+    public void enter( Object visited )
+        throws JSONException
+    {
+
+    }
+
+    @Override
+    public void leave( Object visited )
+        throws JSONException
+    {
+
+    }
+
+    @Override
+    public void visit( Object visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
new file mode 100644
index 0000000..959edad
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ObjectModelFormatter.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.object.ObjectDescriptor;
+
+public class ObjectModelFormatter extends AbstractJsonFormatter<ObjectDescriptor, Void>
+{
+    public ObjectModelFormatter( JSONWriter writer )
+    {
+        super(writer);
+    }
+
+    @Override
+    public void enter( ObjectDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "visibility", visited.visibility().toString());
+    }
+
+    @Override
+    public void leave( ObjectDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}


[44/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/configuration/ConfigurationComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/configuration/ConfigurationComposite.java b/core/api/src/main/java/org/apache/polygene/api/configuration/ConfigurationComposite.java
new file mode 100644
index 0000000..726664f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/configuration/ConfigurationComposite.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.entity.Queryable;
+
+/**
+ * Services that want to be configurable should have a ConfigurationComposite that contains all the settings.
+ * They are treated as EntityComposites, and are therefore stored in an EntityStore. There will be one instance
+ * per service instance that uses each ConfigurationComposite, and the reference of the entity is the same as that
+ * of the service.
+ */
+@Queryable( false )
+public interface ConfigurationComposite
+    extends HasIdentity, Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/configuration/Enabled.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/configuration/Enabled.java b/core/api/src/main/java/org/apache/polygene/api/configuration/Enabled.java
new file mode 100644
index 0000000..764ef4e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/configuration/Enabled.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Common configuration for setting whether a service is enabled or not. A disabled service
+ * is not considered to be available. Let your own ConfigurationComposite extend this interface to use.
+ */
+public interface Enabled
+{
+    @UseDefaults
+    Property<Boolean> enabled();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/configuration/NoSuchConfigurationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/configuration/NoSuchConfigurationException.java b/core/api/src/main/java/org/apache/polygene/api/configuration/NoSuchConfigurationException.java
new file mode 100644
index 0000000..ed2b3a0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/configuration/NoSuchConfigurationException.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+
+public class NoSuchConfigurationException extends RuntimeException
+{
+    private final Class<? extends HasIdentity> configType;
+    private final Identity identity;
+
+    public NoSuchConfigurationException( Class<? extends HasIdentity> configType,
+                                         Identity identity,
+                                         Exception cause
+    )
+    {
+        super( "No configuration found for '" + identity + "' and configuration " + configType.getName() + " has one or more non-Optional properties.", cause );
+        this.configType = configType;
+        this.identity = identity;
+    }
+
+    public Class<? extends HasIdentity> configType()
+    {
+        return configType;
+    }
+
+    public Identity identity()
+    {
+        return identity;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/configuration/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/configuration/package.html b/core/api/src/main/java/org/apache/polygene/api/configuration/package.html
new file mode 100644
index 0000000..b923bc3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/configuration/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Configuration API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/Constraint.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/Constraint.java b/core/api/src/main/java/org/apache/polygene/api/constraint/Constraint.java
new file mode 100644
index 0000000..603b7e5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/Constraint.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+
+/**
+ * All Constraints must implement this interface, which is used for each
+ * value validation.
+ */
+public interface Constraint<ANNOTATION extends Annotation, TYPE>
+    extends Serializable
+{
+    /**
+     * For each value or parameter which should be checked this method will be invoked.
+     * If the method returns true the value is valid. If it returns false the value
+     * is considered invalid. When all constraints have been checked a ConstraintViolationException
+     * will be thrown with all the constraint violations that were found.
+     *
+     * @param annotation the annotation to match
+     * @param value      the value to be checked
+     *
+     * @return true if valid, false if invalid
+     */
+    boolean isValid( ANNOTATION annotation, TYPE value );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDeclaration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDeclaration.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDeclaration.java
new file mode 100644
index 0000000..36988ee
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDeclaration.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * All annotations that are used to trigger Constraints must have this annotation.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.ANNOTATION_TYPE )
+@Documented
+public @interface ConstraintDeclaration
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDescriptor.java
new file mode 100644
index 0000000..9c929ef
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.lang.annotation.Annotation;
+
+/**
+ * Constraint Descriptor.
+ */
+public interface ConstraintDescriptor
+{
+    Annotation annotation();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintImplementationNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintImplementationNotFoundException.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintImplementationNotFoundException.java
new file mode 100644
index 0000000..1d42685
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintImplementationNotFoundException.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+
+/**
+ * This exception is thrown if a Constraint implementation can not be found.
+ */
+public class ConstraintImplementationNotFoundException
+    extends InvalidApplicationException
+{
+    public ConstraintImplementationNotFoundException( String message )
+    {
+        super( message );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolation.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolation.java
new file mode 100644
index 0000000..1236bbf
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolation.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+
+/**
+ * When a constraint violation has occurred (ie Constraint.isValid has returned false) it
+ * is put in a collection of all violations that have occurred for this value check.
+ */
+public final class ConstraintViolation
+    implements Serializable
+{
+    private String name;
+    private final Annotation constraint;
+    private final Object value;
+
+    public ConstraintViolation( String name, Annotation constraint, Object value )
+    {
+        this.name = name;
+        this.constraint = constraint;
+        this.value = value;
+    }
+
+    public String name()
+    {
+        return name;
+    }
+
+    public Annotation constraint()
+    {
+        return constraint;
+    }
+
+    public Object value()
+    {
+        return value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolationException.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolationException.java
new file mode 100644
index 0000000..cc1b1b0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintViolationException.java
@@ -0,0 +1,261 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.util.Classes;
+
+import static java.util.stream.Collectors.joining;
+
+/**
+ * This Exception is thrown when there is one or more Constraint Violations in a method
+ * call.
+ * <p>
+ * The Constraint Violations are aggregated per method, and this exception will contain those
+ * violations, together with the Composite instance it happened on as well as the Method that
+ * was invoked. The Exception also has support for localized messages of these violations.
+ * </p>
+ */
+public class ConstraintViolationException
+    extends IllegalArgumentException
+{
+    private static final long serialVersionUID = 1L;
+
+    private final Collection<ConstraintViolation> constraintViolations;
+    private String methodName;
+    private String mixinTypeName;
+    private String instanceToString;
+    private List<? extends Type> instanceTypes;
+
+    public ConstraintViolationException( Composite instance, Member method,
+                                         Collection<ConstraintViolation> constraintViolations
+    )
+    {
+        this( instance.toString(), Classes.interfacesOf( instance.getClass() ), method, constraintViolations );
+    }
+
+    public ConstraintViolationException( String instanceToString,
+                                         Stream<? extends Type> instanceTypes,
+                                         Member method,
+                                         Collection<ConstraintViolation> violations
+    )
+    {
+        this.instanceToString = instanceToString;
+        this.instanceTypes = instanceTypes.collect( Collectors.toList() );
+        mixinTypeName = method.getDeclaringClass().getName();
+        methodName = method.getName();
+        this.constraintViolations = violations;
+    }
+
+    public ConstraintViolationException( Identity identity,
+                                         List<? extends Type> instanceTypes,
+                                         String mixinTypeName,
+                                         String methodName,
+                                         Collection<ConstraintViolation> violations
+    )
+    {
+        this.instanceToString = identity.toString();
+        this.instanceTypes = instanceTypes;
+        this.mixinTypeName = mixinTypeName;
+        this.methodName = methodName;
+        this.constraintViolations = violations;
+    }
+
+    public Collection<ConstraintViolation> constraintViolations()
+    {
+        return constraintViolations;
+    }
+
+    /**
+     * Creates localized messages of all the constraint violations that has occured.
+     * <p>
+     * The key "<code>polygene.constraint.<i><strong>CompositeType</strong></i>.<i><strong>methodName</strong></i></code>"
+     * will be used to lookup the text formatting
+     * pattern from the ResourceBundle, where <strong><code><i>CompositeType</i></code></strong> is the
+     * class name of the Composite where the constraint was violated. If such key does not exist, then the
+     * key &nbsp;"<code>polygene.constraint</code>" will be used, and if that one also doesn't exist, or
+     * the resourceBundle argument is null, then the default patterns will be used;
+     * </p>
+     * <table summary="Localization of constraint vioations.">
+     * <tr><th>Type of Composite</th><th>Pattern used</th></tr>
+     * <tr><td>Composite</td>
+     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in composite \n{0} of type {1}</code></td>
+     * </tr>
+     * <tr><td>EntityComposite</td>
+     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in entity {1}[id={0}]</code></td>
+     * </tr>
+     * <tr><td>ServiceComposite</td>
+     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in service {0}</code></td>
+     * </tr>
+     * </table>
+     * Then format each ConstraintViolation according to such pattern, where the following argument are passed;
+     * <table summary="List of arguments available."><tr><th>Arg</th><th>Value</th></tr>
+     * <tr>
+     * <td>{0}</td>
+     * <td>Composite instance toString()</td>
+     * </tr>
+     * <tr>
+     * <td>{1}</td>
+     * <td>CompositeType class name</td>
+     * </tr>
+     * <tr>
+     * <td>{2}</td>
+     * <td>MixinType class name</td>
+     * </tr>
+     * <tr>
+     * <td>{3}</td>
+     * <td>MixinType method name</td>
+     * </tr>
+     * <tr>
+     * <td>{4}</td>
+     * <td>Annotation toString()</td>
+     * </tr>
+     * <tr>
+     * <td>{5}</td>
+     * <td>toString() of value passed as the argument, or "null" text if argument was null.</td>
+     * </tr>
+     * </table>
+     * <p>
+     * <b>NOTE!!!</b> This class is still under construction and will be modified further.
+     * </p>
+     *
+     * @param bundle The ResourceBundle for Localization, or null if default formatting and locale to be used.
+     *
+     * @return An array of localized messages of the violations incurred.
+     */
+    public String[] localizedMessagesFrom( ResourceBundle bundle )
+    {
+        String pattern = "Constraint violation in {0}.{1} for method ''{3}'' with constraint \"{4}({6})\", for value ''{5}''";
+
+        ArrayList<String> list = new ArrayList<>();
+        for( ConstraintViolation violation : constraintViolations )
+        {
+            Locale locale;
+            if( bundle != null )
+            {
+                try
+                {
+                    pattern = bundle.getString( "polygene.constraint." + mixinTypeName + "." + methodName );
+                }
+                catch( MissingResourceException e1 )
+                {
+                    try
+                    {
+                        pattern = bundle.getString( "polygene.constraint" );
+                    }
+                    catch( MissingResourceException e2 )
+                    {
+                        // ignore. The default pattern will be used.
+                    }
+                }
+                locale = bundle.getLocale();
+            }
+            else
+            {
+                locale = Locale.getDefault();
+            }
+            MessageFormat format = new MessageFormat( pattern, locale );
+
+            Annotation annotation = violation.constraint();
+            String name = violation.name();
+            Object value = violation.value();
+            String classes;
+            if( instanceTypes.stream().count() == 1 )
+            {
+                Type type = instanceTypes.stream().findFirst().get();
+                classes = Classes.RAW_CLASS.apply( type ).getSimpleName();
+            }
+            else
+            {
+                classes = "[" + instanceTypes.stream()
+                    .map( Classes.RAW_CLASS )
+                    .map( Class::getSimpleName ).collect( joining( "," ) ) + "]";
+            }
+            Object[] args = new Object[]
+                {
+                    instanceToString,
+                    classes,
+                    mixinTypeName,
+                    methodName,
+                    annotation.toString(),
+                    "" + value,
+                    name
+                };
+            StringBuffer text = new StringBuffer();
+            format.format( args, text, null );
+            list.add( text.toString() );
+        }
+        String[] result = new String[ list.size() ];
+        list.toArray( result );
+        return result;
+    }
+
+    public String localizedMessage()
+    {
+        String[] messages = localizedMessagesFrom( null );
+        StringBuilder result = new StringBuilder();
+        boolean first = true;
+        for( String message : messages )
+        {
+            if( !first )
+            {
+                result.append( ',' );
+            }
+            first = false;
+            result.append( message );
+        }
+        return result.toString();
+    }
+
+    @Override
+    public String getLocalizedMessage()
+    {
+        return localizedMessage();
+    }
+
+    @Override
+    public String getMessage()
+    {
+        return localizedMessage();
+    }
+
+    public String methodName()
+    {
+        return methodName;
+    }
+
+    public String mixinTypeName()
+    {
+        return mixinTypeName;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/Constraints.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/Constraints.java b/core/api/src/main/java/org/apache/polygene/api/constraint/Constraints.java
new file mode 100644
index 0000000..e5516a3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/Constraints.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used by composites and mixins to declare what Constraints
+ * can be applied in the Composite.
+ * <p>
+ * Constraints implement the {@link Constraint} interface
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE } )
+@Documented
+public @interface Constraints
+{
+    Class<? extends Constraint<?, ?>>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintsDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintsDescriptor.java
new file mode 100644
index 0000000..8637abe
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/ConstraintsDescriptor.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+/**
+ * Constraints Descriptor.
+ */
+public interface ConstraintsDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/Name.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/Name.java b/core/api/src/main/java/org/apache/polygene/api/constraint/Name.java
new file mode 100644
index 0000000..1ef59c8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/Name.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.constraint;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for parameter names. This is used to add extra information for constraint exception.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.PARAMETER } )
+@Documented
+public @interface Name
+{
+    String value();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/constraint/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/constraint/package.html b/core/api/src/main/java/org/apache/polygene/api/constraint/package.html
new file mode 100644
index 0000000..87e14b7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/constraint/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Constraint API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/Aggregated.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/Aggregated.java b/core/api/src/main/java/org/apache/polygene/api/entity/Aggregated.java
new file mode 100644
index 0000000..7db81cd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/Aggregated.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks an association as aggregating the referenced Entities
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.METHOD } )
+@Documented
+public @interface Aggregated
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilder.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilder.java
new file mode 100644
index 0000000..0fcdeff
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilder.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * EntityBuilders are used to instantiate EntityComposites. They can be acquired from
+ * {@link org.apache.polygene.api.unitofwork.UnitOfWork#newEntityBuilder(Class)} and allows the client
+ * to provide additional settings before instantiating the Composite.
+ *
+ * After calling newInstance() the builder becomes invalid, and may not be called again.
+ */
+public interface EntityBuilder<T>
+{
+    /**
+     * Get a representation of the state for the new Composite.
+     * It is possible to access and update properties and associations,
+     * even immutable ones since the builder represents the initial state.
+     *
+     * @return a proxy implementing the Composite type
+     */
+    T instance();
+
+    /**
+     * Get a representation of the state of the given type for the new Composite.
+     * This is primarily used if you want to provide state for a private mixin type.
+     *
+     * @param mixinType the mixin which you want to provide state for
+     *
+     * @return a proxy implementing the given mixin type
+     */
+    <K> K instanceFor( Class<K> mixinType );
+
+    /**
+     * Create a new Entity instance.
+     *
+     * @return a new Entity instance
+     *
+     * @throws org.apache.polygene.api.common.ConstructionException
+     *                            thrown if it was not possible to instantiate the Composite
+     * @throws LifecycleException if the entity could not be created
+     */
+    T newInstance()
+        throws ConstructionException, LifecycleException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilderTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilderTemplate.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilderTemplate.java
new file mode 100644
index 0000000..00daed2
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityBuilderTemplate.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import org.apache.polygene.api.structure.Module;
+
+/**
+ * EntityBuilderTemplate.
+ */
+public abstract class EntityBuilderTemplate<T>
+{
+    Class<T> type;
+
+    protected EntityBuilderTemplate( Class<T> type )
+    {
+        this.type = type;
+    }
+
+    protected abstract void build( T prototype );
+
+    public T newInstance( Module module )
+    {
+        EntityBuilder<T> builder = module.unitOfWorkFactory().currentUnitOfWork().newEntityBuilder( type );
+        build( builder.instance() );
+        return builder.newInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/EntityComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityComposite.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityComposite.java
new file mode 100644
index 0000000..4fa9cb9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityComposite.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import org.apache.polygene.api.association.AssociationMixin;
+import org.apache.polygene.api.association.ManyAssociationMixin;
+import org.apache.polygene.api.association.NamedAssociationMixin;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.mixin.Mixins;
+
+/**
+ * EntityComposites are Composites that has mutable state persisted in EntityStores and equality defined from its
+ * reference.
+ */
+@Mixins( { AssociationMixin.class, ManyAssociationMixin.class, NamedAssociationMixin.class } )
+public interface EntityComposite extends HasIdentity, Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/EntityDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityDescriptor.java
new file mode 100644
index 0000000..1ff6180
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityDescriptor.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.StatefulCompositeDescriptor;
+
+/**
+ * Entity Descriptor.
+ */
+public interface EntityDescriptor
+    extends CompositeDescriptor, StatefulCompositeDescriptor
+{
+    @Override
+    AssociationStateDescriptor state();
+
+    boolean queryable();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java b/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java
new file mode 100644
index 0000000..731d3c3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/EntityReference.java
@@ -0,0 +1,123 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import java.io.Serializable;
+import java.util.Objects;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.util.NullArgumentException;
+
+/**
+ * An EntityReference is reference of a specific Entity instance.
+ * <p>When stringified, the reference is used as-is. Example:</p>
+ * <pre>123456-abcde</pre>
+ */
+public final class EntityReference
+        implements Serializable
+{
+    /**
+     * Parse an Entity reference to an EntityReference.
+     *
+     * @param identityString the EntityReference reference
+     * @return the EntityReference represented by the given reference
+     */
+    public static EntityReference parseEntityReference(String identityString)
+    {
+        return new EntityReference( new StringIdentity( identityString ) );
+    }
+
+    /**
+     * @param object an EntityComposite
+     * @return the EntityReference for the given EntityComposite
+     */
+    public static EntityReference entityReferenceFor(Object object)
+    {
+        return new EntityReference(((EntityComposite) object).identity().get());
+    }
+
+    public static EntityReference create(Identity identity)
+    {
+        if (identity == null)
+        {
+            return null;
+        }
+        return new EntityReference(identity);
+    }
+
+    private static final long serialVersionUID = 1L;
+
+    private Identity identity;
+
+    /**
+     * @param identity reference reference
+     * @throws NullArgumentException if reference is null or empty
+     */
+    private EntityReference( Identity identity )
+    {
+        Objects.requireNonNull(identity,"reference must not be null");
+        this.identity = identity;
+    }
+
+    /**
+     *
+     * @return The reference of the Entity that this EntityReference.is referring to
+     */
+    public final Identity identity()
+    {
+        return identity;
+    }
+
+    /**
+     * @return An URI representation of this EntityReference.
+     */
+    public String toURI()
+    {
+        return "urn:polygene:entity:" + identity;
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass())
+        {
+            return false;
+        }
+        EntityReference that = (EntityReference) o;
+        return identity.equals(that.identity);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return identity.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        return identity.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/Lifecycle.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/Lifecycle.java b/core/api/src/main/java/org/apache/polygene/api/entity/Lifecycle.java
new file mode 100644
index 0000000..187ef37
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/Lifecycle.java
@@ -0,0 +1,87 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+/**
+ * Lifecycle interface for all Composites.
+ * <p>
+ * This Lifecycle interface is a built-in feature of the Polygene runtime, similar to the Initializable interface.
+ * Any Mixin that implements this interface AND is part of an EntityComposite will have these two methods called
+ * upon creation/removal of the EntityComposite instance to/from the EntityStore. Meaning, the create method is called
+ * only when the identifiable EntityComposite is created the first time, and not when it is read from its persisted
+ * state and created into memory.
+ * </p>
+ * <p>
+ * Example;
+ * </p>
+ * <pre><code>
+ * public interface System
+ * {
+ *     Property&lt;User&gt; admin();
+ * }
+ *
+ * public class SystemAdminMixin&lt;LifeCycle&gt;
+ *     implements System, Lifecyle, ...
+ * {
+ *      &#64;Structure private UnitOfWork uow;
+ *      &#64;This private Identity meAsIdentity;
+ *
+ *      public void create()
+ *      {
+ *          String thisId = meAsIdentity.reference().get();
+ *          EntityBuilder builder = uow.newEntityBuilder( thisId + ":1", UserComposite.class );
+ *          User admin = builder.newInstance();
+ *          admin.set( admin );
+ *      }
+ *
+ *      public void remove()
+ *      {
+ *          uow.remove( admin.get() );
+ *      }
+ * }
+ *
+ * &#64;Mixins( SystemAdminMixin.class )
+ * public interface SystemEntity extends System, EntityComposite
+ * {}
+ *
+ * </code></pre>
+ */
+public interface Lifecycle
+{
+    /**
+     * Creation callback method.
+     * <p>
+     * Called by the Polygene runtime before the newInstance of the entity completes, before the constraints are checked,
+     * allowing for additional initialization.
+     * </p>
+     * @throws Exception if the entity could not be created
+     */
+    void create() throws Exception;
+
+    /**
+     * Removal callback method.
+     * <p>
+     * Called by the Polygene runtime before the entity is removed from the system, allowing
+     * for clean-up operations.
+     * </p>
+     * @throws Exception if the entity could not be removed
+     */
+    void remove() throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/LifecycleException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/LifecycleException.java b/core/api/src/main/java/org/apache/polygene/api/entity/LifecycleException.java
new file mode 100644
index 0000000..e0b2580
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/LifecycleException.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+/**
+ * Thrown if Lifecycle invocation fails
+ */
+public class LifecycleException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    public LifecycleException()
+    {
+    }
+
+    public LifecycleException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/Queryable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/Queryable.java b/core/api/src/main/java/org/apache/polygene/api/entity/Queryable.java
new file mode 100644
index 0000000..4a3f563
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/Queryable.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.entity;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to mark entity types or properties/associations that are indexable.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface Queryable
+{
+    boolean value() default true;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/entity/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/entity/package.html b/core/api/src/main/java/org/apache/polygene/api/entity/package.html
new file mode 100644
index 0000000..39a3223
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/entity/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Entity API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/event/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/event/package.html b/core/api/src/main/java/org/apache/polygene/api/event/package.html
new file mode 100644
index 0000000..4972ae6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/event/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Event API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/HasIdentity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/HasIdentity.java b/core/api/src/main/java/org/apache/polygene/api/identity/HasIdentity.java
new file mode 100644
index 0000000..4e139d1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/HasIdentity.java
@@ -0,0 +1,76 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Immutable;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * This interface provides the identity of the object which may be used
+ * to store the state in a database. It is not the responsibility of the
+ * framework to come up with a good identity string.
+ */
+@Mixins( HasIdentity.HasIdentityMixin.class )
+public interface HasIdentity
+{
+    Method IDENTITY_METHOD = HasIdentityMixin.identityMethod();
+    QualifiedName IDENTITY_STATE_NAME = HasIdentityMixin.stateName();
+
+    @Immutable
+    Property<Identity> identity();
+
+    /**
+     * Default Identity implementation.
+     */
+    class HasIdentityMixin
+        implements HasIdentity
+    {
+        @State
+        private Property<Identity> identity;
+
+
+        @Override
+        public Property<Identity> identity()
+        {
+            return identity;
+        }
+
+        private static QualifiedName stateName()
+        {
+            return QualifiedName.fromAccessor( identityMethod() );
+        }
+
+        private static Method identityMethod()
+        {
+            try
+            {
+                return HasIdentity.class.getMethod( "identity" );
+            }
+            catch( NoSuchMethodException e )
+            {
+                throw new InternalError( "Polygene Core Runtime codebase is corrupted." );
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/Identifiable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/Identifiable.java b/core/api/src/main/java/org/apache/polygene/api/identity/Identifiable.java
new file mode 100644
index 0000000..001ce7e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/Identifiable.java
@@ -0,0 +1,25 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+public interface Identifiable
+{
+    Identity identity();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/Identity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/Identity.java b/core/api/src/main/java/org/apache/polygene/api/identity/Identity.java
new file mode 100644
index 0000000..1db6d6d
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/Identity.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+/**
+ * Representation of an Identity.
+ * Identity is an opaque, immutable data type.
+ * Identity is a very central concept in any domain model.
+ *
+ */
+public interface Identity
+{
+    String toString();
+
+    byte[] toBytes();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/IdentityGenerator.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/IdentityGenerator.java b/core/api/src/main/java/org/apache/polygene/api/identity/IdentityGenerator.java
new file mode 100644
index 0000000..d407b0e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/IdentityGenerator.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+import org.apache.polygene.api.mixin.Mixins;
+
+/**
+ * Generator for identities of EntityComposite's.
+ */
+@Mixins( UuidGeneratorMixin.class )
+public interface IdentityGenerator
+{
+    /**
+     * Generate a new id for the given Composite type
+     *
+     * @param compositeType the type of composite
+     *
+     * @return a new reference
+     */
+    Identity generate( Class<?> compositeType );
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java b/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java
new file mode 100644
index 0000000..d5c43f9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/StringIdentity.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+
+public class StringIdentity
+    implements Identity
+{
+    private final String value;
+
+    public StringIdentity(String value)
+    {
+        Objects.requireNonNull( value, "Identity can not be null." );
+        this.value = value;
+    }
+
+    public StringIdentity(byte[] bytes)
+    {
+        value = new String(bytes, StandardCharsets.UTF_8);
+    }
+
+    public String value()
+    {
+        return value;
+    }
+
+    @Override
+    public byte[] toBytes()
+    {
+        return value.getBytes(StandardCharsets.UTF_8);
+    }
+
+    @Override
+    public String toString()
+    {
+        return value;
+    }
+
+    public static Identity fromString(String serializedState)
+    {
+        return new StringIdentity( serializedState );
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+        {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass())
+        {
+            return false;
+        }
+
+        StringIdentity that = (StringIdentity) o;
+
+        return value.equals(that.value);
+
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return value.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java b/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java
new file mode 100644
index 0000000..0add4c6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/identity/UuidGeneratorMixin.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.identity;
+
+import java.util.UUID;
+
+public class UuidGeneratorMixin
+        implements IdentityGenerator
+{
+    @Override
+    public Identity generate(Class<?> compositeType)
+    {
+        return StringIdentity.fromString(UUID.randomUUID().toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/InjectionScope.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/InjectionScope.java b/core/api/src/main/java/org/apache/polygene/api/injection/InjectionScope.java
new file mode 100644
index 0000000..cc7b3a4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/InjectionScope.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This is used to annotate annotation types which are used for injection.
+ * Each scope signifies a particular scope from which the injection value should be taken.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.ANNOTATION_TYPE } )
+@Documented
+public @interface InjectionScope
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/package.html b/core/api/src/main/java/org/apache/polygene/api/injection/package.html
new file mode 100644
index 0000000..155a5e4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Dependency Injection API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/Invocation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/Invocation.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Invocation.java
new file mode 100644
index 0000000..4305532
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Invocation.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a
+ * invocation specific resource.
+ * These include:
+ * <pre><code>
+ *  - The Method being invoked.
+ *
+ *  - An AnnotationElement with annotations
+ *    from both mixin type, mixin
+ *    implementation.
+ *
+ *  - An Annotation of a specific type
+ * </code></pre>
+ * Examples:
+ * <pre><code>
+ * &#64;Invocation Method theInvokedMethod
+ * &#64;Invocation AnnotationElement annotations
+ * &#64;Invocation Matches matchesAnnotation
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface Invocation
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/Service.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/Service.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Service.java
new file mode 100644
index 0000000..3fb344a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Service.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a service dependency into a Fragment.
+ * <p>
+ * Examples:
+ * </p>
+ * <pre><code>
+ * &#64;Service MyService service
+ * &#64;Service Iterable&lt;MyService&gt; services
+ * &#64;Service ServiceReference&lt;MyService&gt; serviceRef
+ * &#64;Service Iterable&lt;ServiceReference&lt;MyService&gt;&gt; serviceRefs
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface Service
+{
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/State.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/State.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/State.java
new file mode 100644
index 0000000..ab60507
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/State.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a property, association or
+ * StateHolder.
+ * <pre><code>
+ * &#64;State Property&lt;StringState propertyName;
+ * &#64;State Association&lt;MyEntityState associationName;
+ * &#64;State ManyAssociation&lt;MyEntityState manyAssociationName;
+ * &#64;State NamedAssociation&lt;MyEntityState namedAssociationName;
+ * &#64;State StateHolder state;
+ * &#64;State AssociationStateHolder associationState;
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface State
+{
+    /**
+     * Name of the property or association.
+     * If not set then name will be name of field.
+     *
+     * @return the name
+     */
+    public abstract String value() default "";
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/Structure.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/Structure.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Structure.java
new file mode 100644
index 0000000..b2114ab
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Structure.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a
+ * resource specific for the module which the
+ * injected object/fragment is instantiated in.
+ * <p>
+ * Valid types are:
+ * </p>
+ * <pre><code>
+ * - TransientBuilderFactory
+ * - ObjectBuilderFactory
+ * - UnitOfWorkFactory
+ * - ServiceFinder
+ * - Module
+ * - Layer
+ * - Application
+ * - PolygeneAPI
+ * - PolygeneSPI
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface Structure
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/This.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/This.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/This.java
new file mode 100644
index 0000000..1816ac5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/This.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a reference to the same Composite
+ * as the fragment is a part of.
+ * <p>
+ * If the Composite type does not implement the type of the field or parameter
+ * then it will be referencing a private mixin.
+ * </p>
+ * <p>
+ * Calls to the reference will have the same semantics as calls to the Composite itself.
+ * Specifically the same set of Modifiers will be used.
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface This
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/Uses.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/Uses.java b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Uses.java
new file mode 100644
index 0000000..ea590e4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/Uses.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * Annotation to denote the injection of a dependency to be used by a Mixin. The injected
+ * object is provided either by the TransientBuilder.uses() declarations, or if an instance of the appropriate types is not
+ * found, then a new Transient or Object is instantiated.
+ * Call {@link org.apache.polygene.api.composite.TransientBuilder#use} to provide the instance
+ * to be injected.
+ *
+ * Example:
+ * <pre>@Uses SomeType someInstance</pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.PARAMETER, ElementType.FIELD } )
+@Documented
+@InjectionScope
+public @interface Uses
+{
+}
\ No newline at end of file


[80/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ServiceModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ServiceModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ServiceModelFormatter.java
new file mode 100644
index 0000000..97a14e9
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ServiceModelFormatter.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.service.ServiceDescriptor;
+
+public class ServiceModelFormatter extends AbstractJsonFormatter<ServiceDescriptor, Void>
+{
+    public ServiceModelFormatter( JSONWriter writer )
+    {
+        super( writer );
+    }
+
+    @Override
+    public void enter( ServiceDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "identity", visited.identity() );
+        field( "type", visited.primaryType().getName() );
+        field( "visibility", visited.visibility().toString() );
+        Class<Object> config = visited.configurationType();
+        if( config != null )
+        {
+            field( "configuration", config.getName() );
+        }
+        field( "instantiateOnStartup", visited.isInstantiateOnStartup() );
+    }
+
+    @Override
+    public void leave( ServiceDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java
new file mode 100644
index 0000000..4d19f4f
--- /dev/null
+++ b/libraries/appbrowser/src/main/java/org/apache/polygene/library/appbrowser/json/ValueModelFormatter.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser.json;
+
+import org.json.JSONException;
+import org.json.JSONWriter;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.library.appbrowser.Formatter;
+
+public class ValueModelFormatter extends AbstractJsonFormatter<ValueDescriptor,Void>
+{
+    public ValueModelFormatter( JSONWriter writer )
+    {
+        super(writer);
+    }
+
+    @Override
+    public void enter( ValueDescriptor visited )
+        throws JSONException
+    {
+        object();
+        field( "type", visited.valueType().mainType().getName() );
+        field( "visibility", visited.visibility().toString() );
+    }
+
+    @Override
+    public void leave( ValueDescriptor visited )
+        throws JSONException
+    {
+        endObject();
+    }
+
+    @Override
+    public void visit( Void visited )
+        throws JSONException
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Browser.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Browser.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Browser.java
deleted file mode 100644
index 29c3d0f..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Browser.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser;
-
-import java.util.Stack;
-import org.json.JSONException;
-import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.api.util.HierarchicalVisitor;
-
-public class Browser
-{
-    private final ApplicationDescriptor application;
-    private final FormatterFactory factory;
-    private final Stack<Formatter> stack = new Stack<>();
-
-    public Browser( ApplicationDescriptor application, FormatterFactory factory )
-    {
-        this.application = application;
-        this.factory = factory;
-    }
-
-    public void toJson()
-        throws BrowserException
-    {
-        application.accept( new HierarchicalVisitor<Object, Object, BrowserException>()
-        {
-            @Override
-            public boolean visitEnter( Object visited )
-                throws BrowserException
-            {
-                String simpleName = visited.getClass().getSimpleName();
-                Formatter formatter = factory.create( simpleName );
-                stack.push(formatter);
-                if( formatter == null )
-                {
-                    System.err.println( "Unknown application component: " + visited.getClass() );
-                    return false;
-                }
-                try
-                {
-                    formatter.enter( visited );
-                }
-                catch( JSONException e )
-                {
-                    throw new BrowserException( "Formatting failed.", e );
-                }
-                return true;
-            }
-
-            @Override
-            public boolean visitLeave( Object visited )
-                throws BrowserException
-            {
-                Formatter formatter = stack.pop();
-                if( formatter == null )
-                {
-                    System.err.println( "Unknown application component: " + visited.getClass() );
-                    return false;
-                }
-                try
-                {
-                    formatter.leave( visited );
-                }
-                catch( JSONException e )
-                {
-                    throw new BrowserException( "Formatting failed.", e );
-                }
-                return true;
-            }
-
-            @Override
-            public boolean visit( Object visited )
-                throws BrowserException
-            {
-                Formatter formatter = stack.peek();
-                if( formatter == null )
-                {
-                    System.err.println( "Unknown application component: " + visited.getClass() );
-                    return false;
-                }
-                try
-                {
-                    formatter.visit( visited );
-                }
-                catch( JSONException e )
-                {
-                    throw new BrowserException( "Formatting failed.", e );
-                }
-                return true;
-            }
-        } );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/BrowserException.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/BrowserException.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/BrowserException.java
deleted file mode 100644
index 126c198..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/BrowserException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser;
-
-import org.json.JSONException;
-
-public class BrowserException extends RuntimeException
-{
-    public BrowserException( String message, JSONException exception )
-    {
-        super( message, exception);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Formatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Formatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Formatter.java
deleted file mode 100644
index 19355a7..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/Formatter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser;
-
-import org.json.JSONException;
-
-public interface Formatter<NODE, LEAF>
-{
-
-    void enter( NODE visited )
-        throws JSONException;
-
-    void leave( NODE visited )
-        throws JSONException;
-
-    void visit( LEAF visited )
-        throws JSONException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/FormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/FormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/FormatterFactory.java
deleted file mode 100644
index d996e2a..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/FormatterFactory.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser;
-
-public interface FormatterFactory
-{
-
-    Formatter create( String componentType );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/AbstractJsonFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/AbstractJsonFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/AbstractJsonFormatter.java
deleted file mode 100644
index 7682097..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/AbstractJsonFormatter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public abstract class AbstractJsonFormatter<NODE,LEAF>
-    implements Formatter<NODE, LEAF>
-{
-    private final JSONWriter writer;
-
-    public AbstractJsonFormatter( JSONWriter writer )
-    {
-        this.writer = writer;
-    }
-
-    protected void field( String name, String value )
-        throws JSONException
-    {
-        writer.key( name ).value(value);
-    }
-
-    protected void field( String name, boolean value )
-        throws JSONException
-    {
-        writer.key( name ).value(value);
-    }
-
-    protected void array( String name )
-        throws JSONException
-    {
-        writer.key(name);
-        writer.array();
-    }
-
-    protected void endArray()
-        throws JSONException
-    {
-        writer.endArray();
-    }
-
-    protected void object()
-        throws JSONException
-    {
-        writer.object();
-    }
-
-    protected void object(String name)
-        throws JSONException
-    {
-        writer.key(name);
-        writer.object();
-    }
-
-    protected void endObject()
-        throws JSONException
-    {
-        writer.endObject();
-    }
-
-    protected void value( Object value )
-        throws JSONException
-    {
-        writer.value( value );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ApplicationModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ApplicationModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ApplicationModelFormatter.java
deleted file mode 100644
index c862021..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ApplicationModelFormatter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class ApplicationModelFormatter extends AbstractJsonFormatter<ApplicationDescriptor, Void>
-{
-
-    public ApplicationModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( ApplicationDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "name", visited.name() );
-        array("layers");
-    }
-
-    @Override
-    public void leave( ApplicationDescriptor visited )
-        throws JSONException
-    {
-        endArray();
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ArrayFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ArrayFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ArrayFormatter.java
deleted file mode 100644
index 6c315d0..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ArrayFormatter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class ArrayFormatter extends AbstractJsonFormatter
-    implements Formatter
-{
-    private final String name;
-
-    public ArrayFormatter( JSONWriter writer, String name )
-    {
-        super(writer);
-        this.name = name;
-    }
-
-    @Override
-    public void enter( Object visited )
-        throws JSONException
-    {
-        array(name);
-    }
-
-    @Override
-    public void leave( Object visited )
-        throws JSONException
-    {
-        endArray();
-    }
-
-    @Override
-    public void visit( Object visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/CompositeMethodModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/CompositeMethodModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/CompositeMethodModelFormatter.java
deleted file mode 100644
index e4328ea..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/CompositeMethodModelFormatter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.composite.MethodDescriptor;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class CompositeMethodModelFormatter extends AbstractJsonFormatter<MethodDescriptor, Void>
-{
-    public CompositeMethodModelFormatter( JSONWriter writer )
-    {
-        super(writer);
-    }
-
-    @Override
-    public void enter( MethodDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field("method", visited.method().getName() );
-    }
-
-    @Override
-    public void leave( MethodDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ConstructorModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ConstructorModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ConstructorModelFormatter.java
deleted file mode 100644
index 8f864dd..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ConstructorModelFormatter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.composite.ConstructorDescriptor;
-
-public class ConstructorModelFormatter extends AbstractJsonFormatter<ConstructorDescriptor,Void>
-{
-    public ConstructorModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( ConstructorDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "name", visited.constructor().getName() );
-    }
-
-    @Override
-    public void leave( ConstructorDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/EntityModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/EntityModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/EntityModelFormatter.java
deleted file mode 100644
index 70d0d9e..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/EntityModelFormatter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.entity.EntityDescriptor;
-
-public class EntityModelFormatter extends AbstractJsonFormatter<EntityDescriptor, Void>
-{
-
-    public EntityModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( EntityDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "type", visited.primaryType().getName() );
-        field( "visibility", visited.visibility().toString() );
-        field( "queryable", visited.queryable() );
-    }
-
-    @Override
-    public void leave( EntityDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/InjectedFieldModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/InjectedFieldModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/InjectedFieldModelFormatter.java
deleted file mode 100644
index 75a216e..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/InjectedFieldModelFormatter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.composite.DependencyDescriptor;
-import org.apache.polygene.api.composite.InjectedFieldDescriptor;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class InjectedFieldModelFormatter extends AbstractJsonFormatter<InjectedFieldDescriptor, DependencyDescriptor>
-{
-    public InjectedFieldModelFormatter( JSONWriter writer )
-    {
-        super(writer);
-    }
-
-    @Override
-    public void enter( InjectedFieldDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field("name", visited.field().getName() );
-//        field( "optional", visited.optional() );
-//        field( "injectedclass", visited.injectedClass().getName() );
-//        field( "injectedannotation", visited.injectionAnnotation().toString() );
-//        field( "injectedtype", visited.injectionType().toString() );
-//        field( "rawinjectectiontype", visited.rawInjectionType().getName() );
-    }
-
-    @Override
-    public void leave( InjectedFieldDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( DependencyDescriptor visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/JsonFormatterFactory.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/JsonFormatterFactory.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/JsonFormatterFactory.java
deleted file mode 100644
index 5c7748a..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/JsonFormatterFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import java.io.Writer;
-import org.json.JSONWriter;
-import org.apache.polygene.library.appbrowser.Formatter;
-import org.apache.polygene.library.appbrowser.FormatterFactory;
-
-public class JsonFormatterFactory
-    implements FormatterFactory
-{
-    private static final NullFormatter NULL_FORMATTER = new NullFormatter();
-    private final JSONWriter writer;
-
-    public JsonFormatterFactory(Writer destination)
-    {
-        writer = new JSONWriter( destination );
-    }
-
-    @Override
-    public Formatter create( String componentType )
-    {
-        if( componentType.equalsIgnoreCase( "ApplicationModel" ))
-            return new ApplicationModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "LayerModel" ))
-            return new LayerModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "ModuleModel" ))
-            return new ModuleModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "TransientsModel" ))
-            return new ArrayFormatter(writer, "transients");
-        if( componentType.equalsIgnoreCase( "EntitiesModel" ))
-            return new ArrayFormatter(writer, "entities");
-        if( componentType.equalsIgnoreCase( "ServicesModel" ))
-            return new ArrayFormatter(writer, "services");
-        if( componentType.equalsIgnoreCase( "ServiceModel" ))
-            return new ServiceModelFormatter
-                (writer);
-        if( componentType.equalsIgnoreCase( "ValuesModel" ))
-            return new ArrayFormatter(writer, "values");
-        if( componentType.equalsIgnoreCase( "ValueModel" ))
-            return new ValueModelFormatter(writer);
-        if( componentType.equalsIgnoreCase( "ValueStateModel" ))
-            return NULL_FORMATTER;
-        if( componentType.equalsIgnoreCase( "EntityModel" ))
-            return new EntityModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "CompositeMethodsModel" ))
-            return new ArrayFormatter( writer, "methods" );
-        if( componentType.equalsIgnoreCase( "CompositeMethodModel" ))
-            return new CompositeMethodModelFormatter(writer);
-        if( componentType.equalsIgnoreCase( "ObjectsModel" ))
-            return new ArrayFormatter( writer, "objects" );
-        if( componentType.equalsIgnoreCase( "ConstraintsModel" ))
-            return new ArrayFormatter( writer, "constraints" );
-        if( componentType.equalsIgnoreCase( "SideEffectsModel" ))
-            return new ArrayFormatter( writer, "sideeffects" );
-        if( componentType.equalsIgnoreCase( "ConcernsModel" ))
-            return new ArrayFormatter( writer, "concerns" );
-        if( componentType.equalsIgnoreCase( "PropertiesModel" ))
-            return new ArrayFormatter( writer, "properties" );
-        if( componentType.equalsIgnoreCase( "ConstructorsModel" ))
-            return new ArrayFormatter( writer, "constructors" );
-        if( componentType.equalsIgnoreCase( "ConstructorModel" ))
-            return new ConstructorModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "EntityMixinsModel" ))
-            return new ArrayFormatter( writer, "mixins" );
-        if( componentType.equalsIgnoreCase( "MixinsModel" ))
-            return new ArrayFormatter( writer, "mixins" );
-        if( componentType.equalsIgnoreCase( "MixinModel" ))
-            return new MixinModelFormatter( writer );
-        if( componentType.equalsIgnoreCase( "AssociationsModel" ))
-            return new ArrayFormatter( writer, "associations" );
-        if( componentType.equalsIgnoreCase( "ManyAssociationsModel" ))
-            return new ArrayFormatter( writer, "manyassociations" );
-        if( componentType.equalsIgnoreCase( "InjectedFieldsModel" ))
-            return new ArrayFormatter( writer, "injectedfields" );
-        if( componentType.equalsIgnoreCase( "InjectedFieldModel" ))
-            return new InjectedFieldModelFormatter(writer);
-        if( componentType.equalsIgnoreCase( "InjectedMethodsModel" ))
-            return new ArrayFormatter( writer, "injectedmethods" );
-        if( componentType.equalsIgnoreCase( "InjectedParametersModel" ))
-            return new ArrayFormatter( writer, "injectedparameters" );
-        if( componentType.equalsIgnoreCase( "EntityStateModel" ))
-            return NULL_FORMATTER;
-        if( componentType.equalsIgnoreCase( "ObjectModel" ))
-            return new ObjectModelFormatter(writer);
-        if( componentType.equalsIgnoreCase( "ImportedServicesModel" ))
-            return NULL_FORMATTER;
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/LayerModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/LayerModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/LayerModelFormatter.java
deleted file mode 100644
index f55c475..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/LayerModelFormatter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.structure.LayerDescriptor;
-import org.apache.polygene.api.structure.UsedLayersDescriptor;
-
-public class LayerModelFormatter extends AbstractJsonFormatter<LayerDescriptor, Void>
-{
-    public LayerModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( LayerDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "name", visited.name() );
-        array( "uses" );
-        UsedLayersDescriptor usedLayersDescriptor = visited.usedLayers();
-        for( LayerDescriptor used : usedLayersDescriptor.layers() )
-        {
-            value( used.name() );
-        }
-        endArray();
-        array( "modules" );
-    }
-
-    @Override
-    public void leave( LayerDescriptor visited )
-        throws JSONException
-    {
-        endArray();
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/MixinModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/MixinModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/MixinModelFormatter.java
deleted file mode 100644
index 3254e58..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/MixinModelFormatter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.mixin.MixinDescriptor;
-
-public class MixinModelFormatter extends AbstractJsonFormatter<MixinDescriptor, Void>
-{
-    public MixinModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( MixinDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "mixin", visited.mixinClass().getName() );
-    }
-
-    @Override
-    public void leave( MixinDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ModuleModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ModuleModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ModuleModelFormatter.java
deleted file mode 100644
index 1ea5c34..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ModuleModelFormatter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.structure.ModuleDescriptor;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class ModuleModelFormatter extends AbstractJsonFormatter<ModuleDescriptor, Void>
-{
-
-    public ModuleModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( ModuleDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "name", visited.name() );
-    }
-
-    @Override
-    public void leave( ModuleDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/NullFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/NullFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/NullFormatter.java
deleted file mode 100644
index 6cb3e59..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/NullFormatter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class NullFormatter
-    implements Formatter<Object, Object>
-{
-    @Override
-    public void enter( Object visited )
-        throws JSONException
-    {
-
-    }
-
-    @Override
-    public void leave( Object visited )
-        throws JSONException
-    {
-
-    }
-
-    @Override
-    public void visit( Object visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ObjectModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ObjectModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ObjectModelFormatter.java
deleted file mode 100644
index 959edad..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ObjectModelFormatter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.object.ObjectDescriptor;
-
-public class ObjectModelFormatter extends AbstractJsonFormatter<ObjectDescriptor, Void>
-{
-    public ObjectModelFormatter( JSONWriter writer )
-    {
-        super(writer);
-    }
-
-    @Override
-    public void enter( ObjectDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "visibility", visited.visibility().toString());
-    }
-
-    @Override
-    public void leave( ObjectDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ServiceModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ServiceModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ServiceModelFormatter.java
deleted file mode 100644
index 97a14e9..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ServiceModelFormatter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.service.ServiceDescriptor;
-
-public class ServiceModelFormatter extends AbstractJsonFormatter<ServiceDescriptor, Void>
-{
-    public ServiceModelFormatter( JSONWriter writer )
-    {
-        super( writer );
-    }
-
-    @Override
-    public void enter( ServiceDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "identity", visited.identity() );
-        field( "type", visited.primaryType().getName() );
-        field( "visibility", visited.visibility().toString() );
-        Class<Object> config = visited.configurationType();
-        if( config != null )
-        {
-            field( "configuration", config.getName() );
-        }
-        field( "instantiateOnStartup", visited.isInstantiateOnStartup() );
-    }
-
-    @Override
-    public void leave( ServiceDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ValueModelFormatter.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ValueModelFormatter.java b/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ValueModelFormatter.java
deleted file mode 100644
index 4d19f4f..0000000
--- a/libraries/appbrowser/src/main/java/org/apache/zest/library/appbrowser/json/ValueModelFormatter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser.json;
-
-import org.json.JSONException;
-import org.json.JSONWriter;
-import org.apache.polygene.api.value.ValueDescriptor;
-import org.apache.polygene.library.appbrowser.Formatter;
-
-public class ValueModelFormatter extends AbstractJsonFormatter<ValueDescriptor,Void>
-{
-    public ValueModelFormatter( JSONWriter writer )
-    {
-        super(writer);
-    }
-
-    @Override
-    public void enter( ValueDescriptor visited )
-        throws JSONException
-    {
-        object();
-        field( "type", visited.valueType().mainType().getName() );
-        field( "visibility", visited.visibility().toString() );
-    }
-
-    @Override
-    public void leave( ValueDescriptor visited )
-        throws JSONException
-    {
-        endObject();
-    }
-
-    @Override
-    public void visit( Void visited )
-        throws JSONException
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/test/java/org/apache/polygene/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/apache/polygene/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/apache/polygene/library/appbrowser/AppBrowserTest.java
new file mode 100644
index 0000000..4a4ffc2
--- /dev/null
+++ b/libraries/appbrowser/src/test/java/org/apache/polygene/library/appbrowser/AppBrowserTest.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.library.appbrowser;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import org.junit.Test;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.concern.ConcernOf;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+import org.apache.polygene.library.appbrowser.json.JsonFormatterFactory;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+public class AppBrowserTest extends AbstractPolygeneTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.entities( Person.class );
+        module.values( Age.class );
+        module.services( MemoryEntityStoreService.class );
+        module.importedServices( ValueSerialization.class );
+    }
+
+    @Test
+    public void testBrowser()
+        throws Exception
+    {
+        Writer output = new StringWriter();
+        FormatterFactory jsonFactory = new JsonFormatterFactory( output );
+        Browser browser = new Browser( applicationModel, jsonFactory );
+        browser.toJson();
+    }
+
+    @Mixins( Person.Mixin.class )
+    @Concerns( Person.AgeLimitConcern.class )
+    public interface Person extends HasIdentity
+    {
+        String name();
+
+        int yearsOld();
+
+        interface State
+        {
+            Property<String> name();
+
+            Property<Age> age();
+
+            @Optional
+            Association<Person> spouse();
+
+            ManyAssociation<Person> children();
+        }
+
+        abstract class Mixin
+            implements Person
+        {
+
+            @This
+            private State state;
+
+            @Override
+            public String name()
+            {
+                return state.name().get();
+            }
+
+            @Override
+            public int yearsOld()
+            {
+                return state.age().get().numberOfYearsOld();
+            }
+        }
+
+        abstract class AgeLimitConcern extends ConcernOf<Person>
+            implements Person
+        {
+            @This
+            private Person me;
+            @Service
+            private AgeCheckService ageCheck;
+
+            @Override
+            public int yearsOld()
+            {
+                int years = next.yearsOld();
+                if( ageCheck.checkAge( identity(), years ))
+                    throw new DeathException( "Person is dead.");
+                return 0;
+            }
+        }
+    }
+
+    @Mixins( Age.AgeMixin.class )
+    public interface Age
+    {
+        Property<Integer> birthYear();
+
+        int numberOfYearsOld();
+
+        abstract class AgeMixin
+            implements Age
+        {
+
+            @Override
+            public int numberOfYearsOld()
+            {
+                return DateTime.now().getYearOfEra() - birthYear().get();
+            }
+        }
+    }
+
+    public static class DeathException extends RuntimeException
+    {
+        public DeathException( String message )
+        {
+            super( message );
+        }
+    }
+
+    @Mixins(AgeCheckService.AgeCheckerMixin.class)
+    public interface AgeCheckService
+    {
+
+        boolean checkAge( Property<Identity> identity, int years );
+
+        class AgeCheckerMixin
+            implements AgeCheckService
+        {
+
+            @Override
+            public boolean checkAge( Property<Identity> identity, int years )
+            {
+                double probabiility = years/(Math.random()*120+1);
+                return probabiility < 0.9;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
----------------------------------------------------------------------
diff --git a/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java b/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
deleted file mode 100644
index 4a4ffc2..0000000
--- a/libraries/appbrowser/src/test/java/org/apache/zest/library/appbrowser/AppBrowserTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.library.appbrowser;
-
-import java.io.StringWriter;
-import java.io.Writer;
-import org.junit.Test;
-import org.apache.polygene.api.association.Association;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.concern.ConcernOf;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.identity.HasIdentity;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.This;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.library.appbrowser.json.JsonFormatterFactory;
-import org.apache.polygene.test.AbstractPolygeneTest;
-
-public class AppBrowserTest extends AbstractPolygeneTest
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.entities( Person.class );
-        module.values( Age.class );
-        module.services( MemoryEntityStoreService.class );
-        module.importedServices( ValueSerialization.class );
-    }
-
-    @Test
-    public void testBrowser()
-        throws Exception
-    {
-        Writer output = new StringWriter();
-        FormatterFactory jsonFactory = new JsonFormatterFactory( output );
-        Browser browser = new Browser( applicationModel, jsonFactory );
-        browser.toJson();
-    }
-
-    @Mixins( Person.Mixin.class )
-    @Concerns( Person.AgeLimitConcern.class )
-    public interface Person extends HasIdentity
-    {
-        String name();
-
-        int yearsOld();
-
-        interface State
-        {
-            Property<String> name();
-
-            Property<Age> age();
-
-            @Optional
-            Association<Person> spouse();
-
-            ManyAssociation<Person> children();
-        }
-
-        abstract class Mixin
-            implements Person
-        {
-
-            @This
-            private State state;
-
-            @Override
-            public String name()
-            {
-                return state.name().get();
-            }
-
-            @Override
-            public int yearsOld()
-            {
-                return state.age().get().numberOfYearsOld();
-            }
-        }
-
-        abstract class AgeLimitConcern extends ConcernOf<Person>
-            implements Person
-        {
-            @This
-            private Person me;
-            @Service
-            private AgeCheckService ageCheck;
-
-            @Override
-            public int yearsOld()
-            {
-                int years = next.yearsOld();
-                if( ageCheck.checkAge( identity(), years ))
-                    throw new DeathException( "Person is dead.");
-                return 0;
-            }
-        }
-    }
-
-    @Mixins( Age.AgeMixin.class )
-    public interface Age
-    {
-        Property<Integer> birthYear();
-
-        int numberOfYearsOld();
-
-        abstract class AgeMixin
-            implements Age
-        {
-
-            @Override
-            public int numberOfYearsOld()
-            {
-                return DateTime.now().getYearOfEra() - birthYear().get();
-            }
-        }
-    }
-
-    public static class DeathException extends RuntimeException
-    {
-        public DeathException( String message )
-        {
-            super( message );
-        }
-    }
-
-    @Mixins(AgeCheckService.AgeCheckerMixin.class)
-    public interface AgeCheckService
-    {
-
-        boolean checkAge( Property<Identity> identity, int years );
-
-        class AgeCheckerMixin
-            implements AgeCheckService
-        {
-
-            @Override
-            public boolean checkAge( Property<Identity> identity, int years )
-            {
-                double probabiility = years/(Math.random()*120+1);
-                return probabiility < 0.9;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/VirtualHostJettyServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/VirtualHostJettyServiceTest.java b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/VirtualHostJettyServiceTest.java
new file mode 100644
index 0000000..88afe0e
--- /dev/null
+++ b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/VirtualHostJettyServiceTest.java
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.http;
+
+import java.io.IOException;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.library.http.dns.LocalManagedDns;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.util.FreePortFinder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.apache.polygene.library.http.Servlets.addServlets;
+import static org.apache.polygene.library.http.Servlets.serve;
+import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
+import static org.junit.Assert.assertEquals;
+
+public class VirtualHostJettyServiceTest
+    extends AbstractJettyTest
+{
+    private static final String HOST1 = "host1.http.library.polygene";
+    private static final String HOST2 = "host2.http.library.polygene";
+
+    private final int httpPort = FreePortFinder.findFreePortOnLoopback();
+
+    @BeforeClass
+    public static void beforeVirtualHostsClass()
+    {
+        assumeNoIbmJdk();
+        LocalManagedDns.putName( HOST1, "127.0.0.1" );
+        LocalManagedDns.putName( HOST2, "127.0.0.1" );
+    }
+
+    @AfterClass
+    public static void afterVirtualHostsClass()
+    {
+        LocalManagedDns.removeName( HOST1 );
+        LocalManagedDns.removeName( HOST2 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        ModuleAssembly configModule = module;
+        new EntityTestAssembler().assemble( configModule );
+        new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module );
+
+        SecureJettyConfiguration config = configModule.forMixin( SecureJettyConfiguration.class ).declareDefaults();
+        config.hostName().set( "127.0.0.1" );
+        config.port().set( httpPort );
+        config.virtualHosts().set( HOST1 + "," + HOST2 );
+
+        addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module );
+    }
+
+    @Test
+    public void test()
+        throws IOException
+    {
+        // Available on HOST1 and HOST2
+        String output = defaultHttpClient.execute( new HttpGet( "http://" + HOST1 + ":" + httpPort + "/hello" ),
+                                                   stringResponseHandler );
+        assertEquals( "Hello World", output );
+
+        output = defaultHttpClient.execute( new HttpGet( "http://" + HOST2 + ":" + httpPort + "/hello" ),
+                                            stringResponseHandler );
+        assertEquals( "Hello World", output );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDns.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDns.java b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDns.java
new file mode 100644
index 0000000..065c35a
--- /dev/null
+++ b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDns.java
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.http.dns;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import org.xbill.DNS.spi.DNSJavaNameServiceDescriptor;
+import sun.net.spi.nameservice.NameService;
+
+public class LocalManagedDns
+        implements NameService
+{
+
+    private static final NameService DEFAULT_DNS = new DNSJavaNameServiceDescriptor().createNameService();
+    private static final Map<String, String> NAMES = new ConcurrentHashMap<String, String>();
+
+    public static void clearNames()
+    {
+        NAMES.clear();
+    }
+
+    public static String putName( String name, String ip )
+    {
+        return NAMES.put( name, ip );
+    }
+
+    public static String removeName( String name )
+    {
+        return NAMES.remove( name );
+    }
+
+    public String getHostByAddr( byte[] bytes )
+            throws UnknownHostException
+    {
+        return DEFAULT_DNS.getHostByAddr( bytes );
+    }
+
+    public InetAddress[] lookupAllHostAddr( String name )
+            throws UnknownHostException
+    {
+        String log = "[CDNS] Lookup request";
+        String ip = NAMES.get( name );
+        InetAddress[] result = new InetAddress[ 0 ];
+        if ( ip != null && ip.length() > 0 ) {
+            log += " on managed name (" + name + ")";
+            byte[] ipBytes = ipStringToBytes( ip );
+            result = new InetAddress[]{ Inet4Address.getByAddress( ipBytes ) };
+        } else {
+            log += " on non-managed name (" + name + ")";
+            result = DEFAULT_DNS.lookupAllHostAddr( name );
+        }
+        return result;
+    }
+
+    private static byte[] ipStringToBytes( String ipString )
+    {
+        if ( ipString == null || ipString.length() == 0 ) {
+            return null;
+        }
+
+        int inetAddrSize = 4;
+        int octets;
+        char ch;
+        byte[] dst = new byte[ inetAddrSize ];
+        char[] srcb = ipString.toCharArray();
+        boolean saw_digit = false;
+
+        octets = 0;
+        int i = 0;
+        int cur = 0;
+        while ( i < srcb.length ) {
+            ch = srcb[i++];
+            if ( Character.isDigit( ch ) ) {
+                int sum = dst[cur] * 10 + ( Character.digit( ch, 10 ) & 0xff );
+
+                if ( sum > 255 ) {
+                    return null;
+                }
+
+                dst[cur] = ( byte ) ( sum & 0xff );
+                if ( !saw_digit ) {
+                    if ( ++octets > inetAddrSize ) {
+                        return null;
+                    }
+                    saw_digit = true;
+                }
+            } else if ( ch == '.' && saw_digit ) {
+                if ( octets == inetAddrSize ) {
+                    return null;
+                }
+                cur++;
+                dst[cur] = 0;
+                saw_digit = false;
+            } else {
+                return null;
+            }
+        }
+
+        if ( octets < inetAddrSize ) {
+            return null;
+        }
+        return dst;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDnsDescriptor.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDnsDescriptor.java b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDnsDescriptor.java
new file mode 100644
index 0000000..91af739
--- /dev/null
+++ b/libraries/http/src/vhost-test/java/org/apache/polygene/library/http/dns/LocalManagedDnsDescriptor.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.http.dns;
+
+import sun.net.spi.nameservice.NameService;
+import sun.net.spi.nameservice.NameServiceDescriptor;
+
+public class LocalManagedDnsDescriptor
+        implements NameServiceDescriptor
+{
+
+    public static final String PROVIDER_NAME = "LocalManagedDns";
+    private static final NameService nameService = new LocalManagedDns();
+
+    public NameService createNameService()
+            throws Exception
+    {
+        return nameService;
+    }
+
+    public String getProviderName()
+    {
+        return PROVIDER_NAME;
+    }
+
+    public String getType()
+    {
+        return "dns";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java
deleted file mode 100644
index 88afe0e..0000000
--- a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/VirtualHostJettyServiceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.http;
-
-import java.io.IOException;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.library.http.dns.LocalManagedDns;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.util.FreePortFinder;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.apache.polygene.library.http.Servlets.addServlets;
-import static org.apache.polygene.library.http.Servlets.serve;
-import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
-import static org.junit.Assert.assertEquals;
-
-public class VirtualHostJettyServiceTest
-    extends AbstractJettyTest
-{
-    private static final String HOST1 = "host1.http.library.polygene";
-    private static final String HOST2 = "host2.http.library.polygene";
-
-    private final int httpPort = FreePortFinder.findFreePortOnLoopback();
-
-    @BeforeClass
-    public static void beforeVirtualHostsClass()
-    {
-        assumeNoIbmJdk();
-        LocalManagedDns.putName( HOST1, "127.0.0.1" );
-        LocalManagedDns.putName( HOST2, "127.0.0.1" );
-    }
-
-    @AfterClass
-    public static void afterVirtualHostsClass()
-    {
-        LocalManagedDns.removeName( HOST1 );
-        LocalManagedDns.removeName( HOST2 );
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        ModuleAssembly configModule = module;
-        new EntityTestAssembler().assemble( configModule );
-        new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module );
-
-        SecureJettyConfiguration config = configModule.forMixin( SecureJettyConfiguration.class ).declareDefaults();
-        config.hostName().set( "127.0.0.1" );
-        config.port().set( httpPort );
-        config.virtualHosts().set( HOST1 + "," + HOST2 );
-
-        addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module );
-    }
-
-    @Test
-    public void test()
-        throws IOException
-    {
-        // Available on HOST1 and HOST2
-        String output = defaultHttpClient.execute( new HttpGet( "http://" + HOST1 + ":" + httpPort + "/hello" ),
-                                                   stringResponseHandler );
-        assertEquals( "Hello World", output );
-
-        output = defaultHttpClient.execute( new HttpGet( "http://" + HOST2 + ":" + httpPort + "/hello" ),
-                                            stringResponseHandler );
-        assertEquals( "Hello World", output );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java
deleted file mode 100644
index 065c35a..0000000
--- a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDns.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.http.dns;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import org.xbill.DNS.spi.DNSJavaNameServiceDescriptor;
-import sun.net.spi.nameservice.NameService;
-
-public class LocalManagedDns
-        implements NameService
-{
-
-    private static final NameService DEFAULT_DNS = new DNSJavaNameServiceDescriptor().createNameService();
-    private static final Map<String, String> NAMES = new ConcurrentHashMap<String, String>();
-
-    public static void clearNames()
-    {
-        NAMES.clear();
-    }
-
-    public static String putName( String name, String ip )
-    {
-        return NAMES.put( name, ip );
-    }
-
-    public static String removeName( String name )
-    {
-        return NAMES.remove( name );
-    }
-
-    public String getHostByAddr( byte[] bytes )
-            throws UnknownHostException
-    {
-        return DEFAULT_DNS.getHostByAddr( bytes );
-    }
-
-    public InetAddress[] lookupAllHostAddr( String name )
-            throws UnknownHostException
-    {
-        String log = "[CDNS] Lookup request";
-        String ip = NAMES.get( name );
-        InetAddress[] result = new InetAddress[ 0 ];
-        if ( ip != null && ip.length() > 0 ) {
-            log += " on managed name (" + name + ")";
-            byte[] ipBytes = ipStringToBytes( ip );
-            result = new InetAddress[]{ Inet4Address.getByAddress( ipBytes ) };
-        } else {
-            log += " on non-managed name (" + name + ")";
-            result = DEFAULT_DNS.lookupAllHostAddr( name );
-        }
-        return result;
-    }
-
-    private static byte[] ipStringToBytes( String ipString )
-    {
-        if ( ipString == null || ipString.length() == 0 ) {
-            return null;
-        }
-
-        int inetAddrSize = 4;
-        int octets;
-        char ch;
-        byte[] dst = new byte[ inetAddrSize ];
-        char[] srcb = ipString.toCharArray();
-        boolean saw_digit = false;
-
-        octets = 0;
-        int i = 0;
-        int cur = 0;
-        while ( i < srcb.length ) {
-            ch = srcb[i++];
-            if ( Character.isDigit( ch ) ) {
-                int sum = dst[cur] * 10 + ( Character.digit( ch, 10 ) & 0xff );
-
-                if ( sum > 255 ) {
-                    return null;
-                }
-
-                dst[cur] = ( byte ) ( sum & 0xff );
-                if ( !saw_digit ) {
-                    if ( ++octets > inetAddrSize ) {
-                        return null;
-                    }
-                    saw_digit = true;
-                }
-            } else if ( ch == '.' && saw_digit ) {
-                if ( octets == inetAddrSize ) {
-                    return null;
-                }
-                cur++;
-                dst[cur] = 0;
-                saw_digit = false;
-            } else {
-                return null;
-            }
-        }
-
-        if ( octets < inetAddrSize ) {
-            return null;
-        }
-        return dst;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java b/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java
deleted file mode 100644
index 91af739..0000000
--- a/libraries/http/src/vhost-test/java/org/apache/zest/library/http/dns/LocalManagedDnsDescriptor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.http.dns;
-
-import sun.net.spi.nameservice.NameService;
-import sun.net.spi.nameservice.NameServiceDescriptor;
-
-public class LocalManagedDnsDescriptor
-        implements NameServiceDescriptor
-{
-
-    public static final String PROVIDER_NAME = "LocalManagedDns";
-    private static final NameService nameService = new LocalManagedDns();
-
-    public NameService createNameService()
-            throws Exception
-    {
-        return nameService;
-    }
-
-    public String getProviderName()
-    {
-        return PROVIDER_NAME;
-    }
-
-    public String getType()
-    {
-        return "dns";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor b/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
index 97d19d9..093db66 100644
--- a/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
+++ b/libraries/http/src/vhost-test/resources/META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor
@@ -14,4 +14,4 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-polygene.library.http.dns.LocalManagedDnsDescriptor
+org.apache.polygene.library.http.dns.LocalManagedDnsDescriptor


[07/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationInstance.java
new file mode 100644
index 0000000..e27a0af
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationInstance.java
@@ -0,0 +1,174 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.PolygeneRuntime;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+
+/**
+ * Instance of a Polygene application. Contains a list of layers which are managed by this application
+ */
+public class ApplicationInstance
+    implements Application
+{
+
+    // Constructor parameters
+    private final ApplicationModel applicationModel;
+    private final PolygeneRuntime runtime;
+    private final MetaInfo instanceMetaInfo;
+    // Eager instance objects
+    private final ActivationDelegate activation;
+    private final List<LayerInstance> layerInstances;
+
+    public ApplicationInstance( ApplicationModel model, PolygeneRuntime runtime, MetaInfo instanceMetaInfo )
+    {
+        // Constructor parameters
+        this.applicationModel = model;
+        this.runtime = runtime;
+        this.instanceMetaInfo = instanceMetaInfo;
+
+        // Eager instance objects
+        activation = new ActivationDelegate( this );
+        layerInstances = new ArrayList<>();
+    }
+
+    @Override
+    public String toString()
+    {
+        return name();
+    }
+
+    // Implementation of Application
+    @Override
+    public String name()
+    {
+        return applicationModel.name();
+    }
+
+    @Override
+    public String version()
+    {
+        return applicationModel.version();
+    }
+
+    @Override
+    public Mode mode()
+    {
+        return applicationModel.mode();
+    }
+
+    @Override
+    public Layer findLayer( String layerName )
+    {
+        for( LayerInstance layerInstance : layerInstances )
+        {
+            if( layerInstance.model().name().equals( layerName ) )
+            {
+                return layerInstance;
+            }
+        }
+
+        throw new IllegalArgumentException( "No such layer:" + layerName );
+    }
+
+    @Override
+    public Module findModule( String layerName, String moduleName )
+    {
+        for( LayerInstance layerInstance : layerInstances )
+        {
+            if( layerInstance.model().name().equals( layerName ) )
+            {
+                return layerInstance.findModule( moduleName );
+            }
+        }
+
+        throw new IllegalArgumentException( "No such layer:" + layerName );
+    }
+
+    @Override
+    public Stream<? extends Layer> layers()
+    {
+        return layerInstances.stream();
+    }
+
+    @Override
+    public ApplicationDescriptor descriptor()
+    {
+        return applicationModel;
+    }
+
+    // Implementation of MetaInfoHolder
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return instanceMetaInfo.get( infoType );
+    }
+
+    // Implementation of Activation
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        activation.activate( applicationModel.newActivatorsInstance(), layerInstances );
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        activation.passivate();
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    // Other methods
+    void addLayer( LayerInstance layer )
+    {
+        layer.registerActivationEventListener( activation );
+        layerInstances.add( layer );
+    }
+
+    public PolygeneRuntime runtime()
+    {
+        return runtime;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationModel.java
new file mode 100644
index 0000000..a163bed
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ApplicationModel.java
@@ -0,0 +1,178 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.bootstrap.PolygeneRuntime;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.injection.provider.InjectionProviderFactoryStrategy;
+
+/**
+ * JAVADOC
+ */
+public final class ApplicationModel
+    implements ApplicationDescriptor
+{
+    private final String name;
+    private final String version;
+    private final Application.Mode mode;
+    private final MetaInfo metaInfo;
+    private final ActivatorsModel<Application> activatorsModel;
+    private final List<LayerModel> layers;
+    private final InjectionProviderFactory ipf;
+
+    public ApplicationModel( String name,
+                             String version,
+                             Application.Mode mode,
+                             MetaInfo metaInfo,
+                             ActivatorsModel<Application> activatorsModel,
+                             List<LayerModel> layers
+    )
+    {
+        this.name = name;
+        this.version = version;
+        this.mode = mode;
+        this.metaInfo = metaInfo;
+        this.activatorsModel = activatorsModel;
+        this.layers = layers;
+        ipf = new InjectionProviderFactoryStrategy( metaInfo );
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public String version()
+    {
+        return version;
+    }
+
+    public Application.Mode mode()
+    {
+        return mode;
+    }
+
+    public MetaInfo metaInfo()
+    {
+        return metaInfo;
+    }
+
+    public ActivatorsInstance<Application> newActivatorsInstance()
+        throws ActivationException
+    {
+        return new ActivatorsInstance<>( activatorsModel.newInstances() );
+    }
+
+    // SPI
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( activatorsModel.accept( visitor ) )
+            {
+                for( LayerModel layer : layers )
+                {
+                    if( !layer.accept( visitor ) )
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    @Override
+    public ApplicationInstance newInstance( PolygeneAPI runtime, Object... importedServiceInstances )
+        throws InvalidApplicationException
+    {
+        MetaInfo instanceMetaInfo = new MetaInfo( metaInfo );
+        for( Object importedServiceInstance : importedServiceInstances )
+        {
+            instanceMetaInfo.set( importedServiceInstance );
+        }
+
+        ApplicationInstance applicationInstance = new ApplicationInstance( this, (PolygeneRuntime) runtime, instanceMetaInfo );
+
+        // Create layer instances
+        Map<LayerDescriptor, LayerDescriptor> layerInstanceMap = new HashMap<>();
+        Map<LayerDescriptor, List<LayerDescriptor>> usedLayers = new HashMap<>();
+        for( LayerModel layer : layers )
+        {
+            List<LayerDescriptor> usedLayerInstances = new ArrayList<>();
+            usedLayers.put( layer, usedLayerInstances );
+            UsedLayersInstance usedLayersInstance = layer.usedLayers().newInstance( usedLayerInstances );
+            LayerInstance layerInstance = layer.newInstance( applicationInstance );
+            applicationInstance.addLayer( layerInstance );
+            layerInstanceMap.put( layer, layerInstance.descriptor() );
+        }
+
+        // Resolve used layer instances
+        for( LayerModel layer : layers )
+        {
+            List<LayerDescriptor> usedLayerInstances = usedLayers.get( layer );
+            layer.usedLayers().layers().forEach(
+                usedLayer ->
+                {
+                    LayerDescriptor layerDescriptor = layerInstanceMap.get( usedLayer );
+                    if( layerDescriptor == null )
+                    {
+                        throw new InvalidApplicationException( "Could not find used layer:" + usedLayer
+                            .name() );
+                    }
+                    usedLayerInstances.add( layerDescriptor );
+                } );
+        }
+
+        return applicationInstance;
+    }
+
+    public InjectionProviderFactory injectionProviderFactory()
+    {
+        return ipf;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "ApplicationModel" +
+               "{name='" + name + '\'' +
+               ", version='" + version + '\'' +
+               ", mode=" + mode +
+               '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerInstance.java
new file mode 100644
index 0000000..09201fb
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerInstance.java
@@ -0,0 +1,150 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+
+/**
+ * Instance of a Polygene application layer. Contains a list of modules which are managed by this layer.
+ */
+public class LayerInstance
+    implements Layer
+{
+
+    // Constructor parameters
+    private final LayerModel layerModel;
+    private final ApplicationInstance applicationInstance;
+
+    // Eager instance objects
+    private final ActivationDelegate activation;
+    private final List<ModuleInstance> moduleInstances;
+
+    public LayerInstance( LayerModel model,
+                          ApplicationInstance applicationInstance
+    )
+    {
+        // Constructor parameters
+        this.layerModel = model;
+        this.applicationInstance = applicationInstance;
+
+        // Eager instance objects
+        activation = new ActivationDelegate( this );
+        moduleInstances = new ArrayList<>();
+    }
+
+    @Override
+    public String toString()
+    {
+        return layerModel.toString();
+    }
+
+    // Implementation of Layer
+    @Override
+    public String name()
+    {
+        return layerModel.name();
+    }
+
+    @Override
+    public Application application()
+    {
+        return applicationInstance;
+    }
+
+    // Implementation of MetaInfoHolder
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return layerModel.metaInfo( infoType );
+    }
+
+    // Implementation of Activation
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        activation.activate( layerModel.newActivatorsInstance(), moduleInstances );
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        activation.passivate();
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    @Override
+    public Stream<? extends Module> modules()
+    {
+        return moduleInstances.stream();
+    }
+
+    @Override
+    public LayerDescriptor descriptor()
+    {
+        return layerModel;
+    }
+
+    void addModule( ModuleInstance module )
+    {
+        module.registerActivationEventListener( activation );
+        moduleInstances.add( module );
+    }
+
+    public LayerModel model()
+    {
+        return layerModel;
+    }
+
+    /* package */ ModuleInstance findModule( String moduleName )
+    {
+        for( ModuleInstance moduleInstance : moduleInstances )
+        {
+            if( moduleInstance.model().name().equals( moduleName ) )
+            {
+                return moduleInstance;
+            }
+        }
+
+        throw new IllegalArgumentException( "No such module:" + moduleName );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerModel.java
new file mode 100644
index 0000000..04ca846
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/LayerModel.java
@@ -0,0 +1,170 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+
+/**
+ * JAVADOC
+ */
+public final class LayerModel
+    implements LayerDescriptor, VisitableHierarchy<Object, Object>
+{
+    // Model
+    private final String name;
+    private final MetaInfo metaInfo;
+    private final UsedLayersModel usedLayersModel;
+    private final ActivatorsModel<Layer> activatorsModel;
+    private final List<ModuleModel> modules;
+    private LayerInstance layerInstance;
+
+    public LayerModel( String name,
+                       MetaInfo metaInfo,
+                       UsedLayersModel usedLayersModel,
+                       ActivatorsModel<Layer> activatorsModel,
+                       List<ModuleModel> modules
+    )
+    {
+        this.name = name;
+        this.metaInfo = metaInfo;
+        this.usedLayersModel = usedLayersModel;
+        this.activatorsModel = activatorsModel;
+        this.modules = modules;
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    public Iterable<ModuleModel> modules()
+    {
+        return modules;
+    }
+
+    @Override
+    public UsedLayersModel usedLayers()
+    {
+        return usedLayersModel;
+    }
+
+    public ActivatorsInstance<Layer> newActivatorsInstance()
+        throws ActivationException
+    {
+        return new ActivatorsInstance<>( activatorsModel.newInstances() );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            if( activatorsModel.accept( modelVisitor ) )
+            {
+                for( ModuleModel module : modules )
+                {
+                    if( !module.accept( modelVisitor ) )
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    @Override
+    public Layer instance()
+    {
+        return layerInstance;
+    }
+
+    public LayerInstance newInstance( ApplicationInstance applicationInstance )
+    {
+        layerInstance = new LayerInstance( this, applicationInstance );
+        for( ModuleModel module : modules )
+        {
+            ModuleInstance moduleInstance = module.newInstance( this );
+            layerInstance.addModule( moduleInstance );
+        }
+        return layerInstance;
+    }
+
+    @Override
+    public Stream<? extends ObjectDescriptor> visibleObjects( final Visibility visibility )
+    {
+        return modules.stream().flatMap( module -> module.visibleObjects( visibility ) );
+    }
+
+    @Override
+    public Stream<? extends TransientDescriptor> visibleTransients( final Visibility visibility )
+    {
+        return modules.stream().flatMap( module -> module.visibleTransients( visibility ) );
+    }
+
+    @Override
+    public Stream<? extends EntityDescriptor> visibleEntities( final Visibility visibility )
+    {
+        return modules.stream().flatMap( module -> module.visibleEntities( visibility ) );
+    }
+
+    /* package */
+    @Override
+    public Stream<? extends ValueDescriptor> visibleValues( final Visibility visibility )
+    {
+        return modules.stream().flatMap( module -> module.visibleValues( visibility ) );
+    }
+
+    /* package */
+    @Override
+    public Stream<? extends ModelDescriptor> visibleServices( final Visibility visibility )
+    {
+        return modules.stream().flatMap( module -> module.visibleServices( visibility ) );
+    }
+
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleClassLoader.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleClassLoader.java
new file mode 100644
index 0000000..65873f1
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleClassLoader.java
@@ -0,0 +1,182 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+
+import static java.util.stream.Stream.concat;
+import static org.apache.polygene.api.common.Visibility.application;
+import static org.apache.polygene.api.common.Visibility.module;
+import static org.apache.polygene.api.util.Classes.modelTypeSpecification;
+
+// Module ClassLoader
+class ModuleClassLoader
+    extends ClassLoader
+{
+
+    private final ModuleModel moduleModel;
+    private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
+
+    ModuleClassLoader( ModuleModel moduleModel, ClassLoader classLoader )
+    {
+        super( classLoader );
+        this.moduleModel = moduleModel;
+    }
+
+    @Override
+    protected Class<?> findClass( String className )
+        throws ClassNotFoundException
+    {
+        try
+        {
+            Class<?> resultingClass = classes.computeIfAbsent( className, name ->
+            {
+                Predicate<ModelDescriptor> modelTypeSpecification = modelTypeSpecification( name );
+                Stream<? extends ModelDescriptor> moduleModels = concat(
+                    moduleModel.visibleObjects( Visibility.module ),
+                    concat(
+                        moduleModel.visibleEntities( Visibility.module ),
+                        concat(
+                            moduleModel.visibleTransients( Visibility.module ),
+                            moduleModel.visibleValues( Visibility.module )
+                        )
+                    )
+                ).filter( modelTypeSpecification );
+
+                Class<?> clazz = null;
+                Iterator<? extends ModelDescriptor> iterator = moduleModels.iterator();
+                if( iterator.hasNext() )
+                {
+                    clazz = iterator.next().types().findFirst().orElse( null );
+
+                    if( iterator.hasNext() )
+                    {
+                        // Ambiguous exception
+                        new AmbiguousTypeException(
+                            "More than one model matches the classname " + name + ":" + iterator.next()
+                        );
+                    }
+                }
+
+                // Check layer
+                if( clazz == null )
+                {
+                    Stream<? extends ModelDescriptor> modelsInLayer1 = concat(
+                        moduleModel.layer().visibleObjects( Visibility.layer ),
+                        concat(
+                            moduleModel.layer().visibleEntities( Visibility.layer ),
+                            concat(
+                                moduleModel.layer().visibleTransients( Visibility.layer ),
+                                moduleModel.layer().visibleValues( Visibility.layer )
+                            )
+                        )
+                    );
+                    // TODO: What does this actually represents?? Shouldn't 'application' visible models already be handed back from lasyerInstance().visibleXyz() ??
+                    Stream<? extends ModelDescriptor> modelsInLayer2 = concat(
+                        moduleModel.layer().visibleObjects( Visibility.application ),
+                        concat(
+                            moduleModel.layer().visibleEntities( Visibility.application ),
+                            concat(
+                                moduleModel.layer().visibleTransients( Visibility.application ),
+                                moduleModel.layer().visibleValues( Visibility.application )
+                            )
+                        )
+                    );
+                    Stream<? extends ModelDescriptor> layerModels = concat(
+                        modelsInLayer1,
+                        modelsInLayer2
+                    ).filter( modelTypeSpecification );
+
+                    Iterator<? extends ModelDescriptor> layerModelsIter = layerModels.iterator();
+                    if( layerModelsIter.hasNext() )
+                    {
+                        clazz = layerModelsIter.next().types().findFirst().orElse( null );
+
+                        if( layerModelsIter.hasNext() )
+                        {
+                            // Ambiguous exception
+                            new AmbiguousTypeException(
+                                "More than one model matches the classname " + name + ":" + layerModelsIter.next()
+                            );
+                        }
+                    }
+                }
+
+                // Check used layers
+                if( clazz == null )
+                {
+                    Stream<? extends ModelDescriptor> usedLayersModels = concat(
+                        moduleModel.layer()
+                            .usedLayers()
+                            .layers()
+                            .flatMap( layer -> layer.visibleObjects( module ) ),
+                        concat(
+                            moduleModel.layer()
+                                .usedLayers()
+                                .layers()
+                                .flatMap( layer -> layer.visibleEntities( Visibility.layer ) ),
+                            concat(
+                                moduleModel.layer()
+                                    .usedLayers()
+                                    .layers()
+                                    .flatMap( layer -> layer.visibleTransients( application ) ),
+                                moduleModel.layer()
+                                    .usedLayers()
+                                    .layers()
+                                    .flatMap( layer -> layer.visibleValues( application ) )
+                            )
+                        )
+                    ).filter( modelTypeSpecification );
+
+                    Iterator<? extends ModelDescriptor> usedLayersModelsIter = usedLayersModels.iterator();
+                    if( usedLayersModelsIter.hasNext() )
+                    {
+                        clazz = usedLayersModelsIter.next().types().findFirst().orElse( null );
+
+                        if( usedLayersModelsIter.hasNext() )
+                        {
+                            // Ambiguous exception
+                            new AmbiguousTypeException(
+                                "More than one model matches the classname " + name + ":" + usedLayersModelsIter.next()
+                            );
+                        }
+                    }
+                }
+                return clazz;
+            } );
+            if( resultingClass == null )
+            {
+                throw new ClassNotFoundException();
+            }
+            return resultingClass;
+        }
+        catch( AmbiguousTypeException e )
+        {
+            throw new ClassNotFoundException( className, e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
new file mode 100644
index 0000000..4eb9ac1
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleInstance.java
@@ -0,0 +1,606 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.NoSuchTransientException;
+import org.apache.polygene.api.composite.TransientBuilder;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.IdentityGenerator;
+import org.apache.polygene.api.metrics.MetricsProvider;
+import org.apache.polygene.api.object.NoSuchObjectException;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.service.NoSuchServiceException;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.structure.TypeLookup;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.unitofwork.UnitOfWorkException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.api.value.NoSuchValueException;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.api.value.ValueSerializationException;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+import org.apache.polygene.runtime.composite.FunctionStateResolver;
+import org.apache.polygene.runtime.composite.StateResolver;
+import org.apache.polygene.runtime.composite.TransientBuilderInstance;
+import org.apache.polygene.runtime.composite.TransientStateInstance;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.object.ObjectModel;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.runtime.property.PropertyModel;
+import org.apache.polygene.runtime.query.QueryBuilderFactoryImpl;
+import org.apache.polygene.runtime.service.ImportedServicesInstance;
+import org.apache.polygene.runtime.service.ImportedServicesModel;
+import org.apache.polygene.runtime.service.ServicesInstance;
+import org.apache.polygene.runtime.service.ServicesModel;
+import org.apache.polygene.runtime.value.ValueBuilderInstance;
+import org.apache.polygene.runtime.value.ValueBuilderWithPrototype;
+import org.apache.polygene.runtime.value.ValueBuilderWithState;
+import org.apache.polygene.runtime.value.ValueInstance;
+import org.apache.polygene.spi.entitystore.EntityStore;
+import org.apache.polygene.spi.metrics.MetricsProviderAdapter;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+import static java.util.Arrays.asList;
+import static java.util.stream.Stream.concat;
+
+/**
+ * Instance of a Polygene Module. Contains the various composites for this Module.
+ */
+public class ModuleInstance
+    implements Module, ModuleSpi, Activation
+{
+    // Constructor parameters
+    private final ModuleModel model;
+    private final LayerDescriptor layer;
+    private final TypeLookup typeLookup;
+    private final ServicesInstance services;
+    private final ImportedServicesInstance importedServices;
+    // Eager instance objects
+    private final ActivationDelegate activation;
+    private final QueryBuilderFactory queryBuilderFactory;
+    // Lazy assigned on accessors
+    private EntityStore store;
+    private IdentityGenerator generator;
+    private ValueSerialization valueSerialization;
+    private MetricsProvider metrics;
+    private UnitOfWorkFactory uowf;
+
+    @SuppressWarnings( "LeakingThisInConstructor" )
+    public ModuleInstance( ModuleModel moduleModel, LayerDescriptor layer, TypeLookup typeLookup,
+                           ServicesModel servicesModel, ImportedServicesModel importedServicesModel
+    )
+    {
+        // Constructor parameters
+        model = moduleModel;
+        this.layer = layer;
+        this.typeLookup = typeLookup;
+        services = servicesModel.newInstance( moduleModel );
+        importedServices = importedServicesModel.newInstance( moduleModel );
+
+        // Eager instance objects
+        activation = new ActivationDelegate( this );
+        queryBuilderFactory = new QueryBuilderFactoryImpl( this );
+
+        // Activation
+        services.registerActivationEventListener( activation );
+        importedServices.registerActivationEventListener( activation );
+    }
+
+    @Override
+    public String toString()
+    {
+        return model.toString();
+    }
+
+    @Override
+    public ModuleDescriptor descriptor()
+    {
+        return model;
+    }
+
+    // Implementation of Module
+    @Override
+    public String name()
+    {
+        return model.name();
+    }
+
+    // Implementation of MetaInfoHolder
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return model.metaInfo( infoType );
+    }
+
+    // Implementation of ObjectFactory
+    @Override
+    public <T> T newObject( Class<T> mixinType, Object... uses )
+        throws NoSuchObjectException
+    {
+        NullArgumentException.validateNotNull( "mixinType", mixinType );
+        ObjectDescriptor model = typeLookup.lookupObjectModel( mixinType );
+
+        if( model == null )
+        {
+            throw new NoSuchObjectException( mixinType.getName(), name(),
+                                             typeLookup.allObjects().flatMap( HasTypes::types ) );
+        }
+
+        InjectionContext injectionContext = new InjectionContext( model.module(), UsesInstance.EMPTY_USES.use( uses ) );
+        return mixinType.cast( ( (ObjectModel) model ).newInstance( injectionContext ) );
+    }
+
+    @Override
+    public void injectTo( Object instance, Object... uses )
+        throws ConstructionException
+    {
+        NullArgumentException.validateNotNull( "instance", instance );
+        ObjectDescriptor model = typeLookup.lookupObjectModel( instance.getClass() );
+
+        if( model == null )
+        {
+            throw new NoSuchObjectException( instance.getClass().getName(), name(),
+                                             typeLookup.allObjects().flatMap( HasTypes::types ) );
+        }
+
+        InjectionContext injectionContext = new InjectionContext( model.module(), UsesInstance.EMPTY_USES.use( uses ) );
+        ( (ObjectModel) model ).inject( injectionContext, instance );
+    }
+
+    // Implementation of TransientBuilderFactory
+    @Override
+    public <T> TransientBuilder<T> newTransientBuilder( Class<T> mixinType )
+        throws NoSuchTransientException
+    {
+        NullArgumentException.validateNotNull( "mixinType", mixinType );
+        TransientDescriptor model = typeLookup.lookupTransientModel( mixinType );
+
+        if( model == null )
+        {
+            throw new NoSuchTransientException( mixinType.getName(), name(), typeLookup );
+        }
+
+        Map<AccessibleObject, Property<?>> properties = new HashMap<>();
+        model.state().properties().forEach(
+            propertyModel ->
+            {
+                Property<?> property = new PropertyInstance<>( ( (PropertyModel) propertyModel ).getBuilderInfo(),
+                                                               propertyModel.initialValue( model.module() ) );
+                properties.put( propertyModel.accessor(), property );
+            } );
+
+        TransientStateInstance state = new TransientStateInstance( properties );
+
+        return new TransientBuilderInstance<>( model, state, UsesInstance.EMPTY_USES );
+    }
+
+    @Override
+    public <T> T newTransient( final Class<T> mixinType, Object... uses )
+        throws NoSuchTransientException, ConstructionException
+    {
+        return newTransientBuilder( mixinType ).use( uses ).newInstance();
+    }
+
+    // Implementation of ValueBuilderFactory
+    @Override
+    public <T> T newValue( Class<T> mixinType )
+        throws NoSuchValueException, ConstructionException
+    {
+        return newValueBuilder( mixinType ).newInstance();
+    }
+
+    @Override
+    public <T> ValueBuilder<T> newValueBuilder( Class<T> mixinType )
+        throws NoSuchValueException
+    {
+        NullArgumentException.validateNotNull( "mixinType", mixinType );
+        ValueDescriptor compositeModelModule = typeLookup.lookupValueModel( mixinType );
+
+        if( compositeModelModule == null )
+        {
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
+        }
+
+        StateResolver stateResolver = new InitialStateResolver( compositeModelModule.module() );
+        return new ValueBuilderInstance<>( compositeModelModule, this, stateResolver );
+    }
+
+    @Override
+    public <T> ValueBuilder<T> newValueBuilderWithState( Class<T> mixinType,
+                                                         Function<PropertyDescriptor, Object> propertyFunction,
+                                                         Function<AssociationDescriptor, EntityReference> associationFunction,
+                                                         Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+                                                         Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
+    )
+    {
+        NullArgumentException.validateNotNull( "propertyFunction", propertyFunction );
+        NullArgumentException.validateNotNull( "associationFunction", associationFunction );
+        NullArgumentException.validateNotNull( "manyAssociationFunction", manyAssociationFunction );
+        NullArgumentException.validateNotNull( "namedAssociationFunction", namedAssociationFunction );
+
+        ValueDescriptor compositeModelModule = typeLookup.lookupValueModel( mixinType );
+
+        if( compositeModelModule == null )
+        {
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
+        }
+
+        StateResolver stateResolver = new FunctionStateResolver(
+            propertyFunction, associationFunction, manyAssociationFunction, namedAssociationFunction
+        );
+        return new ValueBuilderWithState<>( compositeModelModule, this, stateResolver );
+    }
+
+    private static class InitialStateResolver
+        implements StateResolver
+    {
+        private final ModuleDescriptor module;
+
+        private InitialStateResolver( ModuleDescriptor module )
+        {
+            this.module = module;
+        }
+
+        @Override
+        public Object getPropertyState( PropertyDescriptor propertyDescriptor )
+        {
+            return propertyDescriptor.initialValue( module );
+        }
+
+        @Override
+        public EntityReference getAssociationState( AssociationDescriptor associationDescriptor )
+        {
+            return null;
+        }
+
+        @Override
+        public Stream<EntityReference> getManyAssociationState( AssociationDescriptor associationDescriptor )
+        {
+            return new ArrayList<EntityReference>().stream();
+        }
+
+        @Override
+        public Stream<Map.Entry<String, EntityReference>> getNamedAssociationState( AssociationDescriptor associationDescriptor )
+        {
+            return new HashMap<String, EntityReference>().entrySet().stream();
+        }
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> ValueBuilder<T> newValueBuilderWithPrototype( T prototype )
+    {
+        NullArgumentException.validateNotNull( "prototype", prototype );
+
+        ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) prototype );
+        Class<Composite> valueType = (Class<Composite>) valueInstance.types().findFirst().orElse( null );
+
+        ValueDescriptor model = typeLookup.lookupValueModel( valueType );
+
+        if( model == null )
+        {
+            throw new NoSuchValueException( valueType.getName(), name(), typeLookup );
+        }
+
+        return new ValueBuilderWithPrototype<>( model, this, prototype );
+    }
+
+    @Override
+    public <T> T newValueFromSerializedState( Class<T> mixinType, String serializedState )
+        throws NoSuchValueException, ConstructionException
+    {
+        NullArgumentException.validateNotNull( "mixinType", mixinType );
+        ValueDescriptor model = typeLookup.lookupValueModel( mixinType );
+
+        if( model == null )
+        {
+            throw new NoSuchValueException( mixinType.getName(), name(), typeLookup );
+        }
+
+        try
+        {
+            return valueSerialization().deserialize( model.module(), model.valueType(), serializedState );
+        }
+        catch( ValueSerializationException ex )
+        {
+            throw new ConstructionException( "Could not create value from serialized state", ex );
+        }
+    }
+
+    // Implementation of QueryBuilderFactory
+    @Override
+    public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType )
+    {
+        return queryBuilderFactory.newQueryBuilder( resultType );
+    }
+
+    @Override
+    public <T> ServiceReference<T> findService( Class<T> serviceType )
+        throws NoSuchServiceException
+    {
+        return findService( (Type) serviceType );
+    }
+
+    @Override
+    public <T> ServiceReference<T> findService( Type serviceType )
+    {
+        ModelDescriptor serviceModel = typeLookup.lookupServiceModel( serviceType );
+        if( serviceModel == null )
+        {
+            throw new NoSuchServiceException( serviceType.getTypeName(), name(),typeLookup );
+        }
+        return findServiceReferenceInstance( serviceModel );
+    }
+
+    @Override
+    public <T> Stream<ServiceReference<T>> findServices( final Class<T> serviceType )
+    {
+        return findServices( (Type) serviceType );
+    }
+
+    @Override
+    public <T> Stream<ServiceReference<T>> findServices( final Type serviceType )
+    {
+        List<? extends ModelDescriptor> serviceModels = typeLookup.lookupServiceModels( serviceType );
+        if( serviceModels == null )
+        {
+            return Stream.empty();
+        }
+        //noinspection unchecked
+        return serviceModels.stream()
+                            .map( this::findServiceReferenceInstance )
+                            .filter( Objects::nonNull )
+                            .filter( ref -> ref.hasType( serviceType ) )
+                            .map( ref -> (ServiceReference<T>) ref );
+    }
+
+    private <T> ServiceReference<T> findServiceReferenceInstance( ModelDescriptor model )
+    {
+        ModuleInstance moduleInstanceOfModel = (ModuleInstance) model.module().instance();
+        Optional<ServiceReference<?>> candidate =
+            concat( moduleInstanceOfModel.services.references(), moduleInstanceOfModel.importedServices.references() )
+                .filter( ref -> ref.model().equals( model ) )
+                .findAny();
+        if( candidate.isPresent() )
+        {
+            ServiceReference<?> serviceReference = candidate.get();
+            return (ServiceReference<T>) serviceReference;
+        }
+        return null;
+    }
+
+    // Implementation of Activation
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public void activate()
+        throws ActivationException
+    {
+        activation.activate( model.newActivatorsInstance(), asList( services, importedServices ) );
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        activation.passivate();
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    // Other methods
+    ModuleModel model()
+    {
+        return model;
+    }
+
+    public LayerDescriptor layer()
+    {
+        return layer;
+    }
+
+    @Override
+    public TypeLookup typeLookup()
+    {
+        return typeLookup;
+    }
+
+    public EntityStore entityStore()
+    {
+        synchronized( this )
+        {
+            if( store == null )
+            {
+                try
+                {
+                    ServiceReference<EntityStore> service = findService( EntityStore.class );
+                    store = service.get();
+                }
+                catch( NoSuchServiceException e )
+                {
+                    throw new UnitOfWorkException( "No EntityStore service available in module " + name() );
+                }
+            }
+        }
+        return store;
+    }
+
+    public UnitOfWorkFactory unitOfWorkFactory()
+    {
+        synchronized( this )
+        {
+            if( uowf == null )
+            {
+                try
+                {
+                    ServiceReference<UnitOfWorkFactory> service = findService( UnitOfWorkFactory.class );
+                    uowf = service.get();
+                }
+                catch( NoSuchServiceException e )
+                {
+                    throw new UnitOfWorkException( "No UnitOfWorkFactory service available in module " + name() );
+                }
+            }
+        }
+        return uowf;
+    }
+
+    @Override
+    public ServiceFinder serviceFinder()
+    {
+        return this;
+    }
+
+    @Override
+    public ValueBuilderFactory valueBuilderFactory()
+    {
+        return this;
+    }
+
+    @Override
+    public TransientBuilderFactory transientBuilderFactory()
+    {
+        return this;
+    }
+
+    @Override
+    public ObjectFactory objectFactory()
+    {
+        return this;
+    }
+
+    public IdentityGenerator identityGenerator()
+    {
+        synchronized( this )
+        {
+            if( generator == null )
+            {
+                ServiceReference<IdentityGenerator> service = findService( IdentityGenerator.class );
+                generator = service.get();
+            }
+            return generator;
+        }
+    }
+
+    public ValueSerialization valueSerialization()
+    {
+        synchronized( this )
+        {
+            if( valueSerialization == null )
+            {
+                try
+                {
+                    ServiceReference<ValueSerialization> service = findService( ValueSerialization.class );
+                    valueSerialization = service.get();
+                }
+                catch( NoSuchServiceException e )
+                {
+                    throw new ValueSerializationException( "No ValueSeriaservice available in module " + name() );
+                }
+            }
+        }
+        return valueSerialization;
+    }
+
+    public MetricsProvider metricsProvider()
+    {
+        synchronized( this )
+        {
+            if( metrics == null )
+            {
+                try
+                {
+                    ServiceReference<MetricsProvider> service = findService( MetricsProvider.class );
+                    metrics = service.get();
+                }
+                catch( NoSuchServiceException e )
+                {
+                    metrics = new MetricsProviderAdapter();
+                }
+            }
+        }
+        return metrics;
+    }
+
+//    public Stream<ServiceReference<?>> visibleServices( Visibility visibility )
+//    {
+//        return concat( services.visibleServices( visibility ),
+//                       importedServices.visibleServices( visibility ) );
+//    }
+//
+//
+//
+//    public Stream<ServiceReference<?>> findVisibleServiceTypes()
+//    {
+//        return concat( visibleServices( Visibility.module ),
+//                       concat(
+//                           layer().visibleServices( Visibility.layer ),
+//                           concat(
+//                               layer().visibleServices( Visibility.application ),
+//                               layer().usedLayers().layers().flatMap( layer -> layer.visibleServices(Visibility.application) )
+//                           )
+//                       )
+//        );
+//    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleModel.java
new file mode 100644
index 0000000..f83a2cd
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/ModuleModel.java
@@ -0,0 +1,394 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.structure.TypeLookup;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.composite.TransientsModel;
+import org.apache.polygene.runtime.entity.EntitiesModel;
+import org.apache.polygene.runtime.object.ObjectsModel;
+import org.apache.polygene.runtime.service.ImportedServicesModel;
+import org.apache.polygene.runtime.service.ServicesModel;
+import org.apache.polygene.runtime.value.ValuesModel;
+
+import static java.util.stream.Stream.concat;
+import static org.apache.polygene.api.common.Visibility.application;
+import static org.apache.polygene.api.common.Visibility.layer;
+import static org.apache.polygene.api.common.Visibility.module;
+
+/**
+ * JAVADOC
+ */
+public class ModuleModel
+    implements ModuleDescriptor, VisitableHierarchy<Object, Object>
+{
+    private final LayerDescriptor layerModel;
+    private final ActivatorsModel<Module> activatorsModel;
+    private final TransientsModel transientsModel;
+    private final EntitiesModel entitiesModel;
+    private final ObjectsModel objectsModel;
+    private final ValuesModel valuesModel;
+    private final ServicesModel servicesModel;
+    private final ImportedServicesModel importedServicesModel;
+    private final TypeLookupImpl typeLookup;
+    private final ClassLoader classLoader;
+
+    private final String name;
+    private final MetaInfo metaInfo;
+    private ModuleInstance moduleInstance;
+
+    public ModuleModel( String name,
+                        MetaInfo metaInfo,
+                        LayerDescriptor layerModel,
+                        ActivatorsModel<Module> activatorsModel,
+                        TransientsModel transientsModel,
+                        EntitiesModel entitiesModel,
+                        ObjectsModel objectsModel,
+                        ValuesModel valuesModel,
+                        ServicesModel servicesModel,
+                        ImportedServicesModel importedServicesModel
+    )
+    {
+        this.name = name;
+        this.metaInfo = metaInfo;
+        this.layerModel = layerModel;
+        this.activatorsModel = activatorsModel;
+        this.transientsModel = transientsModel;
+        this.entitiesModel = entitiesModel;
+        this.objectsModel = objectsModel;
+        this.valuesModel = valuesModel;
+        this.servicesModel = servicesModel;
+        this.importedServicesModel = importedServicesModel;
+        typeLookup = new TypeLookupImpl( this );
+        classLoader = new ModuleClassLoader( this, Thread.currentThread().getContextClassLoader() );
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public LayerDescriptor layer()
+    {
+        return layerModel;
+    }
+
+    @Override
+    public ClassLoader classLoader()
+    {
+        return classLoader;
+    }
+
+    public ActivatorsInstance<Module> newActivatorsInstance()
+        throws ActivationException
+    {
+        return new ActivatorsInstance<>( activatorsModel.newInstances() );
+    }
+
+    @Override
+    public EntityDescriptor entityDescriptor( String name )
+    {
+        try
+        {
+            Class<?> type = classLoader().loadClass( name );
+            EntityDescriptor entityModel = typeLookup.lookupEntityModel( type );
+            if( entityModel == null )
+            {
+                return null;
+            }
+            return entityModel;
+        }
+        catch( ClassNotFoundException e )
+        {
+            return null;
+        }
+    }
+
+    @Override
+    public ObjectDescriptor objectDescriptor( String typeName )
+    {
+        try
+        {
+            Class<?> type = classLoader().loadClass( typeName );
+            ObjectDescriptor objectModel = typeLookup.lookupObjectModel( type );
+            if( objectModel == null )
+            {
+                return null;
+            }
+            return objectModel;
+        }
+        catch( ClassNotFoundException e )
+        {
+            return null;
+        }
+    }
+
+    @Override
+    public TransientDescriptor transientDescriptor( String name )
+    {
+        try
+        {
+            Class<?> type = classLoader().loadClass( name );
+            TransientDescriptor transientModel = typeLookup.lookupTransientModel( type );
+            if( transientModel == null )
+            {
+                return null;
+            }
+            return transientModel;
+        }
+        catch( ClassNotFoundException e )
+        {
+            return null;
+        }
+    }
+
+    @Override
+    public ValueDescriptor valueDescriptor( String name )
+    {
+        try
+        {
+            Class<?> type = classLoader().loadClass( name );
+            ValueDescriptor valueModel = typeLookup.lookupValueModel( type );
+            if( valueModel == null )
+            {
+                return null;
+            }
+            return valueModel;
+        }
+        catch( ClassNotFoundException e )
+        {
+            return null;
+        }
+    }
+
+    @Override
+    public Module instance()
+    {
+        return moduleInstance;
+    }
+
+    @Override
+    public TypeLookup typeLookup()
+    {
+        return typeLookup;
+    }
+
+    public ModuleInstance newInstance( LayerDescriptor layerInstance )
+    {
+        moduleInstance = new ModuleInstance( this, layerInstance, typeLookup, servicesModel, importedServicesModel );
+        return moduleInstance;
+    }
+
+    @Override
+    public Stream<? extends TransientDescriptor> transientComposites()
+    {
+        return transientsModel.stream();
+    }
+
+    @Override
+    public Stream<? extends ValueDescriptor> valueComposites()
+    {
+        return valuesModel.stream();
+    }
+
+    @Override
+    public Stream<? extends ServiceDescriptor> serviceComposites()
+    {
+        return servicesModel.models();
+    }
+
+    @Override
+    public Stream<? extends EntityDescriptor> entityComposites()
+    {
+        return entitiesModel.stream();
+    }
+
+    @Override
+    public Stream<? extends ImportedServiceDescriptor> importedServices()
+    {
+        return importedServicesModel.models();
+    }
+
+    @Override
+    public Stream<? extends ObjectDescriptor> objects()
+    {
+        return objectsModel.models();
+    }
+
+    public Stream<? extends ValueDescriptor> findVisibleValueTypes()
+    {
+        return concat( visibleValues( module ),
+                       concat(
+                           layer().visibleValues( layer ),
+                           concat(
+                               layer().visibleValues( application ),
+                               layer().usedLayers().layers().flatMap( layer1 -> layer1.visibleValues( application ) )
+                           )
+                       )
+        );
+    }
+
+    public Stream<? extends EntityDescriptor> findVisibleEntityTypes()
+    {
+        return concat( visibleEntities( module ),
+                       concat(
+                           layer().visibleEntities( layer ),
+                           concat(
+                               layer().visibleEntities( application ),
+                               layer().usedLayers().layers().flatMap( layer1 -> layer1.visibleEntities( application ) )
+                           )
+                       )
+        );
+    }
+
+    public Stream<? extends TransientDescriptor> findVisibleTransientTypes()
+    {
+        return concat( visibleTransients( module ),
+                       concat(
+                           layer().visibleTransients( layer ),
+                           concat(
+                               layer().visibleTransients( application ),
+                               layer().usedLayers()
+                                   .layers()
+                                   .flatMap( layer1 -> layer1.visibleTransients( application ) )
+                           )
+                       )
+        );
+    }
+
+    public Stream<? extends ModelDescriptor> findVisibleServiceTypes()
+    {
+        return concat( visibleServices( module ),
+                       concat(
+                           layer().visibleServices( layer ),
+                           concat(
+                               layer().visibleServices( application ),
+                               layer().usedLayers().layers().flatMap( layer1 -> layer1.visibleServices( application ) )
+                           )
+                       )
+        );
+    }
+
+    public Stream<? extends ObjectDescriptor> findVisibleObjectTypes()
+    {
+        return concat( visibleObjects( module ),
+                       concat(
+                           layer().visibleObjects( layer ),
+                           concat(
+                               layer().visibleObjects( application ),
+                               layer().usedLayers().layers().flatMap( layer -> layer.visibleObjects( application ) )
+                           )
+                       )
+        );
+    }
+
+    public Stream<? extends ObjectDescriptor> visibleObjects( Visibility visibility )
+    {
+        return objectsModel.models()
+            .filter( new Visibilitypredicate( visibility ) );
+    }
+
+    public Stream<? extends TransientDescriptor> visibleTransients( Visibility visibility )
+    {
+        return transientsModel.models()
+            .filter( new Visibilitypredicate( visibility ) );
+    }
+
+    public Stream<? extends EntityDescriptor> visibleEntities( Visibility visibility )
+    {
+        return entitiesModel.models()
+            .filter( new Visibilitypredicate( visibility ) );
+    }
+
+    public Stream<? extends ValueDescriptor> visibleValues( Visibility visibility )
+    {
+        return valuesModel.models()
+            .filter( new Visibilitypredicate( visibility ) );
+    }
+
+    public Stream<? extends ModelDescriptor> visibleServices( Visibility visibility )
+    {
+        return concat(
+            servicesModel.models()
+                .filter( new Visibilitypredicate( visibility ) ),
+            importedServicesModel.models()
+                .filter( new Visibilitypredicate( visibility ) )
+        );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            if( activatorsModel.accept( modelVisitor ) )
+            {
+                if( transientsModel.accept( modelVisitor ) )
+                {
+                    if( entitiesModel.accept( modelVisitor ) )
+                    {
+                        if( servicesModel.accept( modelVisitor ) )
+                        {
+                            if( importedServicesModel.accept( modelVisitor ) )
+                            {
+                                if( objectsModel.accept( modelVisitor ) )
+                                {
+                                    valuesModel.accept( modelVisitor );
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/TypeLookupImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/TypeLookupImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/TypeLookupImpl.java
new file mode 100644
index 0000000..9df92c9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/TypeLookupImpl.java
@@ -0,0 +1,543 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.structure.TypeLookup;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Stream.concat;
+import static org.apache.polygene.api.common.Visibility.application;
+import static org.apache.polygene.api.common.Visibility.layer;
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+
+/**
+ * Central place for Composite Type lookups.
+ */
+class TypeLookupImpl
+    implements TypeLookup
+{
+    private final LazyValue<List<ObjectDescriptor>> allObjects;
+    private final LazyValue<List<TransientDescriptor>> allTransients;
+    private final LazyValue<List<ValueDescriptor>> allValues;
+    private final LazyValue<List<EntityDescriptor>> allEntities;
+    private final LazyValue<List<? extends ModelDescriptor>> allServices;
+    private final ConcurrentHashMap<Class<?>, ObjectDescriptor> objectModels;
+    private final ConcurrentHashMap<Class<?>, TransientDescriptor> transientModels;
+    private final ConcurrentHashMap<Class<?>, ValueDescriptor> valueModels;
+    private final ConcurrentHashMap<Class<?>, List<EntityDescriptor>> entityModels;
+    private final ConcurrentHashMap<Class<?>, EntityDescriptor> unambiguousEntityModels;
+    private final ConcurrentHashMap<Type, ModelDescriptor> serviceModels;
+    private final ConcurrentHashMap<Type, List<? extends ModelDescriptor>> servicesReferences;
+
+    private final ModuleDescriptor moduleModel;
+
+    /**
+     * Create a new TypeLookup bound to the given ModuleModel.
+     *
+     * @param module ModuleModel bound to this TypeLookup
+     */
+    TypeLookupImpl( ModuleModel module )
+    {
+        moduleModel = module;
+
+        // Instance caches
+        allObjects = new LazyValue<>();
+        allTransients = new LazyValue<>();
+        allValues = new LazyValue<>();
+        allEntities = new LazyValue<>();
+        allServices = new LazyValue<>();
+        objectModels = new ConcurrentHashMap<>();
+        transientModels = new ConcurrentHashMap<>();
+        valueModels = new ConcurrentHashMap<>();
+        entityModels = new ConcurrentHashMap<>();
+        unambiguousEntityModels = new ConcurrentHashMap<>();
+        serviceModels = new ConcurrentHashMap<>();
+        servicesReferences = new ConcurrentHashMap<>();
+    }
+
+    @Override
+    public ObjectDescriptor lookupObjectModel( final Class<?> type )
+    {
+        return objectModels.computeIfAbsent( type, key ->
+        {
+            List<? extends ObjectDescriptor> allModels = getAllObjects();
+            ObjectDescriptor model = ambiguityMatching( key, allModels, new ExactTypeMatching<>( key ) );
+            if( model == null )
+            {
+                model = ambiguityMatching( key, allModels, new AssignableFromTypeMatching<>( key ) );
+            }
+            return model;
+        } );
+    }
+
+    @Override
+    public TransientDescriptor lookupTransientModel( final Class<?> type )
+    {
+        return transientModels.computeIfAbsent( type, key ->
+        {
+            List<? extends TransientDescriptor> allModels = getAllTransients();
+            TransientDescriptor model = ambiguityMatching( key, allModels, new ExactTypeMatching<>( key ) );
+            if( model == null )
+            {
+                model = ambiguityMatching( key, allModels, new AssignableFromTypeMatching<>( key ) );
+            }
+            return model;
+        } );
+    }
+
+    @Override
+    public ValueDescriptor lookupValueModel( final Class<?> type )
+    {
+        return valueModels.computeIfAbsent( type, key ->
+        {
+            List<? extends ValueDescriptor> allModels = getAllValues();
+            ValueDescriptor model = ambiguityMatching( key, allModels, new ExactTypeMatching<>( key ) );
+            if( model == null )
+            {
+                model = ambiguityMatching( key, allModels, new AssignableFromTypeMatching<>( key ) );
+            }
+            return model;
+        } );
+    }
+
+    @Override
+    public EntityDescriptor lookupEntityModel( final Class<?> type )
+    {
+        return unambiguousEntityModels.computeIfAbsent( type, key ->
+        {
+            List<? extends EntityDescriptor> allModels = getAllEntities();
+            EntityDescriptor model = ambiguityMatching( key, allModels, new ExactTypeMatching<>( key ) );
+            if( model == null )
+            {
+                model = ambiguityMatching( key, allModels, new AssignableFromTypeMatching<>( key ) );
+            }
+            return model;
+        } );
+    }
+
+    @Override
+    public List<EntityDescriptor> lookupEntityModels( final Class type )
+    {
+        return entityModels.computeIfAbsent(
+            type,
+            key -> new TypeMatchesSelector<EntityDescriptor>( key ).selectFrom( allEntities() ) );
+    }
+
+    @Override
+    public ModelDescriptor lookupServiceModel( Type serviceType )
+    {
+        return serviceModels.computeIfAbsent(
+            serviceType,
+            key -> new BestTypeMatchSelector<ModelDescriptor>( key ).selectFrom( allServices() )
+                                                                    .bestMatchOrElse( null ) );
+    }
+
+    @Override
+    public List<? extends ModelDescriptor> lookupServiceModels( final Type type )
+    {
+        return servicesReferences.computeIfAbsent(
+            type,
+            key -> new TypeMatchesSelector<ModelDescriptor>( key ).selectFrom( allServices() ) );
+    }
+
+    @Override
+    public Stream<ObjectDescriptor> allObjects()
+    {
+        return getAllObjects().stream();
+    }
+
+    private List<ObjectDescriptor> getAllObjects()
+    {
+        return allObjects.computeIfAbsent(
+            () -> concat( moduleModel.objects(),
+                          concat(
+                              concat(
+                                  moduleModel.layer().visibleObjects( layer ),
+                                  moduleModel.layer()
+                                             .visibleObjects( application )
+                              ),
+                              moduleModel.layer()
+                                         .usedLayers()
+                                         .layers()
+                                         .flatMap( layer -> layer.visibleObjects( application ) )
+                          )
+            ).collect( toList() )
+        );
+    }
+
+    @Override
+    public Stream<TransientDescriptor> allTransients()
+    {
+        return getAllTransients().stream();
+    }
+
+    private List<TransientDescriptor> getAllTransients()
+    {
+        return allTransients.computeIfAbsent(
+            () -> concat( moduleModel.transientComposites(),
+                          concat(
+                              concat(
+                                  moduleModel.layer().visibleTransients( layer ),
+                                  moduleModel.layer().visibleTransients( application )
+                              ),
+                              moduleModel.layer()
+                                         .usedLayers()
+                                         .layers()
+                                         .flatMap( layer -> layer.visibleTransients( application ) )
+                          )
+            ).collect( toList() )
+        );
+    }
+
+    @Override
+    public Stream<ValueDescriptor> allValues()
+    {
+        return getAllValues().stream();
+    }
+
+    private List<ValueDescriptor> getAllValues()
+    {
+        return allValues.computeIfAbsent(
+            () -> concat( moduleModel.valueComposites(),
+                          concat(
+                              concat( moduleModel.layer().visibleValues( layer ),
+                                      moduleModel.layer().visibleValues( application )
+                              ),
+                              moduleModel.layer()
+                                         .usedLayers()
+                                         .layers()
+                                         .flatMap( layer1 -> layer1.visibleValues( application ) )
+                          )
+            ).collect( toList() )
+        );
+    }
+
+    @Override
+    public Stream<EntityDescriptor> allEntities()
+    {
+        return getAllEntities().stream();
+    }
+
+    private List<EntityDescriptor> getAllEntities()
+    {
+        return allEntities.computeIfAbsent(
+            () -> concat( moduleModel.entityComposites(),
+                          concat(
+                              concat(
+                                  moduleModel.layer().visibleEntities( layer ),
+                                  moduleModel.layer().visibleEntities( application )
+                              ),
+                              moduleModel.layer()
+                                         .usedLayers()
+                                         .layers()
+                                         .flatMap( layer -> layer.visibleEntities( application ) )
+                          )
+            ).collect( toList() )
+        );
+    }
+
+    @Override
+    public Stream<? extends ModelDescriptor> allServices()
+    {
+        return getAllServices().stream();
+    }
+
+    private List<? extends ModelDescriptor> getAllServices()
+    {
+        return allServices.computeIfAbsent(
+            () -> concat(
+                concat( moduleModel.serviceComposites(),
+                        concat(
+                            concat(
+                                moduleModel.layer().visibleServices( layer ),
+                                moduleModel.layer().visibleServices( application )
+                            ),
+                            moduleModel.layer()
+                                       .usedLayers()
+                                       .layers()
+                                       .flatMap( layer -> layer.visibleServices( application ) )
+                        )
+                ),
+                concat( moduleModel.importedServices(),
+                        concat(
+                            concat(
+                                moduleModel.layer().visibleServices( layer ),
+                                moduleModel.layer().visibleServices( application )
+                            ),
+                            moduleModel.layer()
+                                       .usedLayers()
+                                       .layers()
+                                       .flatMap( layer -> layer.visibleServices( application ) )
+                        )
+                )
+            ).collect( toList() )
+        );
+    }
+
+    private static <T extends ModelDescriptor> T ambiguityMatching(
+        Class type,
+        List<T> modelModules,
+        TypeMatching<T> matching
+    )
+    {
+        List<T> models = modelModules.stream()
+                                     .filter( matching.and( new SameVisibility<>() ) )
+                                     .distinct()
+                                     .collect( toList() );
+        if( models.size() > 1 )
+        {
+            throw new AmbiguousTypeException( "More than one type matches " + type.getName() + ": " + models + "]" );
+        }
+        if( models.isEmpty() )
+        {
+            return null;
+        }
+        return models.get( 0 );
+    }
+
+    private static abstract class TypeMatching<T extends HasTypes>
+        implements Predicate<T>
+    {
+        protected final Type lookedUpType;
+
+        protected TypeMatching( Type lookedUpType )
+        {
+            this.lookedUpType = lookedUpType;
+        }
+
+        @Override
+        public final boolean test( T model )
+        {
+            if( lookedUpType instanceof Class )
+            {
+                return model.types().anyMatch( checkMatch( lookedUpType ) );
+            }
+            else
+            {
+                if( lookedUpType instanceof ParameterizedType )
+                {
+                    // Foo<Bar> check
+                    // First check Foo
+                    ParameterizedType parameterizedType = (ParameterizedType) lookedUpType;
+                    Type rawType = parameterizedType.getRawType();
+                    if( model.types().noneMatch( checkMatch( rawType ) ) )
+                    {
+                        return false;
+                    }
+                    // Then check Bar
+                    return interfacesOf( model.types() ).anyMatch( intf -> intf.equals( lookedUpType ) );
+                }
+                else if( lookedUpType instanceof WildcardType )
+                {
+                    return true;
+                }
+                return false;
+            }
+        }
+
+        protected abstract Predicate<Type> checkMatch( Type matchTo );
+    }
+
+    private static class ExactTypeMatching<T extends HasTypes> extends TypeMatching<T>
+    {
+        private ExactTypeMatching( Type lookedUpType )
+        {
+            super( lookedUpType );
+        }
+
+        protected Predicate<Type> checkMatch( Type matchTo )
+        {
+            return matchTo::equals;
+        }
+    }
+
+    private static class AssignableFromTypeMatching<T extends HasTypes> extends TypeMatching<T>
+    {
+        private AssignableFromTypeMatching( Type lookedUpType )
+        {
+            super( lookedUpType );
+        }
+
+        protected Predicate<Type> checkMatch( Type matchTo )
+        {
+            // TODO; what to do if there is ParameterizedType here?? Now set to ClassCastException and see if anything surfaces
+//            if( matchTo instanceof Class )
+            {
+                Class<?> clazz = (Class<?>) matchTo;
+                return candidate -> !candidate.equals( matchTo ) && clazz.isAssignableFrom( (Class<?>) candidate );
+            }
+//            return candidate -> candidate.equals( matchTo );
+        }
+    }
+
+    /**
+     * Selects descriptors by combining {@link ExactTypeMatching} and {@link AssignableFromTypeMatching}.
+     *
+     * Selected descriptors are sorted, exact matches first, assignable ones second.
+     * Other than that, original order is preserved.
+     *
+     * <code>
+     *     [ assignable1, matching1, assignable2, assignable3, matching2, non-matching-nor-assignable ]
+     * </code>
+     * results in
+     * <code>
+     *     [ matching1, matching2, assignable1, assignable2, assignable3 ]
+     * </code>
+     *
+     * @param <T> Descriptor type
+     */
+    private static class TypeMatchesSelector<T extends HasTypes> extends ArrayList<T>
+    {
+        private final ExactTypeMatching<T> exactMatchPredicate;
+        private final AssignableFromTypeMatching<T> assignablePredicate;
+        private Integer lastMatchIndex;
+
+        private TypeMatchesSelector( Type type )
+        {
+            this.exactMatchPredicate = new ExactTypeMatching<>( type );
+            this.assignablePredicate = new AssignableFromTypeMatching<>( type );
+        }
+
+        List<T> selectFrom( Stream<? extends T> candidates )
+        {
+            candidates.forEach( this::addDescriptor );
+            return this;
+        }
+
+        private void addDescriptor( T descriptor )
+        {
+            if( contains( descriptor ) )
+            {
+                return;
+            }
+            if( exactMatchPredicate.test( descriptor ) )
+            {
+                Integer nextMatchIndex = lastMatchIndex == null ? 0 : lastMatchIndex + 1;
+                add( nextMatchIndex, descriptor );
+                lastMatchIndex = nextMatchIndex;
+            }
+            else if( assignablePredicate.test( descriptor ) )
+            {
+                add( descriptor );
+            }
+        }
+
+        boolean containsExactMatches()
+        {
+            return lastMatchIndex != null;
+        }
+    }
+
+    /**
+     * Selects the best matching descriptor by combining {@link ExactTypeMatching} and {@link AssignableFromTypeMatching}.
+     *
+     * Selected descriptor is the first exact match if it exists, the first assignable otherwise.
+     *
+     * @param <T> Descriptor type
+     */
+    private static class BestTypeMatchSelector<T extends HasTypes>
+    {
+        private TypeMatchesSelector<T> descriptors;
+
+        BestTypeMatchSelector( Type type )
+        {
+            this.descriptors = new TypeMatchesSelector<>( type );
+        }
+
+        BestTypeMatchSelector<T> selectFrom( Stream<? extends T> candidates )
+        {
+            candidates.forEach( this::addDescriptor );
+            return this;
+        }
+
+        T bestMatchOrElse( T or )
+        {
+            return !descriptors.isEmpty() ? descriptors.get( 0 ) : or;
+        }
+
+        private void addDescriptor( T descriptor )
+        {
+            // Until an exact match is found, even if we already found assignable ones,
+            // keep selecting in case the last element is an exact match.
+            if( !descriptors.containsExactMatches() )
+            {
+                descriptors.addDescriptor( descriptor );
+            }
+        }
+    }
+
+    /**
+     * This Predicate will filter out all Models that doesn't have the same visibility as the first one.
+     */
+    private static class SameVisibility<T extends ModelDescriptor>
+        implements Predicate<T>
+    {
+        private Visibility current = null;
+
+        @Override
+        public boolean test( T model )
+        {
+            if( current == null )
+            {
+                current = model.visibility();
+                return true;
+            }
+            return current == model.visibility();
+        }
+    }
+
+    private static class LazyValue<T>
+    {
+        private volatile T value;
+
+        public T computeIfAbsent( Supplier<T> supplier )
+        {
+            if( value == null )
+            {
+                synchronized( this )
+                {
+                    if( value == null )
+                    {
+                        value = supplier.get();
+                    }
+                }
+            }
+            return value;
+        }
+    }
+}


[27/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java b/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
deleted file mode 100644
index d9a5180..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializer.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Function;
-import org.apache.zest.api.composite.AmbiguousTypeException;
-
-/**
- * Use a ValueSerializer to serialize values state.
- *
- * <p>
- *     Serialized object must be one of:
- * </p>
- * <ul>
- *     <li>a ValueComposite,</li>
- *     <li>an EntityComposite or EntityReference,</li>
- *     <li>an Iterable,</li>
- *     <li>a Map,</li>
- *     <li>a Plain Value.</li>
- * </ul>
- * <p>
- *     Nested plain values, EntityReferences, Iterables, Maps, ValueComposites and EntityComposites are supported.
- *     EntityComposites and EntityReferences are serialized as their reference string.
- * </p>
- * <p>
- *     Plain values can be one of:
- * </p>
- * <ul>
- *     <li>String,</li>
- *     <li>Character or char,</li>
- *     <li>Boolean or boolean,</li>
- *     <li>Integer or int,</li>
- *     <li>Long or long,</li>
- *     <li>Short or short,</li>
- *     <li>Byte or byte,</li>
- *     <li>Float or float,</li>
- *     <li>Double or double,</li>
- *     <li>BigInteger,</li>
- *     <li>BigDecimal,</li>
- *     <li>Date,</li>
- *     <li>DateTime (JodaTime),</li>
- *     <li>LocalDateTime (JodaTime),</li>
- *     <li>LocalDate (JodaTime).</li>
- * </ul>
- * <p>
- *     Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are serialized to
- *     base64 encoded bytes using pure Java serialization. If it happens that the value is not Serializable, a
- *     ValueSerializationException is thrown.
- * </p>
- * <p>
- *     Having type information in the serialized payload allows to keep actual ValueComposite types and by so
- *     circumvent {@link AmbiguousTypeException} when deserializing.
- * </p>
- */
-public interface ValueSerializer
-{
-
-    /**
-     * Factory method for a serialize function.
-     *
-     * @param <T> the parametrized function input type
-     * @return a serialization function.
-     */
-    <T> Function<T, String> serialize();
-
-    /**
-     * Factory method for a serialize function.
-     *
-     * @param <T> the parametrized function input type
-     * @param options ValueSerializer Options
-     * @return a serialization function.
-     */
-    <T> Function<T, String> serialize( Options options );
-
-    /**
-     * Factory method for a serialize function.
-     *
-     * @param <T> the parametrized function input type
-     * @param includeTypeInfo if type information should be included in the output
-     * @return a serialization function.
-     */
-    @Deprecated
-    <T> Function<T, String> serialize( boolean includeTypeInfo );
-
-    /**
-     * Serialize the state of a value with type information.
-     *
-     * @param object an Object to serialize
-     * @return the state
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    String serialize( Object object )
-        throws ValueSerializationException;
-
-    /**
-     * Serialize the state of a value.
-     *
-     * @param options ValueSerializer Options
-     * @param object an Object to serialize
-     * @return the state
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    String serialize( Options options, Object object )
-        throws ValueSerializationException;
-
-    /**
-     * Serialize the state of a value.
-     *
-     * @param object an Object to serialize
-     * @param includeTypeInfo if type information should be included in the output
-     * @return the state
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    @Deprecated
-    String serialize( Object object, boolean includeTypeInfo )
-        throws ValueSerializationException;
-
-    /**
-     * Serialize the state of a value with type information.
-     *
-     * @param object an Object to serialize
-     * @param output that will be used as output
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    void serialize( Object object, OutputStream output )
-        throws ValueSerializationException;
-
-    /**
-     * Serialize the state of a value.
-     *
-     * @param options ValueSerializer Options
-     * @param object an Object to serialize
-     * @param output that will be used as output
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    void serialize( Options options, Object object, OutputStream output )
-        throws ValueSerializationException;
-
-    /**
-     * Serialize the state of a value.
-     *
-     * @param object an Object to serialize
-     * @param output that will be used as output
-     * @param includeTypeInfo if type information should be included in the output
-     * @throws ValueSerializationException if the Value serialization failed
-     */
-    @Deprecated
-    void serialize( Object object, OutputStream output, boolean includeTypeInfo )
-        throws ValueSerializationException;
-
-    /**
-     * Serialization options.
-     */
-    final class Options
-    {
-        /**
-         * Boolean flag to include type information.
-         * Default to TRUE.
-         */
-        public static final String INCLUDE_TYPE_INFO = "includeTypeInfo";
-        public static final String MAP_ENTRIES_AS_OBJECTS = "mapentriesasobjects";
-        private final Map<String, String> options = new HashMap<>();
-
-        /**
-         * Create new default ValueSerializer Options.
-         */
-        public Options()
-        {
-            this.options.put( INCLUDE_TYPE_INFO, "true" );
-            this.options.put( MAP_ENTRIES_AS_OBJECTS, "false" );
-        }
-
-        /**
-         * Set {@link #INCLUDE_TYPE_INFO} option to TRUE.
-         * @return This
-         */
-        public Options withTypeInfo()
-        {
-            return put( INCLUDE_TYPE_INFO, true );
-        }
-
-        /**
-         * Set {@link #INCLUDE_TYPE_INFO} option to FALSE.
-         * @return This
-         */
-        public Options withoutTypeInfo()
-        {
-            return put( INCLUDE_TYPE_INFO, false );
-        }
-
-        public Options withMapEntriesAsObjects()
-        {
-            return put( MAP_ENTRIES_AS_OBJECTS, true );
-        }
-
-        public Options withMapEntriesAsKeyValuePairs()
-        {
-            return put( MAP_ENTRIES_AS_OBJECTS, false );
-        }
-
-        /**
-         * Get Boolean option value.
-         * @param option The option
-         * @return The boolean value of the option, or null if absent
-         */
-        public Boolean getBoolean( String option )
-        {
-            if( !options.containsKey( option ) )
-            {
-                return null;
-            }
-            return Boolean.valueOf( options.get( option ) );
-        }
-
-        /**
-         * Get Integer option value.
-         * @param option The option
-         * @return The integer value of the option, or null if absent
-         */
-        public Integer getInteger( String option )
-        {
-            if( !options.containsKey( option ) )
-            {
-                return null;
-            }
-            return Integer.valueOf( options.get( option ) );
-        }
-
-        /**
-         * Get String option value.
-         * @param option The option
-         * @return The string value of the option, or null if absent
-         */
-        public String getString( String option )
-        {
-            return options.get( option );
-        }
-
-        /**
-         * Put an option String value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, String value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, value );
-            return this;
-        }
-
-        /**
-         * Put an option boolean value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, Boolean value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, Boolean.toString( value ) );
-            return this;
-        }
-
-        /**
-         * Put an option Integer value.
-         * @param option The option
-         * @param value The value
-         * @return This Options instance
-         */
-        public Options put( String option, Integer value )
-        {
-            if( value == null )
-            {
-                return remove( option );
-            }
-            options.put( option, value.toString() );
-            return this;
-        }
-
-        /**
-         * Remove an option value.
-         * @param option The option
-         * @return This Options instance
-         */
-        public Options remove( String option )
-        {
-            options.remove( option );
-            return this;
-        }
-
-        /**
-         * Get all defined options as a Map.
-         * @return All defined options in a new Map
-         */
-        public Map<String, String> toMap()
-        {
-            return new HashMap<>( options );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/package.html b/core/api/src/main/java/org/apache/zest/api/value/package.html
deleted file mode 100644
index def90fa..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Value API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
new file mode 100644
index 0000000..123e726
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
@@ -0,0 +1,121 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api;
+
+import java.util.Collections;
+import java.util.function.Predicate;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.query.QueryExpressions;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * TODO
+ */
+public class OperatorsTest
+{
+    @Test
+    public void testOperators()
+        throws UnitOfWorkCompletionException, ActivationException, AssemblyException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                new EntityTestAssembler().assemble( module );
+
+                module.entities( TestEntity.class );
+                module.values( TestValue.class );
+                module.forMixin( TestEntity.class ).declareDefaults().foo().set( "Bar" );
+                module.forMixin( TestValue.class ).declareDefaults().bar().set( "Xyz" );
+                new DefaultUnitOfWorkAssembler().assemble( module );
+            }
+        };
+
+        UnitOfWorkFactory uowf = assembler.module().unitOfWorkFactory();
+        UnitOfWork uow = uowf.newUnitOfWork();
+
+        try
+        {
+            EntityBuilder<TestEntity> entityBuilder = uow.newEntityBuilder( TestEntity.class, new StringIdentity( "123" ) );
+            entityBuilder.instance().value().set( assembler.module().newValue( TestValue.class ) );
+            TestEntity testEntity = entityBuilder.newInstance();
+
+            uow.complete();
+            uow = uowf.newUnitOfWork();
+
+            Iterable<TestEntity> entities = Collections.singleton( testEntity = uow.get( testEntity ) );
+
+            QueryBuilder<TestEntity> builder = assembler.module().newQueryBuilder( TestEntity.class );
+
+            {
+                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
+                                                                          .foo(), "Bar" );
+                Assert.assertTrue( where.test( testEntity ) );
+                System.out.println( where );
+            }
+            {
+                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
+                                                                          .value()
+                                                                          .get()
+                                                                          .bar(), "Xyz" );
+                Assert.assertTrue( where.test( testEntity ) );
+                System.out.println( where );
+
+                Assert.assertTrue( builder.where( where ).newQuery( entities ).find().equals( testEntity ) );
+            }
+        }
+        finally
+        {
+            uow.discard();
+        }
+    }
+
+    public interface TestEntity
+        extends EntityComposite
+    {
+        Property<String> foo();
+
+        Property<TestValue> value();
+    }
+
+    public interface TestValue
+        extends ValueComposite
+    {
+        Property<String> bar();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/activation/ActivationEventsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/activation/ActivationEventsTest.java b/core/api/src/test/java/org/apache/polygene/api/activation/ActivationEventsTest.java
new file mode 100644
index 0000000..b5c09f7
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/activation/ActivationEventsTest.java
@@ -0,0 +1,294 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.junit.Test;
+import org.apache.polygene.api.activation.ActivationEvent.EventType;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+
+import static org.junit.Assert.*;
+import static org.apache.polygene.api.activation.ActivationEvent.EventType.*;
+
+public class ActivationEventsTest
+{
+
+    public static interface TestService
+    {
+        void test();
+    }
+
+    public static class TestServiceInstance
+            implements TestService
+    {
+
+        @Override
+        public void test()
+        {
+        }
+
+    }
+
+    @Mixins( TestServiceInstance.class )
+    public static interface TestServiceComposite
+        extends TestService, ServiceComposite
+    {
+    }
+
+    @Test
+    public void testSingleModuleSingleService()
+        throws Exception
+    {
+        final List<ActivationEvent> events = new ArrayList<>();
+
+        new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.services( TestServiceComposite.class ).instantiateOnStartup();
+            }
+
+            @Override
+            protected void beforeActivation( Application application )
+            {
+                application.registerActivationEventListener( new EventsRecorder( events ) );
+            }
+
+
+        }.application().passivate();
+
+        Iterator<ActivationEvent> it = events.iterator();
+
+        // Activation
+        assertEvent( it.next(), ACTIVATING, "Application" );
+        assertEvent( it.next(), ACTIVATING, "Layer" );
+        assertEvent( it.next(), ACTIVATING, "Module" );
+        assertEvent( it.next(), ACTIVATING, "TestService" );
+        assertEvent( it.next(), ACTIVATED, "TestService" );
+        assertEvent( it.next(), ACTIVATED, "Module" );
+        assertEvent( it.next(), ACTIVATED, "Layer" );
+        assertEvent( it.next(), ACTIVATED, "Application" );
+
+        // Passivation
+        assertEvent( it.next(), PASSIVATING, "Application" );
+        assertEvent( it.next(), PASSIVATING, "Layer" );
+        assertEvent( it.next(), PASSIVATING, "Module" );
+        assertEvent( it.next(), PASSIVATING, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "Module" );
+        assertEvent( it.next(), PASSIVATED, "Layer" );
+        assertEvent( it.next(), PASSIVATED, "Application" );
+
+        assertFalse( it.hasNext() );
+    }
+
+    @Test
+    public void testSingleModuleSingleImportedService()
+            throws Exception
+    {
+        final List<ActivationEvent> events = new ArrayList<>();
+
+        new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.importedServices( TestService.class ).
+                        setMetaInfo( new TestServiceInstance() ).
+                        importOnStartup();
+            }
+
+            @Override
+            protected void beforeActivation( Application application )
+            {
+                application.registerActivationEventListener( new EventsRecorder( events ) );
+            }
+
+
+        }.application().passivate();
+
+        Iterator<ActivationEvent> it = events.iterator();
+
+        // Activation
+        assertEvent( it.next(), ACTIVATING, "Application" );
+        assertEvent( it.next(), ACTIVATING, "Layer" );
+        assertEvent( it.next(), ACTIVATING, "Module" );
+        assertEvent( it.next(), ACTIVATING, "TestService" );
+        assertEvent( it.next(), ACTIVATED, "TestService" );
+        assertEvent( it.next(), ACTIVATED, "Module" );
+        assertEvent( it.next(), ACTIVATED, "Layer" );
+        assertEvent( it.next(), ACTIVATED, "Application" );
+
+        // Passivation
+        assertEvent( it.next(), PASSIVATING, "Application" );
+        assertEvent( it.next(), PASSIVATING, "Layer" );
+        assertEvent( it.next(), PASSIVATING, "Module" );
+        assertEvent( it.next(), PASSIVATING, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "Module" );
+        assertEvent( it.next(), PASSIVATED, "Layer" );
+        assertEvent( it.next(), PASSIVATED, "Application" );
+
+        assertFalse( it.hasNext() );
+    }
+
+    @Test
+    public void testSingleModuleSingleLazyService()
+            throws Exception
+    {
+        final List<ActivationEvent> events = new ArrayList<>();
+
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+
+            @Override
+            public void assemble( ModuleAssembly module )
+                    throws AssemblyException
+            {
+                module.services( TestServiceComposite.class );
+            }
+
+            @Override
+            protected void beforeActivation( Application application )
+            {
+                application.registerActivationEventListener( new EventsRecorder( events ) );
+            }
+
+        };
+        Application application = assembler.application();
+        application.passivate();
+
+        Iterator<ActivationEvent> it = events.iterator();
+
+        // Activation
+        assertEvent( it.next(), ACTIVATING, "Application" );
+        assertEvent( it.next(), ACTIVATING, "Layer" );
+        assertEvent( it.next(), ACTIVATING, "Module" );
+        // Lazy Service NOT activated
+        assertEvent( it.next(), ACTIVATED, "Module" );
+        assertEvent( it.next(), ACTIVATED, "Layer" );
+        assertEvent( it.next(), ACTIVATED, "Application" );
+
+        // Passivation
+        assertEvent( it.next(), PASSIVATING, "Application" );
+        assertEvent( it.next(), PASSIVATING, "Layer" );
+        assertEvent( it.next(), PASSIVATING, "Module" );
+        // Lazy Service NOT passivated
+        assertEvent( it.next(), PASSIVATED, "Module" );
+        assertEvent( it.next(), PASSIVATED, "Layer" );
+        assertEvent( it.next(), PASSIVATED, "Application" );
+
+        assertFalse( it.hasNext() );
+
+        events.clear();
+        application.activate();
+        Module module = assembler.module();
+        module.findService( TestService.class ).get().test();
+        application.passivate();
+
+        for( ActivationEvent event : events ) {
+            System.out.println( event );
+        }
+
+        it = events.iterator();
+
+        // Activation
+        assertEvent( it.next(), ACTIVATING, "Application" );
+        assertEvent( it.next(), ACTIVATING, "Layer" );
+        assertEvent( it.next(), ACTIVATING, "Module" );
+        assertEvent( it.next(), ACTIVATED, "Module" );
+        assertEvent( it.next(), ACTIVATED, "Layer" );
+        assertEvent( it.next(), ACTIVATED, "Application" );
+
+        // Lazy Service Activation
+        assertEvent( it.next(), ACTIVATING, "TestService" );
+        assertEvent( it.next(), ACTIVATED, "TestService" );
+
+        // Passivation
+        assertEvent( it.next(), PASSIVATING, "Application" );
+        assertEvent( it.next(), PASSIVATING, "Layer" );
+        assertEvent( it.next(), PASSIVATING, "Module" );
+        assertEvent( it.next(), PASSIVATING, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "TestService" );
+        assertEvent( it.next(), PASSIVATED, "Module" );
+        assertEvent( it.next(), PASSIVATED, "Layer" );
+        assertEvent( it.next(), PASSIVATED, "Application" );
+
+        assertFalse( it.hasNext() );
+    }
+
+    private static class EventsRecorder
+            implements ActivationEventListener
+    {
+
+        private final List<ActivationEvent> events;
+
+        private EventsRecorder( List<ActivationEvent> events )
+        {
+            this.events = events;
+        }
+
+        @Override
+        public void onEvent( ActivationEvent event )
+        {
+            events.add( event );
+        }
+
+    }
+
+    // WARN This assertion depends on ApplicationInstance, LayerInstance, ModuleInstance and ServiceReferenceInstance toString() method.
+    private static void assertEvent( ActivationEvent event, EventType expectedType, String expected )
+    {
+        boolean wrongEvent = expectedType != event.type();
+        boolean wrongMessage = ! event.message().contains( expected );
+        if( wrongEvent || wrongMessage )
+        {
+            StringBuilder sb = new StringBuilder();
+            sb.append("Event (").append( event ).append( ") has");
+            if( wrongEvent )
+            {
+                sb.append( " wrong type (expected:'" ).append( expectedType ).
+                        append( "' but was:'" ).append( event.type() ).append( "')" );
+                if( wrongMessage )
+                {
+                    sb.append( ";" );
+                }
+            }
+            if( wrongMessage )
+            {
+                sb.append( " wrong message (expected:'" ).append( expected ).
+                        append( "' but was:'" ).append( event.message() ).append( "')" );
+            }
+            fail( sb.toString() );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java b/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
new file mode 100644
index 0000000..1e4ee7d
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
@@ -0,0 +1,214 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Collections;
+import org.junit.Test;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.builder.ApplicationBuilder;
+
+import static org.hamcrest.core.StringContains.containsString;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+public class PassivationExceptionTest
+{
+    private static String stack( Exception ex )
+    {
+        StringWriter writer = new StringWriter();
+        ex.printStackTrace( new PrintWriter( writer ) );
+        return writer.toString();
+    }
+
+    @Test
+    public void testEmptyPassivationException()
+    {
+        PassivationException empty = new PassivationException( Collections.<Exception>emptyList() );
+        assertThat( empty.getMessage(), containsString( "has 0 cause" ) );
+    }
+
+    @Test
+    public void testSinglePassivationException()
+    {
+        PassivationException single = new PassivationException( Collections.singletonList( new Exception( "single" ) ) );
+        String stack = stack( single );
+        assertThat( single.getMessage(), containsString( "has 1 cause" ) );
+        assertThat( stack, containsString( "Suppressed: java.lang.Exception: single" ) );
+    }
+
+    @Test
+    public void testMultiplePassivationException()
+    {
+        PassivationException multi = new PassivationException( Arrays.asList( new Exception( "one" ),
+                                                                              new Exception( "two" ),
+                                                                              new Exception( "three" ) ) );
+        String stack = stack( multi );
+        assertThat( multi.getMessage(), containsString( "has 3 cause(s)" ) );
+        assertThat( stack, containsString( "Suppressed: java.lang.Exception: one" ) );
+        assertThat( stack, containsString( "Suppressed: java.lang.Exception: two" ) );
+        assertThat( stack, containsString( "Suppressed: java.lang.Exception: three" ) );
+    }
+
+    @Test
+    public void testPassivationExceptionsAccrossStructure()
+        throws AssemblyException, ActivationException
+    {
+        ApplicationBuilder appBuilder = new ApplicationBuilder( "TestApplication" );
+        appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler( new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.services( TestService.class ).
+                    identifiedBy( "TestService_Module.A" ).
+                    withActivators( FailBeforePassivationServiceActivator.class ).
+                    instantiateOnStartup();
+            }
+        } );
+        appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler( new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.services( TestService.class ).
+                    identifiedBy( "TestService_Module.B" ).
+                    withActivators( FailAfterPassivationServiceActivator.class ).
+                    instantiateOnStartup();
+            }
+        } );
+        appBuilder.registerActivationEventListener( new TestActivationEventListener() );
+
+        Application app = appBuilder.newApplication();
+
+        try
+        {
+            Module moduleA = app.findModule( "Layer 1", "Module A" );
+            TestService service = moduleA.findService( TestService.class ).get();
+            assertThat( service.hello(), equalTo( "Hello Polygene!" ) );
+        }
+        finally
+        {
+            try
+            {
+                app.passivate();
+                fail( "No PassivationException" );
+            }
+            catch( PassivationException ex )
+            {
+                ex.printStackTrace();
+                String stack = stack( ex );
+                assertThat( ex.getMessage(), containsString( "has 12 cause(s)" ) );
+                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for TestApplication" ) );
+                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 2" ) );
+                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module B" ) );
+                assertThat( stack, containsString( "ACTIVATOR: FAIL AFTER PASSIVATION for TestService_Module.B(active=false,module='Module B')" ) );
+                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module B" ) );
+                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 2" ) );
+                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 1" ) );
+                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module A" ) );
+                assertThat( stack, containsString( "ACTIVATOR: FAIL BEFORE PASSIVATION for TestService_Module.A(active=true,module='Module A')" ) );
+                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module A" ) );
+                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 1" ) );
+                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for TestApplication" ) );
+            }
+        }
+    }
+
+    @Mixins( TestService.Mixin.class )
+    public interface TestService
+    {
+        String hello();
+
+        static class Mixin
+            implements TestService
+        {
+            @Structure
+            private Module module;
+
+            @Override
+            public String hello()
+            {
+                module.name();
+                return "Hello Polygene!";
+            }
+        }
+
+    }
+
+    public static class FailBeforePassivationServiceActivator
+        extends ActivatorAdapter<ServiceReference<TestService>>
+    {
+        @Override
+        public void beforePassivation( ServiceReference<TestService> passivated )
+            throws Exception
+        {
+            throw new Exception( "ACTIVATOR: FAIL BEFORE PASSIVATION for " + passivated );
+        }
+    }
+
+    public static class FailAfterPassivationServiceActivator
+        extends ActivatorAdapter<ServiceReference<TestService>>
+    {
+        @Override
+        public void afterPassivation( ServiceReference<TestService> passivated )
+            throws Exception
+        {
+            throw new Exception( "ACTIVATOR: FAIL AFTER PASSIVATION for " + passivated );
+        }
+    }
+
+    public static class TestActivationEventListener
+        implements ActivationEventListener
+    {
+        @Override
+        public void onEvent( ActivationEvent event )
+            throws Exception
+        {
+            if( !( event.source() instanceof Application )
+                && !( event.source() instanceof Layer )
+                && !( event.source() instanceof Module ) )
+            {
+                return;
+            }
+            switch( event.type() )
+            {
+                case PASSIVATING:
+                    throw new Exception( "EVENT: FAIL BEFORE PASSIVATION for " + event.source() );
+                case PASSIVATED:
+                    throw new Exception( "EVENT: FAIL AFTER PASSIVATION for " + event.source() );
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/annotation/MixinsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/annotation/MixinsTest.java b/core/api/src/test/java/org/apache/polygene/api/annotation/MixinsTest.java
new file mode 100644
index 0000000..ffffffb
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/annotation/MixinsTest.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.annotation;
+
+import java.lang.annotation.Annotation;
+import org.junit.Test;
+import org.apache.polygene.api.mixin.Mixins;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests public api exposed by Mixins annotation.
+ * This will ensure that the public api does not get changed by mistake.
+ */
+public class MixinsTest
+{
+
+    @Test
+    public void retention()
+    {
+        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
+        assertNotNull( "annotations should not be null", annotations );
+        assertEquals( "number of annotations", 1, annotations.length );
+        assertEquals( "annotation type", Mixins.class, annotations[ 0 ].annotationType() );
+    }
+
+    @Mixins( Object.class )
+    private static class Annotated
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/annotation/ModifiedByTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/annotation/ModifiedByTest.java b/core/api/src/test/java/org/apache/polygene/api/annotation/ModifiedByTest.java
new file mode 100644
index 0000000..8c8064d
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/annotation/ModifiedByTest.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.annotation;
+
+import java.lang.annotation.Annotation;
+import org.junit.Test;
+import org.apache.polygene.api.concern.Concerns;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests public api exposed by Concerns annotation.
+ * This will ensure that the public api does not get changed by mistake.
+ */
+public class ModifiedByTest
+{
+
+    @Test
+    public void retention()
+    {
+        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
+        assertNotNull( "annotations should not be null", annotations );
+        assertEquals( "number of annotations", 1, annotations.length );
+        assertEquals( "annotation type", Concerns.class, annotations[ 0 ].annotationType() );
+    }
+
+    @Concerns( Object.class )
+    private static class Annotated
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/annotation/scope/ModifiesTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/annotation/scope/ModifiesTest.java b/core/api/src/test/java/org/apache/polygene/api/annotation/scope/ModifiesTest.java
new file mode 100644
index 0000000..a1d037e
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/annotation/scope/ModifiesTest.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.annotation.scope;
+
+import java.lang.annotation.Annotation;
+import org.junit.Test;
+import org.apache.polygene.api.concern.internal.ConcernFor;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests public api exposed by Modified annotation.
+ * This will ensure that the public api does not get changed by mistake.
+ */
+public class ModifiesTest
+{
+
+    @Test
+    public void retention()
+        throws NoSuchFieldException
+    {
+        Annotation[] annotations = Annotated.class.getDeclaredField( "modified" ).getDeclaredAnnotations();
+        assertNotNull( "annotations should not be null", annotations );
+        assertEquals( "number of annotations", 1, annotations.length );
+        assertEquals( "annotation type", ConcernFor.class, annotations[ 0 ].annotationType() );
+    }
+
+    private static class Annotated
+    {
+        @ConcernFor
+        String modified;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/common/AppliesToTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/common/AppliesToTest.java b/core/api/src/test/java/org/apache/polygene/api/common/AppliesToTest.java
new file mode 100644
index 0000000..500544c
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/common/AppliesToTest.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.annotation.Annotation;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests public api exposed by AppliesTo annotation.
+ * This will ensure that the public api does not get changed by mistake.
+ */
+public class AppliesToTest
+{
+
+    @Test
+    public void retention()
+    {
+        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
+        assertNotNull( "annotations should not be null", annotations );
+        assertEquals( "number of annotations", 1, annotations.length );
+        assertEquals( "annotation type", AppliesTo.class, annotations[ 0 ].annotationType() );
+    }
+
+    @AppliesTo( Object.class )
+    private static class Annotated
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/common/QualifiedNameTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/common/QualifiedNameTest.java b/core/api/src/test/java/org/apache/polygene/api/common/QualifiedNameTest.java
new file mode 100644
index 0000000..e83ac81
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/common/QualifiedNameTest.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import org.junit.Test;
+import org.apache.polygene.api.util.NullArgumentException;
+
+import static org.junit.Assert.assertEquals;
+
+public class QualifiedNameTest
+{
+    @Test
+    public void testQualifiedNameWithDollar()
+    {
+        assertEquals( "Name containing dollar is modified", "Test-Test",
+                      new QualifiedName( TypeName.nameOf( "Test$Test" ), "satisfiedBy" ).type() );
+    }
+
+    @Test
+    public void testQualifiedNameFromQNWithDollar()
+    {
+        assertEquals( "Name containing dollar is cleaned up", "Test-Test",
+                      QualifiedName.fromFQN( "Test$Test:satisfiedBy" ).type() );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments1()
+    {
+        new QualifiedName( TypeName.nameOf( "Test" ), null );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments2()
+    {
+        new QualifiedName( null, "satisfiedBy" );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments3()
+    {
+        new QualifiedName( null, null );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments4()
+    {
+        QualifiedName.fromFQN( null );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments5()
+    {
+        QualifiedName.fromAccessor( null );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments6()
+    {
+        QualifiedName.fromClass( null, "satisfiedBy" );
+    }
+
+    @Test( expected = NullArgumentException.class )
+    public void nonNullArguments7()
+    {
+        QualifiedName.fromClass( null, null );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java b/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
new file mode 100644
index 0000000..0d87560
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
@@ -0,0 +1,240 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class PropertyMapperTest
+{
+    private final static Method MAP_TO_TYPE;
+
+    static
+    {
+        try
+        {
+            MAP_TO_TYPE = PropertyMapper.class.getDeclaredMethod( "mapToType", Composite.class, Type.class, Object.class );
+            MAP_TO_TYPE.setAccessible( true );
+        }
+        catch( NoSuchMethodException e )
+        {
+            InternalError error = new InternalError();
+            error.initCause( e );
+            throw error;
+        }
+    }
+
+    @Test
+    public void testMappingOfInteger()
+        throws Exception
+    {
+        assertEquals( 5, mapToType( null, Integer.class, "5" ) );
+        assertEquals( -5, mapToType( null, Integer.class, "-5" ) );
+        assertEquals( Integer.class, mapToType( null, Integer.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfLong()
+        throws Exception
+    {
+        assertEquals( 5L, mapToType( null, Long.class, "5" ) );
+        assertEquals( 5876328476238746238L, mapToType( null, Long.class, "5876328476238746238" ) );
+        assertEquals( Long.class, mapToType( null, Long.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfBoolean()
+        throws Exception
+    {
+        assertEquals( false, mapToType( null, Boolean.class, "false" ) );
+        assertEquals( true, mapToType( null, Boolean.class, "true" ) );
+        assertEquals( Boolean.class, mapToType( null, Boolean.class, "false" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfFloat()
+        throws Exception
+    {
+        assertEquals( 5.1234f, mapToType( null, Float.class, "5.1234" ) );
+        assertEquals( 5876328476.6238f, mapToType( null, Float.class, "5876328476.6238" ) );
+        assertEquals( Float.class, mapToType( null, Float.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfDouble()
+        throws Exception
+    {
+        assertEquals( 5.1234, mapToType( null, Double.class, "5.1234" ) );
+        assertEquals( 5876328476.623823, mapToType( null, Double.class, "5876328476.623823" ) );
+        assertEquals( Double.class, mapToType( null, Double.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfBigDecimal()
+        throws Exception
+    {
+        assertEquals( new BigDecimal( 3 ), mapToType( null, BigDecimal.class, "3" ) );
+        assertEquals( new BigDecimal( "12345.67891011" ), mapToType( null, BigDecimal.class, "12345.67891011" ) );
+        assertEquals( BigDecimal.class, mapToType( null, BigDecimal.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfBigInteger()
+        throws Exception
+    {
+        assertEquals( new BigInteger( "20", 16 ), mapToType( null, BigInteger.class, "32" ) );
+        assertEquals( new BigInteger( "1234567891011" ), mapToType( null, BigInteger.class, "1234567891011" ) );
+        assertEquals( BigInteger.class, mapToType( null, BigInteger.class, "5" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfEnum()
+        throws Exception
+    {
+        assertEquals( TestEnum.FIRST, mapToType( null, TestEnum.class, "FIRST" ) );
+        assertEquals( TestEnum.SECOND, mapToType( null, TestEnum.class, "SECOND" ) );
+        assertEquals( TestEnum.class, mapToType( null, TestEnum.class, "SECOND" ).getClass() );
+    }
+
+    @Test
+    public void testMappingOfIntegerArray()
+        throws Exception
+    {
+        Object[] value = (Object[]) mapToType( null, Integer[].class, "5,4 , 3   ,2,1" );
+        assertEquals( 5, value.length );
+        assertEquals( 5, value[ 0 ] );
+        assertEquals( 4, value[ 1 ] );
+        assertEquals( 3, value[ 2 ] );
+        assertEquals( 2, value[ 3 ] );
+        assertEquals( 1, value[ 4 ] );
+    }
+
+    @Test
+    public void testMappingOfStringArray()
+        throws Exception
+    {
+        {
+            Object[] value = (Object[]) mapToType( null, String[].class, "5,4 , 3   ,2,1" );
+            assertEquals( 5, value.length );
+            assertEquals( "5", value[ 0 ] );
+            assertEquals( "4 ", value[ 1 ] );
+            assertEquals( " 3   ", value[ 2 ] );
+            assertEquals( "2", value[ 3 ] );
+            assertEquals( "1", value[ 4 ] );
+        }
+        {
+            Object[] value = (Object[]) mapToType( null, String[].class, "5,4 ,\" 3,   \",  \" 2\" ,1" );
+            assertEquals( "5", value[ 0 ] );
+            assertEquals( "4 ", value[ 1 ] );
+            assertEquals( " 3,   ", value[ 2 ] );
+            assertEquals( " 2", value[ 3 ] );
+            assertEquals( "1", value[ 4 ] );
+            assertEquals( 5, value.length );
+        }
+    }
+
+    @Test
+    public void testMappingOfBooleanArray()
+        throws Exception
+    {
+        Object[] value = (Object[]) mapToType( null, Boolean[].class, " true,false,  false, true ,true,false" );
+        assertEquals( true, value[ 0 ] );
+        assertEquals( false, value[ 1 ] );
+        assertEquals( false, value[ 2 ] );
+        assertEquals( true, value[ 3 ] );
+        assertEquals( true, value[ 4 ] );
+        assertEquals( false, value[ 5 ] );
+        assertEquals( 6, value.length );
+    }
+
+    @Test
+    public void testMappingOfList()
+        throws Exception
+    {
+        Type type = Testing.class.getDeclaredMethod( "list" ).getGenericReturnType();
+        List<String> value = (List<String>) mapToType( null, type, "5,4 ,\" 3,   \",  \" 2\" ,1" );
+        assertEquals( "5", value.get( 0 ) );
+        assertEquals( "4 ", value.get( 1 ) );
+        assertEquals( " 3,   ", value.get( 2 ) );
+        assertEquals( " 2", value.get( 3 ) );
+        assertEquals( "1", value.get( 4 ) );
+        assertEquals( 5, value.size() );
+    }
+
+    @Test
+    public void testMappingOfSet()
+        throws Exception
+    {
+        Type type = Testing.class.getDeclaredMethod( "set" ).getGenericReturnType();
+        Set<String> value = (Set<String>) mapToType( null, type, "5,4 ,\" 3,   \",  \" 2\" ,1" );
+        assertTrue( value.contains( "5" ) );
+        assertTrue( value.contains( "4 " ) );
+        assertTrue( value.contains( " 3,   " ) );
+        assertTrue( value.contains( " 2" ) );
+        assertTrue( value.contains( "1" ) );
+        assertEquals( 5, value.size() );
+    }
+
+    @Test
+    public void testMappingOfMap()
+        throws Exception
+    {
+        Type type = Testing.class.getDeclaredMethod( "map" ).getGenericReturnType();
+        Map<String, String> value = (Map<String, String>) mapToType( null, type, "first:5,second:4 , third:\" 3,   \", fourth:  \" 2\" ,fifth : 1" );
+        assertEquals( "5", value.get( "first" ) );
+        assertEquals( "4 ", value.get( "second" ) );
+        assertEquals( " 3,   ", value.get( " third" ) );
+        assertEquals( " 2", value.get( " fourth" ) );
+        assertEquals( " 1", value.get( "fifth " ) );
+        assertEquals( 5, value.size() );
+    }
+
+    private Object mapToType( Composite composite, Type propertyType, Object value )
+        throws IllegalAccessException, InvocationTargetException
+    {
+        return MAP_TO_TYPE.invoke( null, composite, propertyType, value );
+    }
+
+    interface Testing
+    {
+        List<String> list();
+
+        Set<String> set();
+
+        Map<String, String> map();
+    }
+
+    enum TestEnum
+    {
+        FIRST,
+        SECOND
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java b/core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
new file mode 100644
index 0000000..4f2339b
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.injection.InjectionScope;
+
+public class DocumentationSupport
+{
+// START SNIPPET: class
+    @AppliesTo( java.sql.Connection.class )
+    public class CacheConcern extends GenericConcern
+        implements InvocationHandler
+    {
+// END SNIPPET: class
+        @Override
+        public Object invoke( Object proxy, Method method, Object[] args )
+            throws Throwable
+        {
+            return null;
+        }
+    }
+
+// START SNIPPET: filter
+    @AppliesTo( BusinessAppliesToFilter.class )
+    public class BusinessConcern extends GenericConcern
+        implements InvocationHandler
+    {
+// END SNIPPET: filter
+        @Override
+        public Object invoke( Object proxy, Method method, Object[] args )
+            throws Throwable
+        {
+            return null;
+        }
+    }
+
+// START SNIPPET: filter
+    public class BusinessAppliesToFilter
+        implements AppliesToFilter
+    {
+
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass
+        )
+        {
+            return true; // Some criteria for when a method is wrapped with the concern.
+        }
+    }
+// END SNIPPET: filter
+
+
+// START SNIPPET: annotation
+    @AppliesTo( Audited.class )
+    public class AuditConcern extends GenericConcern
+        implements InvocationHandler
+    {
+// START SNIPPET: annotation
+        @Override
+        public Object invoke( Object proxy, Method method, Object[] args )
+            throws Throwable
+        {
+            return null;
+        }
+    }
+
+// START SNIPPET: annotation
+    @Retention( RetentionPolicy.RUNTIME )
+    @Target( { ElementType.METHOD } )
+    @Documented
+    @InjectionScope
+    public @interface Audited
+    {
+    }
+// END SNIPPET: annotation
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/configuration/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/configuration/ConfigurationTest.java b/core/api/src/test/java/org/apache/polygene/api/configuration/ConfigurationTest.java
new file mode 100644
index 0000000..81cdc14
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/configuration/ConfigurationTest.java
@@ -0,0 +1,110 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.junit.Test;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class ConfigurationTest extends AbstractPolygeneTest
+{
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.services( MyService.class ).instantiateOnStartup();
+        module.entities( MyConfig.class );
+        module.values( PersonDetails.class, Address.class, City.class, Country.class );
+        new EntityTestAssembler().assemble( module );
+    }
+
+    @Test
+    public void testConfiguration()
+        throws Exception
+    {
+        MyService service = serviceFinder.findService( MyService.class ).get();
+        PersonDetails details = service.details();
+        assertThat(details.name().get(), equalTo( "Niclas" ) );
+        assertThat(details.address().get().street1().get(), equalTo( "Henan Lu 555" ) );
+        assertThat(details.address().get().street2().get(), equalTo( "Block 15" ) );
+        assertThat(details.address().get().city().get().cityName().get(), equalTo( "Shanghai" ) );
+        assertThat(details.address().get().city().get().country().get().countryName().get(), equalTo( "China" ) );
+    }
+
+    @Mixins(MyServiceMixin.class)
+    public interface MyService extends ServiceComposite
+    {
+        PersonDetails details();
+    }
+
+    public abstract class MyServiceMixin
+        implements MyService
+    {
+        @This
+        Configuration<MyConfig> myconf;
+
+        @Override
+        public PersonDetails details()
+        {
+            return myconf.get().me().get();
+        }
+    }
+
+    public interface MyConfig extends ConfigurationComposite
+    {
+        Property<PersonDetails> me();
+    }
+
+    public interface PersonDetails extends ValueComposite
+    {
+        Property<String> name();
+        Property<Address> address();
+
+    }
+
+    public interface Address extends ValueComposite
+    {
+        Property<String> street1();
+        Property<String> street2();
+        Property<City> city();
+    }
+
+    public interface City extends ValueComposite
+    {
+        Property<String> cityName();
+        Property<Country> country();
+    }
+
+    public interface Country extends ValueComposite
+    {
+        Property<String> countryName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java b/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
new file mode 100644
index 0000000..c088df7
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+public class DeclareConfigurationDefaultsTest
+        extends AbstractPolygeneTest
+{
+
+    @Mixins( FooServiceMixin.class )
+    public static interface FooServiceComposite
+            extends ServiceComposite
+    {
+
+        String configuredFoo();
+
+    }
+
+    public static abstract class FooServiceMixin
+            implements FooServiceComposite
+    {
+
+        @This
+        private Configuration<FooConfigurationComposite> config;
+
+        public String configuredFoo()
+        {
+            return config.get().foo().get();
+        }
+
+    }
+
+    public static interface FooConfigurationComposite
+            extends ConfigurationComposite
+    {
+
+        Property<String> foo();
+
+    }
+
+    public void assemble( ModuleAssembly module )
+            throws AssemblyException
+    {
+        module.services( FooServiceComposite.class ).identifiedBy( "bazar" );
+        module.entities( FooConfigurationComposite.class );
+        new EntityTestAssembler().assemble( module );
+        FooConfigurationComposite config = module.forMixin( FooConfigurationComposite.class ).declareDefaults();
+        config.foo().set( "bar" );
+    }
+
+    @Test
+    public void testConfigurationDefaults()
+    {
+        FooServiceComposite fooService = serviceFinder.findService( FooServiceComposite.class ).get();
+        Assert.assertEquals( "bar", fooService.configuredFoo() );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java b/core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java
new file mode 100644
index 0000000..aa955dc
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.library.constraints.annotation.Email;
+import org.apache.polygene.library.constraints.annotation.MinLength;
+
+// Documentation Support
+@Mixins( MailService.MailServiceMixin.class )
+public interface MailService
+{
+    void sendMail( @Email String to, @MinLength( 8 ) String subject, String body );
+    
+    // START SNIPPET: write
+    void changeExternalMailService( String hostName, int port );
+    // END SNIPPET: write
+    
+    public class MailServiceMixin
+        implements MailService
+    {
+        // START SNIPPET: read        
+        @This
+        private Configuration<MailServiceConfiguration> config;
+
+        @Override
+        public void sendMail( @Email String to, @MinLength( 8 ) String subject, String body )
+        {
+            config.refresh();
+            MailServiceConfiguration conf = config.get();
+            String hostName = conf.hostName().get();
+            int port = conf.port().get();
+            // END SNIPPET: read
+
+            // START SNIPPET: read        
+        }
+        // END SNIPPET: read        
+
+        // START SNIPPET: write        
+        @Override
+        public void changeExternalMailService( String hostName, int port )
+        {
+            MailServiceConfiguration conf = config.get();
+            conf.hostName().set( hostName );
+            conf.port().set( port );
+            config.save();
+        }
+        // START SNIPPET: write        
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/configuration/MailServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/configuration/MailServiceConfiguration.java b/core/api/src/test/java/org/apache/polygene/api/configuration/MailServiceConfiguration.java
new file mode 100644
index 0000000..5bbf563
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/configuration/MailServiceConfiguration.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import org.apache.polygene.api.property.Property;
+
+// Documentation Support class
+// START SNIPPET: configuration
+public interface MailServiceConfiguration extends ConfigurationComposite
+{
+    Property<String> hostName();
+
+    Property<Integer> port();
+}
+// END SNIPPET: configuration

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
new file mode 100644
index 0000000..58e4973
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
@@ -0,0 +1,275 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.docsupport;
+
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+
+public class ApplicationDocs
+{
+    public static void someMethod( String[] args )
+        throws Exception
+    {
+        {
+// START SNIPPET: application1
+            SingletonAssembler zest = new SingletonAssembler()
+            {
+                public void assemble( ModuleAssembly assembly )
+                    throws AssemblyException
+                {
+                    assembly.values( MyStuffValueComposite.class );
+                }
+            };
+// END SNIPPET: application1
+        }
+        {
+            Assembler customerListEditAssembler = new DummyAssembler();
+            Assembler customerEditAssembler = new DummyAssembler();
+            Assembler customerSearchAssembler = new DummyAssembler();
+            Assembler accountsListEditAssembler = new DummyAssembler();
+            Assembler accountsEditAssembler = new DummyAssembler();
+            Assembler accountsSearchAssembler = new DummyAssembler();
+            Assembler customerDomainAssembler = new DummyAssembler();
+            Assembler accountsDomainAssembler = new DummyAssembler();
+// START SNIPPET: application2
+            final Assembler[][][] assemblers =
+                {
+                    { // web layer
+                      { // Customer Module
+                        customerListEditAssembler,
+                        customerEditAssembler,
+                        customerSearchAssembler
+                      },
+                      { // Accounts Module
+                        accountsListEditAssembler,
+                        accountsEditAssembler,
+                        accountsSearchAssembler
+                      }
+                    },
+                    { // domain layer
+                      { // Customer Module
+                        customerDomainAssembler,
+                      },
+                      { // Accounts Module
+                        accountsDomainAssembler,
+                      }
+                    }
+                };
+            Energy4Java zest = new Energy4Java();
+            Application app = zest.newApplication( new ApplicationAssembler()
+            {
+
+                @Override
+                public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+                    throws AssemblyException
+                {
+                    return applicationFactory.newApplicationAssembly( assemblers );
+                }
+            } );
+            app.activate();
+// END SNIPPET: application2
+        }
+    }
+
+    public interface MyStuffValueComposite
+    {
+    }
+
+    private static class DummyAssembler implements Assembler
+    {
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+
+        }
+    }
+
+    // START SNIPPET: application3
+    private static Energy4Java zest;
+
+    public static void main( String[] args )
+        throws Exception
+    {
+        zest = new Energy4Java();
+        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
+        {
+            @Override
+            public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+                throws AssemblyException
+            {
+                return createAssembly( applicationFactory );
+            }
+        } );
+        Application application = model.newInstance( zest.spi() );
+    }
+
+    private static ApplicationAssembly createAssembly( ApplicationAssemblyFactory factory )
+        throws AssemblyException
+    {
+        String applicationName = "Example Application";
+        ApplicationAssembly app = factory.newApplicationAssembly();
+        app.setName( applicationName );
+        LayerAssembly webLayer = createWebLayer( app );
+        LayerAssembly domainLayer = createDomainLayer( app );
+        LayerAssembly infraLayer = createInfrastructureLayer( app );
+        webLayer.uses( domainLayer );
+        webLayer.uses( infraLayer );  // Accesses the WebService
+        domainLayer.uses( infraLayer ); // For persistence
+        return app;
+    }
+
+    private static LayerAssembly createWebLayer(
+        ApplicationAssembly application
+    )
+    {
+        LayerAssembly layer = application.layer( "Web Layer" );
+        createCustomerWebModule( layer );
+        return layer;
+    }
+
+    private static LayerAssembly createDomainLayer(
+        ApplicationAssembly application
+    )
+    {
+        LayerAssembly layer = application.layer( "Domain Layer" );
+        createCustomerDomainModule( layer );
+        // :
+        // :
+        return layer;
+    }
+
+    private static LayerAssembly createInfrastructureLayer(
+        ApplicationAssembly application
+    )
+        throws AssemblyException
+    {
+        LayerAssembly layer = application.layer( "Infrastructure Layer" );
+        createWebServiceModule( layer );
+        createPersistenceModule( layer );
+        return layer;
+    }
+
+    private static void createCustomerWebModule( LayerAssembly layer )
+    {
+        ModuleAssembly assembly = layer.module( "Customer Web Module" );
+        assembly.transients( CustomerViewComposite.class );
+        assembly.transients( CustomerEditComposite.class );
+        assembly.transients( CustomerListViewComposite.class );
+        assembly.transients( CustomerSearchComposite.class );
+    }
+
+    private static void createCustomerDomainModule( LayerAssembly layer )
+    {
+        ModuleAssembly assembly = layer.module( "Customer Domain Module" );
+        assembly.entities( CustomerEntity.class );
+        assembly.entities( CountryEntity.class );
+        assembly.transients( AddressComposite.class );
+    }
+
+    private static void createWebServiceModule( LayerAssembly layer )
+        throws AssemblyException
+    {
+        ModuleAssembly assembly = layer.module( "Web Service Module" );
+        // Someone has created an assembler for a Jetty Web Service.
+        JettyAssembler jetty = new JettyAssembler( 8080 );
+        jetty.assemble( assembly );
+    }
+
+    private static void createPersistenceModule( LayerAssembly layer )
+        throws AssemblyException
+    {
+        ModuleAssembly assembly = layer.module( "Persistence Module" );
+        // Someone has created an assembler for the Neo EntityStore
+        NeoAssembler neo = new NeoAssembler( "./neostore" );
+        neo.assemble( assembly );
+    }
+// START SNIPPET: application3
+
+    public static class CustomerViewComposite
+    {
+
+    }
+    public static class CustomerEditComposite
+    {
+
+    }
+    public static class CustomerListViewComposite
+    {
+
+    }
+    public static class CustomerSearchComposite
+    {
+
+    }
+
+
+    public static class CustomerEntity
+    {
+
+    }
+    public static class CountryEntity
+    {
+
+    }
+    public static class AddressComposite
+    {
+
+    }
+
+    public static class JettyAssembler
+        implements Assembler
+    {
+
+        public JettyAssembler( int port )
+        {
+        }
+
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+        }
+    }
+    public static class NeoAssembler
+        implements Assembler
+    {
+
+        public NeoAssembler( String s )
+        {
+        }
+
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java b/core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java
new file mode 100644
index 0000000..defa286
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.docsupport;
+
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+public class CompositionDocs
+{
+// START SNIPPET: comp1
+    @Mixins( { BalanceCheckMixin.class } )
+    public interface BankAccount
+    {
+        Money checkBalance();
+// END SNIPPET: comp1
+// START SNIPPET: comp1
+    }
+// END SNIPPET: comp1
+
+// START SNIPPET: comp2
+    public void assemble( ModuleAssembly module )
+    {
+        module.entities( BankAccount.class );
+    }
+// END SNIPPET: comp2
+
+    public static class BalanceCheckMixin
+        implements BankAccount
+    {
+        @Override
+        public Money checkBalance()
+        {
+            return null;
+        }
+    }
+
+    public static class Money
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/docsupport/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/docsupport/package.html b/core/api/src/test/java/org/apache/polygene/api/docsupport/package.html
new file mode 100644
index 0000000..6fbef81
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/docsupport/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+<body>
+This package exists to contain snippets for documentation.
+</body>
+</html>
\ No newline at end of file


[12/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
new file mode 100644
index 0000000..774bea7
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
@@ -0,0 +1,847 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.entity.Lifecycle;
+import org.apache.polygene.api.mixin.Initializable;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Methods;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+import static org.objectweb.asm.Opcodes.AASTORE;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ACC_SUPER;
+import static org.objectweb.asm.Opcodes.ACONST_NULL;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ANEWARRAY;
+import static org.objectweb.asm.Opcodes.ARETURN;
+import static org.objectweb.asm.Opcodes.ASTORE;
+import static org.objectweb.asm.Opcodes.ATHROW;
+import static org.objectweb.asm.Opcodes.BIPUSH;
+import static org.objectweb.asm.Opcodes.CHECKCAST;
+import static org.objectweb.asm.Opcodes.DLOAD;
+import static org.objectweb.asm.Opcodes.DRETURN;
+import static org.objectweb.asm.Opcodes.DUP;
+import static org.objectweb.asm.Opcodes.FLOAD;
+import static org.objectweb.asm.Opcodes.FRETURN;
+import static org.objectweb.asm.Opcodes.GETFIELD;
+import static org.objectweb.asm.Opcodes.GETSTATIC;
+import static org.objectweb.asm.Opcodes.GOTO;
+import static org.objectweb.asm.Opcodes.ICONST_0;
+import static org.objectweb.asm.Opcodes.ICONST_1;
+import static org.objectweb.asm.Opcodes.ICONST_2;
+import static org.objectweb.asm.Opcodes.ICONST_3;
+import static org.objectweb.asm.Opcodes.ICONST_4;
+import static org.objectweb.asm.Opcodes.ICONST_5;
+import static org.objectweb.asm.Opcodes.ILOAD;
+import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static org.objectweb.asm.Opcodes.IRETURN;
+import static org.objectweb.asm.Opcodes.LLOAD;
+import static org.objectweb.asm.Opcodes.LRETURN;
+import static org.objectweb.asm.Opcodes.POP;
+import static org.objectweb.asm.Opcodes.PUTSTATIC;
+import static org.objectweb.asm.Opcodes.RETURN;
+import static org.objectweb.asm.Type.getInternalName;
+
+/**
+ * Generate subclasses of mixins/modifiers that implement all interfaces not in the class itself
+ * and which delegates those calls to a given composite invoker.
+ */
+@SuppressWarnings( "raw" )
+public class FragmentClassLoader
+    extends ClassLoader
+{
+    private static final int JDK_VERSION;
+    public static final String GENERATED_POSTFIX = "_Stub";
+
+    static
+    {
+        String jdkString = System.getProperty( "java.specification.version" );
+        switch( jdkString )
+        {
+        case "1.8":
+            JDK_VERSION = Opcodes.V1_8;
+            break;
+        case "1.7":
+        default:
+            JDK_VERSION = Opcodes.V1_7;
+            break;
+        }
+    }
+
+    public FragmentClassLoader( ClassLoader parent )
+    {
+        super( parent );
+    }
+
+    @Override
+    protected Class findClass( String name )
+        throws ClassNotFoundException
+    {
+        if( name.endsWith( GENERATED_POSTFIX ) )
+        {
+            Class baseClass;
+            String baseName = name.substring( 0, name.length() - 5 );
+            try
+            {
+                baseClass = loadClass( baseName );
+            }
+            catch( ClassNotFoundException e )
+            {
+                // Try replacing the last _ with $
+                while( true )
+                {
+                    int idx = baseName.lastIndexOf( "_" );
+                    if( idx != -1 )
+                    {
+                        baseName = baseName.substring( 0, idx ) + "$" + baseName.substring( idx + 1 );
+                        try
+                        {
+                            baseClass = loadClass( baseName );
+                            break;
+                        }
+                        catch( ClassNotFoundException e1 )
+                        {
+                            // Try again
+                        }
+                    }
+                    else
+                    {
+                        throw e;
+                    }
+                }
+            }
+            //  To Allow JDK classes to be composed.
+            if( name.startsWith( "java." ) )
+            {
+                name = "polygene." + name;
+            }
+
+            byte[] b = generateClass( name, baseClass );
+            return defineClass( name, b, 0, b.length, baseClass.getProtectionDomain() );
+        }
+
+        // Try the classloader of this classloader -> get classes in Polygene such as CompositeInvoker
+        return getClass().getClassLoader().loadClass( name );
+    }
+
+    public byte[] generateClass( String name, Class baseClass )
+        throws ClassNotFoundException
+    {
+        String classSlash = name.replace( '.', '/' );
+        String baseClassSlash = getInternalName( baseClass );
+
+        ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
+
+        // Class definition start
+        cw.visit( JDK_VERSION, ACC_PUBLIC + ACC_SUPER, classSlash, null, baseClassSlash, null );
+
+        // Composite reference
+        {
+            cw.visitField( ACC_PUBLIC, "_instance", "Lorg/apache/polygene/api/composite/CompositeInvoker;", null, null )
+                .visitEnd();
+        }
+
+        // Static Method references
+        boolean hasProxyMethods = false;
+        {
+            int idx = 1;
+            for( Method method : baseClass.getMethods() )
+            {
+                if( isOverridden( method, baseClass ) )
+                {
+                    cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;", null, null )
+                        .visitEnd();
+                    hasProxyMethods = true;
+                }
+            }
+        }
+
+        // Constructors
+        for( Constructor constructor : baseClass.getDeclaredConstructors() )
+        {
+            if( Modifier.isPublic( constructor.getModifiers() ) || Modifier.isProtected( constructor.getModifiers() ) )
+            {
+                String desc = org.objectweb.asm.commons.Method.getMethod( constructor ).getDescriptor();
+                MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null, null );
+                mv.visitCode();
+                mv.visitVarInsn( ALOAD, 0 );
+
+                int idx = 1;
+                for( Class aClass : constructor.getParameterTypes() )
+                {
+                    final int opcode;
+                    if( aClass.equals( Integer.TYPE ) )
+                    {
+                        opcode = ILOAD;
+                    }
+                    else if( aClass.equals( Long.TYPE ) )
+                    {
+                        opcode = LLOAD;
+                    }
+                    else if( aClass.equals( Float.TYPE ) )
+                    {
+                        opcode = FLOAD;
+                    }
+                    else if( aClass.equals( Double.TYPE ) )
+                    {
+                        opcode = DLOAD;
+                    }
+                    else
+                    {
+                        opcode = ALOAD;
+                    }
+                    mv.visitVarInsn( opcode, idx++ );
+                }
+
+                mv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, "<init>", desc, false );
+                mv.visitInsn( RETURN );
+                mv.visitMaxs( idx, idx );
+                mv.visitEnd();
+            }
+        }
+
+        // Overloaded and unimplemented methods
+        if( hasProxyMethods )
+        {
+            Method[] methods = baseClass.getMethods();
+            int idx = 0;
+            List<Label> exceptionLabels = new ArrayList<>();
+            for( Method method : methods )
+            {
+                if( isOverridden( method, baseClass ) )
+                {
+                    idx++;
+                    String methodName = method.getName();
+                    String desc = org.objectweb.asm.commons.Method.getMethod( method ).getDescriptor();
+
+                    String[] exceptions = null;
+                    {
+                        MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, methodName, desc, null, null );
+                        if( isInternalPolygeneMethod( method, baseClass ) )
+                        {
+                            // generate a NoOp method...
+                            mv.visitInsn( RETURN );
+                        }
+                        else
+                        {
+                            Label endLabel = null; // Use this if return type is void
+                            if( method.getExceptionTypes().length > 0 )
+                            {
+                                exceptions = new String[ method.getExceptionTypes().length ];
+                                for( int i = 0; i < method.getExceptionTypes().length; i++ )
+                                {
+                                    Class<?> aClass = method.getExceptionTypes()[ i ];
+                                    exceptions[ i ] = getInternalName( aClass );
+                                }
+                            }
+                            mv.visitCode();
+                            Label l0 = new Label();
+                            Label l1 = new Label();
+
+                            exceptionLabels.clear();
+                            for( Class<?> declaredException : method.getExceptionTypes() )
+                            {
+                                Label ld = new Label();
+                                mv.visitTryCatchBlock( l0, l1, ld, getInternalName( declaredException ) );
+                                exceptionLabels.add( ld ); // Reuse this further down for the catch
+                            }
+
+                            Label lruntime = new Label();
+                            mv.visitTryCatchBlock( l0, l1, lruntime, "java/lang/RuntimeException" );
+                            Label lerror = new Label();
+                            mv.visitTryCatchBlock( l0, l1, lerror, "java/lang/Throwable" );
+
+                            mv.visitLabel( l0 );
+                            mv.visitVarInsn( ALOAD, 0 );
+                            mv.visitFieldInsn( GETFIELD, classSlash, "_instance",
+                                               "Lorg/apache/polygene/api/composite/CompositeInvoker;" );
+                            mv.visitFieldInsn( GETSTATIC, classSlash, "m" + idx, "Ljava/lang/reflect/Method;" );
+
+                            int paramCount = method.getParameterTypes().length;
+                            int stackIdx = 0;
+                            if( paramCount == 0 )
+                            {
+                                // Send in null as parameter
+                                mv.visitInsn( ACONST_NULL );
+                            }
+                            else
+                            {
+                                insn( mv, paramCount );
+                                mv.visitTypeInsn( ANEWARRAY, "java/lang/Object" );
+                                int pidx = 0;
+                                for( Class<?> aClass : method.getParameterTypes() )
+                                {
+                                    mv.visitInsn( DUP );
+                                    insn( mv, pidx++ );
+                                    stackIdx = wrapParameter( mv, aClass, stackIdx + 1 );
+                                    mv.visitInsn( AASTORE );
+                                }
+                            }
+
+                            // Call method
+                            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/api/composite/CompositeInvoker",
+                                                "invokeComposite",
+                                                "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
+
+                            // Return value
+                            if( !method.getReturnType().equals( Void.TYPE ) )
+                            {
+                                unwrapResult( mv, method.getReturnType(), l1 );
+                            }
+                            else
+                            {
+                                mv.visitInsn( POP );
+                                mv.visitLabel( l1 );
+                                endLabel = new Label();
+                                mv.visitJumpInsn( GOTO, endLabel );
+                            }
+
+                            // Increase stack to beyond method args
+                            stackIdx++;
+
+                            // Declared exceptions
+                            int exceptionIdx = 0;
+                            for( Class<?> aClass : method.getExceptionTypes() )
+                            {
+                                mv.visitLabel( exceptionLabels.get( exceptionIdx++ ) );
+                                mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ getInternalName( aClass ) } );
+                                mv.visitVarInsn( ASTORE, stackIdx );
+                                mv.visitVarInsn( ALOAD, stackIdx );
+                                mv.visitInsn( ATHROW );
+                            }
+
+                            // RuntimeException and Error catch-all
+                            mv.visitLabel( lruntime );
+                            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/RuntimeException" } );
+                            mv.visitVarInsn( ASTORE, stackIdx );
+                            mv.visitVarInsn( ALOAD, stackIdx );
+                            mv.visitInsn( ATHROW );
+
+                            mv.visitLabel( lerror );
+                            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/Throwable" } );
+                            mv.visitVarInsn( ASTORE, stackIdx );
+                            mv.visitVarInsn( ALOAD, stackIdx );
+                            mv.visitTypeInsn( CHECKCAST, "java/lang/Error" );
+                            mv.visitInsn( ATHROW );
+
+                            // Return type = void
+                            if( endLabel != null )
+                            {
+                                mv.visitLabel( endLabel );
+                                mv.visitFrame( Opcodes.F_SAME, 0, null, 0, null );
+                                mv.visitInsn( RETURN );
+                            }
+
+                            mv.visitMaxs( 0, 0 );
+                            mv.visitEnd();
+                        }
+                    }
+
+                    if( !Modifier.isAbstract( method.getModifiers() ) )
+                    {
+                        // Add method with _ as prefix
+                        MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(), desc, null, exceptions );
+                        mv.visitCode();
+                        mv.visitVarInsn( ALOAD, 0 );
+
+                        // Parameters
+                        int stackIdx = 1;
+                        for( Class<?> aClass : method.getParameterTypes() )
+                        {
+                            stackIdx = loadParameter( mv, aClass, stackIdx ) + 1;
+                        }
+
+                        // Call method
+                        mv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, method.getName(), desc, false );
+
+                        // Return value
+                        if( !method.getReturnType().equals( Void.TYPE ) )
+                        {
+                            returnResult( mv, method.getReturnType() );
+                        }
+                        else
+                        {
+                            mv.visitInsn( RETURN );
+                        }
+
+                        mv.visitMaxs( 1, 1 );
+                        mv.visitEnd();
+                    }
+                }
+            }
+
+            // Class initializer
+            {
+                MethodVisitor mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null, null );
+                mv.visitCode();
+                Label l0 = new Label();
+                Label l1 = new Label();
+                Label l2 = new Label();
+                mv.visitTryCatchBlock( l0, l1, l2, "java/lang/NoSuchMethodException" );
+                mv.visitLabel( l0 );
+
+                // Lookup methods and store in static variables
+                int midx = 0;
+                for( Method method : methods )
+                {
+                    if( isOverridden( method, baseClass ) )
+                    {
+                        method.setAccessible( true );
+                        Class methodClass;
+                        if( Modifier.isAbstract( method.getModifiers() ) )
+                        {
+                            methodClass = method.getDeclaringClass();
+                        }
+                        else
+                        {
+                            try
+                            {
+                                methodClass = getInterfaceMethodDeclaration( method,
+                                                                             baseClass ); // Overridden method lookup
+                            }
+                            catch( NoSuchMethodException e )
+                            {
+                                throw new ClassNotFoundException( name, e );
+                            }
+                        }
+
+                        midx++;
+
+                        mv.visitLdcInsn( Type.getType( methodClass ) );
+                        mv.visitLdcInsn( method.getName() );
+                        insn( mv, method.getParameterTypes().length );
+                        mv.visitTypeInsn( ANEWARRAY, "java/lang/Class" );
+
+                        int pidx = 0;
+                        for( Class<?> aClass : method.getParameterTypes() )
+                        {
+                            mv.visitInsn( DUP );
+                            insn( mv, pidx++ );
+                            type( mv, aClass );
+                            mv.visitInsn( AASTORE );
+                        }
+
+                        mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
+                                            "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
+                        mv.visitFieldInsn( PUTSTATIC, classSlash, "m" + midx, "Ljava/lang/reflect/Method;" );
+                    }
+                }
+
+                mv.visitLabel( l1 );
+                Label l3 = new Label();
+                mv.visitJumpInsn( GOTO, l3 );
+                mv.visitLabel( l2 );
+                mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/NoSuchMethodException" } );
+                mv.visitVarInsn( ASTORE, 0 );
+                mv.visitVarInsn( ALOAD, 0 );
+                mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/NoSuchMethodException", "printStackTrace", "()V", false );
+                mv.visitLabel( l3 );
+                mv.visitFrame( Opcodes.F_SAME, 0, null, 0, null );
+                mv.visitInsn( RETURN );
+                mv.visitMaxs( 6, 1 );
+                mv.visitEnd();
+            }
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    private static boolean isOverridden( Method method, Class baseClass )
+    {
+        if( Modifier.isAbstract( method.getModifiers() ) )
+        {
+            return true; // Implement all abstract methods
+        }
+
+        if( Modifier.isFinal( method.getModifiers() ) )
+        {
+            return false; // Cannot override final methods
+        }
+
+        if( isInterfaceMethod( method, baseClass ) )
+        {
+            // if() used for clarity.
+            //noinspection RedundantIfStatement
+            if( isInternalPolygeneMethod( method, baseClass ) )
+            {
+                return false; // Skip methods in Polygene-internal interfaces
+            }
+            else
+            {
+                return true;
+            }
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    private static boolean isInternalPolygeneMethod( Method method, Class baseClass )
+    {
+        return isDeclaredIn( method, Initializable.class, baseClass )
+               || isDeclaredIn( method, Lifecycle.class, baseClass );
+    }
+
+    private static boolean isDeclaredIn( Method method, Class<?> clazz, Class<?> baseClass )
+    {
+        return clazz.isAssignableFrom( baseClass ) && checkForMethod( method, clazz );
+    }
+
+    private static Class getInterfaceMethodDeclaration( Method method, Class clazz )
+        throws NoSuchMethodException
+    {
+        return interfacesOf( clazz )
+            .map( Classes.RAW_CLASS )
+            .filter( intface -> checkForMethod( method, intface ) )
+            .findFirst()
+            .orElseThrow( () -> new NoSuchMethodException( method.getName() ) );
+    }
+
+    private static boolean isInterfaceMethod( Method method, Class<?> baseClass )
+    {
+        return interfacesOf( baseClass )
+            .map( Classes.RAW_CLASS )
+            .filter( Methods.HAS_METHODS )
+            .anyMatch( intface -> checkForMethod( method, intface ));
+    }
+
+    private static boolean checkForMethod( Method method, Class<?> intface )
+    {
+        try
+        {
+            Method m = intface.getMethod( method.getName(), method.getParameterTypes() );
+            m.setAccessible( true );
+            return true;
+        }
+        catch( NoSuchMethodException e )
+        {
+            return false;
+        }
+    }
+
+    private static void type( MethodVisitor mv, Class<?> aClass )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Integer", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Long", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Short", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Byte", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Double", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Float", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Boolean", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Character", "TYPE", "Ljava/lang/Class;" );
+        }
+        else
+        {
+            mv.visitLdcInsn( Type.getType( aClass ) );
+        }
+    }
+
+    private static int wrapParameter( MethodVisitor mv, Class<?> aClass, int idx )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitVarInsn( LLOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitVarInsn( DLOAD, idx );
+            idx++; // Extra jump
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitVarInsn( FLOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false );
+        }
+        else
+        {
+            mv.visitVarInsn( ALOAD, idx );
+        }
+
+        return idx;
+    }
+
+    private static void unwrapResult( MethodVisitor mv, Class<?> aClass, Label label )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Integer" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Long" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false );
+            mv.visitLabel( label );
+            mv.visitInsn( LRETURN );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Short" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Byte" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Double" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false );
+            mv.visitLabel( label );
+            mv.visitInsn( DRETURN );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Float" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false );
+            mv.visitLabel( label );
+            mv.visitInsn( FRETURN );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Boolean" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Character" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else
+        {
+            mv.visitTypeInsn( CHECKCAST, getInternalName( aClass ) );
+            mv.visitLabel( label );
+            mv.visitInsn( ARETURN );
+        }
+    }
+
+    private static int loadParameter( MethodVisitor mv, Class<?> aClass, int idx )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitVarInsn( LLOAD, idx );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitVarInsn( DLOAD, idx );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitVarInsn( FLOAD, idx );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else
+        {
+            mv.visitVarInsn( ALOAD, idx );
+        }
+
+        return idx;
+    }
+
+    private static void returnResult( MethodVisitor mv, Class<?> aClass )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitInsn( LRETURN );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitInsn( DRETURN );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitInsn( FRETURN );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else
+        {
+            mv.visitTypeInsn( CHECKCAST, getInternalName( aClass ) );
+            mv.visitInsn( ARETURN );
+        }
+    }
+
+    private static void insn( MethodVisitor mv, int length )
+    {
+        switch( length )
+        {
+        case 0:
+            mv.visitInsn( ICONST_0 );
+            return;
+        case 1:
+            mv.visitInsn( ICONST_1 );
+            return;
+        case 2:
+            mv.visitInsn( ICONST_2 );
+            return;
+        case 3:
+            mv.visitInsn( ICONST_3 );
+            return;
+        case 4:
+            mv.visitInsn( ICONST_4 );
+            return;
+        case 5:
+            mv.visitInsn( ICONST_5 );
+            return;
+        default:
+            mv.visitIntInsn( BIPUSH, length );
+        }
+    }
+
+    public static boolean isGenerated( Class clazz )
+    {
+        return clazz.getName().endsWith( GENERATED_POSTFIX );
+    }
+
+    public static boolean isGenerated( Object object )
+    {
+        return object.getClass().getName().endsWith( GENERATED_POSTFIX );
+    }
+
+    public Class loadFragmentClass( Class fragmentClass )
+        throws ClassNotFoundException
+    {
+        return loadClass( fragmentClass.getName().replace( '$', '_' ) + GENERATED_POSTFIX );
+    }
+
+    public static Class getSourceClass( Class fragmentClass )
+    {
+        return fragmentClass.getName().endsWith( GENERATED_POSTFIX ) ? fragmentClass.getSuperclass() : fragmentClass;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentInvocationHandler.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentInvocationHandler.java
new file mode 100644
index 0000000..f0dfca6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentInvocationHandler.java
@@ -0,0 +1,137 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+abstract class FragmentInvocationHandler
+    implements InvocationHandler
+{
+    private static final String COMPACT_TRACE = "polygene.compacttrace";
+
+    private static final CompactLevel compactLevel;
+
+    static
+    {
+        compactLevel = CompactLevel.valueOf( System.getProperty( COMPACT_TRACE, "proxy" ) );
+    }
+
+    protected Object fragment;
+    protected Method method;
+
+    void setFragment( Object fragment )
+    {
+        this.fragment = fragment;
+    }
+
+    public void setMethod( Method method )
+    {
+        this.method = method;
+    }
+
+    protected Throwable cleanStackTrace( Throwable throwable, Object proxy, Method method )
+    {
+        if( compactLevel == CompactLevel.off )
+        {
+            return throwable;
+        }
+
+        StackTraceElement[] trace = throwable.getStackTrace();
+
+        // Check if exception originated within Polygene or JDK - if so then skip compaction
+        if( trace.length == 0 || !isApplicationClass( trace[ 0 ].getClassName() ) )
+        {
+            return throwable;
+        }
+
+        int count = 0;
+        for( int i = 0; i < trace.length; i++ )
+        {
+            StackTraceElement stackTraceElement = trace[ i ];
+            if( !isApplicationClass( stackTraceElement.getClassName() ) )
+            {
+                // TODO: Should find stack entry outside Runtime, and compact beyond that
+                trace[ i ] = null;
+                count++;
+            }
+            else
+            {
+                boolean classOrigin = stackTraceElement.getClassName().equals( proxy.getClass().getSimpleName() );
+                boolean methodOrigin = stackTraceElement.getMethodName().equals( method.getName() );
+                if( classOrigin && methodOrigin && compactLevel == CompactLevel.proxy )
+                {
+                    // Stop removing if the originating method call has been located in the stack.
+                    // For 'semi' and 'extensive' compaction, we don't and do the entire stack instead.
+                    trace[ i ] = new StackTraceElement( proxy.getClass()
+                                                            .getInterfaces()[ 0 ].getName(), method.getName(), null, -1 );
+                    break; // Stop compacting this trace
+                }
+            }
+        }
+
+        // Create new trace array
+        int idx = 0;
+        StackTraceElement[] newTrace = new StackTraceElement[ trace.length - count ];
+        for( StackTraceElement stackTraceElement : trace )
+        {
+            if( stackTraceElement != null )
+            {
+                newTrace[ idx++ ] = stackTraceElement;
+            }
+        }
+        throwable.setStackTrace( newTrace );
+
+        Throwable nested = throwable.getCause();
+        if( nested != null )
+        {
+            //noinspection ThrowableResultOfMethodCallIgnored
+            cleanStackTrace( nested, proxy, method );
+        }
+        for( Throwable suppressed : throwable.getSuppressed() )
+        {
+            //noinspection ThrowableResultOfMethodCallIgnored
+            cleanStackTrace( suppressed, proxy, method );
+        }
+        return throwable;
+    }
+
+    private boolean isApplicationClass( String className )
+    {
+        if( compactLevel == CompactLevel.semi )
+        {
+            return !isJdkInternals( className );
+        }
+        return !( className.endsWith( FragmentClassLoader.GENERATED_POSTFIX ) ||
+                  className.startsWith( "org.apache.polygene.runtime" ) ||
+                  isJdkInternals( className ) );
+    }
+
+    private boolean isJdkInternals( String className )
+    {
+        return className.startsWith( "java.lang.reflect" )
+               || className.startsWith( "jdk.internal.reflect" )
+               || className.startsWith( "com.sun.proxy" )
+               || className.startsWith( "sun.reflect" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FunctionStateResolver.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FunctionStateResolver.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FunctionStateResolver.java
new file mode 100644
index 0000000..1357568
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FunctionStateResolver.java
@@ -0,0 +1,115 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.ManyAssociationState;
+import org.apache.polygene.spi.entity.NamedAssociationState;
+
+/**
+ * Function based StateResolver.
+ */
+public class FunctionStateResolver
+    implements StateResolver
+{
+    final Function<PropertyDescriptor, Object> propertyFunction;
+    final Function<AssociationDescriptor, EntityReference> associationFunction;
+    final Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction;
+    final Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction;
+
+    public FunctionStateResolver( Function<PropertyDescriptor, Object> propertyFunction,
+                                  Function<AssociationDescriptor, EntityReference> associationFunction,
+                                  Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+                                  Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction )
+    {
+        this.propertyFunction = propertyFunction;
+        this.associationFunction = associationFunction;
+        this.manyAssociationFunction = manyAssociationFunction;
+        this.namedAssociationFunction = namedAssociationFunction;
+    }
+
+    @Override
+    public Object getPropertyState( PropertyDescriptor propertyDescriptor )
+    {
+        return propertyFunction.apply( propertyDescriptor );
+    }
+
+    @Override
+    public EntityReference getAssociationState( AssociationDescriptor associationDescriptor )
+    {
+        return associationFunction.apply( associationDescriptor );
+    }
+
+    @Override
+    public Stream<EntityReference> getManyAssociationState( AssociationDescriptor associationDescriptor )
+    {
+        return manyAssociationFunction.apply( associationDescriptor );
+    }
+
+    @Override
+    public Stream<Map.Entry<String, EntityReference>> getNamedAssociationState(
+        AssociationDescriptor associationDescriptor )
+    {
+        return namedAssociationFunction.apply( associationDescriptor );
+    }
+
+    public void populateState( EntityModel model, EntityState state )
+    {
+        model.state().properties().forEach(
+            propDesc ->
+            {
+                Object value = getPropertyState( propDesc );
+                state.setPropertyValue( propDesc.qualifiedName(), value );
+            } );
+        model.state().associations().forEach(
+            assDesc ->
+            {
+                EntityReference ref = getAssociationState( assDesc );
+                state.setAssociationValue( assDesc.qualifiedName(), ref );
+            } );
+        model.state().manyAssociations().forEach(
+            manyAssDesc ->
+            {
+                ManyAssociationState associationState = state.manyAssociationValueOf( manyAssDesc.qualifiedName() );
+                // First clear existing ones
+                associationState.forEach( associationState::remove );
+                // then add the new ones.
+                getManyAssociationState( manyAssDesc )
+                    .forEach( ref -> associationState.add( 0, ref ) );
+            } );
+        model.state().namedAssociations().forEach(
+            namedAssDesc ->
+            {
+                NamedAssociationState associationState = state.namedAssociationValueOf( namedAssDesc.qualifiedName() );
+                // First clear existing ones
+                associationState.forEach( associationState::remove );
+                // then add the new ones.
+                getNamedAssociationState( namedAssDesc )
+                    .forEach( entry -> associationState.put( entry.getKey(), entry.getValue() ) );
+            } );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/GenericFragmentInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/GenericFragmentInvocationHandler.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/GenericFragmentInvocationHandler.java
new file mode 100644
index 0000000..44259e8
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/GenericFragmentInvocationHandler.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+public final class GenericFragmentInvocationHandler
+    extends FragmentInvocationHandler
+{
+    // InvocationHandler implementation ------------------------------
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            return ( (InvocationHandler) fragment ).invoke( proxy, method, args );
+        }
+        catch( InvocationTargetException throwable )
+        {
+            throw cleanStackTrace( throwable.getTargetException(), proxy, method );
+        }
+        catch( Throwable throwable )
+        {
+            throw cleanStackTrace( throwable, proxy, method );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/Genericpredicate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/Genericpredicate.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/Genericpredicate.java
new file mode 100644
index 0000000..e8c5cea
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/Genericpredicate.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.function.Predicate;
+
+/**
+ * Specification that checks whether a given class implements InvocationHandler or not.
+ */
+public class Genericpredicate
+    implements Predicate<Class<?>>
+{
+    public static final Genericpredicate INSTANCE = new Genericpredicate();
+
+    @Override
+    public boolean test( Class<?> item )
+    {
+        return InvocationHandler.class.isAssignableFrom( item );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InstancePool.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InstancePool.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InstancePool.java
new file mode 100644
index 0000000..0eec577
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InstancePool.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+/**
+ * JAVADOC
+ */
+public interface InstancePool<T>
+{
+    public T obtainInstance();
+
+    public void releaseInstance( T instance );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinModel.java
new file mode 100644
index 0000000..37722e6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinModel.java
@@ -0,0 +1,184 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Initializable;
+import org.apache.polygene.api.mixin.InitializationException;
+import org.apache.polygene.api.mixin.MixinDescriptor;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectedFieldsModel;
+import org.apache.polygene.runtime.injection.InjectedMethodsModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * JAVADOC
+ */
+public final class MixinModel
+    implements MixinDescriptor, VisitableHierarchy<Object, Object>, Dependencies
+{
+    private final Class<?> mixinClass;
+    private final Class<?> instantiationClass;
+    private final ConstructorsModel constructorsModel;
+    private final InjectedFieldsModel injectedFieldsModel;
+    private final InjectedMethodsModel injectedMethodsModel;
+    private final List<Class<?>> thisMixinTypes;
+
+    public MixinModel( Class<?> declaredMixinClass, Class<?> instantiationClass )
+    {
+        injectedFieldsModel = new InjectedFieldsModel( declaredMixinClass );
+        injectedMethodsModel = new InjectedMethodsModel( declaredMixinClass );
+
+        this.mixinClass = declaredMixinClass;
+        this.instantiationClass = instantiationClass;
+        constructorsModel = new ConstructorsModel( instantiationClass );
+
+        thisMixinTypes = buildThisMixinTypes();
+    }
+
+    @Override
+    public Class<?> mixinClass()
+    {
+        return mixinClass;
+    }
+
+    public Class<?> instantiationClass()
+    {
+        return instantiationClass;
+    }
+
+    public boolean isGeneric()
+    {
+        return InvocationHandler.class.isAssignableFrom( mixinClass );
+    }
+
+    public Stream<DependencyModel> dependencies()
+    {
+        Stream<? extends Dependencies> models = Stream.of( constructorsModel, injectedFieldsModel, injectedMethodsModel );
+        return models.flatMap( Dependencies::dependencies );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( constructorsModel.accept( visitor ) )
+            {
+                if( injectedFieldsModel.accept( visitor ) )
+                {
+                    injectedMethodsModel.accept( visitor );
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    // Context
+    public Object newInstance( CompositeInstance compositeInstance, StateHolder state, UsesInstance uses )
+    {
+        InjectionContext injectionContext = new InjectionContext( compositeInstance, uses, state );
+        return newInstance( injectionContext );
+    }
+
+    public Object newInstance( InjectionContext injectionContext )
+    {
+        Object mixin;
+        CompositeInstance compositeInstance = injectionContext.compositeInstance();
+
+        mixin = constructorsModel.newInstance( injectionContext );
+
+        if( FragmentClassLoader.isGenerated( instantiationClass ) )
+        {
+            try
+            {
+                instantiationClass.getDeclaredField( "_instance" ).set( mixin,
+                                                                        injectionContext.compositeInstance() );
+            }
+            catch( IllegalAccessException | NoSuchFieldException e )
+            {
+                e.printStackTrace();
+            }
+        }
+
+        injectedFieldsModel.inject( injectionContext, mixin );
+        injectedMethodsModel.inject( injectionContext, mixin );
+        if( mixin instanceof Initializable )
+        {
+            try
+            {
+                ( (Initializable) mixin ).initialize();
+            }
+            catch( Exception e )
+            {
+                List<Class<?>> compositeType = compositeInstance.types().collect( Collectors.toList() );
+                String message = "Unable to initialize " + mixinClass + " in composite " + compositeType;
+                throw new ConstructionException( new InitializationException( message, e ) );
+            }
+        }
+        return mixin;
+    }
+
+    public Iterable<Class<?>> thisMixinTypes()
+    {
+        return thisMixinTypes;
+    }
+
+    private List<Class<?>> buildThisMixinTypes()
+    {
+        return dependencies()
+            .filter( new DependencyModel.ScopeSpecification( This.class ) )
+            .distinct()
+            .map( DependencyModel::rawInjectionType )
+            .collect( Collectors.toList() );
+    }
+
+    protected FragmentInvocationHandler newInvocationHandler( Method method )
+    {
+        if( InvocationHandler.class.isAssignableFrom( mixinClass )
+            && !method.getDeclaringClass().isAssignableFrom( mixinClass ) )
+        {
+            return new GenericFragmentInvocationHandler();
+        }
+        else
+        {
+            return new TypedModifierInvocationHandler();
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return mixinClass.getName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsInstance.java
new file mode 100644
index 0000000..b26f548
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsInstance.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+public interface MixinsInstance
+{
+    Object invoke( Object composite, Object[] params, CompositeMethodInstance methodInstance )
+        throws Throwable;
+
+    Object invokeObject( Object proxy, Object[] args, Method method )
+        throws Throwable;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsModel.java
new file mode 100644
index 0000000..2f6e333
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/MixinsModel.java
@@ -0,0 +1,234 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Stream;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectedFieldModel;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+
+/**
+ * Base implementation of model for mixins. This records the mapping between methods in the Composite
+ * and mixin implementations.
+ */
+public class MixinsModel
+    implements Binder, VisitableHierarchy<Object, Object>, Dependencies
+{
+    protected final Map<Method, MixinModel> methodImplementation = new HashMap<Method, MixinModel>();
+    protected final Map<Method, Integer> methodIndex = new HashMap<Method, Integer>();
+    protected List<MixinModel> mixinModels = new ArrayList<MixinModel>();
+
+    private final Map<Class, Integer> mixinIndex = new HashMap<Class, Integer>();
+    private final Set<Class<?>> mixinTypes = new LinkedHashSet<Class<?>>();
+
+    public Stream<Class<?>> mixinTypes()
+    {
+        return mixinTypes.stream();
+    }
+
+    public <T> boolean isImplemented( Class<T> mixinType )
+    {
+        return mixinTypes.contains( mixinType );
+    }
+
+    public List<MixinModel> mixinModels()
+    {
+        return mixinModels;
+    }
+
+    public MixinModel mixinFor( Method method )
+    {
+        return methodImplementation.get( method );
+    }
+
+    public MixinModel getMixinModel( Class mixinClass )
+    {
+        for( MixinModel mixinModel : mixinModels )
+        {
+            if( mixinModel.mixinClass().equals( mixinClass ) )
+            {
+                return mixinModel;
+            }
+        }
+        return null;
+    }
+
+    public void addMixinType( Class mixinType )
+    {
+        Stream<? extends Type> stream = interfacesOf( mixinType );
+        Stream<Class<?>> rawClass = stream.map( Classes.RAW_CLASS );
+        rawClass.forEach( mixinTypes::add );
+    }
+
+    public void addMixinModel( MixinModel mixinModel )
+    {
+        mixinModels.add( mixinModel );
+    }
+
+    public void addMethodMixin( Method method, MixinModel mixinModel )
+    {
+        methodImplementation.put( method, mixinModel );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( MixinModel mixinModel : mixinModels )
+            {
+                mixinModel.accept( visitor );
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    // Binding
+    @Override
+    public void bind( final Resolution resolution )
+        throws BindingException
+    {
+        // Order mixins based on @This usages
+        UsageGraph<MixinModel> deps = new UsageGraph<MixinModel>( mixinModels, new Uses(), true );
+        mixinModels = deps.resolveOrder();
+
+        // Populate mappings
+        for( int i = 0; i < mixinModels.size(); i++ )
+        {
+            MixinModel mixinModel = mixinModels.get( i );
+            mixinIndex.put( mixinModel.mixinClass(), i );
+        }
+
+        for( Map.Entry<Method, MixinModel> methodClassEntry : methodImplementation.entrySet() )
+        {
+            methodIndex.put( methodClassEntry.getKey(), mixinIndex.get( methodClassEntry.getValue().mixinClass() ) );
+        }
+
+        for( MixinModel mixinModel : mixinModels )
+        {
+            mixinModel.accept( new HierarchicalVisitorAdapter<Object, Object, BindingException>()
+            {
+                @Override
+                public boolean visitEnter( Object visited )
+                    throws BindingException
+                {
+                    if( visited instanceof InjectedFieldModel )
+                    {
+                        InjectedFieldModel fieldModel = (InjectedFieldModel) visited;
+                        fieldModel.bind( resolution.forField( fieldModel.field() ) );
+                        return false;
+                    }
+                    else if( visited instanceof Binder )
+                    {
+                        Binder constructorsModel = (Binder) visited;
+                        constructorsModel.bind( resolution );
+
+                        return false;
+                    }
+                    return true;
+                }
+
+                @Override
+                public boolean visit( Object visited )
+                    throws BindingException
+                {
+                    if( visited instanceof Binder )
+                    {
+                        ( (Binder) visited ).bind( resolution );
+                    }
+                    return true;
+                }
+            } );
+        }
+    }
+
+    // Context
+
+    public Object[] newMixinHolder()
+    {
+        return new Object[ mixinIndex.size() ];
+    }
+
+    public FragmentInvocationHandler newInvocationHandler( final Method method )
+    {
+        return mixinFor( method ).newInvocationHandler( method );
+    }
+
+    public Stream<DependencyModel> dependencies()
+    {
+        return mixinModels.stream().flatMap( Dependencies::dependencies );
+    }
+
+    public Stream<Method> invocationsFor( final Class<?> mixinClass )
+    {
+        return methodImplementation.entrySet()
+            .stream().filter( entry -> entry.getValue().mixinClass().equals( mixinClass ) )
+            .map( Map.Entry::getKey );
+    }
+
+    private class Uses
+        implements UsageGraph.Use<MixinModel>
+    {
+        @Override
+        public Collection<MixinModel> uses( MixinModel source )
+        {
+            // System.out.println("BEGIN> MixinsModel.Uses.uses( "+source+" )");
+            Iterable<Class<?>> thisMixinTypes = source.thisMixinTypes();
+            List<MixinModel> usedMixinClasses = new ArrayList<MixinModel>();
+            // System.out.println("\tSource Mixin Types and Methods: ");
+            for( Class thisMixinType : thisMixinTypes )
+            {
+                // System.out.println("\t\t"+thisMixinType);
+                for( Method method : thisMixinType.getMethods() )
+                {
+                    // System.out.println("\t\t\t"+method);
+                    if( !Modifier.isStatic( method.getModifiers() ) )
+                    {
+                        MixinModel used = methodImplementation.get( method );
+                        usedMixinClasses.add( used );
+                    }
+                }
+            }
+            // System.out.println( "END>   MixinsModel.Uses.uses( " + source + " )" );
+            return usedMixinClasses;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyGenerator.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyGenerator.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyGenerator.java
new file mode 100644
index 0000000..df7a02a
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyGenerator.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Proxy;
+
+/**
+ * generates proxyclasses
+ */
+public class ProxyGenerator {
+    public static Class<?> createProxyClass(ClassLoader mainTypeClassLoader, Class<?>[] interfaces) {
+        ClassLoader effectiveClassLoader = Thread.currentThread().getContextClassLoader();
+        if (effectiveClassLoader == null) {
+            effectiveClassLoader = mainTypeClassLoader;
+        }
+        return Proxy.getProxyClass(effectiveClassLoader, interfaces);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyReferenceInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyReferenceInvocationHandler.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyReferenceInvocationHandler.java
new file mode 100644
index 0000000..5d125a2
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ProxyReferenceInvocationHandler.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.polygene.api.composite.CompositeInvoker;
+
+public final class ProxyReferenceInvocationHandler
+    implements InvocationHandler, CompositeInvoker
+{
+    private Object proxy;
+
+    public Object proxy()
+    {
+        return proxy;
+    }
+
+    public void setProxy( Object proxy )
+    {
+        this.proxy = proxy;
+    }
+
+    public void clearProxy()
+    {
+        proxy = null;
+    }
+
+    @Override
+    public Object invokeComposite( Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            InvocationHandler invocationHandler = Proxy.getInvocationHandler( this.proxy );
+            return invocationHandler.invoke( this.proxy, method, args );
+        }
+        catch( InvocationTargetException e )
+        {
+            throw e.getTargetException();
+        }
+        catch( UndeclaredThrowableException e )
+        {
+            throw e.getUndeclaredThrowable();
+        }
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            InvocationHandler invocationHandler = Proxy.getInvocationHandler( this.proxy );
+            return invocationHandler.invoke( this.proxy, method, args );
+        }
+        catch( InvocationTargetException e )
+        {
+            throw e.getTargetException();
+        }
+        catch( UndeclaredThrowableException e )
+        {
+            throw e.getUndeclaredThrowable();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectInvocationHandlerResult.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectInvocationHandlerResult.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectInvocationHandlerResult.java
new file mode 100644
index 0000000..44c10d5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectInvocationHandlerResult.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+public final class SideEffectInvocationHandlerResult
+    implements InvocationHandler
+{
+    private Object result;
+    private Throwable throwable;
+
+    public SideEffectInvocationHandlerResult()
+    {
+    }
+
+    public void setResult( Object result, Throwable throwable )
+    {
+        this.result = result;
+        this.throwable = throwable;
+    }
+
+    // InvocationHandler implementation ------------------------------
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        if( throwable != null )
+        {
+            throw throwable;
+        }
+        else
+        {
+            return result;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectModel.java
new file mode 100644
index 0000000..0b19e80
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectModel.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import org.apache.polygene.api.sideeffect.SideEffectDescriptor;
+
+/**
+ * JAVADOC
+ */
+public final class SideEffectModel
+    extends AbstractModifierModel
+    implements SideEffectDescriptor
+{
+    public SideEffectModel( Class<?> sideEffectClass, Class<?> instantiationClass )
+    {
+        super( sideEffectClass, instantiationClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsInstance.java
new file mode 100644
index 0000000..011cd9c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsInstance.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.List;
+
+/**
+ * JAVADOC
+ */
+public final class SideEffectsInstance
+    implements InvocationHandler
+{
+    private final List<InvocationHandler> sideEffects;
+    private final SideEffectInvocationHandlerResult resultInvocationHandler;
+    private final ProxyReferenceInvocationHandler proxyHandler;
+    private InvocationHandler invoker;
+
+    public SideEffectsInstance( List<InvocationHandler> sideEffects,
+                                SideEffectInvocationHandlerResult resultInvocationHandler,
+                                ProxyReferenceInvocationHandler proxyHandler,
+                                InvocationHandler invoker
+    )
+    {
+        this.sideEffects = sideEffects;
+        this.resultInvocationHandler = resultInvocationHandler;
+        this.proxyHandler = proxyHandler;
+        this.invoker = invoker;
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            Object result = invoker.invoke( proxy, method, args );
+            invokeSideEffects( proxy, method, args, result, null );
+            return result;
+        }
+        catch( Throwable throwable )
+        {
+            invokeSideEffects( proxy, method, args, null, throwable );
+            throw throwable;
+        }
+    }
+
+    private void invokeSideEffects( Object proxy,
+                                    Method method,
+                                    Object[] params,
+                                    Object result,
+                                    Throwable originalThrowable
+    )
+        throws Throwable
+    {
+        proxyHandler.setProxy( proxy );
+        resultInvocationHandler.setResult( result, originalThrowable );
+
+        try
+        {
+            for( InvocationHandler sideEffect : sideEffects )
+            {
+                try
+                {
+                    sideEffect.invoke( proxy, method, params );
+                }
+                catch( Throwable throwable )
+                {
+                    if( throwable != originalThrowable )
+                    {
+                        throwable.printStackTrace();
+                    }
+                }
+            }
+        }
+        finally
+        {
+            proxyHandler.clearProxy();
+            resultInvocationHandler.setResult( null, null );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsModel.java
new file mode 100644
index 0000000..73c910c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SideEffectsModel.java
@@ -0,0 +1,87 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.sideeffect.SideEffectsDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+
+/**
+ * JAVADOC
+ */
+public final class SideEffectsModel
+    implements SideEffectsDescriptor, Dependencies, VisitableHierarchy<Object, Object>
+{
+    public static final SideEffectsModel EMPTY_SIDEEFFECTS = new SideEffectsModel( Collections.<SideEffectModel>emptyList() );
+
+    private List<SideEffectModel> sideEffectModels = null;
+
+    public SideEffectsModel( List<SideEffectModel> sideEffectModels )
+    {
+        this.sideEffectModels = sideEffectModels;
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return sideEffectModels.stream().flatMap( Dependencies::dependencies );
+    }
+
+    // Context
+    public SideEffectsInstance newInstance( Method method, ModuleDescriptor module, InvocationHandler invoker )
+    {
+        ProxyReferenceInvocationHandler proxyHandler = new ProxyReferenceInvocationHandler();
+        SideEffectInvocationHandlerResult result = new SideEffectInvocationHandlerResult();
+        List<InvocationHandler> sideEffects = new ArrayList<InvocationHandler>( sideEffectModels.size() );
+        for( SideEffectModel sideEffectModel : sideEffectModels )
+        {
+            InvocationHandler sideEffect = sideEffectModel.newInstance( module, result, proxyHandler, method );
+            sideEffects.add( sideEffect );
+        }
+        return new SideEffectsInstance( sideEffects, result, proxyHandler, invoker );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( SideEffectModel sideEffectModel : sideEffectModels )
+            {
+                if( !sideEffectModel.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateModel.java
new file mode 100644
index 0000000..9995d1b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateModel.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.composite.StateDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.property.PropertiesModel;
+import org.apache.polygene.runtime.property.PropertyModel;
+
+/**
+ * Base model for Composite state
+ */
+public class StateModel
+    implements StateDescriptor, VisitableHierarchy<Object, Object>
+{
+    protected final PropertiesModel propertiesModel;
+
+    public StateModel( PropertiesModel propertiesModel )
+    {
+        this.propertiesModel = propertiesModel;
+    }
+
+    public PropertyModel propertyModelFor( AccessibleObject accessor )
+    {
+        return propertiesModel.getProperty( accessor );
+    }
+
+    @Override
+    public PropertyModel findPropertyModelByName( String name )
+        throws IllegalArgumentException
+    {
+        return propertiesModel.getPropertyByName( name );
+    }
+
+    @Override
+    public PropertyModel findPropertyModelByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        return propertiesModel.getPropertyByQualifiedName( name );
+    }
+
+    @Override
+    public Stream<PropertyModel> properties()
+    {
+        return propertiesModel.properties();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            ( (VisitableHierarchy<Object, Object>) propertiesModel ).accept( visitor );
+        }
+        return visitor.visitLeave( this );
+    }
+}


[17/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java
deleted file mode 100644
index 0892909..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/TestValue.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- */
-public interface TestValue
-    extends ValueComposite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java
deleted file mode 100644
index 71c6d03..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/LayeredApplicationAssemblerTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly;
-
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.bootstrap.AssemblyException;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class LayeredApplicationAssemblerTest
-{
-    @Test
-    public void validateThatAssemblerCreatesApplication()
-        throws AssemblyException, ActivationException
-    {
-        TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test );
-        assembler.initialize();
-        assembler.start();
-
-        assertThat( assembler.application().name(), equalTo("Test Application") );
-        assertThat( assembler.application().version(), equalTo("1.0.1") );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java
deleted file mode 100644
index 7e9c565..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/TestApplication.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly;
-
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.layered.LayeredApplicationAssembler;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.assembly.config.ConfigurationLayer;
-import org.apache.zest.bootstrap.assembly.connectivity.ConnectivityLayer;
-import org.apache.zest.bootstrap.assembly.domain.DomainLayer;
-import org.apache.zest.bootstrap.assembly.infrastructure.InfrastructureLayer;
-import org.apache.zest.bootstrap.assembly.service.ServiceLayer;
-
-// START SNIPPET: application
-public class TestApplication extends LayeredApplicationAssembler
-{
-
-    public TestApplication( String name, String version, Application.Mode mode )
-        throws AssemblyException
-    {
-        super( name, version, mode );
-    }
-
-    @Override
-    protected void assembleLayers( ApplicationAssembly assembly )
-        throws AssemblyException
-    {
-        LayerAssembly configLayer = createLayer( ConfigurationLayer.class );
-        ModuleAssembly configModule = configLayer.module( "Configuration Module" );
-        LayerAssembly infraLayer = new InfrastructureLayer( configModule ).assemble( assembly.layer( InfrastructureLayer.NAME  ));
-        LayerAssembly domainLayer = createLayer( DomainLayer.class );
-        LayerAssembly serviceLayer = createLayer( ServiceLayer.class );
-        LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );
-
-        connectivityLayer.uses( serviceLayer );
-        connectivityLayer.uses( domainLayer );
-        serviceLayer.uses( domainLayer );
-        domainLayer.uses( infraLayer );
-        infraLayer.uses( configLayer );
-    }
-}
-// END SNIPPET: application

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java
deleted file mode 100644
index b285088..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/config/ConfigurationLayer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.config;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.layered.LayerAssembler;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-public class ConfigurationLayer implements LayerAssembler
-{
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java
deleted file mode 100644
index 9e304bb..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/connectivity/ConnectivityLayer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.connectivity;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.layered.LayerAssembler;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-public class ConnectivityLayer implements LayerAssembler
-{
-    public static final String NAME = "Connectivity";
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java
deleted file mode 100644
index a2b7907..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/DomainLayer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.domain;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
-
-public class DomainLayer extends LayeredLayerAssembler
-{
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        createModule( layer, InvoicingModule.class );
-        createModule( layer, OrderModule.class );
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java
deleted file mode 100644
index 9ee5aab..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/InvoicingModule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.domain;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.ModuleAssembler;
-
-public class InvoicingModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java
deleted file mode 100644
index adf02c3..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/domain/OrderModule.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.domain;
-
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.ModuleAssembler;
-
-public class OrderModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.entities( Order.class, Customer.class );
-        module.values( Address.class );
-        return module;
-    }
-
-    public interface Order
-    {
-        Association<Customer> customer();
-
-        Property<Address> invoicingAddress();
-
-        Property<Address> deliveryAddress();
-    }
-
-    public interface Customer
-    {
-    }
-
-    public interface Address
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java
deleted file mode 100644
index b1f23f6..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/IndexingModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.infrastructure;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.ModuleAssembler;
-
-public class IndexingModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Indexing Module";
-    private final ModuleAssembly configModule;
-
-    public IndexingModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java
deleted file mode 100644
index 9b4cfe0..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/InfrastructureLayer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.infrastructure;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.LayerAssembler;
-import org.apache.zest.bootstrap.layered.LayeredLayerAssembler;
-
-public class InfrastructureLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Infrastructure Layer";
-    private final ModuleAssembly configModule;
-
-    public InfrastructureLayer( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        new StorageModule( configModule ).assemble( layer, layer.module( StorageModule.NAME ) );
-        new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );
-        createModule( layer, SerializationModule.class );
-        return layer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java
deleted file mode 100644
index ad7d8ae..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/SerializationModule.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.infrastructure;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.ModuleAssembler;
-
-public class SerializationModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module
-    )
-        throws AssemblyException
-    {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java
deleted file mode 100644
index 29e6697..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/infrastructure/StorageModule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.infrastructure;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.layered.ModuleAssembler;
-
-public class StorageModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Storage Module";
-    private final ModuleAssembly configModule;
-
-    public StorageModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java
deleted file mode 100644
index 45f126d..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/assembly/service/ServiceLayer.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.assembly.service;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.layered.LayerAssembler;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-public class ServiceLayer implements LayerAssembler
-{
-    public static final String NAME = "Service";
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java
deleted file mode 100644
index d6e9b39..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/builder/ApplicationBuilderTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.builder;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.json.JSONException;
-import org.junit.Test;
-
-import static java.util.stream.Collectors.toList;
-import static org.apache.zest.bootstrap.ClassScanner.findClasses;
-import static org.apache.zest.bootstrap.ClassScanner.matches;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class ApplicationBuilderTest
-{
-    @Test
-    public void givenBuilderUseWhenBuildingApplicationExpectSuccess()
-        throws AssemblyException, ActivationException
-    {
-        ApplicationBuilder builder = new ApplicationBuilder( "Build from API test." );
-        builder.withLayer( "layer1" ).using( "layer2" ).using( "layer3" );
-        builder.withLayer( "layer2" );
-        builder.withLayer( "layer3" )
-               .withModule( "test module" )
-               .withAssemblers( findClasses( getClass() ).filter( matches( ".*ServiceAssembler" ) )
-                                                         .collect( toList() ) );
-        Application application = builder.newApplication();
-        Module module = application.findModule( "layer3", "test module" );
-        TestService service = module.findService( TestService.class ).get();
-        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
-    }
-
-    @Test
-    public void givenJsonWhenBuildingApplicationExpectSuccess()
-        throws JSONException, ActivationException, AssemblyException
-    {
-        ApplicationBuilder builder = ApplicationBuilder.fromJson( APPLICATION );
-        Application application = builder.newApplication();
-        Module module = application.findModule( "layer3", "test module" );
-        TestService service = module.findService( TestService.class ).get();
-        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
-    }
-
-    @Test
-    public void givenJsonInputStreamWhenBuildingApplicationExpectSuccess()
-        throws IOException, JSONException, ActivationException, AssemblyException
-    {
-        InputStream input = new ByteArrayInputStream( APPLICATION.getBytes( "UTF-8" ) );
-        ApplicationBuilder builder = ApplicationBuilder.fromJson( input );
-        Application application = builder.newApplication();
-        Module module = application.findModule( "layer3", "test module" );
-        TestService service = module.findService( TestService.class ).get();
-        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
-    }
-
-
-    private static final String APPLICATION =
-        "{\n" +
-        "    \"name\": \"Build from JSON test.\",\n" +
-        "    \"layers\": [\n" +
-        "        {\n" +
-        "            \"name\": \"layer1\",\n" +
-        "            \"uses\": [ \"layer2\", \"layer3\"]\n" +
-        "        },\n" +
-        "        {\n" +
-        "            \"name\": \"layer2\"\n" +
-        "        },\n" +
-        "        {\n" +
-        "            \"name\": \"layer3\",\n" +
-        "            \"modules\" : [\n" +
-        "                {\n" +
-        "                    \"name\" : \"test module\",\n" +
-        "                    \"assemblers\" : [\n" +
-        "                            \"org.apache.zest.bootstrap.builder.ApplicationBuilderTest$TestServiceAssembler\"\n" +
-        "                    ]\n" +
-        "                }\n" +
-        "            ]\n" +
-        "        }\n" +
-        "    ]\n" +
-        "}";
-
-    public static class TestServiceAssembler
-        implements Assembler
-    {
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-            module.addServices( TestService.class );
-        }
-    }
-
-    @Mixins( TestService.TestMixin.class )
-    public interface TestService
-    {
-        String sayHello();
-
-        class TestMixin
-            implements TestService
-        {
-
-            @Override
-            public String sayHello()
-            {
-                return "Hello Polygene!";
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java
deleted file mode 100644
index 5503fc0..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/somepackage/Test2Value.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.somepackage;
-
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- */
-public interface Test2Value
-    extends ValueComposite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/docs/runtime.txt
----------------------------------------------------------------------
diff --git a/core/runtime/src/docs/runtime.txt b/core/runtime/src/docs/runtime.txt
index 6509299..6caaa4a 100644
--- a/core/runtime/src/docs/runtime.txt
+++ b/core/runtime/src/docs/runtime.txt
@@ -31,7 +31,7 @@ perhaps that a new Core SPI Extension is needed.
 include::../../build/docs/buildinfo/artifact.txt[]
 
 Let's repeat that; *Never, never, ever depend on Core Runtime*. Make sure that the compile dependency does NOT include
-the `org.apache.zest.core.runtime` jar.
+the `org.apache.polygene.core.runtime` jar.
 
 == Custom AssemblyHelper ==
 BUT, there are super-rare cases, where a custom AssemblyHelper might be needed. One known use-case is tp introduce

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
new file mode 100644
index 0000000..2a0be69
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
@@ -0,0 +1,360 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.AssociationWrapper;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.ManyAssociationWrapper;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.association.NamedAssociationWrapper;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.PropertyWrapper;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.ApplicationModelFactory;
+import org.apache.polygene.bootstrap.PolygeneRuntime;
+import org.apache.polygene.runtime.association.AbstractAssociationInstance;
+import org.apache.polygene.runtime.bootstrap.ApplicationAssemblyFactoryImpl;
+import org.apache.polygene.runtime.bootstrap.ApplicationModelFactoryImpl;
+import org.apache.polygene.runtime.composite.ProxyReferenceInvocationHandler;
+import org.apache.polygene.runtime.composite.TransientInstance;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.runtime.service.ImportedServiceReferenceInstance;
+import org.apache.polygene.runtime.service.ServiceInstance;
+import org.apache.polygene.runtime.service.ServiceReferenceInstance;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.value.ValueInstance;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.apache.polygene.spi.entity.EntityState;
+
+import static java.lang.reflect.Proxy.getInvocationHandler;
+import static org.apache.polygene.runtime.composite.TransientInstance.compositeInstanceOf;
+
+/**
+ * Incarnation of Polygene.
+ */
+public final class PolygeneRuntimeImpl
+    implements PolygeneSPI, PolygeneRuntime
+{
+    private final ApplicationAssemblyFactory applicationAssemblyFactory;
+    private final ApplicationModelFactory applicationModelFactory;
+
+    public PolygeneRuntimeImpl()
+    {
+        applicationAssemblyFactory = new ApplicationAssemblyFactoryImpl();
+        applicationModelFactory = new ApplicationModelFactoryImpl();
+    }
+
+    @Override
+    public ApplicationAssemblyFactory applicationAssemblyFactory()
+    {
+        return applicationAssemblyFactory;
+    }
+
+    @Override
+    public ApplicationModelFactory applicationModelFactory()
+    {
+        return applicationModelFactory;
+    }
+
+    @Override
+    public PolygeneAPI api()
+    {
+        return this;
+    }
+
+    @Override
+    public PolygeneSPI spi()
+    {
+        return this;
+    }
+
+    // API
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> T dereference( T composite )
+    {
+        InvocationHandler handler = getInvocationHandler( composite );
+        if( handler instanceof ProxyReferenceInvocationHandler )
+        {
+            return (T) ( (ProxyReferenceInvocationHandler) handler ).proxy();
+        }
+        if( handler instanceof CompositeInstance )
+        {
+            return composite;
+        }
+        return null;
+    }
+
+    @Override
+    public ModuleDescriptor moduleOf( Object compositeOrServiceReferenceOrUow )
+    {
+        if( compositeOrServiceReferenceOrUow instanceof TransientComposite )
+        {
+            TransientComposite composite = (TransientComposite) compositeOrServiceReferenceOrUow;
+            return TransientInstance.compositeInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof EntityComposite )
+        {
+            EntityComposite composite = (EntityComposite) compositeOrServiceReferenceOrUow;
+            return EntityInstance.entityInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ValueComposite )
+        {
+            ValueComposite composite = (ValueComposite) compositeOrServiceReferenceOrUow;
+            return ValueInstance.valueInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) compositeOrServiceReferenceOrUow;
+            InvocationHandler handler = getInvocationHandler( composite );
+            if( handler instanceof ServiceInstance )
+            {
+                return ( (ServiceInstance) handler ).module();
+            }
+            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof UnitOfWork )
+        {
+            ModuleUnitOfWork unitOfWork = (ModuleUnitOfWork) compositeOrServiceReferenceOrUow;
+            return unitOfWork.module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
+            return reference.module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ImportedServiceReferenceInstance )
+        {
+            ImportedServiceReferenceInstance<?> importedServiceReference
+                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
+            return importedServiceReference.module();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be one of "
+                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
+                                                             ServiceComposite.class, ServiceReference.class,
+                                                             UnitOfWork.class ) );
+    }
+
+    @Override
+    public ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference )
+    {
+        if( compositeOrServiceReference instanceof TransientComposite )
+        {
+            TransientComposite composite = (TransientComposite) compositeOrServiceReference;
+            return TransientInstance.compositeInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof EntityComposite )
+        {
+            EntityComposite composite = (EntityComposite) compositeOrServiceReference;
+            return EntityInstance.entityInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ValueComposite )
+        {
+            ValueComposite composite = (ValueComposite) compositeOrServiceReference;
+            return ValueInstance.valueInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) compositeOrServiceReference;
+            InvocationHandler handler = getInvocationHandler( composite );
+            if( handler instanceof ServiceInstance )
+            {
+                return ( (ServiceInstance) handler ).descriptor();
+            }
+            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReference;
+            return reference.serviceDescriptor();
+        }
+        else if( compositeOrServiceReference instanceof ImportedServiceReferenceInstance )
+        {
+            ImportedServiceReferenceInstance<?> importedServiceReference
+                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReference;
+            return importedServiceReference.serviceDescriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be one of "
+                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
+                                                             ServiceComposite.class, ServiceReference.class ) );
+    }
+
+    @Override
+    public CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference )
+    {
+        return (CompositeDescriptor) modelDescriptorFor( compositeOrServiceReference );
+    }
+
+    // Descriptors
+
+    @Override
+    public TransientDescriptor transientDescriptorFor( Object transsient )
+    {
+        if( transsient instanceof TransientComposite )
+        {
+            TransientInstance transientInstance = compositeInstanceOf( (Composite) transsient );
+            return (TransientDescriptor) transientInstance.descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + TransientComposite.class );
+    }
+
+    @Override
+    public StateHolder stateOf( TransientComposite composite )
+    {
+        return TransientInstance.compositeInstanceOf( composite ).state();
+    }
+
+    @Override
+    public EntityDescriptor entityDescriptorFor( Object entity )
+    {
+        if( entity instanceof EntityComposite )
+        {
+            EntityInstance entityInstance = (EntityInstance) getInvocationHandler( entity );
+            return entityInstance.entityModel();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + EntityComposite.class );
+    }
+
+    @Override
+    public AssociationStateHolder stateOf( EntityComposite composite )
+    {
+        return EntityInstance.entityInstanceOf( composite ).state();
+    }
+
+    @Override
+    public ValueDescriptor valueDescriptorFor( Object value )
+    {
+        if( value instanceof ValueComposite )
+        {
+            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
+            return valueInstance.descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + ValueComposite.class );
+    }
+
+    @Override
+    public AssociationStateHolder stateOf( ValueComposite composite )
+    {
+        return ValueInstance.valueInstanceOf( composite ).state();
+    }
+
+    @Override
+    public ServiceDescriptor serviceDescriptorFor( Object service )
+    {
+        if( service instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> ref = (ServiceReferenceInstance<?>) service;
+            return ref.serviceDescriptor();
+        }
+        if( service instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) service;
+            return (ServiceDescriptor) ServiceInstance.serviceInstanceOf( composite ).descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of "
+                                            + ServiceComposite.class + " or " + ServiceReference.class );
+    }
+
+    @Override
+    public PropertyDescriptor propertyDescriptorFor( Property<?> property )
+    {
+        while( property instanceof PropertyWrapper )
+        {
+            property = ( (PropertyWrapper) property ).next();
+        }
+
+        return (PropertyDescriptor) ( (PropertyInstance<?>) property ).propertyInfo();
+    }
+
+    @Override
+    public AssociationDescriptor associationDescriptorFor( AbstractAssociation association )
+    {
+        while( association instanceof AssociationWrapper )
+        {
+            association = ( (AssociationWrapper) association ).next();
+        }
+
+        while( association instanceof ManyAssociationWrapper )
+        {
+            association = ( (ManyAssociationWrapper) association ).next();
+        }
+
+        while( association instanceof NamedAssociationWrapper )
+        {
+            association = ( (NamedAssociationWrapper) association ).next();
+        }
+
+        return (AssociationDescriptor) ( (AbstractAssociationInstance) association ).associationInfo();
+    }
+
+    // SPI
+    @Override
+    public EntityState entityStateOf( EntityComposite composite )
+    {
+        return EntityInstance.entityInstanceOf( composite ).entityState();
+    }
+
+    @Override
+    public EntityReference entityReferenceOf( Association<?> assoc )
+    {
+        return assoc.reference();
+    }
+
+    @Override
+    public Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc )
+    {
+        return assoc.references();
+    }
+
+    @Override
+    public Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc )
+    {
+        return assoc.references();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationDelegate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationDelegate.java b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationDelegate.java
new file mode 100644
index 0000000..22b6c7b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationDelegate.java
@@ -0,0 +1,401 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.activation;
+
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEvent;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.service.ServiceReference;
+
+import static org.apache.polygene.api.activation.ActivationEvent.EventType.ACTIVATED;
+import static org.apache.polygene.api.activation.ActivationEvent.EventType.ACTIVATING;
+import static org.apache.polygene.api.activation.ActivationEvent.EventType.PASSIVATED;
+import static org.apache.polygene.api.activation.ActivationEvent.EventType.PASSIVATING;
+
+/**
+ * This class manage Activation of a target and propagates to children.
+ */
+@SuppressWarnings( "raw" )
+public final class ActivationDelegate
+    extends ActivationEventListenerSupport
+{
+    private final Object target;
+    private final boolean fireEvents;
+    private ActivatorsInstance targetActivators = null;
+    private final LinkedList<Activation> activeChildren = new LinkedList<>();
+
+    /**
+     * Create a new ActivationDelegate that will fire events.
+     * @param target target of Activation
+     */
+    public ActivationDelegate( Object target )
+    {
+        this( target, true );
+    }
+
+    /**
+     * Create a new ActivationDelegate.
+     * @param target target of Activation
+     * @param fireEvents if {@link ActivationEvent}s should be fired
+     */
+    public ActivationDelegate( Object target, boolean fireEvents )
+    {
+        super();
+        this.target = target;
+        this.fireEvents = fireEvents;
+    }
+
+    public void activate( ActivatorsInstance targetActivators, Activation child )
+        throws Exception
+    {
+        activate( targetActivators, Collections.singleton( child ), null );
+    }
+
+    public void activate( ActivatorsInstance targetActivators, Activation child, Runnable callback )
+        throws Exception
+    {
+        activate( targetActivators, Collections.singleton( child ), callback );
+    }
+
+    public void activate( ActivatorsInstance targetActivators, Iterable<? extends Activation> children )
+        throws ActivationException
+    {
+        activate( targetActivators, children, null );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public void activate( ActivatorsInstance targetActivators, Iterable<? extends Activation> children, Runnable callback )
+        throws ActivationException
+    {
+        if( this.targetActivators != null )
+        {
+            throw new IllegalStateException( "Activation.activate() called multiple times "
+                                             + "or without calling passivate() first!" );
+        }
+
+        try
+        {
+            // Before Activation Events
+            if( fireEvents )
+            {
+                fireEvent( new ActivationEvent( target, ACTIVATING ) );
+            }
+
+            // Before Activation for Activators
+            targetActivators.beforeActivation( target instanceof ServiceReference
+                                               ? new PassiveServiceReference( (ServiceReference) target )
+                                               : target );
+
+            // Activation
+            for( Activation child : children )
+            {
+                if( !activeChildren.contains( child ) )
+                {
+                    child.activate();
+                }
+                activeChildren.addFirst( child );
+            }
+
+            // Internal Activation Callback
+            if( callback != null )
+            {
+                callback.run();
+            }
+
+            // After Activation
+            targetActivators.afterActivation( target );
+
+            // After Activation Events
+            if( fireEvents )
+            {
+                fireEvent( new ActivationEvent( target, ACTIVATED ) );
+            }
+
+            // Activated
+            this.targetActivators = targetActivators;
+        }
+        catch( Exception e )
+        {
+            // Passivate actives
+            try
+            {
+                passivate();
+            }
+            catch( PassivationException e1 )
+            {
+                ActivationException activationEx = new ActivationException( "Unable to Activate application.", e );
+                activationEx.addSuppressed( e1 );
+                throw activationEx;
+            }
+            if( e instanceof ActivationException )
+            {
+                throw ( (ActivationException) e );
+            }
+            throw new ActivationException( "Unable to Activate application.", e );
+        }
+    }
+
+    public void passivate()
+        throws PassivationException
+    {
+        passivate( null );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public void passivate( Runnable callback )
+        throws PassivationException
+    {
+        Set<Exception> exceptions = new LinkedHashSet<>();
+
+        // Before Passivation Events
+        if( fireEvents )
+        {
+            ActivationEvent event = new ActivationEvent( target, PASSIVATING );
+            for( ActivationEventListener listener : listeners )
+            {
+                try
+                {
+                    listener.onEvent( event );
+                }
+                catch( Exception ex )
+                {
+                    if( ex instanceof PassivationException )
+                    {
+                        exceptions.addAll( ( (PassivationException) ex ).causes() );
+                    }
+                    else
+                    {
+                        exceptions.add( ex );
+                    }
+                }
+            }
+        }
+
+        // Before Passivation for Activators
+        if( targetActivators != null )
+        {
+            try
+            {
+                targetActivators.beforePassivation( target );
+            }
+            catch( PassivationException ex )
+            {
+                exceptions.addAll( ex.causes() );
+            }
+            catch( Exception ex )
+            {
+                exceptions.add( ex );
+            }
+        }
+
+        // Passivation
+        while( !activeChildren.isEmpty() )
+        {
+            passivateOneChild( exceptions );
+        }
+
+        // Internal Passivation Callback
+        if( callback != null )
+        {
+            try
+            {
+                callback.run();
+            }
+            catch( Exception ex )
+            {
+                exceptions.add( ex );
+            }
+        }
+
+        // After Passivation for Activators
+        if( targetActivators != null )
+        {
+            try
+            {
+                targetActivators.afterPassivation( target instanceof ServiceReference
+                                                   ? new PassiveServiceReference( (ServiceReference) target )
+                                                   : target );
+            }
+            catch( PassivationException ex )
+            {
+                exceptions.addAll( ex.causes() );
+            }
+            catch( Exception ex )
+            {
+                exceptions.add( ex );
+            }
+        }
+        targetActivators = null;
+
+        // After Passivation Events
+        if( fireEvents )
+        {
+            ActivationEvent event = new ActivationEvent( target, PASSIVATED );
+            for( ActivationEventListener listener : listeners )
+            {
+                try
+                {
+                    listener.onEvent( event );
+                }
+                catch( Exception ex )
+                {
+                    if( ex instanceof PassivationException )
+                    {
+                        exceptions.addAll( ( (PassivationException) ex ).causes() );
+                    }
+                    else
+                    {
+                        exceptions.add( ex );
+                    }
+                }
+            }
+        }
+
+        // Error handling
+        if( exceptions.isEmpty() )
+        {
+            return;
+        }
+        throw new PassivationException( exceptions );
+    }
+
+    @SuppressWarnings( "TooBroadCatch" )
+    private void passivateOneChild( Set<Exception> exceptions )
+    {
+        Activation activeChild = activeChildren.removeFirst();
+        try
+        {
+            activeChild.passivate();
+        }
+        catch( PassivationException ex )
+        {
+            exceptions.addAll( ex.causes() );
+        }
+        catch( Exception ex )
+        {
+            exceptions.add( ex );
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    private static class PassiveServiceReference
+        implements ServiceReference
+    {
+
+        private final ServiceReference reference;
+
+        private PassiveServiceReference( ServiceReference reference )
+        {
+            this.reference = reference;
+        }
+
+        @Override
+        public Identity identity()
+        {
+            return reference.identity();
+        }
+
+        @Override
+        public Object get()
+        {
+            throw new IllegalStateException( "Service is passive, either activating and"
+                                             + " cannot be used yet or passivating and cannot be used anymore." );
+        }
+
+        @Override
+        public boolean isActive()
+        {
+            return false;
+        }
+
+        @Override
+        public boolean isAvailable()
+        {
+            return false;
+        }
+
+        @Override
+        public ModelDescriptor model()
+        {
+            return reference.model();
+        }
+
+        @Override
+        public Stream<Class<?>> types()
+        {
+            return reference.types();
+        }
+
+        @Override
+        public <T> T metaInfo( Class<T> infoType )
+        {
+            return reference.metaInfo( infoType );
+        }
+
+        @Override
+        public void registerActivationEventListener( ActivationEventListener listener )
+        {
+            reference.registerActivationEventListener( listener );
+        }
+
+        @Override
+        public void deregisterActivationEventListener( ActivationEventListener listener )
+        {
+            reference.deregisterActivationEventListener( listener );
+        }
+
+        @Override
+        public int hashCode()
+        {
+            return identity().hashCode();
+        }
+
+        @Override
+        public boolean equals( Object obj )
+        {
+            if( obj == null )
+            {
+                return false;
+            }
+            if( getClass() != obj.getClass() )
+            {
+                return false;
+            }
+            final ServiceReference other = (ServiceReference) obj;
+            return identity().equals( other.identity() );
+        }
+
+        @Override
+        public String toString()
+        {
+            return reference.toString();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationEventListenerSupport.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationEventListenerSupport.java b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationEventListenerSupport.java
new file mode 100644
index 0000000..b844756
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivationEventListenerSupport.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.activation;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.activation.ActivationEvent;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+
+/**
+ * Internal helper for managing registrations and firing events
+ */
+/* package */ class ActivationEventListenerSupport
+    implements ActivationEventListenerRegistration, ActivationEventListener
+{
+    protected List<ActivationEventListener> listeners = new ArrayList<>();
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        List<ActivationEventListener> newListeners = new ArrayList<>();
+        newListeners.addAll( listeners );
+        newListeners.add( listener );
+        listeners = newListeners;
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        List<ActivationEventListener> newListeners = new ArrayList<>();
+        newListeners.addAll( listeners );
+        newListeners.remove( listener );
+        listeners = newListeners;
+    }
+
+    /* package */ void fireEvent( ActivationEvent event )
+        throws Exception
+    {
+        for( ActivationEventListener listener : listeners )
+        {
+            listener.onEvent( event );
+        }
+    }
+
+    @Override
+    public void onEvent( ActivationEvent event )
+        throws Exception
+    {
+        fireEvent( event );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorModel.java
new file mode 100644
index 0000000..72d957b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorModel.java
@@ -0,0 +1,110 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.activation;
+
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.activation.ActivatorDescriptor;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.composite.ConstructorsModel;
+import org.apache.polygene.runtime.injection.InjectedFieldsModel;
+import org.apache.polygene.runtime.injection.InjectedMethodsModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * Model for a single Activator.
+ *
+ * @param <ActivateeType> Type of the activation target
+ */
+public class ActivatorModel<ActivateeType>
+    implements ActivatorDescriptor, VisitableHierarchy<Object, Object>
+{
+    private final Class<? extends Activator<ActivateeType>> activatorType;
+    private final ConstructorsModel constructorsModel;
+    private final InjectedFieldsModel injectedFieldsModel;
+    private final InjectedMethodsModel injectedMethodsModel;
+
+    public ActivatorModel( Class<? extends Activator<ActivateeType>> activatorType )
+    {
+        this.activatorType = activatorType;
+        this.constructorsModel = new ConstructorsModel( activatorType );
+        this.injectedFieldsModel = new InjectedFieldsModel( activatorType );
+        this.injectedMethodsModel = new InjectedMethodsModel( activatorType );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( constructorsModel.accept( visitor ) )
+            {
+                if( injectedFieldsModel.accept( visitor ) )
+                {
+                    injectedMethodsModel.accept( visitor );
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Activator<ActivateeType> newInstance()
+    {
+        try
+        {
+            return activatorType.newInstance();
+        }
+        catch( InstantiationException | IllegalAccessException ex )
+        {
+            throw new ConstructionException( "Could not instantiate " + activatorType.getName(), ex );
+        }
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public Activator<ActivateeType> newInstance( InjectionContext injectionContext )
+    {
+        try
+        {
+            Activator<ActivateeType> instance = (Activator<ActivateeType>) constructorsModel.newInstance( injectionContext );
+            injectionContext = new InjectionContext( injectionContext.module(), injectionContext.uses(), instance );
+            inject( injectionContext, instance );
+            return instance;
+        }
+        catch( Exception ex )
+        {
+            throw new ConstructionException( "Could not instantiate " + activatorType.getName(), ex );
+        }
+    }
+
+    public void inject( InjectionContext injectionContext, Activator<ActivateeType> instance )
+    {
+        injectedFieldsModel.inject( injectionContext, instance );
+        injectedMethodsModel.inject( injectionContext, instance );
+    }
+
+    @Override
+    public String toString()
+    {
+        return activatorType.getName();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsInstance.java
new file mode 100644
index 0000000..26ef238
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsInstance.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.activation;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.stream.StreamSupport;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.activation.PassivationException;
+
+import static java.util.stream.Collectors.toCollection;
+
+/**
+ * Instance of a Polygene Activators of one Activation target. Contains ordered
+ * Activators and roll the Activation on the target.
+ *
+ * @param <ActivateeType> Type of the activation target
+ */
+public class ActivatorsInstance<ActivateeType>
+    implements Activator<ActivateeType>
+{
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public static final ActivatorsInstance EMPTY = new ActivatorsInstance( Collections.emptyList() );
+
+    private final Iterable<Activator<ActivateeType>> activators;
+
+    public ActivatorsInstance( Iterable<Activator<ActivateeType>> activators )
+    {
+        this.activators = activators;
+    }
+
+    @Override
+    public void beforeActivation( ActivateeType activating )
+        throws Exception
+    {
+        for( Activator<ActivateeType> activator : activators )
+        {
+            activator.beforeActivation( activating );
+        }
+    }
+
+    @Override
+    public void afterActivation( ActivateeType activated )
+        throws Exception
+    {
+        for( Activator<ActivateeType> activator : activators )
+        {
+            activator.afterActivation( activated );
+        }
+    }
+
+    @Override
+    public void beforePassivation( ActivateeType passivating )
+        throws Exception
+    {
+        Set<Exception> exceptions = new LinkedHashSet<>();
+        Iterator<Activator<ActivateeType>> iterator = reverseActivatorsIterator();
+        while( iterator.hasNext() )
+        {
+            Activator<ActivateeType> activator = iterator.next();
+            try
+            {
+                activator.beforePassivation( passivating );
+            }
+            catch( Exception ex )
+            {
+                exceptions.add( ex );
+            }
+        }
+        if( !exceptions.isEmpty() )
+        {
+            throw new PassivationException( exceptions );
+        }
+    }
+
+    @Override
+    public void afterPassivation( ActivateeType passivated )
+        throws Exception
+    {
+        Set<Exception> exceptions = new LinkedHashSet<>();
+        Iterator<Activator<ActivateeType>> iterator = reverseActivatorsIterator();
+        while( iterator.hasNext() )
+        {
+            Activator<ActivateeType> activator = iterator.next();
+            try
+            {
+                activator.afterPassivation( passivated );
+            }
+            catch( Exception ex )
+            {
+                exceptions.add( ex );
+            }
+        }
+        if( !exceptions.isEmpty() )
+        {
+            throw new PassivationException( exceptions );
+        }
+    }
+
+    private Iterator<Activator<ActivateeType>> reverseActivatorsIterator()
+    {
+        return StreamSupport.stream( activators.spliterator(), false )
+                            .collect( toCollection( LinkedList::new ) )
+                            .descendingIterator();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsModel.java
new file mode 100644
index 0000000..69b3800
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/activation/ActivatorsModel.java
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.activation;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * Activators Model.
+ *
+ * @param <ActivateeType> Type of the activation target
+ */
+public class ActivatorsModel<ActivateeType>
+    implements VisitableHierarchy<Object, Object>
+{
+
+    private final List<ActivatorModel<ActivateeType>> activatorModels = new ArrayList<>();
+    private final Iterable<Class<? extends Activator<ActivateeType>>> activatorsClasses;
+
+    public ActivatorsModel( Iterable<Class<? extends Activator<ActivateeType>>> activatorsClasses )
+    {
+        this.activatorsClasses = activatorsClasses;
+        for( Class<? extends Activator<ActivateeType>> activatorClass : activatorsClasses )
+        {
+            activatorModels.add( new ActivatorModel<>( activatorClass ) );
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
+            {
+                if( !activatorModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Iterable<ActivatorModel<ActivateeType>> models()
+    {
+        return activatorModels;
+    }
+
+    public Iterable<Activator<ActivateeType>> newInstances()
+        throws ActivationException
+    {
+        List<Activator<ActivateeType>> activators = new ArrayList<>();
+        for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
+        {
+            activators.add( activatorModel.newInstance() );
+        }
+        return activators;
+    }
+
+    public Iterable<Activator<ActivateeType>> newInstances( ModuleDescriptor module )
+        throws ActivationException
+    {
+        List<Activator<ActivateeType>> activators = new ArrayList<>();
+        for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
+        {
+            InjectionContext injectionContext = new InjectionContext( module, UsesInstance.EMPTY_USES );
+            activators.add( activatorModel.newInstance( injectionContext ) );
+        }
+        return activators;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/AbstractAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AbstractAssociationInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AbstractAssociationInstance.java
new file mode 100644
index 0000000..51106d3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AbstractAssociationInstance.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.Type;
+import java.util.function.BiFunction;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+
+/**
+ * Implementation of AbstractAssociation. Includes helper methods for subclasses
+ */
+public abstract class AbstractAssociationInstance<T>
+    implements AbstractAssociation
+{
+    protected AssociationInfo associationInfo;
+    private final BiFunction<EntityReference, Type, Object> entityFunction;
+
+    public AbstractAssociationInstance( AssociationInfo associationInfo,
+                                        BiFunction<EntityReference, Type, Object> entityFunction
+    )
+    {
+        this.associationInfo = associationInfo;
+        this.entityFunction = entityFunction;
+    }
+
+    public AssociationInfo associationInfo()
+    {
+        return associationInfo;
+    }
+
+    public void setAssociationInfo( AssociationInfo newInfo )
+    {
+        this.associationInfo = newInfo;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected T getEntity( EntityReference entityId )
+    {
+        if( entityId == null )
+        {
+            return null;
+        }
+
+        return (T) entityFunction.apply( entityId, associationInfo.type() );
+    }
+
+    protected EntityReference getEntityReference( Object composite )
+    {
+        if( composite == null )
+        {
+            return null;
+        }
+
+        return EntityReference.create(((HasIdentity) composite).identity().get());
+    }
+
+    protected void checkType( Object instance )
+    {
+
+        if( instance instanceof HasIdentity || instance == null )
+        {
+            return;
+        }
+        throw new IllegalArgumentException( "Object must be a subtype of org.apache.polygene.api.reference.Identity: " + instance.getClass() );
+    }
+
+    protected void checkImmutable()
+        throws IllegalStateException
+    {
+        if( associationInfo.isImmutable() )
+        {
+            throw new IllegalStateException( "Association [" + associationInfo.qualifiedName() + "] is immutable." );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInfo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInfo.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInfo.java
new file mode 100644
index 0000000..e5f7ac0
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInfo.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.Type;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.runtime.composite.ConstraintsCheck;
+
+/**
+ * TODO
+ */
+public interface AssociationInfo
+    extends ConstraintsCheck
+{
+    boolean isImmutable();
+
+    QualifiedName qualifiedName();
+
+    Type type();
+}


[48/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
deleted file mode 100644
index c2f9bfe..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/ZestExtension.groovy
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-
-@CompileStatic
-class PolygeneExtension
-{
-  private final Project project
-  final Core core
-
-  PolygeneExtension( Project project )
-  {
-    this.project = project
-    this.core = new Core()
-  }
-
-  boolean isDevelopmentVersion()
-  {
-    return project.version == '0' || project.version.toString().contains( 'SNAPSHOT' )
-  }
-
-  boolean isReleaseVersion()
-  {
-    return !isDevelopmentVersion()
-  }
-
-  class Core
-  {
-    Dependency api = core( 'api' )
-    Dependency spi = core( 'spi' )
-    Dependency runtime = core( 'runtime' )
-    Dependency bootstrap = core( 'bootstrap' )
-    Dependency testsupport = core( 'testsupport' )
-  }
-
-  private Dependency core( String name )
-  {
-    return dependency( 'org.apache.zest.core', "org.apache.zest.core.$name" )
-  }
-
-  Dependency library( String name )
-  {
-    return dependency( 'org.apache.zest.libraries', "org.apache.zest.library.$name" )
-  }
-
-  Dependency extension( String name )
-  {
-    return dependency( 'org.apache.zest.extensions', "org.apache.zest.extension.$name" )
-  }
-
-  Dependency tool( String name )
-  {
-    return dependency( 'org.apache.zest.tools', "org.apache.zest.tool.$name" )
-  }
-
-  private Dependency dependency( String group, String name )
-  {
-    project.dependencies.project( path: ":$group:$name" )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy
deleted file mode 100644
index 8a5570c..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationExtension.groovy
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.dependencies
-
-import groovy.transform.CompileStatic
-import org.gradle.api.artifacts.DependencySubstitution
-import org.gradle.api.artifacts.component.ModuleComponentSelector
-import org.gradle.internal.BiAction
-
-@CompileStatic
-class DependenciesDeclarationExtension
-{
-  final Map<String, String> repositoriesUrls = [ : ]
-  final Map<String, Object> libraries = [ : ]
-  final Map<String, List<Object>> defaultDependencies = [ : ]
-  BiAction<DependencySubstitution, ModuleComponentSelector> dependencySubstitutionSpec
-  final Map<String, String> buildToolsVersions = [ : ]
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy
deleted file mode 100644
index c04ca55..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesDeclarationPlugin.groovy
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.dependencies
-
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-
-class DependenciesDeclarationPlugin implements Plugin<Project>
-{
-  @Override
-  void apply( Project project )
-  {
-    project.extensions.create( 'dependenciesDeclaration', DependenciesDeclarationExtension )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy
deleted file mode 100644
index bd9efde..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dependencies/DependenciesPlugin.groovy
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.dependencies
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Action
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Configuration
-import org.gradle.api.artifacts.DependencySubstitution
-import org.gradle.api.artifacts.component.ModuleComponentSelector
-import org.gradle.api.artifacts.repositories.MavenArtifactRepository
-
-@CompileStatic
-class DependenciesPlugin implements Plugin<Project>
-{
-  @Override
-  void apply( final Project project )
-  {
-    def dependenciesDeclaration = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
-    applyRepositories( project, dependenciesDeclaration )
-    applyLibraries( project, dependenciesDeclaration )
-    applyDependencyResolutionRules( project, dependenciesDeclaration )
-    applyDefaultDependencies( project, dependenciesDeclaration )
-  }
-
-  private static void applyRepositories( Project project, DependenciesDeclarationExtension declaration )
-  {
-    declaration.repositoriesUrls.each { name, url ->
-      project.repositories.maven { MavenArtifactRepository repo ->
-        repo.name = name
-        repo.url = url
-      }
-    }
-  }
-
-  private static void applyLibraries( Project project, DependenciesDeclarationExtension declaration )
-  {
-    project.extensions.extraProperties.set 'libraries', declaration.libraries
-  }
-
-  private static void applyDependencyResolutionRules( Project project, DependenciesDeclarationExtension declaration )
-  {
-    project.configurations.all(
-      { Configuration configuration ->
-        configuration.resolutionStrategy.dependencySubstitution.all(
-          { DependencySubstitution dep ->
-            if( dep.requested instanceof ModuleComponentSelector )
-            {
-              def selector = dep.requested as ModuleComponentSelector
-              declaration.dependencySubstitutionSpec.execute dep, selector
-            }
-          } as Action<DependencySubstitution> )
-      } as Action<Configuration> )
-  }
-
-  private static void applyDefaultDependencies( Project project, DependenciesDeclarationExtension declaration )
-  {
-    declaration.defaultDependencies.each { String configuration, List<Object> dependencies ->
-      dependencies.each { dependency ->
-        if( dependency instanceof Collection )
-        {
-          dependency.each { subdep ->
-            project.dependencies.add( configuration, subdep )
-          }
-        }
-        else
-        {
-          project.dependencies.add( configuration, dependency )
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy
deleted file mode 100644
index 6d45427..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/DistributionPlugin.groovy
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.dist
-
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-import org.apache.rat.gradle.RatTask
-import org.apache.tools.ant.filters.ReplaceTokens
-import org.apache.zest.gradle.RootProjectPlugin
-import org.apache.zest.gradle.TaskGroups
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.apache.zest.gradle.release.ReleaseSpecPlugin
-import org.gradle.api.Action
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.file.CopySpec
-import org.gradle.api.file.FileCopyDetails
-import org.gradle.api.tasks.Copy
-import org.gradle.api.tasks.GradleBuild
-import org.gradle.api.tasks.bundling.Compression
-import org.gradle.api.tasks.bundling.Tar
-import org.gradle.api.tasks.bundling.Zip
-
-@CompileStatic
-class DistributionPlugin implements Plugin<Project>
-{
-  static class TaskNames
-  {
-    static final String UNPACK_SOURCE_DIST = 'unpackSrcDist'
-    static final String UNPACK_BINARY_DIST = 'unpackBinDist'
-    static final String CHECK_SOURCE_DIST = 'checkSrcDist'
-    static final String CHECK_BINARY_DIST = 'checkBinDist'
-    static final String CHECK_BINARY_DIST_RAT = 'checkBinDist_rat'
-    static final String GENERATE_MAVEN_OFFLINE_HELPERS = 'generateMavenGoOfflineHelpers'
-    static final String GENERATE_GRADLE_OFFLINE_HELPERS = 'generateGradleGoOfflineHelpers'
-    static final String CHECK_MAVEN_OFFLINE_HELPERS = 'checkMavenGoOfflineHelpers'
-    static final String CHECK_GRADLE_OFFLINE_HELPERS = 'checkGradleGoOfflineHelpers'
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    configureSourceDistribution( project )
-    configureBinaryDistribution( project )
-    configureDistributionChecksums( project )
-    configureHelperTasks( project )
-  }
-
-  private static void configureSourceDistribution( Project project )
-  {
-    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
-    def srcDistFilesCopySpec = project.copySpec { CopySpec spec ->
-      spec.from '.'
-      spec.include '*.txt'
-      spec.include 'doap.rdf'
-      spec.include '*.gradle'
-      spec.include 'gradlew*'
-      spec.include 'gradle/**'
-      spec.include 'etc/**'
-      spec.include 'buildSrc/**'
-      spec.include 'src/**'
-      releaseSpec.approvedProjects.each { p ->
-        def relPath = new File( project.projectDir.toURI().relativize( p.projectDir.toURI() ).toString() )
-        spec.include "$relPath/**"
-      }
-      spec.include 'manual/**'
-      spec.include 'samples/**'
-      spec.include 'tests/**'
-      spec.include 'tutorials/**'
-      spec.include 'tools/shell/**'
-      // Filtered, see below
-      spec.exclude 'settings.gradle'
-      spec.exclude 'gradle.properties'
-      // Excludes
-      spec.exclude '**/build/**'             // Build output
-      spec.exclude 'derby.log'               // Derby test garbage
-      spec.exclude '**/*.iml'                // IDEA files
-      spec.exclude '**/*.ipr'                // IDEA files
-      spec.exclude '**/*.iws'                // IDEA files
-      spec.exclude '**/.idea'                // IDEA files
-      spec.exclude '**/out/**'               // IDEA build output
-      spec.exclude '**/.classpath'           // Eclipse files
-      spec.exclude '**/.project'             // Eclipse files
-      spec.exclude '**/.settings'            // Eclipse files
-      spec.exclude '**/.nb-gradle/**'        // Netbeans files
-      spec.exclude '**/.nb-gradle*'          // Netbeans files
-      spec.exclude '**/.git/**'              // Git directories
-      spec.exclude '**/.git*'                // Git files
-      spec.exclude '**/.gradle/**'           // Gradle management files
-      spec.exclude '**/.gradletasknamecache' // Gradle cache
-      spec.into '.'
-    }
-    def srcDistFilteredFilesTask = project.tasks.create( 'srcDistFilteredFiles' )
-    srcDistFilteredFilesTask.description = 'Apply release specification to source distribution build scripts'
-    // Generates various files for the source distribution
-    // - settings.gradle
-    // - gradle.properties to set version !
-    def filteredDir = new File( "$project.buildDir/tmp/srcDistFilteredFiles" )
-    srcDistFilteredFilesTask.outputs.file filteredDir
-    srcDistFilteredFilesTask.doLast {
-      // Settings
-      def settingsFile = new File( filteredDir, 'settings.gradle' )
-      settingsFile.parentFile.mkdirs()
-      def filteredSettings = ''
-      project.file( 'settings.gradle' ).readLines().each { line ->
-        if( line.contains( '\'libraries:' ) || line.contains( '\'extensions:' ) || line.contains( '\'tools:' ) )
-        {
-          def accepted = false
-          releaseSpec.approvedProjects.collect { it.projectDir }.each { acceptedProjectDir ->
-            if( line.contains( "'${ acceptedProjectDir.parentFile.name }:${ acceptedProjectDir.name }'" ) )
-            {
-              accepted = true
-            }
-          }
-          if( accepted )
-          {
-            filteredSettings += "$line\n"
-          }
-        }
-        else
-        {
-          filteredSettings += "$line\n"
-        }
-      }
-      settingsFile.text = filteredSettings
-      // gradle.properties
-      def gradlePropsFile = new File( filteredDir, 'gradle.properties' )
-      gradlePropsFile.parentFile.mkdirs()
-      gradlePropsFile.text = project.file( 'gradle.properties' ).text +
-                             "\nskipSigning=true\nskipAsciidocIfAbsent=true\n\nversion=$project.version\n"
-    }
-    def srcDistFilteredFilesCopySpec = project.copySpec { CopySpec spec ->
-      spec.from srcDistFilteredFilesTask
-      spec.into '.'
-    }
-    def srcDistCopySpec = project.copySpec { CopySpec spec ->
-      spec.into "apache-zest-java-$project.version-src"
-      spec.with srcDistFilesCopySpec
-      spec.with srcDistFilteredFilesCopySpec
-    }
-
-    def zipSources = project.tasks.create( 'zipSources', Zip ) { Zip task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = 'Assemble .zip source distribution'
-      task.baseName = 'apache-zest-java'
-      task.with srcDistCopySpec
-      task.classifier = 'src'
-    }
-    def tarSources = project.tasks.create( 'tarSources', Tar ) { Tar task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = 'Assemble .tar.gz source distribution'
-      task.baseName = 'apache-zest-java'
-      task.with srcDistCopySpec
-      task.compression = Compression.GZIP
-      task.classifier = 'src'
-    }
-    project.artifacts.add( 'archives', zipSources )
-    project.artifacts.add( 'archives', tarSources )
-
-    project.tasks.create( TaskNames.UNPACK_SOURCE_DIST, Copy ) { Copy task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = "Unpack source distribution"
-      task.with srcDistCopySpec
-      task.into 'build/unpacked-distributions/src'
-    }
-
-    def unpackedSrcDistDir = project.file( "build/unpacked-distributions/src/apache-zest-java-$project.version-src" )
-    project.tasks.create( TaskNames.CHECK_SOURCE_DIST, GradleBuild.class, { GradleBuild task ->
-      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
-      task.description = "Check the source distribution by running the 'check' and 'assemble' tasks inside"
-      task.dependsOn TaskNames.UNPACK_SOURCE_DIST
-      task.buildFile = "$unpackedSrcDistDir/build.gradle"
-      task.tasks = [ 'check', 'assemble' ]
-    } as Action<GradleBuild> )
-  }
-
-  private static void configureBinaryDistribution( Project project )
-  {
-    configureGoOfflineHelpers( project )
-
-    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
-    def reportsDistCopySpec = project.copySpec { CopySpec spec ->
-      spec.from "$project.buildDir/reports"
-      spec.into 'docs/reports'
-    }
-    def docsCopySpec = project.copySpec { CopySpec spec ->
-      spec.from 'build/docs'
-      spec.from 'manual/build/docs/website'
-      spec.into 'docs'
-    }
-    def runtimeDependenciesListCopySpec = project.copySpec { CopySpec spec ->
-      releaseSpec.approvedProjects.collect { p ->
-        spec.into( 'libs/' ) { CopySpec sub ->
-          sub.from "$p.buildDir/reports/project/dependencies.txt"
-          sub.rename 'dependencies.txt', "${ p.name }-${ p.version }-runtime-deps.txt"
-        }
-      }
-      spec.into( '.' ) { CopySpec sub ->
-        sub.from project.tasks.getByName( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS ).outputs
-        sub.from project.tasks.getByName( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS ).outputs
-      }
-    }
-    def libsCopySpec = project.copySpec { CopySpec spec ->
-      releaseSpec.approvedProjects.collect { proj ->
-        spec.into( 'libs/' ) { CopySpec sub ->
-          sub.from proj.configurations.getByName( 'archives' ).artifacts.files
-          sub.exclude '**-testsources.jar'
-          sub.exclude '**/*.asc'
-        }
-      }
-    }
-    def extraDistTextCopySpec = project.copySpec { CopySpec spec ->
-      releaseSpec.approvedProjects.collect { p ->
-        spec.from project.fileTree( dir: "$p.projectDir/src/dist/", include: '**', exclude: "**/*.jar*" )
-        spec.eachFile { FileCopyDetails fcd ->
-          fcd.filter( ReplaceTokens, tokens: [ version: project.version ] )
-        }
-      }
-      spec.into '.'
-    }
-    def extraDistBinCopySpec = project.copySpec { CopySpec spec ->
-      releaseSpec.approvedProjects.collect { p ->
-        spec.from "$p.projectDir/src/dist/"
-        spec.include '**/*.jar'
-        spec.include '**/*.jar_'
-      }
-      spec.into '.'
-    }
-    def binDistNoticesCopySpec = project.copySpec { CopySpec spec ->
-      spec.from "$project.projectDir/LICENSE.txt"
-      spec.from "$project.projectDir/src/bin-dist"
-      spec.into '.'
-    }
-    def binDistImage = project.copySpec { CopySpec spec ->
-      spec.into "apache-zest-java-$project.version-bin"
-      spec.with binDistNoticesCopySpec
-      spec.with docsCopySpec
-      spec.with reportsDistCopySpec
-      spec.with runtimeDependenciesListCopySpec
-      spec.with extraDistTextCopySpec
-      spec.with extraDistBinCopySpec
-      spec.with libsCopySpec
-    }
-
-    def zipBinaries = project.tasks.create( 'zipBinaries', Zip ) { Zip task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = 'Assemble .zip binary distribution'
-      task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
-      task.baseName = 'apache-zest-java'
-      task.classifier = 'bin'
-      task.with binDistImage
-    }
-    def tarBinaries = project.tasks.create( 'tarBinaries', Tar ) { Tar task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = 'Assemble .tar.gz binary distribution'
-      task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
-      task.baseName = 'apache-zest-java'
-      task.classifier = 'bin'
-      task.compression = Compression.GZIP
-      task.with binDistImage
-    }
-    project.artifacts.add( 'archives', zipBinaries )
-    project.artifacts.add( 'archives', tarBinaries )
-
-    project.tasks.create( TaskNames.UNPACK_BINARY_DIST, Copy ) { Copy task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = "Unpack binary distribution"
-      task.with binDistImage
-      task.into 'build/unpacked-distributions/bin'
-    }
-
-    configureBinaryDistributionCheck( project )
-  }
-
-  private static void configureGoOfflineHelpers( Project project )
-  {
-    def externalRepos = project.rootProject.extensions.getByType( DependenciesDeclarationExtension ).repositoriesUrls
-    def approvedProjectsTask = project.tasks.getByName( ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS )
-    def genOfflineMaven = project.tasks.create( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS,
-                                                GoOfflineHelpersTasks.GenerateMaven )
-    def genOfflineGradle = project.tasks.create( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS,
-                                                 GoOfflineHelpersTasks.GenerateGradle )
-    genOfflineMaven.repositories = externalRepos
-    genOfflineGradle.repositories = externalRepos
-    [ genOfflineMaven, genOfflineGradle ].each { task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.dependsOn approvedProjectsTask
-    }
-    def checkOfflineMaven = project.tasks.create( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS,
-                                                  GoOfflineHelpersTasks.CheckMaven )
-    checkOfflineMaven.group = TaskGroups.DISTRIBUTION_VERIFICATION
-    checkOfflineMaven.description = 'Check binary distribution Maven dependencies download helper'
-    checkOfflineMaven.dependsOn genOfflineMaven
-    def checkOfflineGradle = project.tasks.create( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS,
-                                                   GoOfflineHelpersTasks.CheckGradle )
-    checkOfflineGradle.group = TaskGroups.DISTRIBUTION_VERIFICATION
-    checkOfflineGradle.description = 'Check binary distribution Gradle dependencies download helper'
-    checkOfflineGradle.dependsOn genOfflineGradle
-    [ checkOfflineMaven, checkOfflineGradle ].each { task ->
-      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
-      task.dependsOn TaskNames.UNPACK_BINARY_DIST
-    }
-  }
-
-  private static void configureBinaryDistributionCheck( Project project )
-  {
-    def unpackedBinDistDir = project.file( "build/unpacked-distributions/bin/apache-zest-java-$project.version-bin" )
-    project.tasks.create( TaskNames.CHECK_BINARY_DIST_RAT, RatTask, { RatTask task ->
-      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
-      task.description = "Checks binary distribution using Apache RAT"
-      task.dependsOn TaskNames.UNPACK_BINARY_DIST
-      task.inputDir = unpackedBinDistDir.absolutePath
-      task.reportDir = project.file( 'build/reports/rat-bin-dist' )
-      task.excludes = [
-        '.gradle/**',
-        'docs/reports/**',
-        'docs/javadocs/**',
-        'etc/templates/**',
-        'libs/**'
-      ]
-    } as Action<RatTask> )
-    project.tasks.getByName( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckMaven task ->
-      task.directory = unpackedBinDistDir
-    }
-    project.tasks.getByName( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckGradle task ->
-      task.directory = unpackedBinDistDir
-      task.mustRunAfter TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
-    }
-    project.tasks.create( TaskNames.CHECK_BINARY_DIST ) { Task task ->
-      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
-      task.description = 'Checks binary distribution'
-      task.dependsOn TaskNames.CHECK_BINARY_DIST_RAT
-      task.dependsOn TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
-      task.dependsOn TaskNames.CHECK_GRADLE_OFFLINE_HELPERS
-    }
-  }
-
-  @CompileStatic( TypeCheckingMode.SKIP )
-  private static void configureDistributionChecksums( Project project )
-  {
-    project.tasks.withType( Zip ) { Zip task ->
-      task.doLast {
-        project.ant.checksum file: task.archivePath, algorithm: 'MD5'
-        project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
-      }
-    }
-    project.tasks.withType( Tar ) { Tar task ->
-      task.doLast {
-        project.ant.checksum file: task.archivePath, algorithm: 'MD5'
-        project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
-      }
-    }
-  }
-
-  private static void configureHelperTasks( Project project )
-  {
-    project.tasks.create( 'dist', Copy ) { Copy task ->
-      task.group = TaskGroups.DISTRIBUTION
-      task.description = "Assembles source and binary distributions"
-      task.dependsOn 'install'
-      task.from project.tasks.getByName( 'unpackBinDist' )
-      task.into "$project.buildDir/dist"
-    }
-    project.tasks.create( 'checkDists' ) { Task task ->
-      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
-      task.description = "Checks source and binary distributions"
-      task.dependsOn TaskNames.CHECK_SOURCE_DIST, TaskNames.CHECK_BINARY_DIST
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/GoOfflineHelpersTasks.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/GoOfflineHelpersTasks.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/GoOfflineHelpersTasks.groovy
deleted file mode 100644
index 8ff7540..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/dist/GoOfflineHelpersTasks.groovy
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.dist
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.apache.zest.gradle.tasks.ExecLogged
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-import org.gradle.api.artifacts.ProjectDependency
-import org.gradle.api.artifacts.result.ResolvedComponentResult
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.process.ExecSpec
-
-/**
- * Tasks to generate and check go-offline maven and gradle helpers bundled with the binary distribution.
- */
-@CompileStatic
-interface GoOfflineHelpersTasks
-{
-  class GenerateMaven extends DefaultTask
-  {
-    static final String POM_FILENAME = 'go-offline.pom'
-
-    @Input
-    Map<String, String> repositories = [ : ]
-
-    @Internal
-    File outputDir = new File( project.buildDir, 'go-offline-helpers' )
-
-    @OutputFile
-    File getMavenGoOfflineHelper()
-    {
-      return new File( outputDir, POM_FILENAME )
-    }
-
-    GenerateMaven()
-    {
-      super();
-      outputs.upToDateWhen { false }
-    }
-
-    @TaskAction
-    void generate()
-    {
-      outputDir.mkdirs()
-      def components = Utils.resolveAllRuntimeComponents( project )
-      def maven = generateMaven( components )
-      mavenGoOfflineHelper.text = maven
-    }
-
-    private String generateMaven( Set<ResolvedComponentResult> components )
-    {
-      def pom = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'xml' )
-      pom += '<project>\n  <modelVersion>4.0.0</modelVersion>\n'
-      pom +=
-        "  <groupId>org.apache.zest</groupId>\n  <artifactId>go-offline-helper</artifactId>\n  <version>$project.version</version>\n"
-      pom += '  <packaging>pom</packaging>\n'
-      pom +=
-        '  <!--\n  This pom has the sole purpose of downloading all dependencies in a directory relative to this file named \'dependencies\'.\n'
-      pom += "  Use the following command:\n\n  mvn -f $POM_FILENAME validate\n  -->\n  <repositories>\n"
-      repositories.entrySet().each { repo ->
-        pom += "    <repository><id>go-offline-repo-$repo.key</id><url>${ repo.value }</url></repository>\n"
-      }
-      pom += '  </repositories>\n  <dependencies>\n'
-      components.each { comp ->
-        pom += '    <dependency>\n'
-        pom += "      <groupId>$comp.moduleVersion.group</groupId>\n"
-        pom += "      <artifactId>$comp.moduleVersion.name</artifactId>\n"
-        pom += "      <version>$comp.moduleVersion.version</version>\n"
-        pom += '    </dependency>\n'
-      }
-      pom += """  </dependencies>\n  <build><plugins><plugin>
-    <groupId>org.apache.maven.plugins</groupId>
-    <artifactId>maven-dependency-plugin</artifactId>
-    <version>2.10</version>
-    <executions>
-      <execution>
-        <id>go-offline-jars</id><phase>validate</phase>
-        <goals><goal>copy-dependencies</goal></goals>
-        <configuration>
-          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
-          <excludeTransitive>true</excludeTransitive>
-        </configuration>
-      </execution>
-      <execution>
-        <id>go-offline-sources</id><phase>validate</phase>
-        <goals><goal>copy-dependencies</goal></goals>
-        <configuration>
-          <classifier>sources</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
-          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
-          <excludeTransitive>true</excludeTransitive>
-        </configuration>
-      </execution>
-      <execution>
-        <id>go-offline-javadocs</id><phase>validate</phase>
-        <goals><goal>copy-dependencies</goal></goals>
-        <configuration>
-          <classifier>javadoc</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
-          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
-          <excludeTransitive>true</excludeTransitive>
-        </configuration>
-      </execution>
-    </executions>
-  </plugin></plugins></build>
-</project>
-"""
-      return pom
-    }
-  }
-
-  class GenerateGradle extends DefaultTask
-  {
-    static final String BUILD_SCRIPT_FILENAME = 'go-offline.gradle'
-
-    @Input
-    Map<String, String> repositories = [ : ]
-
-    @Internal
-    File outputDir = new File( project.buildDir, 'go-offline-helpers' )
-
-    @OutputFile
-    File getGradleGoOfflineHelper()
-    {
-      return new File( outputDir, BUILD_SCRIPT_FILENAME )
-    }
-
-    GenerateGradle()
-    {
-      super();
-      outputs.upToDateWhen { false }
-    }
-
-    @TaskAction
-    void generate()
-    {
-      outputDir.mkdirs()
-      def components = Utils.resolveAllRuntimeComponents( project )
-      def gradle = generateGradle( components )
-      gradleGoOfflineHelper.text = gradle
-    }
-
-    private String generateGradle( Set<ResolvedComponentResult> components )
-    {
-      def build = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'java' )
-      build += '// This gradle build file has the sole purpose of downloading all dependencies in a directory\n'
-      build += '// relative to this file named \'dependencies\'.\n'
-      build += "// Use the following command: gradle -b $BUILD_SCRIPT_FILENAME download\n"
-      build += 'apply plugin: \'java\'\nconfigurations { download }\nrepositories {\n'
-      repositories.entrySet().each { repo ->
-        build += "  maven { url '${ repo.value }' }\n"
-      }
-      build += '}\ndependencies {\n'
-      components.each { comp ->
-        def depCoords = "${ comp.moduleVersion.group }:${ comp.moduleVersion.name }:${ comp.moduleVersion.version }"
-        build += "  download( '$depCoords' ) { transitive = false }\n"
-      }
-      build += """}
-task download( type: Copy ) {
-  outputs.upToDateWhen { false }
-  def sources = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
-    project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'sources' ] )
-  }
-  def javadocs = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
-    project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'javadoc' ] )
-  }
-  from configurations.download
-  from configurations.detachedConfiguration( sources as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
-  from configurations.detachedConfiguration( javadocs as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
-  into file( 'dependencies/' )
-}
-"""
-      return build
-    }
-  }
-
-  class CheckMaven extends DefaultTask
-  {
-    @Internal
-    File directory
-
-    @InputFile
-    File getMavenGoOfflineHelper()
-    {
-      return new File( directory, GenerateMaven.POM_FILENAME )
-    }
-
-    CheckMaven()
-    {
-      super();
-      description = 'Check the binary distribution Maven go-offline helper'
-      outputs.upToDateWhen { false }
-      onlyIf { Utils.isMvnInstalled() }
-    }
-
-    @TaskAction
-    void check()
-    {
-      def dependenciesDir = new File( directory, 'dependencies' )
-      project.delete dependenciesDir
-      def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
-      def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
-      def command = [ 'mvn', '-e', '-f', GenerateMaven.POM_FILENAME, 'validate' ] as Object[]
-      ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
-        spec.workingDir directory
-        spec.commandLine command
-      }
-      Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateMaven.POM_FILENAME )
-    }
-  }
-
-  class CheckGradle extends DefaultTask
-  {
-    @Internal
-    File directory
-
-    @InputFile
-    File getGradleGoOfflineHelper()
-    {
-      return new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
-    }
-
-    CheckGradle()
-    {
-      super();
-      description = 'Check the binary distribution Gradle go-offline helper'
-      outputs.upToDateWhen { false }
-    }
-
-    @TaskAction
-    void check()
-    {
-      def buildScript = new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
-      def dependenciesDir = new File( directory, 'dependencies' )
-      project.delete dependenciesDir
-      def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
-      def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
-      ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
-        spec.workingDir project.projectDir
-        spec.commandLine './gradlew', '-u', '-s', '-b', buildScript.absolutePath, 'download'
-      }
-      Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateGradle.BUILD_SCRIPT_FILENAME )
-    }
-  }
-
-  static class Utils
-  {
-    // Do the global dependency resolution here so there won't be any surprise when using the helpers
-    // This also allow to apply the resolution strategy defined in libraries.gradle
-    // WARN some of our modules depends on != versions of some artifacts, this resolution flatten this using the most up to date
-    private static Set<ResolvedComponentResult> resolveAllRuntimeComponents( Project rootProject )
-    {
-      def allRuntimeDeps = getAllRuntimeDependencies( rootProject )
-      def configuration = rootProject.configurations.findByName( 'goOfflineHelpers' )
-      if( !configuration )
-      {
-        configuration = rootProject.configurations.create( 'goOfflineHelpers' )
-        allRuntimeDeps.each { set -> rootProject.dependencies.add( configuration.name, set ) }
-      }
-      return configuration.incoming.resolutionResult.allComponents.findAll { ResolvedComponentResult comp ->
-        !comp.moduleVersion.group.startsWith( 'org.apache.zest' )
-      } as Set<ResolvedComponentResult>
-    }
-
-    private static List<Dependency> getAllRuntimeDependencies( Project rootProject )
-    {
-      def releaseSpec = rootProject.extensions.getByType( ReleaseSpecExtension )
-      def allDependencies = releaseSpec.approvedProjects.collect { project ->
-        project.configurations.getByName( 'runtime' ).allDependencies
-      }.flatten() as List<Dependency>
-      return allDependencies.findAll { Dependency dep ->
-        !( dep instanceof ProjectDependency ) && dep.name != null && !dep.group.startsWith( 'org.apache.zest' )
-      }
-    }
-
-    private static void checkAllJarsArePresent( Project rootProject, File dependenciesDir, String helper )
-    {
-      def allDependencies = getAllRuntimeDependencies( rootProject )
-      allDependencies.each { Dependency dep ->
-        def jarName = "${ dep.name }-${ dep.version }.jar"
-        def jarFile = new File( dependenciesDir, jarName )
-        if( !jarFile.exists() )
-        {
-          throw new GradleException( "Binary distribution $helper failed!\n" +
-                                     "\tMissing: $dep\n" +
-                                     "\tin $jarFile" );
-        }
-      }
-    }
-
-    private static boolean isMvnInstalled()
-    {
-      def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
-      def flattened = pathDirs.collect( { String pathDir -> new File( pathDir, 'mvn' ) } ).flatten() as List<File>
-      return flattened.find( { File pathDir -> pathDir.isFile() } ) != null
-    }
-
-    // Generate license headers with comment styles
-    private static String licenseHeader( String base, String flavour )
-    {
-      def header
-      switch( flavour )
-      {
-        case 'java': case 'groovy': case 'js':
-          header = licenseHeader_wrap( base, '/*', ' * ', ' */' ); break
-        case 'xml': case 'html':
-          header = licenseHeader_wrap( base, '<!--', '  ', '-->' ); break
-        case 'txt': case 'shell': case 'python': case 'ruby':
-          header = licenseHeader_wrap( base, null, '# ', null ); break
-        case 'adoc': case 'asciidoc':
-          header = licenseHeader_wrap( base, null, '// ', null ); break
-        default:
-          header = base
-      }
-      header
-    }
-
-    private static String licenseHeader_wrap( String base, String top, String left, String bottom )
-    {
-      ( top ? "$top\n" : '' ) + base.readLines().collect { "${ left }${ it }" }.join( '\n' ) + '\n' +
-      ( bottom ? "$bottom\n" : '' )
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
deleted file mode 100644
index 324c196..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/AsciidocBuildInfoPlugin.groovy
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.doc
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.TaskGroups
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-
-@CompileStatic
-class AsciidocBuildInfoPlugin implements Plugin<Project>
-{
-  final static String TASK_NAME = 'makeAsciidocBuildInfo'
-
-  def void apply( Project project )
-  {
-    def buildInfoDir = new File( project.buildDir, "docs/buildinfo" );
-
-    def makeAsciidocBuildInfoTask = project.tasks.create( TASK_NAME )
-    makeAsciidocBuildInfoTask.group = TaskGroups.DOCUMENTATION
-    makeAsciidocBuildInfoTask.description = 'Generates asciidoc artifact snippet'
-    makeAsciidocBuildInfoTask.doLast {
-      buildInfoDir.mkdirs()
-
-      // GroupID, ArtifactID, Version table in artifact.txt
-      def artifactTableFile = new File( buildInfoDir, "artifact.txt" )
-      def artifactTable = """
-        |.Artifact
-        |[role="artifact", options="header,autowidth"]
-        ||===================================================
-        ||Group ID|Artifact ID|Version
-        ||${ project.group }|${ project.name }|${ project.version }
-        ||===================================================
-        """.stripMargin()
-      artifactTableFile.withWriter { out -> out.println( artifactTable ) }
-    }
-
-    // Declare inputs/outputs
-    if( project.getBuildFile() != null && project.getBuildFile().exists() )
-    {
-      makeAsciidocBuildInfoTask.getInputs().file( project.getBuildFile() )
-    }
-    makeAsciidocBuildInfoTask.getOutputs().file( buildInfoDir )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
deleted file mode 100644
index 31e2cc8..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/DocumentationTask.groovy
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.doc
-
-import groovy.io.FileType
-import groovy.transform.CompileStatic
-import groovy.transform.TypeCheckingMode
-import java.security.MessageDigest
-import org.apache.zest.gradle.PolygeneExtension
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.apache.zest.gradle.tasks.ExecLogged
-import org.gradle.api.Action;
-import org.gradle.api.DefaultTask
-import org.gradle.api.file.CopySpec
-import org.gradle.api.tasks.Internal
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputDirectory
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.process.ExecSpec
-
-// TODO: try to use dependencies for FOP and execute within the same JVM.
-// TODO: move the bulk of resources into this plugin, instead of sitting in the project.
-@CompileStatic
-class DocumentationTask extends DefaultTask
-{
-  @Input def String docName
-  @Input def String docType
-
-  @InputDirectory def File getCommonResourcesDir() { project.file( 'src/resources' ) }
-  @InputDirectory def File getConfigDir() { project.file( 'src/conf' ) }
-  @InputDirectory def File getDocsDir() { project.file( 'src/docs' ) }
-  @InputDirectory def File getSrcMainDir() { project.file( 'src/main' ) }
-  @InputDirectory def File getXslDir() { project.file( 'src/xsl' ) }
-  @InputDirectory def File getBuildSrcDir() { project.rootProject.file( 'buildSrc/src' ) }
-
-  @InputFiles def getSubProjectsDocsDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/docs' ) } }
-  @InputFiles def getSubProjectsTestDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/test' ) } }
-
-  @OutputDirectory def File getOutputDir() { project.file( "${ project.buildDir }/docs/${ docName }/" ) }
-
-  @Internal def File getTempAsciidocDir() { project.file( "${ project.buildDir }/tmp-asciidoc" ) }
-  @Internal def File getTempDir() { project.file( "${ project.buildDir }/tmp/docs/${ docName }" ) }
-
-  @TaskAction
-  def void generate()
-  {
-    installAsciidocFilters()
-
-    [ outputDir, tempAsciidocDir, tempDir ].each { it.deleteDir() }
-    [ outputDir, tempAsciidocDir, tempDir ].each { it.mkdirs() }
-
-    copySubProjectsDocsResources()
-    generateAsciidocAccordingToReleaseSpecification()
-    generateXDoc()
-    generateChunkedHtml()
-    // generateSingleHtml()
-    // generatePdf()
-  }
-
-  def void installAsciidocFilters()
-  {
-    def digester = MessageDigest.getInstance( 'SHA' )
-    def filtersDir = project.rootProject.file( 'buildSrc/src/asciidoc/filters' )
-    def userHome = new File( System.getProperty( 'user.home' ) )
-    def dotAsciidocFiltersDir = new File( userHome, '.asciidoc/filters' )
-    def installSnippets = false
-    filtersDir.eachFileRecurse( FileType.FILES ) { originalFile ->
-      def targetFile = new File( dotAsciidocFiltersDir,
-                                 ( originalFile.toURI() as String ) - ( filtersDir.toURI() as String ) )
-      if( !targetFile.exists() )
-      {
-        installSnippets = true
-      }
-      else
-      {
-        def originalDigest = digester.digest( originalFile.bytes )
-        def targetDigest = digester.digest( targetFile.bytes )
-        if( originalDigest != targetDigest )
-        {
-          installSnippets = true
-        }
-      }
-    }
-    if( installSnippets )
-    {
-      dotAsciidocFiltersDir.mkdirs()
-      project.rootProject.copy { CopySpec spec ->
-        spec.from filtersDir
-        spec.into dotAsciidocFiltersDir
-      }
-      dotAsciidocFiltersDir.eachFileRecurse( FileType.FILES ) { file ->
-        if( file.name.endsWith( '.py' ) )
-        {
-          chmod( file, '755' )
-        }
-      }
-      println "Polygene Asciidoc Filters Installed!"
-    }
-  }
-
-  @CompileStatic( TypeCheckingMode.SKIP )
-  def void chmod( File file, String permissions )
-  {
-    ant.chmod( file: file.absolutePath, perm: permissions )
-  }
-
-  def void copySubProjectsDocsResources()
-  {
-    project.rootProject.subprojects.each { p ->
-      p.copy { CopySpec spec ->
-        spec.from p.file( 'src/docs/resources' )
-        spec.into outputDir
-        spec.include '**'
-      }
-    }
-  }
-
-  def void generateAsciidocAccordingToReleaseSpecification()
-  {
-    def zest = project.extensions.getByType( PolygeneExtension )
-    project.copy { CopySpec spec ->
-      spec.from docsDir
-      spec.into tempAsciidocDir
-      spec.include '**'
-    }
-    if( zest.releaseVersion )
-    {
-      def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
-      def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
-      def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
-      [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
-        def filteredFileContent = ''
-        asciidocFile.readLines().each { line ->
-          if( line.startsWith( 'include::' ) )
-          {
-            def approved = false
-            def releaseApprovedProjects = project.rootProject.extensions.
-              getByType( ReleaseSpecExtension ).approvedProjects
-            releaseApprovedProjects.collect { it.projectDir }.each { approvedProjectDir ->
-              if( line.contains( "${ approvedProjectDir.parentFile.name }/${ approvedProjectDir.name }" ) )
-              {
-                approved = true
-              }
-            }
-            if( approved )
-            {
-              filteredFileContent += "$line\n"
-            }
-          }
-          else
-          {
-            filteredFileContent += "$line\n"
-          }
-        }
-        asciidocFile.text = filteredFileContent
-      }
-    }
-  }
-
-  def void generateXDoc()
-  {
-    def outLog = getLogFile( 'adoc-2-docbook', 'stdout' )
-    def errLog = getLogFile( 'adoc-2-docbook', 'stderr' )
-    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
-      spec.executable = 'asciidoc'
-      spec.workingDir = '..'
-      def commonResourcesPath = relativePath( project.rootDir, commonResourcesDir )
-      def asciidocConfigPath = relativePath( project.rootDir, new File( configDir, 'asciidoc.conf' ) )
-      def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
-      def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
-      def xdocOutputPath = relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
-      def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
-      spec.args = [
-        '--attribute', 'revnumber=' + project.version,
-        '--attribute', 'level1=' + ( docType == 'article' ? 1 : 0 ),
-        '--attribute', 'level2=' + ( docType == 'article' ? 2 : 1 ),
-        '--attribute', 'level3=' + ( docType == 'article' ? 3 : 2 ),
-        '--attribute', 'level4=' + ( docType == 'article' ? 4 : 3 ),
-        '--attribute', 'importdir=' + commonResourcesPath,
-        '--backend', 'docbook',
-        '--attribute', 'docinfo1',
-        '--doctype', docType,
-        '--conf-file=' + asciidocConfigPath,
-        '--conf-file=' + docbookConfigPath,
-        '--conf-file=' + linkimagesConfigPath,
-        '--out-file', xdocOutputPath,
-        asciidocIndexPath
-      ]
-    } as Action<? super ExecSpec> )
-  }
-
-  def void generateChunkedHtml()
-  {
-    project.copy { CopySpec spec ->
-      spec.from commonResourcesDir
-      spec.into outputDir
-      spec.include '**'
-    }
-    project.copy { CopySpec spec ->
-      spec.from "$docsDir/$docName/resources"
-      spec.into outputDir
-      spec.include '**'
-    }
-    def outLog = getLogFile( 'docbook-2-chunked-html', 'stdout' )
-    def errLog = getLogFile( 'docbook-2-chunked-html', 'stderr' )
-    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
-      def xsltFile = "$docsDir/$docName/xsl/chunked.xsl"
-      def outputPath = relativePath( project.projectDir, outputDir ) + '/'
-      spec.executable = 'xsltproc'
-      spec.args = [
-        '--nonet',
-        '--noout',
-        '--output', outputPath,
-        xsltFile,
-        "$tempDir/xdoc-temp.xml"
-      ]
-    } as Action<? super ExecSpec> )
-  }
-
-  def void generateSingleHtml()
-  {
-    def outLog = getLogFile( 'docbook-2-html', 'stdout' )
-    def errLog = getLogFile( 'docbook-2-html', 'stderr' )
-    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
-      // XML_CATALOG_FILES=
-      String xsltFile = "$xslDir/xhtml.xsl"
-      spec.executable = 'xsltproc'
-      spec.args = [
-        '--nonet',
-        '--noout',
-        '--output', "$outputDir/${ docName }.html",
-        xsltFile,
-        "$tempDir/xdoc-temp.xml"
-      ]
-    } as Action<? super ExecSpec> )
-  }
-
-  def void generatePdf()
-  {
-    // $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
-    def outLog = getLogFile( 'docbook-2-fo', 'stdout' )
-    def errLog = getLogFile( 'docbook-2-fo', 'stderr' )
-    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
-      String xsltFile = "$xslDir/fo.xsl"
-      spec.executable = 'xsltproc'
-      spec.args = [
-        '--nonet',
-        '--output', "$tempDir/${ docName }.fo",
-        xsltFile,
-        "$tempDir/xdoc-temp.xml"
-      ]
-    } as Action<? super ExecSpec> )
-
-    // $ fop article.fo article.pdf
-    outLog = getLogFile( 'fo-2-pdf', 'stdout' )
-    errLog = getLogFile( 'fo-2-pdf', 'stderr' )
-    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
-      spec.executable = 'fop'
-      spec.args = [
-        "$tempDir/${ docName }.fo",
-        "$outputDir/${ docName }.pdf"
-      ]
-    } as Action<? super ExecSpec> )
-  }
-
-  private File getLogFile( String step, String stream )
-  {
-    return project.file( "${ project.buildDir }/tmp/${ name }/${ step }-${ stream }.log" )
-  }
-
-  private static String relativePath( File root, File target )
-  {
-    new File( root.toURI().relativize( target.toURI() ).toString() ).path
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/ManualPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/ManualPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/ManualPlugin.groovy
deleted file mode 100644
index 49cfcd5..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/ManualPlugin.groovy
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.doc
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.TaskGroups
-import org.apache.zest.gradle.PolygeneExtension
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.tasks.Copy
-
-@CompileStatic
-class ManualPlugin implements Plugin<Project>
-{
-  static class TaskNames
-  {
-    static final String WEBSITE = "website"
-    static final String ARCHIVE_WEBSITE = "archiveWebsite"
-    static final String COPY_WEBSITE = "copyWebsite"
-    static final String MANUALS = "manuals"
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    def zest = project.extensions.getByType( PolygeneExtension )
-    project.tasks.create( TaskNames.WEBSITE, DocumentationTask ) { DocumentationTask task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Generates documentation website'
-      task.dependsOn project.rootProject.allprojects.findResults { Project p ->
-        p.tasks.findByName AsciidocBuildInfoPlugin.TASK_NAME
-      }
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
-      task.docName = 'website'
-      task.docType = 'article'
-    }
-    project.tasks.create( TaskNames.ARCHIVE_WEBSITE, Copy ) { Copy task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Copy website to ../zest-web'
-      task.dependsOn TaskNames.WEBSITE
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
-      if( zest.developmentVersion )
-      {
-        task.into "$project.rootProject.projectDir/../zest-web/site/content/java/develop"
-      }
-      else
-      {
-        task.into "$project.rootProject.projectDir/../zest-web/site/content/java/$project.version"
-      }
-      task.from "$project.buildDir/docs/website/"
-    }
-    project.tasks.create( TaskNames.COPY_WEBSITE, Copy ) { Copy task ->
-      task.group = TaskGroups.RELEASE
-      task.description = 'Copy website to ../zest-web LATEST'
-      task.dependsOn TaskNames.ARCHIVE_WEBSITE
-      task.onlyIf { zest.releaseVersion }
-      task.from "$project.rootProject.projectDir/../zest-web/site/content/java/$project.version/"
-      task.into "$project.rootProject.projectDir/../zest-web/site/content/java/latest/"
-    }
-    project.tasks.create( TaskNames.MANUALS ) { Task task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Generates all documentation'
-      task.dependsOn TaskNames.COPY_WEBSITE
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
-    }
-  }
-
-  private static Boolean asciidocInstalled = null
-
-  // Force when building a release version
-  // Skip if skipAsciidocIfAbsent property is set
-  // Skip if asciidoc is not found in PATH when building a development version
-  private static boolean isAsciidocInstalled( Project project, PolygeneExtension zest )
-  {
-    if( asciidocInstalled == null )
-    {
-      def skipAsciidocIfAbsent = project.findProperty 'skipAsciidocIfAbsent'
-      if( !skipAsciidocIfAbsent && zest.releaseVersion )
-      {
-        project.logger.info 'Asciidoc tasks forced for building a release version, hope you have Asciidoc installed'
-        asciidocInstalled = true
-      }
-      else
-      {
-        def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
-        def asciidocCandidates = pathDirs.collect( { String path ->
-          new File( path, 'asciidoc' )
-        } ).flatten() as List<File>
-        asciidocInstalled = asciidocCandidates.findAll( { it.isFile() } )
-        if( !asciidocInstalled )
-        {
-          project.logger.lifecycle 'WARNING Asciidoc not found in PATH, manual tasks will skip\n' +
-                                   '        Please install http://www.methods.co.nz/asciidoc/'
-        }
-      }
-    }
-    return asciidocInstalled
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
deleted file mode 100644
index d992e9f..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.doc
-
-import groovy.transform.CompileStatic
-import org.gradle.api.file.EmptyFileVisitor
-import org.gradle.api.tasks.SourceTask
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.Optional
-import org.gradle.api.tasks.InputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.api.file.FileVisitDetails
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.stream.StreamResult
-import javax.xml.transform.stream.StreamSource
-
-/**
- *  Gradle task for running a set of one or more
- *  files through an XSLT transform.  A styleSheet
- *  file must be specified.  The source file(s) are
- *  configured just like any other source task:
- *     source <file>
- *       ...or...
- *     source <directory>
- *       ...and then optionally...
- *     include '*.xml'
- *     exclude, etc.
- *
- *  One of destDir or destFile must be specified, though if
- *  there are multiple source files then destFile will just
- *  keep getting rewritten.
- *
- *  The extension is stripped from the source files and the
- *  specified extension is appended (whether it is set or not)
- *  it defaults to no extension.
- *
- *  Example task formatting a check style report:
- *
- *  task checkstyleReport(type: XsltTask, dependsOn: check) {
- *      source project.checkstyleResultsDir
- *      include '*.xml'
- *
- *      destDir = project.checkstyleResultsDir
- *      extension = 'html'
- *
- *      stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
- * }
- *
- *  The above definition requires that the specified XSL file be
- *  copied in with the other checkstyle configuration files.  (The
- *  file in the example is part of the checkstyle distribution.)
- *
- */
-@CompileStatic
-class XsltTask extends SourceTask
-{
-
-  @OutputDirectory
-  @Optional
-  File destDir
-
-  @Optional
-  String extension
-
-  @InputFile
-  File stylesheetFile
-
-  @TaskAction
-  def transform()
-  {
-    def factory = TransformerFactory.newInstance()
-    def transformer = factory.newTransformer( new StreamSource( stylesheetFile ) );
-
-    getSource().visit( new EmptyFileVisitor() {
-      @Override
-      void visitFile( FileVisitDetails fvd )
-      {
-        // Remove the extension from the file name
-        def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
-        if( extension == null )
-        {
-          extension = 'html'
-        }
-        name += '.' + extension
-        def destFile = new File( destDir, name )
-        transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
-      }
-    } )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
deleted file mode 100644
index 29f1986..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/performance/PerformanceTestsPlugin.groovy
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.performance
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.TaskGroups
-import org.gradle.api.Action
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.bundling.Jar
-import org.gradle.api.tasks.testing.Test
-import org.gradle.language.base.plugins.LifecycleBasePlugin
-
-// TODO Add profiling tasks (jfr or honest? flamegraphs?)
-// TODO Add simple regression assertions, how? testing against a previous version?
-@CompileStatic
-class PerformanceTestsPlugin implements Plugin<Project>
-{
-  static class TaskNames
-  {
-    static final String PERFORMANCE_TEST = 'performanceTest'
-    static final String PERFORMANCE_PROFILE = 'performanceProfile'
-    static final String PERFORMANCE_CHECK = 'performanceCheck'
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
-    sourceSets.create 'perf'
-    project.dependencies.add 'perfCompile', sourceSets.getByName( 'main' ).output
-    project.dependencies.add 'perfCompile', sourceSets.getByName( 'test' ).output
-    project.dependencies.add 'perfCompile', project.configurations.getByName( 'testCompile' )
-    project.dependencies.add 'perfRuntime', project.configurations.getByName( 'testRuntime' )
-    project.tasks.getByName( LifecycleBasePlugin.CHECK_TASK_NAME ).dependsOn 'compilePerfJava'
-    project.tasks.create( TaskNames.PERFORMANCE_TEST, Test, { Test task ->
-      task.group = TaskGroups.PERFORMANCE
-      task.description = 'Runs performance tests.'
-      task.maxParallelForks = 1
-      task.forkEvery = 1L
-      task.testClassesDir = sourceSets.getByName( 'perf' ).output.classesDir
-      task.classpath = sourceSets.getByName( 'perf' ).runtimeClasspath
-      task.systemProperty 'jar.path', ( project.tasks.getByName( 'jar' ) as Jar ).archivePath
-    } as Action<Test> )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/MavenMetadata.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/MavenMetadata.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/MavenMetadata.groovy
deleted file mode 100644
index 7f368e6..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/MavenMetadata.groovy
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.publish
-
-import org.gradle.api.artifacts.maven.MavenDeployer
-
-class MavenMetadata
-{
-  static void applyTo( MavenDeployer mavenDeployer )
-  {
-    mavenDeployer.pom {
-      project {
-        url 'https://zest.apache.org/'
-        organization {
-          name 'The Apache Software Foundation'
-          url 'https://apache.org/'
-        }
-        inceptionYear '2007'
-        issueManagement {
-          system 'jira'
-          url 'https://issues.apache.org/jira/browse/ZEST'
-        }
-        scm {
-          url "https://github.com/apache/zest-java"
-          connection "scm:git:https://git-wip-us.apache.org/repos/asf/zest-java.git"
-          developerConnection "scm:git:https://git-wip-us.apache.org/repos/asf/zest-java.git"
-        }
-        licenses {
-          license {
-            name 'Apache License, version 2.0.'
-            url 'http://www.apache.org/licenses/LICENSE-2.0'
-          }
-        }
-        mailingLists {
-          mailingList {
-            name 'Users List'
-            subscribe 'users-subscribe@zest.apache.org'
-            unsubscribe 'users-unsubscribe@zest.apache.org'
-            post 'users@zest.apache.org'
-            archive 'https://mail-archives.apache.org/mod_mbox/zest-users/'
-            otherArchives {
-              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
-            }
-          }
-          mailingList {
-            name 'Development List'
-            subscribe 'dev-subscribe@zest.apache.org'
-            unsubscribe 'dev-unsubscribe@zest.apache.org'
-            post 'dev@zest.apache.org'
-            archive 'https://mail-archives.apache.org/mod_mbox/zest-dev/'
-            otherArchives {
-              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
-            }
-          }
-          mailingList {
-            name 'Commits List'
-            subscribe 'commits-subscribe@zest.apache.org'
-            unsubscribe 'commits-unsubscribe@zest.apache.org'
-            post 'commits@zest.apache.org'
-            archive 'https://mail-archives.apache.org/mod_mbox/zest-commits/'
-            otherArchives {
-              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
-            }
-          }
-        }
-        developers {
-          developer {
-            id 'niclas@hedhman.org'
-            name 'Niclas Hedhman'
-            email 'niclas@hedhman.org'
-            roles {
-              role 'Core Team'
-            }
-            organizationUrl 'http://zest.apache.org'
-            timezone 'UTC+8'
-          }
-          developer {
-            id 'rickardoberg'
-            name 'Rickard \u00F6berg'
-            email 'rickard.oberg@jayway.se'
-            roles {
-              role 'Core Team'
-            }
-            url 'http://www.neotechnology.com'
-            organization 'Neo Technology AB'
-            organizationUrl 'http://www.neotechnology.com'
-            timezone 'UTC+8'
-          }
-          developer {
-            id 'edward.yakop@gmail.com'
-            name 'Edward Yakop'
-            email 'efy@codedragons.com'
-            roles {
-              role 'Core Team'
-            }
-            organizationUrl 'http://zest.apache.org'
-            timezone 'UTC+8'
-          }
-          developer {
-            id 'adreghiciu@gmail.com'
-            name 'Alin Dreghiciu'
-            email 'adreghiciu@codedragons.com'
-            roles {
-              role 'Core Team'
-            }
-            organizationUrl 'http://zest.apache.org'
-            timezone 'UTC+2'
-          }
-          developer {
-            id 'mesirii'
-            name 'Michael Hunger'
-            email 'qi4j@jexp.de'
-            roles {
-              role 'Core Team'
-            }
-            timezone 'CET'
-          }
-
-          developer {
-            id "muhdkamil"
-            name "Muhd Kamil bin Mohd Baki"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC+8"
-          }
-
-          developer {
-            id "ops4j@leangen.net"
-            name "David Leangen"
-            organization "Bioscene"
-            email "ops4j@leangen.net"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC+9"
-          }
-
-          developer {
-            id "sonny.gill@jayway.net"
-            name "Sonny Gill"
-            email "sonny.public@gmail.com"
-            roles {
-              role 'Community Team'
-            }
-            timezone "UTC+8"
-          }
-
-          developer {
-            id "taowen"
-            name "Tao Wen"
-            organization ""
-            email "taowen@gmail.com"
-            roles {
-              role 'Community Team'
-            }
-            timezone "UTC+8"
-          }
-
-          developer {
-            id "thobe"
-            name "Tobias Ivarsson"
-            email "tobias@neotechnology.com"
-            url "http://www.neotechnology.com"
-            organization "NeoTechnology"
-            organizationUrl "http://www.neotechnology.com"
-            roles {
-              role "Platform Team"
-            }
-            timezone "CET"
-          }
-
-          developer {
-            id "boon"
-            name "Lan Boon Ping"
-            email "boonping81@gmail.com"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC+8"
-          }
-
-          developer {
-            id "jan.kronquist@gmail.com"
-            name "Jan Kronquist"
-            email "jan.kronquist@gmail.com"
-            organization "Jayway"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "CET"
-          }
-
-          developer {
-            id "nmwael"
-            name "Nino Saturnino Martinez Vazquez Wael"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "CET"
-          }
-
-          developer {
-            id "peter@neubauer.se"
-            name "Peter Neubauer"
-            email "peter@neubauer.se"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "CET"
-          }
-
-          developer {
-            id "rwallace"
-            name "Richard Wallace"
-            email "rwallace@thewallacepack.net"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC-7"
-          }
-
-          developer {
-            id "siannyhalim@gmail.com"
-            name "Sianny Halim"
-            email "siannyhalim@gmail.com"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC+8"
-          }
-
-          developer {
-            id "paul@nosphere.org"
-            name "Paul Merlin"
-            email "paul@nosphere.org"
-            roles {
-              role 'Core Team'
-            }
-            timezone "CET"
-          }
-
-          developer {
-            id "stas.dev+qi4j@gmail.com"
-            name "Stanislav Muhametsin"
-            email "stas.dev+qi4j@gmail.com"
-            roles {
-              role 'Platform Team'
-            }
-            timezone "UTC+2"
-          }
-
-          developer {
-            id "tonny"
-            name "Tonny Kohar"
-            roles {
-              role "Community Team"
-            }
-            email "tonny.kohar@gmail.com"
-            timezone "UTC+7"
-          }
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
deleted file mode 100644
index 92b00ca..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/publish/PublishingPlugin.groovy
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.publish
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.PolygeneExtension
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.gradle.api.GradleException
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.artifacts.maven.MavenDeployer
-import org.gradle.api.artifacts.maven.MavenDeployment
-import org.gradle.api.internal.plugins.DslObject
-import org.gradle.api.plugins.MavenRepositoryHandlerConvention
-import org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer
-import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
-import org.gradle.api.tasks.Upload
-import org.gradle.plugins.signing.Sign
-import org.gradle.plugins.signing.SigningExtension
-
-/**
- * Publishing.
- *
- * <strong>Configuration</strong>
- *
- * By default RELEASES are signed, SNAPSHOTS are not.
- * Signing can be turned on or off by setting the {@literal uploadSigned} property.
- *
- * By default RELEASES must satisfy {@link org.apache.zest.gradle.release.ModuleReleaseSpec}, SNAPSHOT don't.
- * This can be turned on or off by setting the {@literal uploadReleaseSpec} property.
- *
- * By default RELEASES and SNAPSHOTS are uploaded using HTTP.
- * Used Wagon can be overridden by setting the {@literal uploadWagon} property.
- *
- * By default RELEASES and SNAPSHOTS are uploaded to Apache Nexus.
- * Target repository can be overridden by setting the {@literal uploadRepository} property.
- *
- * No username/password is provided by default.
- * If needed set them using the uploadUsername and {@literal uploadPassword} properties.
- */
-@CompileStatic
-class PublishingPlugin implements Plugin<Project>
-{
-  static final String WAGON_HTTP = 'org.apache.maven.wagon:wagon-http:2.2'
-  static final String WAGON_SSH = 'org.apache.maven.wagon:wagon-ssh:2.2'
-  static final String WAGON_WEBDAV = 'org.apache.maven.wagon:wagon-webdav:1.0-beta-2'
-
-  static final String RELEASES_REPOSITORY_NAME = 'apache.releases.https'
-  static final String RELEASES_REPOSITORY_URL = 'https://repository.apache.org/service/local/staging/deploy/maven2'
-  static final String SNAPSHOTS_REPOSITORY_NAME = 'apache.snapshots.https'
-  static final String SNAPSHOTS_REPOSITORY_URL = 'https://repository.apache.org/content/repositories/snapshots'
-
-  static class Config
-  {
-    boolean snapshots
-    boolean releases
-    boolean signed
-    boolean releaseSpec
-    String wagon
-    String repositoryName
-    String repositoryUrl
-    String username
-    String password
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    Config config = configFor( project )
-    applyWagonConfiguration( project, config )
-    configureSigning( project, config )
-    configureUploadArchives( project, config )
-    configureMavenMetadata( project )
-    applyMavenPublishAuth( project )
-  }
-
-  private static Config configFor( Project project )
-  {
-    def zest = project.extensions.getByType( PolygeneExtension )
-    def config = new Config()
-    config.snapshots = zest.developmentVersion
-    config.releases = zest.releaseVersion
-    config.signed = project.findProperty( 'uploadSigned' ) ?: config.releases
-    config.releaseSpec = project.findProperty( 'uploadReleaseSpec' ) ?: config.releases
-    config.wagon = project.findProperty( 'uploadWagon' ) ?: WAGON_HTTP
-    config.repositoryName = project.findProperty( 'uploadRepositoryName' ) ?:
-                            config.releases ? RELEASES_REPOSITORY_NAME : SNAPSHOTS_REPOSITORY_NAME
-    config.repositoryUrl = project.findProperty( 'uploadRepository' ) ?:
-                           config.releases ? RELEASES_REPOSITORY_URL : SNAPSHOTS_REPOSITORY_URL
-    config.username = project.findProperty( 'uploadUsername' )
-    config.password = project.findProperty( 'uploadPassword' )
-    return config
-  }
-
-  private static void applyWagonConfiguration( Project project, Config config )
-  {
-    project.configurations.create( 'deployersJars' )
-    project.dependencies.add( 'deployersJars', config.wagon )
-  }
-
-  private static void configureSigning( Project project, Config config )
-  {
-    project.plugins.apply 'signing'
-    def signing = project.extensions.getByType( SigningExtension )
-    signing.required = config.signed
-    signing.sign project.configurations.getByName( 'archives' )
-    def signArchives = project.tasks.getByName( 'signArchives' ) as Sign
-    signArchives.onlyIf { !project.findProperty( 'skipSigning' ) }
-  }
-
-  private static void configureUploadArchives( Project project, Config config )
-  {
-    project.plugins.apply 'maven'
-    def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
-    uploadArchives.doFirst {
-      if( project.version == "0" )
-      {
-        throw new GradleException( "'version' must be given as a system property to perform a release." )
-      }
-    }
-    uploadArchives.onlyIf {
-      def notSkipped = !project.hasProperty( 'skipUpload' )
-      def approvedProject = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects.contains( project )
-      return notSkipped && ( !config.releaseSpec || ( approvedProject || project == project.rootProject ) )
-    }
-    uploadArchives.dependsOn project.tasks.getByName( 'check' )
-    def repositoriesConvention = new DslObject( uploadArchives.repositories )
-      .getConvention()
-      .getPlugin( MavenRepositoryHandlerConvention )
-    def mavenDeployer = repositoriesConvention.mavenDeployer() as DefaultGroovyMavenDeployer
-    if( config.signed )
-    {
-      mavenDeployer.beforeDeployment { MavenDeployment deployment ->
-        project.extensions.getByType( SigningExtension ).signPom( deployment )
-      }
-    }
-    mavenDeployer.configuration = project.configurations.getByName( 'deployersJars' )
-    def repository = new MavenRemoteRepository()
-    repository.id = config.repositoryName
-    repository.url = config.repositoryUrl
-    if( config.username )
-    {
-      repository.authentication.userName = config.username
-      repository.authentication.password = config.password
-    }
-    if( config.releases )
-    {
-      mavenDeployer.repository = repository
-    }
-    else
-    {
-      mavenDeployer.snapshotRepository = repository
-    }
-  }
-
-  private static void configureMavenMetadata( Project project )
-  {
-    def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
-    def mavenDeployer = uploadArchives.repositories.getByName( 'mavenDeployer' ) as MavenDeployer
-    MavenMetadata.applyTo( mavenDeployer )
-  }
-
-  private static void applyMavenPublishAuth( final Project project )
-  {
-    // Bug in maven-publish-auth require apply after uploadArchives setup
-    project.plugins.apply 'maven-publish-auth'
-  }
-}


[24/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java b/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
deleted file mode 100644
index b423a58..0000000
--- a/core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.docsupport;
-
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-
-public class ApplicationDocs
-{
-    public static void someMethod( String[] args )
-        throws Exception
-    {
-        {
-// START SNIPPET: application1
-            SingletonAssembler zest = new SingletonAssembler()
-            {
-                public void assemble( ModuleAssembly assembly )
-                    throws AssemblyException
-                {
-                    assembly.values( MyStuffValueComposite.class );
-                }
-            };
-// END SNIPPET: application1
-        }
-        {
-            Assembler customerListEditAssembler = new DummyAssembler();
-            Assembler customerEditAssembler = new DummyAssembler();
-            Assembler customerSearchAssembler = new DummyAssembler();
-            Assembler accountsListEditAssembler = new DummyAssembler();
-            Assembler accountsEditAssembler = new DummyAssembler();
-            Assembler accountsSearchAssembler = new DummyAssembler();
-            Assembler customerDomainAssembler = new DummyAssembler();
-            Assembler accountsDomainAssembler = new DummyAssembler();
-// START SNIPPET: application2
-            final Assembler[][][] assemblers =
-                {
-                    { // web layer
-                      { // Customer Module
-                        customerListEditAssembler,
-                        customerEditAssembler,
-                        customerSearchAssembler
-                      },
-                      { // Accounts Module
-                        accountsListEditAssembler,
-                        accountsEditAssembler,
-                        accountsSearchAssembler
-                      }
-                    },
-                    { // domain layer
-                      { // Customer Module
-                        customerDomainAssembler,
-                      },
-                      { // Accounts Module
-                        accountsDomainAssembler,
-                      }
-                    }
-                };
-            Energy4Java zest = new Energy4Java();
-            Application app = zest.newApplication( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-                    throws AssemblyException
-                {
-                    return applicationFactory.newApplicationAssembly( assemblers );
-                }
-            } );
-            app.activate();
-// END SNIPPET: application2
-        }
-    }
-
-    public interface MyStuffValueComposite
-    {
-    }
-
-    private static class DummyAssembler implements Assembler
-    {
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-
-        }
-    }
-
-    // START SNIPPET: application3
-    private static Energy4Java zest;
-
-    public static void main( String[] args )
-        throws Exception
-    {
-        zest = new Energy4Java();
-        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-                throws AssemblyException
-            {
-                return createAssembly( applicationFactory );
-            }
-        } );
-        Application application = model.newInstance( zest.spi() );
-    }
-
-    private static ApplicationAssembly createAssembly( ApplicationAssemblyFactory factory )
-        throws AssemblyException
-    {
-        String applicationName = "Example Application";
-        ApplicationAssembly app = factory.newApplicationAssembly();
-        app.setName( applicationName );
-        LayerAssembly webLayer = createWebLayer( app );
-        LayerAssembly domainLayer = createDomainLayer( app );
-        LayerAssembly infraLayer = createInfrastructureLayer( app );
-        webLayer.uses( domainLayer );
-        webLayer.uses( infraLayer );  // Accesses the WebService
-        domainLayer.uses( infraLayer ); // For persistence
-        return app;
-    }
-
-    private static LayerAssembly createWebLayer(
-        ApplicationAssembly application
-    )
-    {
-        LayerAssembly layer = application.layer( "Web Layer" );
-        createCustomerWebModule( layer );
-        return layer;
-    }
-
-    private static LayerAssembly createDomainLayer(
-        ApplicationAssembly application
-    )
-    {
-        LayerAssembly layer = application.layer( "Domain Layer" );
-        createCustomerDomainModule( layer );
-        // :
-        // :
-        return layer;
-    }
-
-    private static LayerAssembly createInfrastructureLayer(
-        ApplicationAssembly application
-    )
-        throws AssemblyException
-    {
-        LayerAssembly layer = application.layer( "Infrastructure Layer" );
-        createWebServiceModule( layer );
-        createPersistenceModule( layer );
-        return layer;
-    }
-
-    private static void createCustomerWebModule( LayerAssembly layer )
-    {
-        ModuleAssembly assembly = layer.module( "Customer Web Module" );
-        assembly.transients( CustomerViewComposite.class );
-        assembly.transients( CustomerEditComposite.class );
-        assembly.transients( CustomerListViewComposite.class );
-        assembly.transients( CustomerSearchComposite.class );
-    }
-
-    private static void createCustomerDomainModule( LayerAssembly layer )
-    {
-        ModuleAssembly assembly = layer.module( "Customer Domain Module" );
-        assembly.entities( CustomerEntity.class );
-        assembly.entities( CountryEntity.class );
-        assembly.transients( AddressComposite.class );
-    }
-
-    private static void createWebServiceModule( LayerAssembly layer )
-        throws AssemblyException
-    {
-        ModuleAssembly assembly = layer.module( "Web Service Module" );
-        // Someone has created an assembler for a Jetty Web Service.
-        JettyAssembler jetty = new JettyAssembler( 8080 );
-        jetty.assemble( assembly );
-    }
-
-    private static void createPersistenceModule( LayerAssembly layer )
-        throws AssemblyException
-    {
-        ModuleAssembly assembly = layer.module( "Persistence Module" );
-        // Someone has created an assembler for the Neo EntityStore
-        NeoAssembler neo = new NeoAssembler( "./neostore" );
-        neo.assemble( assembly );
-    }
-// START SNIPPET: application3
-
-    public static class CustomerViewComposite
-    {
-
-    }
-    public static class CustomerEditComposite
-    {
-
-    }
-    public static class CustomerListViewComposite
-    {
-
-    }
-    public static class CustomerSearchComposite
-    {
-
-    }
-
-
-    public static class CustomerEntity
-    {
-
-    }
-    public static class CountryEntity
-    {
-
-    }
-    public static class AddressComposite
-    {
-
-    }
-
-    public static class JettyAssembler
-        implements Assembler
-    {
-
-        public JettyAssembler( int port )
-        {
-        }
-
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-        }
-    }
-    public static class NeoAssembler
-        implements Assembler
-    {
-
-        public NeoAssembler( String s )
-        {
-        }
-
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java b/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java
deleted file mode 100644
index ecccf62..0000000
--- a/core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.docsupport;
-
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-public class CompositionDocs
-{
-// START SNIPPET: comp1
-    @Mixins( { BalanceCheckMixin.class } )
-    public interface BankAccount
-    {
-        Money checkBalance();
-// END SNIPPET: comp1
-// START SNIPPET: comp1
-    }
-// END SNIPPET: comp1
-
-// START SNIPPET: comp2
-    public void assemble( ModuleAssembly module )
-    {
-        module.entities( BankAccount.class );
-    }
-// END SNIPPET: comp2
-
-    public static class BalanceCheckMixin
-        implements BankAccount
-    {
-        @Override
-        public Money checkBalance()
-        {
-            return null;
-        }
-    }
-
-    public static class Money
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/docsupport/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/docsupport/package.html b/core/api/src/test/java/org/apache/zest/api/docsupport/package.html
deleted file mode 100644
index 6fbef81..0000000
--- a/core/api/src/test/java/org/apache/zest/api/docsupport/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-<body>
-This package exists to contain snippets for documentation.
-</body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java b/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java
deleted file mode 100644
index ee0d512..0000000
--- a/core/api/src/test/java/org/apache/zest/api/injection/scope/StateFieldTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-/**
- * Define a field to be a Property
- */
-public class StateFieldTest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        new EntityTestAssembler().assemble( module );
-        module.entities( PersonEntity.class );
-    }
-
-    @Test
-    public void givenEntityWithFieldPropertiesWhenUpdatedThenReturnCorrect()
-        throws Exception
-    {
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        try
-        {
-            PersonEntity charles = unitOfWork.newEntity( PersonEntity.class );
-            charles.changeName( "Charles" );
-            Assert.assertEquals( charles.getName(), "Charles" );
-
-            PersonEntity daniel = unitOfWork.newEntity( PersonEntity.class );
-            daniel.changeName( "Daniel" );
-            Assert.assertEquals( daniel.getName(), "Daniel" );
-
-            PersonEntity lisa = unitOfWork.newEntity( PersonEntity.class );
-            lisa.changeName( "Lisa" );
-            Assert.assertEquals( lisa.getName(), "Lisa" );
-
-            charles.befriend( daniel );
-            charles.befriend( lisa );
-            charles.marry( lisa );
-
-            unitOfWork.complete();
-
-            unitOfWork = unitOfWorkFactory.newUnitOfWork();
-
-            charles = unitOfWork.get( charles );
-            daniel = unitOfWork.get( daniel );
-            Assert.assertTrue( charles.isFriend( daniel ) );
-
-            unitOfWork.complete();
-        }
-        finally
-        {
-            unitOfWork.discard();
-        }
-    }
-
-    @Mixins( PersonEntity.Mixin.class )
-    public interface PersonEntity
-        extends EntityComposite
-    {
-        void changeName( String newName );
-
-        void marry( PersonEntity entity );
-
-        void befriend( PersonEntity entity );
-
-        boolean isFriend( PersonEntity entity );
-
-        String getName();
-
-        abstract class Mixin
-            implements PersonEntity
-        {
-            @State
-            @UseDefaults
-            public Property<String> name;
-
-            @State
-            @Optional
-            public Association<PersonEntity> spouse;
-
-            @State
-            public ManyAssociation<PersonEntity> friends;
-
-            @Override
-            public void changeName( String newName )
-            {
-                name.set( newName );
-            }
-
-            @Override
-            public void marry( PersonEntity entity )
-            {
-                spouse.set( entity );
-            }
-
-            @Override
-            public void befriend( PersonEntity entity )
-            {
-                friends.add( entity );
-            }
-
-            @Override
-            public String getName()
-            {
-                return name.get();
-            }
-
-            @Override
-            public boolean isFriend( PersonEntity entity )
-            {
-                return friends.contains( entity );
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java b/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java
deleted file mode 100644
index 05c0b9c..0000000
--- a/core/api/src/test/java/org/apache/zest/api/injection/scope/ThisTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Annotation;
-import org.junit.Test;
-import org.apache.zest.api.common.Optional;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests public api exposed by This annotation.
- * This will ensure that the public api does not get changed by mistake.
- */
-public class ThisTest
-{
-
-    @Test
-    public void retention()
-        throws NoSuchFieldException
-    {
-        Annotation[] annotations = Annotated.class.getDeclaredField( "uses" ).getDeclaredAnnotations();
-        assertNotNull( "annotations should not be null", annotations );
-        assertEquals( "number of annotations", 1, annotations.length );
-        assertEquals( "annotation type", This.class, annotations[ 0 ].annotationType() );
-    }
-
-    private static class Annotated
-    {
-        @This
-        String uses;
-        @Optional
-        @This
-        String usesOptional;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
deleted file mode 100644
index 0a224d7..0000000
--- a/core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import org.apache.zest.api.injection.scope.Service;
-
-public class DocumentationSupport
-{
-    // START SNIPPET: common
-    @Service
-    private MetricsProvider provider;
-    // END SNIPPET: common
-
-    public void forDocumentationOnly()
-    {
-        // START SNIPPET: gauge
-        final BlockingQueue queue = new LinkedBlockingQueue( 20 );
-        // END SNIPPET: gauge
-        // START SNIPPET: gauge
-        MetricsGaugeFactory gaugeFactory = provider.createFactory( MetricsGaugeFactory.class );
-        MetricsGauge<Integer> gauge = gaugeFactory.registerGauge( "Sample Gauge", new MetricsGauge<Integer>()
-        {
-            @Override
-            public Integer value()
-            {
-                return queue.size();
-            }
-        } );
-        // END SNIPPET: gauge
-
-        // START SNIPPET: counter
-        MetricsCounterFactory counterFactory = provider.createFactory( MetricsCounterFactory.class );
-        MetricsCounter counter = counterFactory.createCounter( "Sample Counter" );
-        // END SNIPPET: counter
-
-        // START SNIPPET: histogram
-        MetricsHistogramFactory histoFactory = provider.createFactory( MetricsHistogramFactory.class );
-        MetricsHistogram histogram = histoFactory.createHistogram( "Sample Histogram" );
-        // END SNIPPET: histogram
-
-        // START SNIPPET: meter
-        MetricsMeterFactory meterFactory = provider.createFactory( MetricsMeterFactory.class );
-        MetricsMeter meter = meterFactory.createMeter( "Sample Meter" );
-        // END SNIPPET: meter
-
-        // START SNIPPET: timer
-        MetricsTimerFactory timerFactory = provider.createFactory( MetricsTimerFactory.class );
-        MetricsTimer timer = timerFactory.createTimer( "Sample Timer" );
-        // END SNIPPET: timer
-
-        // START SNIPPET: healthcheck
-        MetricsHealthCheckFactory healthFactory = provider.createFactory( MetricsHealthCheckFactory.class );
-        MetricsHealthCheck healthCheck = healthFactory.registerHealthCheck(
-            "Sample Healthcheck",
-            new MetricsHealthCheck()
-            {
-                @Override
-                public Result check()
-                    throws Exception
-                {
-                    ServiceStatus status = pingMyService();
-                    return new Result( status.isOk(), status.getErrorMessage(), status.getException() );
-                }
-            } );
-        // END SNIPPET: healthcheck
-
-    }
-
-    private ServiceStatus pingMyService()
-    {
-        return new ServiceStatus();
-    }
-
-    private static class ServiceStatus
-    {
-        String errorMessage;
-        Exception exception;
-
-        public String getErrorMessage()
-        {
-            return errorMessage;
-        }
-
-        public Exception getException()
-        {
-            return exception;
-        }
-
-        public boolean isOk()
-        {
-            return errorMessage.equals( "OK" );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java b/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java
deleted file mode 100644
index 57ebee1..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-
-// START SNIPPET: mixinType
-public interface BankAccount
-{
-    Money checkBalance();
-}
-// END SNIPPET: mixinType
-
-class Money {}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Car.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Car.java b/core/api/src/test/java/org/apache/zest/api/mixin/Car.java
deleted file mode 100644
index a3b719d..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/Car.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-// START SNIPPET: mixin
-@Mixins( { StartMixin.class, VehicleMixin.class } )
-public interface Car extends Startable, Vehicle
-{}
-// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Something.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Something.java b/core/api/src/test/java/org/apache/zest/api/mixin/Something.java
deleted file mode 100644
index 0a24c2d..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/Something.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-// START SNIPPET: something
-@Mixins( SomethingMixin.class )
-public interface Something
-{}
-// END SNIPPET: something
-
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java
deleted file mode 100644
index 5c019de..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-// START SNIPPET: something
-public class SomethingMixin
-        implements Something
-{
-    // State is allowed.
-
-    public void doSomething()
-    {
-        // do stuff...
-    }
-}
-// END SNIPPET: something

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java
deleted file mode 100644
index f761468..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/StartMixin.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-public abstract class StartMixin implements Startable
-{}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java b/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java
deleted file mode 100644
index 6bdce19..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/Startable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-// START SNIPPET: mixin
-public interface Startable
-{
-    boolean start();
-    void stop();
-}
-
-// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java b/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java
deleted file mode 100644
index 9feb1c9..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-// START SNIPPET: mixin
-public interface Vehicle
-{
-    void turn(float angle);
-
-    void accelerate(float acceleration);
-
-    // more methods
-}
-
-// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java
deleted file mode 100644
index 10b5829..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/VehicleMixin.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-public abstract class VehicleMixin
-{}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
deleted file mode 100644
index 4a0d2b4..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import org.junit.Test;
-import org.apache.zest.api.composite.TransientBuilder;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class DecoratorMixinTest extends AbstractPolygeneTest
-{
-    // START SNIPPET: assembly
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.transients( View1.class );
-        module.transients( View2.class );
-        module.transients( FooModel.class );
-    }
-// END SNIPPET: assembly
-
-// START SNIPPET: test
-
-    @Test
-    public void testDecoration()
-    {
-        FooModelImpl model = new FooModelImpl( "Init" );
-        View1 view1 = createView1( model );
-        View2 view2 = createView2( model );
-        assertThat( view1.bar(), equalTo( "Init" ) );
-        assertThat( view2.bar(), equalTo( "Init" ) );
-        model.setBar( "New Value" );
-        assertThat( view1.bar(), equalTo( "New Value" ) );
-        assertThat( view2.bar(), equalTo( "New Value" ) );
-    }
-// END SNIPPET: test
-
-    @Test
-    public void testDecorationWithGenericMixin()
-    {
-        InvocationHandler handler = new FooModelInvocationHandler("Init");
-        ClassLoader cl = getClass().getClassLoader();
-        FooModel model = (FooModel) Proxy.newProxyInstance( cl, new Class[]{ FooModel.class }, handler );
-        View1 view1 = createView1( model );
-        View2 view2 = createView2( model );
-        assertThat( view1.bar(), equalTo( "Init" ) );
-        assertThat( view2.bar(), equalTo( "Init" ) );
-        model.setBar( "New Value" );
-        assertThat( view1.bar(), equalTo( "New Value" ) );
-        assertThat( view2.bar(), equalTo( "New Value" ) );
-    }
-
-    // START SNIPPET: create
-    public View1 createView1( FooModel model )
-    {
-        TransientBuilder<View1> builder = transientBuilderFactory.newTransientBuilder( View1.class );
-        builder.use( model );
-        return builder.newInstance();
-    }
-// END SNIPPET: create
-
-    public View2 createView2( FooModel model )
-    {
-        TransientBuilder<View2> builder = transientBuilderFactory.newTransientBuilder( View2.class );
-        builder.use( model );
-        return builder.newInstance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java
deleted file mode 100644
index 5a43502..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-import org.apache.zest.api.composite.DecoratorMixin;
-import org.apache.zest.api.mixin.Mixins;
-
-// START SNIPPET: decorator
-@Mixins(DecoratorMixin.class)
-// START SNIPPET: plain
-public interface FooModel
-// END SNIPPET: decorator
-{
-    String getBar();
-    void setBar(String value);
-// END SNIPPET: plain
-
-// START SNIPPET: plain
-}
-// END SNIPPET: plain

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java
deleted file mode 100644
index 5bab32c..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-public class FooModelImpl
-    implements FooModel
-{
-    private String bar;
-
-    public FooModelImpl( String bar )
-    {
-        this.bar = bar;
-    }
-
-    @Override
-    public String getBar()
-    {
-        return bar;
-    }
-
-    public void setBar( String bar )
-    {
-        this.bar = bar;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java
deleted file mode 100644
index a94a7eb..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModelInvocationHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-public class FooModelInvocationHandler
-    implements InvocationHandler
-{
-    private String value;
-
-    public FooModelInvocationHandler( String value )
-    {
-        this.value = value;
-    }
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        if(method.getName().equals( "hashCode" ))
-            return hashCode();
-        if(method.getName().equals( "equals" ))
-            return equals(args[0]);
-        if(args==null || args.length==0)
-            return value;
-        value = (String) args[0];
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java
deleted file mode 100644
index 7ffe104..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-
-// START SNIPPET: decorator
-@Mixins(View1.Mixin.class)
-public interface View1
-{
-    String bar();
-
-    public class Mixin
-        implements View1
-    {
-        @This
-        FooModel model;
-
-        @Override
-        public String bar()
-        {
-            return model.getBar();
-        }
-    }
-}
-// END SNIPPET: decorator

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java b/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java
deleted file mode 100644
index 1232058..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View2.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.decoratorMixin;
-
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-
-@Mixins(View2.Mixin.class)
-public interface View2
-{
-    String bar();
-    public class Mixin
-        implements View2
-    {
-        @This
-        FooModel model;
-
-        @Override
-        public String bar()
-        {
-            return model.getBar();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java
deleted file mode 100644
index 1d8e8d4..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.mixin.StartMixin;
-import org.apache.zest.api.mixin.Startable;
-
-// START SNIPPET: partial
-@Mixins( { StartMixin.class, SpeedMixin.class, CrashResultMixin.class } )
-public interface Car extends Startable, Vehicle
-{}
-
-// END SNIPPET: partial

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java
deleted file mode 100644
index a6521f9..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/CrashResultMixin.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-public class CrashResultMixin implements Crashable
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java
deleted file mode 100644
index cf8637d..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Crashable.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-public interface Crashable
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java
deleted file mode 100644
index e33d548..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-// START SNIPPET: partial
-public interface SpeedLocation
-{
-    void turn(float angle);
-
-    void accelerate(float acceleration);
-}
-// END SNIPPET: partial

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java
deleted file mode 100644
index 39ed93a..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-// START SNIPPET: partial
-public abstract class SpeedMixin
-        implements SpeedLocation
-{
-    // state for speed
-
-    public void accelerate( float acceleration )
-    {
-        // logic
-    }
-}
-
-// END SNIPPET: partial
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java b/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java
deleted file mode 100644
index 474b3f7..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.partial;
-
-// START SNIPPET: partial
-public interface Vehicle extends SpeedLocation, Crashable
-{
-}
-
-// END SNIPPET: partial
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java
deleted file mode 100644
index 410d255..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.privateMixin;
-
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.mixin.Mixins;
-
-// START SNIPPET: private
-@Mixins( CargoMixin.class )
-public interface Cargo extends EntityComposite
-{
-    String origin();
-
-    String destination();
-
-    void changeDestination( String newDestination );
-
-}
-
-// END SNIPPET: private

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java
deleted file mode 100644
index 6b5fb58..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.privateMixin;
-
-import org.apache.zest.api.injection.scope.This;
-
-// START SNIPPET: private
-public abstract class CargoMixin
-        implements Cargo
-{
-    @This
-    private CargoState state;
-
-    public String origin()
-    {
-        return state.origin().get();
-    }
-
-    public String destination()
-    {
-        return state.destination().get();
-    }
-
-    public void changeDestination( String newDestination )
-    {
-        state.destination().set( newDestination );
-    }
-}
-
-// END SNIPPET: private
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java b/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java
deleted file mode 100644
index d7e2516..0000000
--- a/core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin.privateMixin;
-
-import org.apache.zest.api.property.Property;
-
-// START SNIPPET: private
-public interface CargoState
-{
-    Property<String> origin();
-    Property<String> destination();
-}
-
-// END SNIPPET: private
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java b/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java
deleted file mode 100644
index 1213cee..0000000
--- a/core/api/src/test/java/org/apache/zest/api/object/ObjectBuilderTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.object;
-
-import org.junit.Test;
-import org.apache.zest.api.injection.scope.Uses;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * JAVADOC
- */
-public class ObjectBuilderTest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.objects( A.class, B.class, C.class, D.class );
-    }
-
-    @Test
-    public void testNotProvidedUses()
-    {
-        A a = objectFactory.newObject( A.class );
-        assertNotNull( a );
-        assertNotNull( a.b );
-        assertNotNull( a.b.c );
-        assertNotNull( a.b.c.d );
-    }
-
-    public static class A
-    {
-        @Uses
-        B b;
-    }
-
-    public static class B
-    {
-        @Uses
-        C c;
-    }
-
-    public static class C
-    {
-        @Uses
-        D d;
-    }
-
-    public static class D
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java b/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java
deleted file mode 100644
index e0136c6..0000000
--- a/core/api/src/test/java/org/apache/zest/api/property/PropertyErrorTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import org.junit.Test;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-/**
- * Error messages for Properties
- */
-public class PropertyErrorTest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        new EntityTestAssembler().assemble( module );
-        module.entities( PersonEntity.class );
-    }
-
-    @Test( expected = ConstraintViolationException.class )
-    public void givenEntityWithNonOptionPropertyWhenInstantiatedThenException()
-        throws Exception
-    {
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        try
-        {
-            PersonEntity person = unitOfWork.newEntity( PersonEntity.class );
-
-            unitOfWork.complete();
-        }
-        finally
-        {
-            unitOfWork.discard();
-        }
-    }
-
-    interface PersonEntity
-        extends EntityComposite
-    {
-        Property<String> foo();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
deleted file mode 100644
index fe50761..0000000
--- a/core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import java.util.List;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.qualifier.ServiceTags;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-
-public class DocumentationSupport
-    implements Assembler
-{
-    // START SNIPPET: tag
-    // START SNIPPET: instantiateOnStartup
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        ServiceDeclaration service = module.addServices( MyDemoService.class );
-        // END SNIPPET: tag
-        service.instantiateOnStartup();
-        // END SNIPPET: instantiateOnStartup
-        // START SNIPPET: tag
-        service.taggedWith( "Important", "Drain" );
-        // END SNIPPET: tag
-    }
-
-    private static class MyDemoService
-    {
-    }
-
-    private static class MyOtherDemoService
-    {
-        // START SNIPPET: UseTag
-        @Service
-        private List<ServiceReference<MyDemoService>> services;
-
-        public MyDemoService locateImportantService()
-        {
-            for( ServiceReference<MyDemoService> ref : services )
-            {
-                ServiceTags serviceTags = ref.metaInfo( ServiceTags.class );
-                if( serviceTags.hasTag( "Important" ) )
-                {
-                    return ref.get();
-                }
-            }
-            return null;
-        }
-        // END SNIPPET: UseTag
-    }
-
-    // START SNIPPET: activation1
-    @Mixins( MyActivationMixin.class )
-    public static interface MyActivationDemoService
-        extends ServiceComposite, ServiceActivation
-    {
-    }
-
-    public static class MyActivationMixin
-        implements ServiceActivation
-    {
-        @Override
-        public void activateService()
-            throws Exception
-        {
-            // Activation code
-        }
-
-        @Override
-        public void passivateService()
-            throws Exception
-        {
-            // Passivation code
-        }
-    }
-    // END SNIPPET: activation1
-
-    // START SNIPPET: activation2
-    @Activators( MyActivator.class )
-    public static interface MyOtherActivationDemoService
-        extends ServiceComposite
-    {
-    }
-
-    public static class MyActivator
-        extends ServiceActivatorAdapter<MyOtherActivationDemoService>
-    {
-        @Override
-        public void afterActivation( ServiceReference<MyOtherActivationDemoService> activated )
-            throws Exception
-        {
-            // Activation code
-        }
-
-        @Override
-        public void beforePassivation( ServiceReference<MyOtherActivationDemoService> passivating )
-            throws Exception
-        {
-            // Passivation code
-        }
-    }
-    // END SNIPPET: activation2
-
-    static class Activation3
-        implements Assembler
-    {
-        // START SNIPPET: activation3
-        @Override
-        public void assemble( ModuleAssembly module )
-        {
-            module.services( MyDemoService.class ).withActivators( MyActivator.class );
-        }
-        // END SNIPPET: activation3
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java b/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java
deleted file mode 100644
index bfbeeb6..0000000
--- a/core/api/src/test/java/org/apache/zest/api/unitofwork/RemovalTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.identity.StringIdentity;
-import org.junit.Test;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-public class RemovalTest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.entities( TestEntity.class );
-        module.entities( PidRegulator.class );
-        new EntityTestAssembler().assemble( module );
-    }
-
-    @Test
-    public void givenEntityIsCreatedAndUnitOfWorkIsNotCompletedWhenEntityIsRemoveThenSuccessfulRemoval()
-        throws Exception
-    {
-        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
-        try
-        {
-            EntityBuilder<TestEntity> builder = uow.newEntityBuilder( TestEntity.class, new StringIdentity( "123" ) );
-            builder.instance().test().set( "habba" );
-            TestEntity test = builder.newInstance();
-            uow.remove( test );
-            uow.complete();
-        }
-        finally
-        {
-            uow.discard();
-        }
-    }
-
-    @Test
-    public void givenStandardPidRegulatorWhenNoChangeInInputExpectOutputToGoTowardsMinimum()
-        throws Exception
-    {
-        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
-        PidRegulator regulator = null;
-        try
-        {
-            regulator = createPidRegulator( uow );
-        }
-        finally
-        {
-            if( regulator != null )
-            {
-                uow.remove( regulator );
-            }
-            // TODO: This problem is related to that uow.remove() has a bug.
-            // If the Entity is both created and removed in the same session, then the remove() should simply remove
-            // the entity from the internal UoW holding area, and not set the REMOVED status.
-
-            // Probably that UnitOfWorkInstance.remove() should also call instanceCache.remove(), but the question is
-            // then what is an InstanceKey vs EntityReference
-            uow.complete();
-        }
-    }
-
-    public interface TestEntity
-        extends EntityComposite
-    {
-        @Optional
-        Property<String> test();
-    }
-
-    private PidRegulator createPidRegulator( UnitOfWork uow )
-        throws UnitOfWorkCompletionException
-    {
-        EntityBuilder<PidRegulator> builder = uow.newEntityBuilder( PidRegulator.class );
-        PidRegulator prototype = builder.instance();
-        prototype.p().set( 1.0f );
-        prototype.i().set( 10f );
-        prototype.d().set( 0.1f );
-        prototype.maxD().set( 10f );
-        prototype.maximum().set( 100f );
-        prototype.minimum().set( 0f );
-        PidRegulator regulator = builder.newInstance();
-
-        return regulator;
-    }
-
-    //    @Mixins( { PidRegulatorAlgorithmMixin.class } )
-    public interface PidRegulator
-        extends PidParameters, EntityComposite
-    {
-    }
-
-    public interface PidParameters
-    {
-        Property<Float> p();
-
-        Property<Float> i();
-
-        Property<Float> d();
-
-        Property<Float> maxD();
-
-        Property<Float> minimum();
-
-        Property<Float> maximum();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java b/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java
deleted file mode 100644
index 170132b..0000000
--- a/core/api/src/test/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplateTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.junit.Test;
-import org.apache.zest.api.entity.EntityBuilderTemplate;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-/**
- * TODO
- */
-public class UnitOfWorkTemplateTest
-    extends AbstractPolygeneTest
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        new EntityTestAssembler().assemble( module );
-        module.entities( TestEntity.class );
-    }
-
-    @Test
-    public void testTemplate()
-        throws UnitOfWorkCompletionException
-    {
-        new UnitOfWorkTemplate<Void, RuntimeException>()
-        {
-            @Override
-            protected Void withUnitOfWork( UnitOfWork uow )
-                throws RuntimeException
-            {
-                new EntityBuilderTemplate<TestEntity>( TestEntity.class )
-                {
-                    @Override
-                    protected void build( TestEntity prototype )
-                    {
-                        prototype.name().set( "Rickard" );
-                    }
-                }.newInstance( module.instance() );
-
-                return null;
-            }
-        }.withModule( module.instance() );
-    }
-
-    interface TestEntity
-        extends EntityComposite
-    {
-        Property<String> name();
-    }
-}


[34/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/Constraint.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/Constraint.java b/core/api/src/main/java/org/apache/zest/api/constraint/Constraint.java
deleted file mode 100644
index c426e8d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/Constraint.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-
-/**
- * All Constraints must implement this interface, which is used for each
- * value validation.
- */
-public interface Constraint<ANNOTATION extends Annotation, TYPE>
-    extends Serializable
-{
-    /**
-     * For each value or parameter which should be checked this method will be invoked.
-     * If the method returns true the value is valid. If it returns false the value
-     * is considered invalid. When all constraints have been checked a ConstraintViolationException
-     * will be thrown with all the constraint violations that were found.
-     *
-     * @param annotation the annotation to match
-     * @param value      the value to be checked
-     *
-     * @return true if valid, false if invalid
-     */
-    boolean isValid( ANNOTATION annotation, TYPE value );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDeclaration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDeclaration.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDeclaration.java
deleted file mode 100644
index 85e7072..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDeclaration.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * All annotations that are used to trigger Constraints must have this annotation.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.ANNOTATION_TYPE )
-@Documented
-public @interface ConstraintDeclaration
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDescriptor.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDescriptor.java
deleted file mode 100644
index 9272e38..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.lang.annotation.Annotation;
-
-/**
- * Constraint Descriptor.
- */
-public interface ConstraintDescriptor
-{
-    Annotation annotation();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintImplementationNotFoundException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintImplementationNotFoundException.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintImplementationNotFoundException.java
deleted file mode 100644
index 13312ec..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintImplementationNotFoundException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import org.apache.zest.api.common.InvalidApplicationException;
-
-/**
- * This exception is thrown if a Constraint implementation can not be found.
- */
-public class ConstraintImplementationNotFoundException
-    extends InvalidApplicationException
-{
-    public ConstraintImplementationNotFoundException( String message )
-    {
-        super( message );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolation.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolation.java
deleted file mode 100644
index 44b4830..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-
-/**
- * When a constraint violation has occurred (ie Constraint.isValid has returned false) it
- * is put in a collection of all violations that have occurred for this value check.
- */
-public final class ConstraintViolation
-    implements Serializable
-{
-    private String name;
-    private final Annotation constraint;
-    private final Object value;
-
-    public ConstraintViolation( String name, Annotation constraint, Object value )
-    {
-        this.name = name;
-        this.constraint = constraint;
-        this.value = value;
-    }
-
-    public String name()
-    {
-        return name;
-    }
-
-    public Annotation constraint()
-    {
-        return constraint;
-    }
-
-    public Object value()
-    {
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolationException.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolationException.java
deleted file mode 100644
index b883f7d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintViolationException.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.util.Classes;
-
-import static java.util.stream.Collectors.joining;
-
-/**
- * This Exception is thrown when there is one or more Constraint Violations in a method
- * call.
- * <p>
- * The Constraint Violations are aggregated per method, and this exception will contain those
- * violations, together with the Composite instance it happened on as well as the Method that
- * was invoked. The Exception also has support for localized messages of these violations.
- * </p>
- */
-public class ConstraintViolationException
-    extends IllegalArgumentException
-{
-    private static final long serialVersionUID = 1L;
-
-    private final Collection<ConstraintViolation> constraintViolations;
-    private String methodName;
-    private String mixinTypeName;
-    private String instanceToString;
-    private List<? extends Type> instanceTypes;
-
-    public ConstraintViolationException( Composite instance, Member method,
-                                         Collection<ConstraintViolation> constraintViolations
-    )
-    {
-        this( instance.toString(), Classes.interfacesOf( instance.getClass() ), method, constraintViolations );
-    }
-
-    public ConstraintViolationException( String instanceToString,
-                                         Stream<? extends Type> instanceTypes,
-                                         Member method,
-                                         Collection<ConstraintViolation> violations
-    )
-    {
-        this.instanceToString = instanceToString;
-        this.instanceTypes = instanceTypes.collect( Collectors.toList() );
-        mixinTypeName = method.getDeclaringClass().getName();
-        methodName = method.getName();
-        this.constraintViolations = violations;
-    }
-
-    public ConstraintViolationException( Identity identity,
-                                         List<? extends Type> instanceTypes,
-                                         String mixinTypeName,
-                                         String methodName,
-                                         Collection<ConstraintViolation> violations
-    )
-    {
-        this.instanceToString = identity.toString();
-        this.instanceTypes = instanceTypes;
-        this.mixinTypeName = mixinTypeName;
-        this.methodName = methodName;
-        this.constraintViolations = violations;
-    }
-
-    public Collection<ConstraintViolation> constraintViolations()
-    {
-        return constraintViolations;
-    }
-
-    /**
-     * Creates localized messages of all the constraint violations that has occured.
-     * <p>
-     * The key "<code>zest.constraint.<i><strong>CompositeType</strong></i>.<i><strong>methodName</strong></i></code>"
-     * will be used to lookup the text formatting
-     * pattern from the ResourceBundle, where <strong><code><i>CompositeType</i></code></strong> is the
-     * class name of the Composite where the constraint was violated. If such key does not exist, then the
-     * key &nbsp;"<code>zest.constraint</code>" will be used, and if that one also doesn't exist, or
-     * the resourceBundle argument is null, then the default patterns will be used;
-     * </p>
-     * <table summary="Localization of constraint vioations.">
-     * <tr><th>Type of Composite</th><th>Pattern used</th></tr>
-     * <tr><td>Composite</td>
-     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in composite \n{0} of type {1}</code></td>
-     * </tr>
-     * <tr><td>EntityComposite</td>
-     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in entity {1}[id={0}]</code></td>
-     * </tr>
-     * <tr><td>ServiceComposite</td>
-     * <td><code>Constraint Violation in {2}.{3} with constraint {4}, in service {0}</code></td>
-     * </tr>
-     * </table>
-     * Then format each ConstraintViolation according to such pattern, where the following argument are passed;
-     * <table summary="List of arguments available."><tr><th>Arg</th><th>Value</th></tr>
-     * <tr>
-     * <td>{0}</td>
-     * <td>Composite instance toString()</td>
-     * </tr>
-     * <tr>
-     * <td>{1}</td>
-     * <td>CompositeType class name</td>
-     * </tr>
-     * <tr>
-     * <td>{2}</td>
-     * <td>MixinType class name</td>
-     * </tr>
-     * <tr>
-     * <td>{3}</td>
-     * <td>MixinType method name</td>
-     * </tr>
-     * <tr>
-     * <td>{4}</td>
-     * <td>Annotation toString()</td>
-     * </tr>
-     * <tr>
-     * <td>{5}</td>
-     * <td>toString() of value passed as the argument, or "null" text if argument was null.</td>
-     * </tr>
-     * </table>
-     * <p>
-     * <b>NOTE!!!</b> This class is still under construction and will be modified further.
-     * </p>
-     *
-     * @param bundle The ResourceBundle for Localization, or null if default formatting and locale to be used.
-     *
-     * @return An array of localized messages of the violations incurred.
-     */
-    public String[] localizedMessagesFrom( ResourceBundle bundle )
-    {
-        String pattern = "Constraint violation in {0}.{1} for method ''{3}'' with constraint \"{4}({6})\", for value ''{5}''";
-
-        ArrayList<String> list = new ArrayList<>();
-        for( ConstraintViolation violation : constraintViolations )
-        {
-            Locale locale;
-            if( bundle != null )
-            {
-                try
-                {
-                    pattern = bundle.getString( "zest.constraint." + mixinTypeName + "." + methodName );
-                }
-                catch( MissingResourceException e1 )
-                {
-                    try
-                    {
-                        pattern = bundle.getString( "zest.constraint" );
-                    }
-                    catch( MissingResourceException e2 )
-                    {
-                        // ignore. The default pattern will be used.
-                    }
-                }
-                locale = bundle.getLocale();
-            }
-            else
-            {
-                locale = Locale.getDefault();
-            }
-            MessageFormat format = new MessageFormat( pattern, locale );
-
-            Annotation annotation = violation.constraint();
-            String name = violation.name();
-            Object value = violation.value();
-            String classes;
-            if( instanceTypes.stream().count() == 1 )
-            {
-                Type type = instanceTypes.stream().findFirst().get();
-                classes = Classes.RAW_CLASS.apply( type ).getSimpleName();
-            }
-            else
-            {
-                classes = "[" + instanceTypes.stream()
-                    .map( Classes.RAW_CLASS )
-                    .map( Class::getSimpleName ).collect( joining( "," ) ) + "]";
-            }
-            Object[] args = new Object[]
-                {
-                    instanceToString,
-                    classes,
-                    mixinTypeName,
-                    methodName,
-                    annotation.toString(),
-                    "" + value,
-                    name
-                };
-            StringBuffer text = new StringBuffer();
-            format.format( args, text, null );
-            list.add( text.toString() );
-        }
-        String[] result = new String[ list.size() ];
-        list.toArray( result );
-        return result;
-    }
-
-    public String localizedMessage()
-    {
-        String[] messages = localizedMessagesFrom( null );
-        StringBuilder result = new StringBuilder();
-        boolean first = true;
-        for( String message : messages )
-        {
-            if( !first )
-            {
-                result.append( ',' );
-            }
-            first = false;
-            result.append( message );
-        }
-        return result.toString();
-    }
-
-    @Override
-    public String getLocalizedMessage()
-    {
-        return localizedMessage();
-    }
-
-    @Override
-    public String getMessage()
-    {
-        return localizedMessage();
-    }
-
-    public String methodName()
-    {
-        return methodName;
-    }
-
-    public String mixinTypeName()
-    {
-        return mixinTypeName;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/Constraints.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/Constraints.java b/core/api/src/main/java/org/apache/zest/api/constraint/Constraints.java
deleted file mode 100644
index d1931a9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/Constraints.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used by composites and mixins to declare what Constraints
- * can be applied in the Composite.
- * <p>
- * Constraints implement the {@link Constraint} interface
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE } )
-@Documented
-public @interface Constraints
-{
-    Class<? extends Constraint<?, ?>>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintsDescriptor.java b/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintsDescriptor.java
deleted file mode 100644
index bfe5622..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/ConstraintsDescriptor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-/**
- * Constraints Descriptor.
- */
-public interface ConstraintsDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/Name.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/Name.java b/core/api/src/main/java/org/apache/zest/api/constraint/Name.java
deleted file mode 100644
index a77a965..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/Name.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.constraint;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation for parameter names. This is used to add extra information for constraint exception.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.PARAMETER } )
-@Documented
-public @interface Name
-{
-    String value();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/constraint/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/constraint/package.html b/core/api/src/main/java/org/apache/zest/api/constraint/package.html
deleted file mode 100644
index 87e14b7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/constraint/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Constraint API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/Aggregated.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/Aggregated.java b/core/api/src/main/java/org/apache/zest/api/entity/Aggregated.java
deleted file mode 100644
index f63e1b3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/Aggregated.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marks an association as aggregating the referenced Entities
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.METHOD } )
-@Documented
-public @interface Aggregated
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilder.java b/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilder.java
deleted file mode 100644
index 2c574d6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilder.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * EntityBuilders are used to instantiate EntityComposites. They can be acquired from
- * {@link org.apache.zest.api.unitofwork.UnitOfWork#newEntityBuilder(Class)} and allows the client
- * to provide additional settings before instantiating the Composite.
- *
- * After calling newInstance() the builder becomes invalid, and may not be called again.
- */
-public interface EntityBuilder<T>
-{
-    /**
-     * Get a representation of the state for the new Composite.
-     * It is possible to access and update properties and associations,
-     * even immutable ones since the builder represents the initial state.
-     *
-     * @return a proxy implementing the Composite type
-     */
-    T instance();
-
-    /**
-     * Get a representation of the state of the given type for the new Composite.
-     * This is primarily used if you want to provide state for a private mixin type.
-     *
-     * @param mixinType the mixin which you want to provide state for
-     *
-     * @return a proxy implementing the given mixin type
-     */
-    <K> K instanceFor( Class<K> mixinType );
-
-    /**
-     * Create a new Entity instance.
-     *
-     * @return a new Entity instance
-     *
-     * @throws org.apache.zest.api.common.ConstructionException
-     *                            thrown if it was not possible to instantiate the Composite
-     * @throws LifecycleException if the entity could not be created
-     */
-    T newInstance()
-        throws ConstructionException, LifecycleException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilderTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilderTemplate.java b/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilderTemplate.java
deleted file mode 100644
index 45aa497..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/EntityBuilderTemplate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import org.apache.zest.api.structure.Module;
-
-/**
- * EntityBuilderTemplate.
- */
-public abstract class EntityBuilderTemplate<T>
-{
-    Class<T> type;
-
-    protected EntityBuilderTemplate( Class<T> type )
-    {
-        this.type = type;
-    }
-
-    protected abstract void build( T prototype );
-
-    public T newInstance( Module module )
-    {
-        EntityBuilder<T> builder = module.unitOfWorkFactory().currentUnitOfWork().newEntityBuilder( type );
-        build( builder.instance() );
-        return builder.newInstance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/EntityComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/EntityComposite.java b/core/api/src/main/java/org/apache/zest/api/entity/EntityComposite.java
deleted file mode 100644
index 44de095..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/EntityComposite.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import org.apache.zest.api.association.AssociationMixin;
-import org.apache.zest.api.association.ManyAssociationMixin;
-import org.apache.zest.api.association.NamedAssociationMixin;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.mixin.Mixins;
-
-/**
- * EntityComposites are Composites that has mutable state persisted in EntityStores and equality defined from its
- * reference.
- */
-@Mixins( { AssociationMixin.class, ManyAssociationMixin.class, NamedAssociationMixin.class } )
-public interface EntityComposite extends HasIdentity, Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/EntityDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/EntityDescriptor.java b/core/api/src/main/java/org/apache/zest/api/entity/EntityDescriptor.java
deleted file mode 100644
index 42ac4a4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/EntityDescriptor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import org.apache.zest.api.association.AssociationStateDescriptor;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.StatefulCompositeDescriptor;
-
-/**
- * Entity Descriptor.
- */
-public interface EntityDescriptor
-    extends CompositeDescriptor, StatefulCompositeDescriptor
-{
-    @Override
-    AssociationStateDescriptor state();
-
-    boolean queryable();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/EntityReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/EntityReference.java b/core/api/src/main/java/org/apache/zest/api/entity/EntityReference.java
deleted file mode 100644
index a6a5e0e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/EntityReference.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import java.io.Serializable;
-import java.util.Objects;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.identity.StringIdentity;
-import org.apache.zest.api.util.NullArgumentException;
-
-/**
- * An EntityReference is reference of a specific Entity instance.
- * <p>When stringified, the reference is used as-is. Example:</p>
- * <pre>123456-abcde</pre>
- */
-public final class EntityReference
-        implements Serializable
-{
-    /**
-     * Parse an Entity reference to an EntityReference.
-     *
-     * @param identityString the EntityReference reference
-     * @return the EntityReference represented by the given reference
-     */
-    public static EntityReference parseEntityReference(String identityString)
-    {
-        return new EntityReference( new StringIdentity( identityString ) );
-    }
-
-    /**
-     * @param object an EntityComposite
-     * @return the EntityReference for the given EntityComposite
-     */
-    public static EntityReference entityReferenceFor(Object object)
-    {
-        return new EntityReference(((EntityComposite) object).identity().get());
-    }
-
-    public static EntityReference create(Identity identity)
-    {
-        if (identity == null)
-        {
-            return null;
-        }
-        return new EntityReference(identity);
-    }
-
-    private static final long serialVersionUID = 1L;
-
-    private Identity identity;
-
-    /**
-     * @param identity reference reference
-     * @throws NullArgumentException if reference is null or empty
-     */
-    private EntityReference( Identity identity )
-    {
-        Objects.requireNonNull(identity,"reference must not be null");
-        this.identity = identity;
-    }
-
-    /**
-     *
-     * @return The reference of the Entity that this EntityReference.is referring to
-     */
-    public final Identity identity()
-    {
-        return identity;
-    }
-
-    /**
-     * @return An URI representation of this EntityReference.
-     */
-    public String toURI()
-    {
-        return "urn:zest:entity:" + identity;
-    }
-
-    @Override
-    public boolean equals(Object o)
-    {
-        if (this == o)
-        {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass())
-        {
-            return false;
-        }
-        EntityReference that = (EntityReference) o;
-        return identity.equals(that.identity);
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return identity.hashCode();
-    }
-
-    @Override
-    public String toString()
-    {
-        return identity.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/Lifecycle.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/Lifecycle.java b/core/api/src/main/java/org/apache/zest/api/entity/Lifecycle.java
deleted file mode 100644
index c360b25..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/Lifecycle.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-/**
- * Lifecycle interface for all Composites.
- * <p>
- * This Lifecycle interface is a built-in feature of the Polygene runtime, similar to the Initializable interface.
- * Any Mixin that implements this interface AND is part of an EntityComposite will have these two methods called
- * upon creation/removal of the EntityComposite instance to/from the EntityStore. Meaning, the create method is called
- * only when the identifiable EntityComposite is created the first time, and not when it is read from its persisted
- * state and created into memory.
- * </p>
- * <p>
- * Example;
- * </p>
- * <pre><code>
- * public interface System
- * {
- *     Property&lt;User&gt; admin();
- * }
- *
- * public class SystemAdminMixin&lt;LifeCycle&gt;
- *     implements System, Lifecyle, ...
- * {
- *      &#64;Structure private UnitOfWork uow;
- *      &#64;This private Identity meAsIdentity;
- *
- *      public void create()
- *      {
- *          String thisId = meAsIdentity.reference().get();
- *          EntityBuilder builder = uow.newEntityBuilder( thisId + ":1", UserComposite.class );
- *          User admin = builder.newInstance();
- *          admin.set( admin );
- *      }
- *
- *      public void remove()
- *      {
- *          uow.remove( admin.get() );
- *      }
- * }
- *
- * &#64;Mixins( SystemAdminMixin.class )
- * public interface SystemEntity extends System, EntityComposite
- * {}
- *
- * </code></pre>
- */
-public interface Lifecycle
-{
-    /**
-     * Creation callback method.
-     * <p>
-     * Called by the Polygene runtime before the newInstance of the entity completes, before the constraints are checked,
-     * allowing for additional initialization.
-     * </p>
-     * @throws Exception if the entity could not be created
-     */
-    void create() throws Exception;
-
-    /**
-     * Removal callback method.
-     * <p>
-     * Called by the Polygene runtime before the entity is removed from the system, allowing
-     * for clean-up operations.
-     * </p>
-     * @throws Exception if the entity could not be removed
-     */
-    void remove() throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/LifecycleException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/LifecycleException.java b/core/api/src/main/java/org/apache/zest/api/entity/LifecycleException.java
deleted file mode 100644
index c4b5957..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/LifecycleException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-/**
- * Thrown if Lifecycle invocation fails
- */
-public class LifecycleException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public LifecycleException()
-    {
-    }
-
-    public LifecycleException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/Queryable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/Queryable.java b/core/api/src/main/java/org/apache/zest/api/entity/Queryable.java
deleted file mode 100644
index 132789d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/Queryable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.entity;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used to mark entity types or properties/associations that are indexable.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface Queryable
-{
-    boolean value() default true;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/entity/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/entity/package.html b/core/api/src/main/java/org/apache/zest/api/entity/package.html
deleted file mode 100644
index 39a3223..0000000
--- a/core/api/src/main/java/org/apache/zest/api/entity/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Entity API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/event/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/event/package.html b/core/api/src/main/java/org/apache/zest/api/event/package.html
deleted file mode 100644
index 4972ae6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/event/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Event API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/HasIdentity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/HasIdentity.java b/core/api/src/main/java/org/apache/zest/api/identity/HasIdentity.java
deleted file mode 100644
index c256690..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/HasIdentity.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.injection.scope.State;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.property.Property;
-
-/**
- * This interface provides the identity of the object which may be used
- * to store the state in a database. It is not the responsibility of the
- * framework to come up with a good identity string.
- */
-@Mixins( HasIdentity.HasIdentityMixin.class )
-public interface HasIdentity
-{
-    Method IDENTITY_METHOD = HasIdentityMixin.identityMethod();
-    QualifiedName IDENTITY_STATE_NAME = HasIdentityMixin.stateName();
-
-    @Immutable
-    Property<Identity> identity();
-
-    /**
-     * Default Identity implementation.
-     */
-    class HasIdentityMixin
-        implements HasIdentity
-    {
-        @State
-        private Property<Identity> identity;
-
-
-        @Override
-        public Property<Identity> identity()
-        {
-            return identity;
-        }
-
-        private static QualifiedName stateName()
-        {
-            return QualifiedName.fromAccessor( identityMethod() );
-        }
-
-        private static Method identityMethod()
-        {
-            try
-            {
-                return HasIdentity.class.getMethod( "identity" );
-            }
-            catch( NoSuchMethodException e )
-            {
-                throw new InternalError( "Polygene Core Runtime codebase is corrupted." );
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/Identifiable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/Identifiable.java b/core/api/src/main/java/org/apache/zest/api/identity/Identifiable.java
deleted file mode 100644
index f111570..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/Identifiable.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-public interface Identifiable
-{
-    Identity identity();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/Identity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/Identity.java b/core/api/src/main/java/org/apache/zest/api/identity/Identity.java
deleted file mode 100644
index 6cf549e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/Identity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-/**
- * Representation of an Identity.
- * Identity is an opaque, immutable data type.
- * Identity is a very central concept in any domain model.
- *
- */
-public interface Identity
-{
-    String toString();
-
-    byte[] toBytes();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/IdentityGenerator.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/IdentityGenerator.java b/core/api/src/main/java/org/apache/zest/api/identity/IdentityGenerator.java
deleted file mode 100644
index d15c8ab..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/IdentityGenerator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-import org.apache.zest.api.mixin.Mixins;
-
-/**
- * Generator for identities of EntityComposite's.
- */
-@Mixins( UuidGeneratorMixin.class )
-public interface IdentityGenerator
-{
-    /**
-     * Generate a new id for the given Composite type
-     *
-     * @param compositeType the type of composite
-     *
-     * @return a new reference
-     */
-    Identity generate( Class<?> compositeType );
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/StringIdentity.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/StringIdentity.java b/core/api/src/main/java/org/apache/zest/api/identity/StringIdentity.java
deleted file mode 100644
index a3e5002..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/StringIdentity.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Objects;
-
-public class StringIdentity
-    implements Identity
-{
-    private final String value;
-
-    public StringIdentity(String value)
-    {
-        Objects.requireNonNull( value, "Identity can not be null." );
-        this.value = value;
-    }
-
-    public StringIdentity(byte[] bytes)
-    {
-        value = new String(bytes, StandardCharsets.UTF_8);
-    }
-
-    public String value()
-    {
-        return value;
-    }
-
-    @Override
-    public byte[] toBytes()
-    {
-        return value.getBytes(StandardCharsets.UTF_8);
-    }
-
-    @Override
-    public String toString()
-    {
-        return value;
-    }
-
-    public static Identity fromString(String serializedState)
-    {
-        return new StringIdentity( serializedState );
-    }
-
-    @Override
-    public boolean equals(Object o)
-    {
-        if (this == o)
-        {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass())
-        {
-            return false;
-        }
-
-        StringIdentity that = (StringIdentity) o;
-
-        return value.equals(that.value);
-
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return value.hashCode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/identity/UuidGeneratorMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/identity/UuidGeneratorMixin.java b/core/api/src/main/java/org/apache/zest/api/identity/UuidGeneratorMixin.java
deleted file mode 100644
index 5caddc0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/identity/UuidGeneratorMixin.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.identity;
-
-import java.util.UUID;
-
-public class UuidGeneratorMixin
-        implements IdentityGenerator
-{
-    @Override
-    public Identity generate(Class<?> compositeType)
-    {
-        return StringIdentity.fromString(UUID.randomUUID().toString());
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/InjectionScope.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/InjectionScope.java b/core/api/src/main/java/org/apache/zest/api/injection/InjectionScope.java
deleted file mode 100644
index eb8ec5f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/InjectionScope.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This is used to annotate annotation types which are used for injection.
- * Each scope signifies a particular scope from which the injection value should be taken.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.ANNOTATION_TYPE } )
-@Documented
-public @interface InjectionScope
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/package.html b/core/api/src/main/java/org/apache/zest/api/injection/package.html
deleted file mode 100644
index 155a5e4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Dependency Injection API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/Invocation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/Invocation.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/Invocation.java
deleted file mode 100644
index f83b86f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/Invocation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a
- * invocation specific resource.
- * These include:
- * <pre><code>
- *  - The Method being invoked.
- *
- *  - An AnnotationElement with annotations
- *    from both mixin type, mixin
- *    implementation.
- *
- *  - An Annotation of a specific type
- * </code></pre>
- * Examples:
- * <pre><code>
- * &#64;Invocation Method theInvokedMethod
- * &#64;Invocation AnnotationElement annotations
- * &#64;Invocation Matches matchesAnnotation
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface Invocation
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/Service.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/Service.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/Service.java
deleted file mode 100644
index 65eee4d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/Service.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a service dependency into a Fragment.
- * <p>
- * Examples:
- * </p>
- * <pre><code>
- * &#64;Service MyService service
- * &#64;Service Iterable&lt;MyService&gt; services
- * &#64;Service ServiceReference&lt;MyService&gt; serviceRef
- * &#64;Service Iterable&lt;ServiceReference&lt;MyService&gt;&gt; serviceRefs
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface Service
-{
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/State.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/State.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/State.java
deleted file mode 100644
index 853da83..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/State.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a property, association or
- * StateHolder.
- * <pre><code>
- * &#64;State Property&lt;StringState propertyName;
- * &#64;State Association&lt;MyEntityState associationName;
- * &#64;State ManyAssociation&lt;MyEntityState manyAssociationName;
- * &#64;State NamedAssociation&lt;MyEntityState namedAssociationName;
- * &#64;State StateHolder state;
- * &#64;State AssociationStateHolder associationState;
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface State
-{
-    /**
-     * Name of the property or association.
-     * If not set then name will be name of field.
-     *
-     * @return the name
-     */
-    public abstract String value() default "";
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/Structure.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/Structure.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/Structure.java
deleted file mode 100644
index 2a9916c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/Structure.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a
- * resource specific for the module which the
- * injected object/fragment is instantiated in.
- * <p>
- * Valid types are:
- * </p>
- * <pre><code>
- * - TransientBuilderFactory
- * - ObjectBuilderFactory
- * - UnitOfWorkFactory
- * - ServiceFinder
- * - Module
- * - Layer
- * - Application
- * - PolygeneAPI
- * - PolygeneSPI
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface Structure
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/This.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/This.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/This.java
deleted file mode 100644
index 995ad8b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/This.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a reference to the same Composite
- * as the fragment is a part of.
- * <p>
- * If the Composite type does not implement the type of the field or parameter
- * then it will be referencing a private mixin.
- * </p>
- * <p>
- * Calls to the reference will have the same semantics as calls to the Composite itself.
- * Specifically the same set of Modifiers will be used.
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface This
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/Uses.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/Uses.java b/core/api/src/main/java/org/apache/zest/api/injection/scope/Uses.java
deleted file mode 100644
index 1512167..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/Uses.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.injection.scope;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * Annotation to denote the injection of a dependency to be used by a Mixin. The injected
- * object is provided either by the TransientBuilder.uses() declarations, or if an instance of the appropriate types is not
- * found, then a new Transient or Object is instantiated.
- * Call {@link org.apache.zest.api.composite.TransientBuilder#use} to provide the instance
- * to be injected.
- *
- * Example:
- * <pre>@Uses SomeType someInstance</pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.PARAMETER, ElementType.FIELD } )
-@Documented
-@InjectionScope
-public @interface Uses
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/injection/scope/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/injection/scope/package.html b/core/api/src/main/java/org/apache/zest/api/injection/scope/package.html
deleted file mode 100644
index 10f4f1c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/injection/scope/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Dependency Injection Scopes.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/Metric.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/Metric.java b/core/api/src/main/java/org/apache/zest/api/metrics/Metric.java
deleted file mode 100644
index 14fe767..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/Metric.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Marker interface for all Metric types.
- */
-public interface Metric
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricNames.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricNames.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricNames.java
deleted file mode 100644
index a924d4b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricNames.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-import org.apache.zest.api.structure.Module;
-
-import java.lang.reflect.Method;
-import java.util.StringJoiner;
-
-/**
- * Metric names utilities.
- */
-public class MetricNames
-{
-    /**
-     * Build a Metric name for the given fragments.
-     *
-     * @param fragments Name fragments
-     * @return Metric name
-     */
-    public static String nameFor( String... fragments )
-    {
-        StringJoiner joiner = new StringJoiner( "." );
-        for( String fragment : fragments )
-        {
-            joiner.add( fragment );
-        }
-        return joiner.toString();
-    }
-
-    /**
-     * Build a Metric name for the given Module, Type and optional fragments.
-     *
-     * @param module Module
-     * @param type Type
-     * @param fragments Name fragments
-     * @return Metric name
-     */
-    public static String nameFor( Module module, Class<?> type, String... fragments )
-    {
-        StringJoiner joiner = new StringJoiner( "." )
-                .add( module.layer().name() )
-                .add( module.name() )
-                .add( className( type ) );
-        for( String fragment : fragments )
-        {
-            joiner.add( fragment );
-        }
-        return joiner.toString();
-    }
-
-    /**
-     * Build a Metric name for the given Module, Method and optional fragments.
-     *
-     * @param module Module
-     * @param method Method
-     * @param fragments Name fragments
-     * @return Metric name
-     */
-    public static String nameFor( Module module, Method method, String... fragments )
-    {
-        StringJoiner joiner = new StringJoiner( "." )
-                .add( module.layer().name() )
-                .add( module.name() )
-                .add( className( method.getDeclaringClass() ) )
-                .add( method.getName() );
-        for( String fragment : fragments )
-        {
-            joiner.add( fragment );
-        }
-        return joiner.toString();
-    }
-
-    private static String className( Class<?> clazz )
-    {
-        return clazz.getName().substring( clazz.getName().lastIndexOf( '.' ) + 1 ).replace( '$', '.' );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounter.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounter.java
deleted file mode 100644
index e1ed01f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Metrics Counter.
- */
-public interface MetricsCounter extends Metric
-{
-    void increment();
-
-    void increment( int steps );
-
-    void decrement();
-
-    void decrement( int steps );
-}


[19/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleAssembly.java
deleted file mode 100644
index 8965815..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleAssembly.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.type.HasTypes;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-
-/**
- * The ModuleAssembly is used to register any information about * what the module should contain, such as composites,
- * entities and services.
- * <p>
- * Use the methods and the fluent API's to declare how the module should be constructed.
- * </p>
- */
-public interface ModuleAssembly
-{
-    /**
-     * Access the layer assembly for this module.
-     *
-     * @return The Layer containing this Module.
-     */
-    LayerAssembly layer();
-
-    /**
-     * Get an assembly for a particular Module. If this is called many times with the same names, then the same module
-     * is affected.
-     *
-     * @param layerName  The name of the Layer
-     * @param moduleName The name of the Module to retrieve or create.
-     *
-     * @return The ModuleAssembly for the Module.
-     */
-    ModuleAssembly module( String layerName, String moduleName );
-
-    /**
-     * Set the name of this module.
-     *
-     * @param name The name that this Module should have.
-     *
-     * @return This instance to support the fluid DSL of bootstrap.
-     */
-    ModuleAssembly setName( String name );
-
-    /**
-     * Access the currently set name for this module.
-     *
-     * @return The name of this Module.
-     */
-    String name();
-
-    ModuleAssembly setMetaInfo( Object info );
-
-    /**
-     * Set the module activators. Activators are executed in order around the
-     * Module activation and passivation.
-     *
-     * @param activators the module activators
-     *
-     * @return the assembly
-     */
-    @SuppressWarnings( { "unchecked", "varargs" } )
-    ModuleAssembly withActivators( Class<? extends Activator<Module>>... activators );
-
-    /**
-     * Declare a list of TransientComposites for this Module. Use the TransientDeclaration that is returned to
-     * declare further settings. Note that the TransientDeclaration works on all of the types specified.
-     *
-     * @param transientTypes The types that specifies the Transient types.
-     *
-     * @return An TransientDeclaration for the specified Transient types.
-     */
-    TransientDeclaration transients( Class<?>... transientTypes );
-
-    /**
-     * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the TransientComposite types of interest.
-     *
-     * @return An TransientDeclaration for the specified TransientComposite types.
-     */
-    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
-
-    /**
-     * Declare a list of ValueComposites for this Module. Use the ValueDeclaration that is returned to
-     * declare further settings. Note that the ValueDeclaration works on all of the types specified.
-     *
-     * @param valueTypes The types that specifies the Value types.
-     *
-     * @return An ValueDeclaration for the specified Value types.
-     */
-    ValueDeclaration values( Class<?>... valueTypes );
-
-    /**
-     * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the ValueComposite types of interest.
-     *
-     * @return An ValueDeclaration for the specified ValueComposite types.
-     */
-    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
-
-    /**
-     * Declare a list of EntityComposites for this Module. Use the EntityDeclaration that is returned to
-     * declare further settings. Note that the EntityDeclaration works on all of the types specified.
-     *
-     * @param entityTypes The types that specifies the Entity types.
-     *
-     * @return An EntityDeclaration for the specified Entity types.
-     */
-    EntityDeclaration entities( Class<?>... entityTypes );
-
-    /**
-     * Given a Specification for EntityAssembly's, returns a EntityDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the EntityComposite types of interest.
-     *
-     * @return An EntityDeclaration for the specified EntityComposite types.
-     */
-    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
-
-    /**
-     * Declare a list of Configuration Composites for this Module. Use the ConfigurationDeclaration that is returned to
-     * declare further settings. Note that the ConfigurationDeclaration works on all of the types specified.
-     *
-     * @param configurationTypes The types that specifies the Configuration types.
-     *
-     * @return An ConfigurationDeclaration for the specified Configuration types.
-     */
-    ConfigurationDeclaration configurations( Class<?>... configurationTypes );
-
-    /**
-     * Given a Specification for ConfigurationAssembly's, returns a ConfigurationDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the ConfigurationComposite types of interest.
-     *
-     * @return An ConfigurationDeclaration for the specified EntityComposite types.
-     */
-    ConfigurationDeclaration configurations( Predicate<HasTypes> specification );
-
-    /**
-     * Declare a list of object classes for this Module. Use the ObjectDeclaration that is returned to
-     * declare further settings. Note that the ObjectDeclaration works on all of the types specified.
-     *
-     * @param objectTypes The types that specifies the Object types.
-     *
-     * @return An ObjectDeclaration for the specified Object types.
-     *
-     * @throws AssemblyException on invalid assembly
-     */
-    ObjectDeclaration objects( Class<?>... objectTypes )
-        throws AssemblyException;
-
-    /**
-     * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the Object types of interest.
-     *
-     * @return An ObjectDeclaration for the specified Object types.
-     */
-    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
-
-    /**
-     * Create a list of ServiceComposites for this Module. Use the ServiceDeclaration that is returned to
-     * declare further settings. This will always create new assemblies for the specified types, instead
-     * of potentially working on already declared types like the services(...) method.
-     *
-     * @param serviceTypes The types that specifies the Service types.
-     *
-     * @return An ServiceDeclaration for the specified Service types.
-     */
-    ServiceDeclaration addServices( Class<?>... serviceTypes );
-
-    /**
-     * Declare a list of ServiceComposites for this Module. Use the ServiceDeclaration that is returned to
-     * declare further settings. Note that the ServiceDeclaration works on all of the types specified.
-     *
-     * @param serviceTypes The types that specifies the Service types.
-     *
-     * @return An ServiceDeclaration for the specified Service types.
-     */
-    ServiceDeclaration services( Class<?>... serviceTypes );
-
-    /**
-     * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the ServiceComposite types of interest.
-     *
-     * @return An ServiceDeclaration for the specified ServiceComposite types.
-     */
-    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
-
-    /**
-     * Declare a list of imported services for this Module. Use the ImportedServiceDeclaration that is returned to
-     * declare further settings. Note that the ImportedServiceDeclaration works on all of the types specified.
-     *
-     * @param serviceTypes The types that specifies the Imported Service types.
-     *
-     * @return An ImportedServiceDeclaration for the specified Imported Service types.
-     */
-    ImportedServiceDeclaration importedServices( Class<?>... serviceTypes );
-
-    /**
-     * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
-     * be used to work with all of the assemblies matched by the specification.
-     *
-     * @param specification The Specification that specifies the Imported Service types of interest.
-     *
-     * @return An ImportedServiceDeclaration for the specified Imported Service types.
-     */
-    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
-
-    <T> MixinDeclaration<T> forMixin( Class<T> mixinType );
-
-    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleName.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleName.java
deleted file mode 100644
index e6de34c..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ModuleName.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Set the name of the module
- */
-public final class ModuleName
-    implements Assembler
-{
-    private final String name;
-
-    public ModuleName( String name )
-    {
-        this.name = name;
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.setName( name );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/NamedAssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/NamedAssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/NamedAssociationDeclarations.java
deleted file mode 100644
index 6969494..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/NamedAssociationDeclarations.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.lang.reflect.AccessibleObject;
-import org.apache.zest.api.common.MetaInfo;
-
-/**
- * This provides declared {@link org.apache.zest.api.association.NamedAssociation} information that the runtime can use.
- */
-public interface NamedAssociationDeclarations
-{
-    MetaInfo metaInfoFor( AccessibleObject accessor );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectAssembly.java
deleted file mode 100644
index c9b4ef9..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single object type in a Module.
- */
-public interface ObjectAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectDeclaration.java
deleted file mode 100644
index 7b7f6da..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ObjectDeclaration.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring objects.Instances
- * of this API are acquired by calling {@link ModuleAssembly#objects(Class[])}.
- */
-public interface ObjectDeclaration
-{
-    ObjectDeclaration setMetaInfo( Object info );
-
-    ObjectDeclaration visibleIn( Visibility visibility )
-        throws IllegalStateException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/RuntimeFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/RuntimeFactory.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/RuntimeFactory.java
deleted file mode 100644
index 326dd0c..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/RuntimeFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Polygene runtime factory.
- */
-public interface RuntimeFactory
-{
-    PolygeneRuntime createRuntime();
-
-    /**
-     * Standalone application Polygene runtime factory.
-     */
-    public final class StandaloneApplicationRuntimeFactory
-        implements RuntimeFactory
-    {
-        @Override
-        public PolygeneRuntime createRuntime()
-        {
-            ClassLoader loader = getClass().getClassLoader();
-            try
-            {
-                Class<? extends PolygeneRuntime> runtimeClass = loadRuntimeClass( loader );
-                return runtimeClass.newInstance();
-            }
-            catch( ClassNotFoundException e )
-            {
-                System.err.println( "Polygene Runtime jar is not present in the classpath." );
-            }
-            catch( InstantiationException | IllegalAccessException e )
-            {
-                System.err.println( "Invalid Polygene Runtime class. If you are providing your own Polygene Runtime, please " +
-                                    "contact dev@zest.apache.org mailing list for assistance." );
-            }
-            return null;
-        }
-
-        @SuppressWarnings( { "unchecked" } )
-        private Class<? extends PolygeneRuntime> loadRuntimeClass( ClassLoader loader )
-            throws ClassNotFoundException
-        {
-            return (Class<? extends PolygeneRuntime>) loader.loadClass( "org.apache.zest.runtime.PolygeneRuntimeImpl" );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceAssembly.java
deleted file mode 100644
index 4d0c2a2..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.identity.Identifiable;
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single ServiceComposite in a Module.
- */
-public interface ServiceAssembly extends HasTypes, Identifiable
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceDeclaration.java
deleted file mode 100644
index f17ad8a..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ServiceDeclaration.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring services hosted in Polygene. Instances
- * of this API are acquired by calling {@link ModuleAssembly#services(Class[])}.
- */
-public interface ServiceDeclaration
-{
-    ServiceDeclaration setMetaInfo( Object serviceAttribute );
-
-    ServiceDeclaration visibleIn( Visibility visibility );
-
-    ServiceDeclaration withConcerns( Class<?>... concerns );
-
-    ServiceDeclaration withSideEffects( Class<?>... sideEffects );
-
-    ServiceDeclaration withMixins( Class<?>... mixins );
-
-    ServiceDeclaration withTypes( Class<?>... types );
-
-    ServiceDeclaration identifiedBy( String identity );
-
-    ServiceDeclaration taggedWith( String... tags );
-
-    ServiceDeclaration instantiateOnStartup();
-
-    /**
-     * Set the service activators. Activators are executed in order around the
-     * ServiceReference activation and passivation.
-     *
-     * @param activators the service activators
-     * @return the assembly
-     */    
-    @SuppressWarnings( { "unchecked","varargs" } )
-    ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
deleted file mode 100644
index 5d6117b..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.object.ObjectFactory;
-import org.apache.zest.api.service.ServiceFinder;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilderFactory;
-
-/**
- * Base class for Assembler that creates an Application
- * with one Layer and one Module. Create a subclass of this
- * and implement the {@link Assembler#assemble(ModuleAssembly)} method.
- * Once the SingletonAssembler is instantiated it will have created and activated
- * an Application which can be accessed from {@link org.apache.zest.bootstrap.SingletonAssembler#application()}.
- * You can also easily access any resources specific for the single Module, such as the TransientBuilderFactory.
- */
-public abstract class SingletonAssembler
-    implements Assembler
-{
-    private Energy4Java zest;
-    private Application applicationInstance;
-    private final Module moduleInstance;
-
-    /**
-     * Creates a Polygene Runtime instance containing one Layer with one Module.
-     * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add
-     * additional layers and modules via the Assembler interface that must be implemented in the subclass of this
-     * class.
-     *
-     * @throws AssemblyException   Either if the model can not be created from the disk, or some inconsistency in
-     *                             the programming model makes it impossible to create it.
-     * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception..
-     */
-    public SingletonAssembler()
-        throws AssemblyException, ActivationException
-    {
-// START SNIPPET: actual
-        zest = new Energy4Java();
-        applicationInstance = zest.newApplication(
-            applicationFactory -> applicationFactory.newApplicationAssembly( SingletonAssembler.this )
-        );
-
-        try
-        {
-            beforeActivation( applicationInstance );
-            applicationInstance.activate();
-        }
-        catch( Exception e )
-        {
-            if( e instanceof ActivationException )
-            {
-                throw ( (ActivationException) e );
-            }
-            throw new ActivationException( "Could not activate application", e );
-        }
-// START SNIPPET: actual
-
-        moduleInstance = applicationInstance.findModule( "Layer 1", "Module 1" );
-    }
-
-    public final PolygeneAPI runtime()
-    {
-        return zest.spi();
-    }
-
-    public final Application application()
-    {
-        return applicationInstance;
-    }
-
-    public final Module module()
-    {
-        return moduleInstance;
-    }
-
-    protected void beforeActivation( Application application )
-        throws Exception
-    {
-    }
-
-    protected UnitOfWorkFactory unitOfWorkFactory()
-    {
-        return moduleInstance.unitOfWorkFactory();
-    }
-
-    protected ServiceFinder serviceFinder()
-    {
-        return moduleInstance.serviceFinder();
-    }
-
-    protected ValueBuilderFactory valueBuilderFactory()
-    {
-        return moduleInstance.valueBuilderFactory();
-    }
-
-    protected TransientBuilderFactory transientBuilderFactory()
-    {
-        return moduleInstance.transientBuilderFactory();
-    }
-
-    protected ObjectFactory objectFactory()
-    {
-        return moduleInstance.objectFactory();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/StateDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/StateDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/StateDeclarations.java
deleted file mode 100644
index 55ed93d..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/StateDeclarations.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.lang.reflect.AccessibleObject;
-import org.apache.zest.api.common.MetaInfo;
-
-/**
- * This provides declared {@link org.apache.zest.api.property.Property} information that the runtime can use.
- */
-public interface StateDeclarations
-{
-    MetaInfo metaInfoFor( AccessibleObject accessor );
-
-    Object initialValueOf( AccessibleObject accessor );
-
-    boolean useDefaults( AccessibleObject accessor );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientAssembly.java
deleted file mode 100644
index dac0396..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single TransientComposite in a Module.
- */
-public interface TransientAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientDeclaration.java
deleted file mode 100644
index 6e9436b..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/TransientDeclaration.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring TransientComposites. Instances
- * of this API are acquired by calling {@link ModuleAssembly#transients(Class[])}.
- */
-public interface TransientDeclaration
-{
-    TransientDeclaration setMetaInfo( Object info );
-
-    TransientDeclaration visibleIn( Visibility visibility );
-
-    TransientDeclaration withConcerns( Class<?>... concerns );
-
-    TransientDeclaration withSideEffects( Class<?>... sideEffects );
-
-    TransientDeclaration withMixins( Class<?>... mixins );
-
-    TransientDeclaration withTypes( Class<?>... roles );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueAssembly.java
deleted file mode 100644
index 8a892cd..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single ValueComposite in a Module.
- */
-public interface ValueAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueDeclaration.java
deleted file mode 100644
index 51c0116..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ValueDeclaration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring values
- */
-public interface ValueDeclaration
-{
-    ValueDeclaration setMetaInfo( Object info );
-
-    ValueDeclaration visibleIn( Visibility visibility );
-
-    ValueDeclaration withConcerns( Class<?>... concerns );
-
-    ValueDeclaration withSideEffects( Class<?>... sideEffects );
-
-    ValueDeclaration withMixins( Class<?>... mixins );
-
-    ValueDeclaration withTypes( Class<?>... roles );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ZestRuntime.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ZestRuntime.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ZestRuntime.java
deleted file mode 100644
index 72d83c7..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ZestRuntime.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.spi.PolygeneSPI;
-
-/**
- * This interface has to be implemented by Polygene runtimes.
- */
-public interface PolygeneRuntime
-{
-    ApplicationAssemblyFactory applicationAssemblyFactory();
-
-    ApplicationModelFactory applicationModelFactory();
-
-    PolygeneAPI api();
-
-    PolygeneSPI spi();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ApplicationBuilder.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ApplicationBuilder.java
deleted file mode 100644
index 7c53bea..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ApplicationBuilder.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.builder;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Scanner;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.apache.zest.api.activation.ActivationEventListener;
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.activation.ApplicationPassivationThread;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-/**
- * Application Builder.
- */
-public class ApplicationBuilder
-    implements ActivationEventListenerRegistration
-{
-    private final String applicationName;
-    private String applicationVersion;
-    private Application.Mode applicationMode;
-    private final List<Object> metaInfos = new ArrayList<>();
-    private boolean passivationShutdownHook;
-    private final Map<String, LayerDeclaration> layers = new HashMap<>();
-    private final List<ActivationEventListener> activationListeners = new ArrayList<>();
-
-    public ApplicationBuilder( String applicationName )
-    {
-        this.applicationName = applicationName;
-    }
-
-    public ApplicationBuilder version( String version )
-    {
-        applicationVersion = version;
-        return this;
-    }
-
-    public ApplicationBuilder mode( Application.Mode mode )
-    {
-        applicationMode = mode;
-        return this;
-    }
-
-    public ApplicationBuilder metaInfo( Object... metaInfos )
-    {
-        for( Object metaInfo : metaInfos )
-        {
-            this.metaInfos.add( metaInfo );
-        }
-        return this;
-    }
-
-    /**
-     * Register a JVM shutdown hook that passivate the Application.
-     *
-     * The hook is registered after activating the Application and before {@link #afterActivation()}.
-     *
-     * @return This builder
-     */
-    public ApplicationBuilder withPassivationShutdownHook()
-    {
-        this.passivationShutdownHook = true;
-        return this;
-    }
-
-    /**
-     * Create and activate a new Application.
-     * @return Activated Application
-     * @throws AssemblyException if the assembly failed
-     * @throws ActivationException if the activation failed
-     */
-    public Application newApplication()
-        throws AssemblyException, ActivationException
-    {
-        Energy4Java zest = new Energy4Java();
-        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory factory )
-                throws AssemblyException
-            {
-                ApplicationAssembly assembly = factory.newApplicationAssembly();
-                assembly.setName( applicationName );
-                if( applicationVersion != null )
-                {
-                    assembly.setVersion( applicationVersion );
-                }
-                if( applicationMode != null )
-                {
-                    assembly.setMode( applicationMode );
-                }
-                for( Object metaInfo : metaInfos )
-                {
-                    assembly.setMetaInfo( metaInfo );
-                }
-                HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
-                for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() )
-                {
-                    LayerAssembly layer = entry.getValue().createLayer( assembly );
-                    createdLayers.put( entry.getKey(), layer );
-                }
-                for( LayerDeclaration layer : layers.values() )
-                {
-                    layer.initialize( createdLayers );
-                }
-                return assembly;
-            }
-        } );
-        Application application = model.newInstance( zest.api() );
-        for( ActivationEventListener activationListener : activationListeners )
-        {
-            application.registerActivationEventListener( activationListener );
-        }
-        beforeActivation();
-        application.activate();
-        if( passivationShutdownHook )
-        {
-            Runtime.getRuntime().addShutdownHook( new ApplicationPassivationThread( application ) );
-        }
-        afterActivation();
-        return application;
-    }
-
-    /**
-     * Called before application activation.
-     */
-    protected void beforeActivation()
-    {
-    }
-
-    /**
-     * Called after application activation.
-     */
-    protected void afterActivation()
-    {
-    }
-
-    @Override
-    public void registerActivationEventListener( ActivationEventListener listener )
-    {
-        activationListeners.add( listener );
-    }
-
-    @Override
-    public void deregisterActivationEventListener( ActivationEventListener listener )
-    {
-        activationListeners.remove( listener );
-    }
-
-    /**
-     * Declare Layer.
-     * @param layerName Name of the Layer
-     * @return Layer declaration for the given name, new if did not already exists
-     */
-    public LayerDeclaration withLayer( String layerName )
-    {
-        LayerDeclaration layerDeclaration = layers.get( layerName );
-        if( layerDeclaration != null )
-        {
-            return layerDeclaration;
-        }
-        layerDeclaration = new LayerDeclaration( layerName );
-        layers.put( layerName, layerDeclaration );
-        return layerDeclaration;
-    }
-
-    /**
-     * Load an ApplicationBuilder from a JSON String.
-     * @param json JSON String
-     * @return Application Builder loaded from JSON
-     * @throws JSONException if unable to read JSON
-     * @throws AssemblyException if unable to declare the assembly
-     */
-    public static ApplicationBuilder fromJson( String json )
-        throws JSONException, AssemblyException
-    {
-        JSONObject root = new JSONObject( json );
-        return fromJson( root );
-    }
-
-    /**
-     * Load an ApplicationBuilder from a JSON InputStream.
-     * @param json JSON input
-     * @return Application Builder loaded from JSON
-     * @throws JSONException if unable to read JSON
-     * @throws AssemblyException if unable to declare the assembly
-     */
-    public static ApplicationBuilder fromJson( InputStream json )
-        throws JSONException, AssemblyException
-    {
-        String jsonString = new Scanner( json, "UTF-8" ).useDelimiter( "\\A" ).next();
-        return fromJson( jsonString );
-    }
-
-    /**
-     * Load an ApplicationBuilder from a JSONObject.
-     * @param root JSON object
-     * @return Application Builder loaded from JSON
-     * @throws JSONException if unable to read JSON
-     * @throws AssemblyException if unable to declare the assembly
-     */
-    public static ApplicationBuilder fromJson( JSONObject root )
-        throws JSONException, AssemblyException
-    {
-        String applicationName = root.getString( "name" );
-        ApplicationBuilder builder = new ApplicationBuilder( applicationName );
-        builder.configureWithJson( root );
-        return builder;
-    }
-
-    /** Configures the application struucture from a JSON document.
-     *
-     * @param root The JSON document root.
-     * @throws JSONException if the JSON document isn't valid.
-     * @throws AssemblyException if probelms in the Assemblers provided in the JSON document.
-     */
-    protected void configureWithJson( JSONObject root )
-        throws JSONException, AssemblyException
-    {
-        JSONArray layers = root.optJSONArray( "layers" );
-        if( layers != null )
-        {
-            for( int i = 0; i < layers.length(); i++ )
-            {
-                JSONObject layerObject = layers.getJSONObject( i );
-                String layerName = layerObject.getString( "name" );
-                LayerDeclaration layerDeclaration = withLayer( layerName );
-                JSONArray using = layerObject.optJSONArray( "uses" );
-                if( using != null )
-                {
-                    for( int j = 0; j < using.length(); j++ )
-                    {
-                        layerDeclaration.using( using.getString( j ) );
-                    }
-                }
-                JSONArray modules = layerObject.optJSONArray( "modules" );
-                if( modules != null )
-                {
-                    for( int k = 0; k < modules.length(); k++ )
-                    {
-                        JSONObject moduleObject = modules.getJSONObject( k );
-                        String moduleName = moduleObject.getString( "name" );
-                        ModuleDeclaration moduleDeclaration = layerDeclaration.withModule( moduleName );
-                        JSONArray assemblers = moduleObject.optJSONArray( "assemblers" );
-                        if( assemblers != null )
-                        {
-                            for( int m = 0; m < assemblers.length(); m++ )
-                            {
-                                String string = assemblers.getString( m );
-                                moduleDeclaration.withAssembler( string );
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * {@literal main} method that read JSON from STDIN.
-     * <p>Passivation exceptions are written to STDERR if any.</p>
-     * @param args Unused
-     * @throws JSONException if unable to read JSON
-     * @throws AssemblyException if the assembly failed
-     * @throws ActivationException if the activation failed
-     */
-    public static void main( String[] args )
-        throws JSONException, ActivationException, AssemblyException
-    {
-        fromJson( System.in ).withPassivationShutdownHook().newApplication();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/LayerDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/LayerDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/LayerDeclaration.java
deleted file mode 100644
index 710743e..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/LayerDeclaration.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.builder;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.StreamSupport;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-/**
- * Provides declared {@link org.apache.zest.api.structure.Layer} information that the {@link ApplicationBuilder} can use.
- */
-public class LayerDeclaration
-{
-    private final String layerName;
-    private final List<String> using = new ArrayList<>();
-    private final Map<String, ModuleDeclaration> modules = new HashMap<>();
-    private LayerAssembly layer;
-
-    LayerDeclaration( String layerName )
-    {
-        this.layerName = layerName;
-    }
-
-    /**
-     * Declare using layer.
-     * @param layerName Used layer name
-     * @return This Layer declaration
-     */
-    public LayerDeclaration using( String layerName )
-    {
-        this.using.add( layerName );
-        return this;
-    }
-
-    /**
-     * Declare using layers.
-     * @param layerNames Used layers names
-     * @return This Layer declaration
-     */
-    public LayerDeclaration using( Iterable<String> layerNames )
-    {
-        StreamSupport.stream( layerNames.spliterator(), false )
-                     .forEach( using::add );
-        return this;
-    }
-
-    /**
-     * Declare Module.
-     * @param moduleName Name of the Module
-     * @return Module declaration for the given name, new if did not already exists
-     */
-    public ModuleDeclaration withModule( String moduleName )
-    {
-        ModuleDeclaration module = modules.get( moduleName );
-        if( module != null )
-        {
-            return module;
-        }
-        module = new ModuleDeclaration( moduleName );
-        modules.put( moduleName, module );
-        return module;
-    }
-
-    LayerAssembly createLayer( ApplicationAssembly application )
-    {
-        layer = application.layer( layerName );
-        layer.setName( layerName );
-        for( ModuleDeclaration module : modules.values() )
-        {
-            ModuleAssembly assembly = module.createModule( layer );
-        }
-        return layer;
-    }
-
-    void initialize( HashMap<String, LayerAssembly> createdLayers )
-        throws AssemblyException
-    {
-        for( String uses : using )
-        {
-            LayerAssembly usedLayer = createdLayers.get( uses );
-            layer.uses( usedLayer );
-        }
-        for( ModuleDeclaration module : modules.values() )
-        {
-            module.initialize();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ModuleDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ModuleDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ModuleDeclaration.java
deleted file mode 100644
index 0a4b5fa..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/ModuleDeclaration.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.builder;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.StreamSupport;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-import static java.util.stream.Collectors.toList;
-import static org.apache.zest.api.util.Classes.isAssignableFrom;
-
-/**
- * Provides declared {@link org.apache.zest.api.structure.Module} information that the {@link ApplicationBuilder} can use.
- */
-public class ModuleDeclaration
-{
-    private final String moduleName;
-    private final List<Assembler> assemblers = new ArrayList<>();
-    private ModuleAssembly module;
-
-    public ModuleDeclaration( String moduleName )
-    {
-        this.moduleName = moduleName;
-    }
-
-    /**
-     * Declare Assembler.
-     * @param assembler Assembler instance
-     * @return This Module declaration
-     */
-    public ModuleDeclaration withAssembler( Assembler assembler )
-    {
-        assemblers.add( assembler );
-        return this;
-    }
-
-    /**
-     * Declare Assembler.
-     * @param classname Assembler class name
-     * @return This Module declaration
-     * @throws AssemblyException if unable to load class, not an Assembler or unable to instanciate
-     */
-    public ModuleDeclaration withAssembler( String classname )
-        throws AssemblyException
-    {
-        Class<? extends Assembler> clazz = loadClass( classname );
-        return withAssembler( clazz );
-    }
-
-    /**
-     * Declare Assembler.
-     * @param assemblerClass Assembler class
-     * @return This Module declaration
-     * @throws AssemblyException not an Assembler or if unable to instanciate
-     */
-    public ModuleDeclaration withAssembler( Class<?> assemblerClass )
-        throws AssemblyException
-    {
-        Assembler assembler = createAssemblerInstance( assemblerClass );
-        assemblers.add( assembler );
-        return this;
-    }
-
-    /**
-     * Declare Assemblers.
-     * <p>Declare several Assemblers from an Iterable of Class objects.</p>
-     * <p>Typically used along {@link org.apache.zest.bootstrap.ClassScanner}.</p>
-     * @param assemblerClasses Assembler classes
-     * @return This Module declaration
-     * @throws AssemblyException if one of the Class is not an Assembler or unable to instantiate
-     */
-    public ModuleDeclaration withAssemblers( Iterable<Class<?>> assemblerClasses )
-        throws AssemblyException
-    {
-        List<Class<?>> notAssemblers = StreamSupport.stream( assemblerClasses.spliterator(), false )
-                                                    .filter( isAssignableFrom( Assembler.class ).negate() )
-                                                    .collect( toList() );
-        if( !notAssemblers.isEmpty() )
-        {
-            throw new AssemblyException(
-                "Classes " + notAssemblers + " are not implementing " + Assembler.class.getName()
-            );
-        }
-        for( Class<?> assemblerClass : assemblerClasses )
-        {
-            withAssembler( assemblerClass );
-        }
-        return this;
-    }
-
-    ModuleAssembly createModule( LayerAssembly layer )
-    {
-        module = layer.module( moduleName );
-        return module;
-    }
-
-    void initialize()
-        throws AssemblyException
-    {
-        for( Assembler assembler : assemblers )
-        {
-            assembler.assemble( module );
-        }
-    }
-
-    @SuppressWarnings( "unchecked" )
-    private Class<? extends Assembler> loadClass( String classname )
-        throws AssemblyException
-    {
-        Class<?> clazz;
-        try
-        {
-            clazz = getClass().getClassLoader().loadClass( classname );
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to load class " + classname, e );
-        }
-        if( !Assembler.class.isAssignableFrom( clazz ) )
-        {
-            throw new AssemblyException(
-                "Class " + classname + " is not implementing " + Assembler.class.getName()
-            );
-        }
-        //noinspection unchecked
-        return (Class<? extends Assembler>) clazz;
-    }
-
-    private Assembler createAssemblerInstance( Class<?> assemblerClass )
-        throws AssemblyException
-    {
-        if( !Assembler.class.isAssignableFrom( assemblerClass ) )
-        {
-            throw new AssemblyException(
-                "Class " + assemblerClass + " is not implementing " + Assembler.class.getName()
-            );
-        }
-        try
-        {
-            return (Assembler) assemblerClass.newInstance();
-        }
-        catch( Exception e )
-        {
-            throw new AssemblyException( "Unable to instantiate " + assemblerClass, e );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/package.html b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/package.html
deleted file mode 100644
index 6c1ff92..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/builder/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Application Builder.</h2>
-        <p>
-            Generic ApplicationBuilder, which simplifies the creation of Application Structure, either by a fluid DSL
-            or from a JSON file.
-        </p>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/identity/DefaultIdentityGeneratorAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
deleted file mode 100644
index 94b9f3b..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.identity;
-
-import org.apache.zest.api.identity.IdentityGenerator;
-import org.apache.zest.api.identity.UuidGeneratorMixin;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-public class DefaultIdentityGeneratorAssembler
-    implements Assembler
-{
-
-    @Override
-    public void assemble(ModuleAssembly module)
-            throws AssemblyException
-    {
-        module.services(IdentityGenerator.class).withMixins(UuidGeneratorMixin.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/IllegalLayerAssemblerException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/IllegalLayerAssemblerException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/IllegalLayerAssemblerException.java
deleted file mode 100644
index 0b62ae0..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/IllegalLayerAssemblerException.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.layered;
-
-import org.apache.zest.bootstrap.AssemblyException;
-
-public class IllegalLayerAssemblerException extends AssemblyException
-{
-    public IllegalLayerAssemblerException( String message )
-    {
-        super( message );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayerAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayerAssembler.java
deleted file mode 100644
index b6b0dd0..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayerAssembler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.layered;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-public interface LayerAssembler
-{
-    LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredApplicationAssembler.java
deleted file mode 100644
index 809b01e..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredApplicationAssembler.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.layered;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.activation.PassivationException;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.bootstrap.LayerAssembly;
-
-public abstract class LayeredApplicationAssembler
-    implements ApplicationAssembler
-{
-    protected final Energy4Java zest;
-    protected final String name;
-    protected final String version;
-
-    private final Application.Mode mode;
-    private final HashMap<Class<? extends LayerAssembler>, LayerAssembler> assemblers = new HashMap<>();
-
-    private ApplicationAssembly assembly;
-    protected ApplicationDescriptor model;
-    protected Application application;
-
-    public LayeredApplicationAssembler( String name, String version, Application.Mode mode )
-        throws AssemblyException
-    {
-        this.name = name;
-        this.version = version;
-        this.mode = mode;
-        zest = new Energy4Java();
-    }
-
-    public void initialize()
-        throws AssemblyException
-    {
-        model = zest.newApplicationModel( this );
-        onModelCreated( model );
-        instantiateApplication( zest, model );
-    }
-
-    public ApplicationAssembly assembly()
-    {
-        return assembly;
-    }
-
-    /**
-     * This method is called from the <code>initialize</code> method to instantiate the Polygene application from the
-     * application model.
-     *
-     * <p>
-     * The default implementation simply calls;
-     * </p>
-     * <pre><code>
-     *   application = model.newInstance( zest.spi() );
-     * </code></pre>
-     *
-     * @param zest  The Polygene runtime engine.
-     * @param model The application model descriptor.
-     */
-    protected void instantiateApplication( Energy4Java zest, ApplicationDescriptor model )
-    {
-        application = model.newInstance( zest.spi() );
-    }
-
-    /**
-     * This method is called after the Application Model has been created, before the instantiation of the Polygene
-     * application.
-     *
-     * <p>
-     * The default implementation does nothing. Applications may have advanced features to inspect or
-     * modify the model prior to instantiation, and this is the place where such advanced manipulation is
-     * expected to take place.
-     * </p>
-     *
-     * @param model The model that has just been created.
-     */
-    protected void onModelCreated( ApplicationDescriptor model )
-    {
-    }
-
-    public ApplicationDescriptor model()
-    {
-        return model;
-    }
-
-    public Application application()
-    {
-        return application;
-    }
-
-    public void start()
-        throws ActivationException
-    {
-        application.activate();
-    }
-
-    public void stop()
-        throws PassivationException
-    {
-        application.passivate();
-    }
-
-    @Override
-    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-        throws AssemblyException
-    {
-        assembly = applicationFactory.newApplicationAssembly();
-        assembly.setName( name );
-        assembly.setVersion( version );
-        assembly.setMode( mode );
-        assembleLayers( assembly );
-        return assembly;
-    }
-
-    protected LayerAssembly createLayer( Class<? extends LayerAssembler> layerAssemblerClass )
-        throws IllegalArgumentException
-    {
-        try
-        {
-            String classname = layerAssemblerClass.getSimpleName();
-            if( classname.endsWith( "Layer" ) )
-            {
-                classname = classname.substring( 0, classname.length() - 5 ) + " Layer";
-            }
-            setNameIfPresent( layerAssemblerClass, classname );
-            LayerAssembly layer = assembly.layer( classname );
-
-            LayerAssembler layerAssembler = instantiateLayerAssembler( layerAssemblerClass, layer );
-            assemblers.put( layerAssemblerClass, layerAssembler );
-            assembleLayer( layerAssembler, layer );
-            return layer;
-        }
-        catch( Exception e )
-        {
-            throw new IllegalArgumentException( "Unable to instantiate layer with " + layerAssemblerClass.getSimpleName(), e );
-        }
-    }
-
-    protected void assembleLayer( LayerAssembler layerAssembler, LayerAssembly layer )
-        throws AssemblyException
-    {
-        layerAssembler.assemble( layer );
-    }
-
-    protected <T extends LayerAssembler> LayerAssembler instantiateLayerAssembler( Class<T> layerAssemblerClass,
-                                                                                   LayerAssembly layer
-    )
-        throws InstantiationException, IllegalAccessException, InvocationTargetException, IllegalLayerAssemblerException
-    {
-        LayerAssembler assembler = createWithFactoryMethod( layerAssemblerClass, layer );
-        if( assembler != null )
-        {
-            return assembler;
-        }
-        assembler = createWithConstructor( layerAssemblerClass, layer );
-        if( assembler != null )
-        {
-            return assembler;
-        }
-        throw new IllegalLayerAssemblerException( "No matching factory method nor constructor found in " + layerAssemblerClass );
-    }
-
-    private LayerAssembler createWithFactoryMethod( Class<? extends LayerAssembler> layerAssemblerClass,
-                                                    LayerAssembly layer
-    )
-        throws InvocationTargetException, IllegalAccessException
-    {
-        try
-        {
-            Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create", LayerAssembly.class );
-            factoryMethod.setAccessible( true );
-            int modifiers = factoryMethod.getModifiers();
-            if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
-            {
-                return (LayerAssembler) factoryMethod.invoke( null, layer );
-            }
-        }
-        catch( NoSuchMethodException e )
-        {
-            try
-            {
-                Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create" );
-                factoryMethod.setAccessible( true );
-                int modifiers = factoryMethod.getModifiers();
-                if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
-                {
-                    return (LayerAssembler) factoryMethod.invoke( null );
-                }
-            }
-            catch( NoSuchMethodException e1 )
-            {
-            }
-        }
-        return null;
-    }
-
-    private LayerAssembler createWithConstructor( Class<? extends LayerAssembler> layerAssemblerClass,
-                                                  LayerAssembly assembly
-    )
-        throws IllegalAccessException, InvocationTargetException, InstantiationException
-    {
-        try
-        {
-            Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getConstructor( LayerAssembly.class );
-            if( constructor != null )
-            {
-                constructor.setAccessible( true );
-                return constructor.newInstance( assembly );
-            }
-        }
-        catch( NoSuchMethodException e )
-        {
-            try
-            {
-                Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getDeclaredConstructor();
-                if( constructor != null )
-                {
-                    constructor.setAccessible( true );
-                    System.out.println(constructor);
-                    return constructor.newInstance();
-                }
-            }
-            catch( NoSuchMethodException e1 )
-            {
-                return null;
-            }
-        }
-        return null;
-    }
-
-    static void setNameIfPresent( Class<?> clazz, String classname )
-        throws IllegalAccessException
-    {
-        try
-        {
-            Field field = clazz.getDeclaredField( "NAME" );
-            if( Modifier.isStatic( field.getModifiers() ) )
-            {
-                field.setAccessible( true );
-                field.set( null, classname );
-            }
-        }
-        catch( Exception e )
-        {
-            // Ignore and consider normal.
-        }
-    }
-
-    @SuppressWarnings( "unchecked" )
-    protected <T extends LayerAssembler> T assemblerOf( Class<T> layerAssemblerClass )
-    {
-        return (T) assemblers.get( layerAssemblerClass );
-    }
-
-    /**
-     * Called from the <code>assemble</code> method to assemble the layers in the application.
-     *
-     * <p>
-     * This method must be implemented, and is typically a list of LayerAssembler instantiations, followed
-     * by {@link LayerAssembly#uses(LayerAssembly...)} declarations.
-     * </p>
-     *
-     * @param assembly Application assembly
-     * @throws AssemblyException on invalid assembly
-     */
-    protected abstract void assembleLayers( ApplicationAssembly assembly )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
deleted file mode 100644
index 62f8bc7..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/LayeredLayerAssembler.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.layered;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-public abstract class LayeredLayerAssembler
-    implements LayerAssembler
-{
-    private HashMap<Class<? extends ModuleAssembler>, ModuleAssembler> assemblers = new HashMap<>();
-
-    protected ModuleAssembly createModule( LayerAssembly layer, Class<? extends ModuleAssembler> moduleAssemblerClass )
-    {
-        try
-        {
-            ModuleAssembler moduleAssembler = instantiateAssembler( layer, moduleAssemblerClass );
-            String moduleName = createModuleName( moduleAssemblerClass );
-            LayeredApplicationAssembler.setNameIfPresent( moduleAssemblerClass, moduleName );
-            ModuleAssembly module = layer.module( moduleName );
-            assemblers.put( moduleAssemblerClass, moduleAssembler );
-            ModuleAssembly assembly = moduleAssembler.assemble( layer, module );
-            if( assembly == null )
-            {
-                return module;
-            }
-            return assembly;
-        }
-        catch( Exception e )
-        {
-            throw new IllegalArgumentException( "Unable to instantiate module with " + moduleAssemblerClass.getSimpleName(), e );
-        }
-    }
-
-    protected String createModuleName( Class<? extends ModuleAssembler> modulerAssemblerClass )
-    {
-        String moduleName = modulerAssemblerClass.getSimpleName();
-        if( moduleName.endsWith( "Module" ) )
-        {
-            moduleName = moduleName.substring( 0, moduleName.length() - 6 ) + " Module";
-        }
-        return moduleName;
-    }
-
-    protected ModuleAssembler instantiateAssembler( LayerAssembly layer,
-                                                  Class<? extends ModuleAssembler> modulerAssemblerClass
-    )
-        throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException
-    {
-        ModuleAssembler moduleAssembler;
-        try
-        {
-            Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor( ModuleAssembly.class );
-            assemblyConstructor.setAccessible( true );
-            moduleAssembler = assemblyConstructor.newInstance( layer );
-        }
-        catch( NoSuchMethodException e )
-        {
-            Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor();
-            assemblyConstructor.setAccessible( true );
-            moduleAssembler = assemblyConstructor.newInstance();
-        }
-        return moduleAssembler;
-    }
-
-    @SuppressWarnings( "unchecked" )
-    protected <T extends ModuleAssembler> T assemblerOf( Class<T> moduleAssemblerType )
-    {
-        return (T) assemblers.get( moduleAssemblerType );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/ModuleAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/ModuleAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/ModuleAssembler.java
deleted file mode 100644
index 1b416c8..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/ModuleAssembler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.layered;
-
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-public interface ModuleAssembler
-{
-    ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/package.html b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/package.html
deleted file mode 100644
index 0b8300b..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/layered/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Layered Assembly.</h2>
-    </body>
-</html>


[18/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/package.html b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/package.html
deleted file mode 100644
index 7c867b8..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Assembly and Bootstrap API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
deleted file mode 100644
index b8d8f41..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap.unitofwork;
-
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-public class DefaultUnitOfWorkAssembler
-    implements Assembler
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        Class factoryMixin = loadMixinClass( "org.apache.zest.runtime.unitofwork.UnitOfWorkFactoryMixin" );
-        module.services( UnitOfWorkFactory.class ).withMixins( factoryMixin );
-
-        Class uowMixin = loadMixinClass( "org.apache.zest.runtime.unitofwork.ModuleUnitOfWork" );
-        module.transients( UnitOfWork.class ).withMixins( uowMixin );
-    }
-
-    private Class<?> loadMixinClass( String name )
-        throws AssemblyException
-    {
-        try
-        {
-            return getClass().getClassLoader().loadClass( name );
-        }
-        catch( ClassNotFoundException e )
-        {
-            throw new AssemblyException( "Default UnitOfWorkFactory mixin is not present in the system." );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/AssemblySpecificationTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/AssemblySpecificationTest.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/AssemblySpecificationTest.java
new file mode 100644
index 0000000..a107af2
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/AssemblySpecificationTest.java
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.type.HasTypes;
+import org.junit.Test;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class AssemblySpecificationTest
+{
+    @Test
+    public void givenSingleMatchingTypeWhenFilteringExpectTrue()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( String.class );
+        HasTypes hasTypes = new MockedHasTyoes( String.class );
+        assertThat( underTest.test( hasTypes ), equalTo(true) );
+    }
+
+    @Test
+    public void givenMultipleMatchingTypeWhenFilteringExpectTrue()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class, String.class );
+        HasTypes hasTypes = new MockedHasTyoes( String.class );
+        assertThat( underTest.test( hasTypes ), equalTo(true) );
+    }
+
+    @Test
+    public void givenSingleNonMatchingTypeWhenFilteringExpectFalse()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class );
+        HasTypes hasTypes = new MockedHasTyoes( Integer.class );
+        assertThat( underTest.test( hasTypes ), equalTo(false) );
+    }
+
+    @Test
+    public void givenMultipleMatchingTypeWhenFilteringAgainstMultipleExpectTrue()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, Integer.class, BigDecimal.class );
+        HasTypes hasTypes = new MockedHasTyoes( String.class, Integer.class );
+        assertThat( underTest.test( hasTypes ), equalTo(true) );
+    }
+
+    @Test
+    public void givenMultipleNonMatchingTypeWhenFilteringAgainstSingleExpectFalse()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class, String.class );
+        HasTypes hasTypes = new MockedHasTyoes( Integer.class );
+        assertThat( underTest.test( hasTypes ), equalTo(false) );
+    }
+
+    @Test
+    public void givenMultipleNonMatchingTypeWhenFilteringAgainstMultipleExpectFalse()
+    {
+        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class );
+        HasTypes hasTypes = new MockedHasTyoes( String.class, Integer.class );
+        assertThat( underTest.test( hasTypes ), equalTo(false) );
+    }
+
+    private static class MockedHasTyoes
+        implements HasTypes
+    {
+        private final Class[] types;
+
+        public MockedHasTyoes( Class... types)
+        {
+            this.types = types;
+        }
+
+        @Override
+        public Stream<Class<?>> types()
+        {
+            return Arrays.stream(types);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
new file mode 100644
index 0000000..f257aad
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.bootstrap.somepackage.Test2Value;
+import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.polygene.bootstrap.ClassScanner.findClasses;
+import static org.apache.polygene.bootstrap.ClassScanner.matches;
+
+/**
+ * Test and showcase of the ClassScanner assembly utility.
+ */
+public class ClassScannerTest
+{
+    @Test
+    public void testClassScannerFiles()
+        throws ActivationException, AssemblyException
+    {
+        SingletonAssembler singleton = new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                new DefaultUnitOfWorkAssembler().assemble( module );
+
+                // Find all classes starting from TestValue, but include only the ones that are named *Value
+                findClasses( TestValue.class ).filter( matches( ".*Value" ) )
+                                              .forEach( module::values );
+            }
+        };
+
+        singleton.module().newValueBuilder( TestValue.class );
+        singleton.module().newValueBuilder( Test2Value.class );
+    }
+
+    @Test
+    public void testClassScannerJar()
+    {
+        Assert.assertEquals( 185, findClasses( Test.class ).count() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
new file mode 100644
index 0000000..08b61d1
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
@@ -0,0 +1,442 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.importer.InstanceImporter;
+import org.apache.polygene.api.service.importer.NewObjectImporter;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.Module;
+
+@SuppressWarnings( "ALL" )
+public class DocumentationSupport
+{
+
+    public static Predicate<ObjectAssembly> hasMyTypeSpecification = new Predicate<ObjectAssembly>()
+    {
+
+        public boolean test( ObjectAssembly item )
+        {
+            return item.types().anyMatch( type -> type.equals(String.class) );
+        }
+
+    };
+
+    public static class objects
+            implements Assembler
+    {
+
+        public static class MyObject {}
+
+        // START SNIPPET: objects
+        @Override
+        public void assemble( ModuleAssembly module )
+                throws AssemblyException
+        {
+            module.objects( MyObject.class ).visibleIn( Visibility.layer );
+        }
+        // END SNIPPET: objects
+
+    }
+
+    public static class transients
+            implements Assembler
+    {
+
+        public static interface MyTransient {}
+
+        // START SNIPPET: transients
+        @Override
+        public void assemble( ModuleAssembly module )
+                throws AssemblyException
+        {
+            module.transients( MyTransient.class ).visibleIn( Visibility.layer );
+        }
+        // END SNIPPET: transients
+
+    }
+
+    public static class values
+            implements Assembler
+    {
+
+        public static interface MyValue {}
+
+        // START SNIPPET: values
+        @Override
+        public void assemble( ModuleAssembly module )
+                throws AssemblyException
+        {
+            module.values( MyValue.class ).visibleIn( Visibility.layer );
+        }
+        // END SNIPPET: values
+
+    }
+
+    public static class entities
+            implements Assembler
+    {
+
+        public static interface MyEntity {}
+
+        // START SNIPPET: entities
+        @Override
+        public void assemble( ModuleAssembly module )
+                throws AssemblyException
+        {
+            module.entities( MyEntity.class ).visibleIn( Visibility.layer );
+        }
+        // END SNIPPET: entities
+
+    }
+
+    public static class services
+            implements Assembler
+    {
+
+        public static interface MyService {}
+
+        // START SNIPPET: services
+        @Override
+        public void assemble( ModuleAssembly module )
+                throws AssemblyException
+        {
+            module.services( MyService.class ).visibleIn( Visibility.layer );
+        }
+        // END SNIPPET: services
+
+    }
+
+    public static class taggedServices
+        implements Assembler
+    {
+
+        public static interface MyService {}
+
+        // START SNIPPET: tagged-services
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+            module.services( MyService.class ).taggedWith( "foo", "bar" );
+        }
+        // END SNIPPET: tagged-services
+    }
+
+    public static class importedServices
+        implements Assembler
+    {
+
+        public static class MyService {}
+
+        // START SNIPPET: imported-services
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+            module.importedServices( MyService.class ).
+                importedBy( InstanceImporter.class ).
+                setMetaInfo( new MyService() );
+
+            // OR
+
+            module.objects( MyService.class );
+            module.importedServices( MyService.class ).
+                importedBy( NewObjectImporter.class );
+        }
+        // END SNIPPET: imported-services
+    }
+
+    public static class defaultPropertyValues
+        implements Assembler
+    {
+
+        public interface MyValue { Property<String> foo(); }
+        public interface MyEntity { Property<String> cathedral(); }
+
+        // START SNIPPET: properties-defaults
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+            module.values( MyValue.class );
+            MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults();
+            myValueDefaults.foo().set( "bar" );
+
+            module.entities( MyEntity.class );
+            MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults();
+            myEntityDefaults.cathedral().set( "bazar" );
+        }
+        // END SNIPPET: properties-defaults
+    }
+
+    public static class singleton
+    {
+
+        public interface MyService { }
+        public interface Stuff { }
+
+        void singleton()
+            throws ActivationException, AssemblyException
+        {
+            // START SNIPPET: singleton
+            SingletonAssembler assembler = new SingletonAssembler()
+            {
+
+                @Override
+                public void assemble( ModuleAssembly module )
+                        throws AssemblyException
+                {
+                    module.services( MyService.class ).identifiedBy( "Foo" );
+                    module.services( MyService.class ).identifiedBy( "Bar" );
+                    module.objects( Stuff.class );
+                }
+
+            };
+            Module module = assembler.module();
+            Stuff stuff = module.newObject( Stuff.class );
+            // END SNIPPET: singleton
+        }
+
+    }
+
+    public static class pancake
+    {
+
+        public static class LoginAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class MenuAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class PerspectivesAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class ViewsAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class ReportingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class PdfAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class BookkeepingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class CashFlowAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class BalanceSheetAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class PricingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class ProductAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+
+        private static Energy4Java zest;
+
+        // START SNIPPET: pancake
+        public static void main( String[] args )
+                throws Exception
+        {
+            zest = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]{
+                { // View Layer
+                    { // Login Module
+                        new LoginAssembler()
+                    // :
+                    },
+                    { // Main Workbench Module
+                        new MenuAssembler(),
+                        new PerspectivesAssembler(),
+                        new ViewsAssembler()
+                    // :
+                    },
+                    { // Printing Module
+                        new ReportingAssembler(),
+                        new PdfAssembler()
+                    // :
+                    }
+                },
+                { // Application Layer
+                    { // Accounting Module
+                        new BookkeepingAssembler(),
+                        new CashFlowAssembler(),
+                        new BalanceSheetAssembler()
+                    // :
+                    },
+                    { // Inventory Module
+                        new PricingAssembler(),
+                        new ProductAssembler()
+                    // :
+                    }
+                },
+                { // Domain Layer
+                // :
+                },
+                { // Infrastructure Layer
+                // :
+                }
+            };
+            ApplicationDescriptor model = newApplication( assemblers );
+            Application runtime = model.newInstance( zest.spi() );
+            runtime.activate();
+        }
+
+        private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers )
+                throws AssemblyException
+        {
+            return zest.newApplicationModel( new ApplicationAssembler()
+            {
+
+                @Override
+                public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory )
+                        throws AssemblyException
+                {
+                    return appFactory.newApplicationAssembly( assemblers );
+                }
+
+            } );
+        }
+        // END SNIPPET: pancake
+
+    }
+
+    public static class full
+    {
+
+        public static class CustomerViewComposite{}
+        public static class CustomerEditComposite{}
+        public static class CustomerListViewComposite{}
+        public static class CustomerSearchComposite{}
+        public static class CustomerEntity{}
+        public static class CountryEntity{}
+        public static class AddressValue{}
+        public static class LdapAuthenticationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class ThrinkAuthorizationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class UserTrackingAuditAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+        public static class NeoAssembler implements Assembler{ NeoAssembler( String path ) {} public void assemble( ModuleAssembly module ) throws AssemblyException { } }
+
+        // START SNIPPET: full
+        private static Energy4Java zest;
+
+        private static Application application;
+
+        public static void main( String[] args )
+                throws Exception
+        {
+            // Create a Polygene Runtime
+            zest = new Energy4Java();
+            application = zest.newApplication( new ApplicationAssembler()
+            {
+
+                @Override
+                public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory )
+                        throws AssemblyException
+                {
+                    ApplicationAssembly assembly = appFactory.newApplicationAssembly();
+                    buildAssembly( assembly );
+                    return assembly;
+                }
+
+            } );
+            // activate the application
+            application.activate();
+        }
+
+        static void buildAssembly( ApplicationAssembly app ) throws AssemblyException
+        {
+            LayerAssembly webLayer = createWebLayer( app );
+            LayerAssembly domainLayer = createDomainLayer( app );
+            LayerAssembly persistenceLayer = createInfrastructureLayer( app );
+            LayerAssembly authLayer = createAuth2Layer( app );
+            LayerAssembly messagingLayer = createMessagingLayer( app );
+
+            webLayer.uses( domainLayer );
+            domainLayer.uses( authLayer );
+            domainLayer.uses( persistenceLayer );
+            domainLayer.uses( messagingLayer );
+        }
+
+        static LayerAssembly createWebLayer( ApplicationAssembly app ) throws AssemblyException
+        {
+            LayerAssembly layer = app.layer( "web-layer" );
+            createCustomerWebModule( layer );
+            return layer;
+        }
+
+        static LayerAssembly createDomainLayer( ApplicationAssembly app ) throws AssemblyException
+        {
+            LayerAssembly layer = app.layer( "domain-layer" );
+            createCustomerDomainModule( layer );
+            // :
+            // :
+            return layer;
+        }
+
+        static LayerAssembly createInfrastructureLayer( ApplicationAssembly app ) throws AssemblyException
+        {
+            LayerAssembly layer = app.layer( "infrastructure-layer" );
+            createPersistenceModule( layer );
+            return layer;
+        }
+
+        static LayerAssembly createMessagingLayer( ApplicationAssembly app ) throws AssemblyException
+        {
+            LayerAssembly layer = app.layer( "messaging-layer" );
+            createWebServiceModule( layer );
+            createMessagingPersistenceModule( layer );
+            return layer;
+        }
+
+        static LayerAssembly createAuth2Layer( ApplicationAssembly application ) throws AssemblyException
+        {
+            LayerAssembly layer = application.layer( "auth2-layer" );
+            createAuthModule( layer );
+            return layer;
+        }
+
+        static void createCustomerWebModule( LayerAssembly layer ) throws AssemblyException
+        {
+            ModuleAssembly assembly = layer.module( "customer-web-module" );
+            assembly.transients( CustomerViewComposite.class, CustomerEditComposite.class,
+                                 CustomerListViewComposite.class, CustomerSearchComposite.class );
+        }
+
+        static void createCustomerDomainModule( LayerAssembly layer ) throws AssemblyException
+        {
+            ModuleAssembly assembly = layer.module( "customer-domain-module" );
+            assembly.entities( CustomerEntity.class, CountryEntity.class );
+            assembly.values( AddressValue.class );
+        }
+
+        static void createAuthModule( LayerAssembly layer ) throws AssemblyException
+        {
+            ModuleAssembly assembly = layer.module( "auth-module" );
+            new LdapAuthenticationAssembler().assemble( assembly );
+            new ThrinkAuthorizationAssembler().assemble( assembly );
+            new UserTrackingAuditAssembler().assemble( assembly );
+        }
+
+        static void createPersistenceModule( LayerAssembly layer ) throws AssemblyException
+        {
+            ModuleAssembly assembly = layer.module( "persistence-module" );
+            // Someone has created an assembler for the Neo EntityStore
+            new NeoAssembler( "./neostore" ).assemble( assembly );
+        }
+
+        // END SNIPPET: full
+        private static void createWebServiceModule( LayerAssembly layer ) throws AssemblyException
+        {
+        }
+
+        private static void createMessagingPersistenceModule( LayerAssembly layer ) throws AssemblyException
+        {
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/TestValue.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/TestValue.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/TestValue.java
new file mode 100644
index 0000000..74274b0
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/TestValue.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.value.ValueComposite;
+
+/**
+ */
+public interface TestValue
+    extends ValueComposite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/LayeredApplicationAssemblerTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/LayeredApplicationAssemblerTest.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/LayeredApplicationAssemblerTest.java
new file mode 100644
index 0000000..484d3e2
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/LayeredApplicationAssemblerTest.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly;
+
+import org.junit.Test;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.AssemblyException;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class LayeredApplicationAssemblerTest
+{
+    @Test
+    public void validateThatAssemblerCreatesApplication()
+        throws AssemblyException, ActivationException
+    {
+        TestApplication assembler = new TestApplication( "Test Application", "1.0.1", Application.Mode.test );
+        assembler.initialize();
+        assembler.start();
+
+        assertThat( assembler.application().name(), equalTo("Test Application") );
+        assertThat( assembler.application().version(), equalTo("1.0.1") );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/TestApplication.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/TestApplication.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/TestApplication.java
new file mode 100644
index 0000000..ef5ca60
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/TestApplication.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly;
+
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.assembly.config.ConfigurationLayer;
+import org.apache.polygene.bootstrap.assembly.connectivity.ConnectivityLayer;
+import org.apache.polygene.bootstrap.assembly.domain.DomainLayer;
+import org.apache.polygene.bootstrap.assembly.infrastructure.InfrastructureLayer;
+import org.apache.polygene.bootstrap.assembly.service.ServiceLayer;
+
+// START SNIPPET: application
+public class TestApplication extends LayeredApplicationAssembler
+{
+
+    public TestApplication( String name, String version, Application.Mode mode )
+        throws AssemblyException
+    {
+        super( name, version, mode );
+    }
+
+    @Override
+    protected void assembleLayers( ApplicationAssembly assembly )
+        throws AssemblyException
+    {
+        LayerAssembly configLayer = createLayer( ConfigurationLayer.class );
+        ModuleAssembly configModule = configLayer.module( "Configuration Module" );
+        LayerAssembly infraLayer = new InfrastructureLayer( configModule ).assemble( assembly.layer( InfrastructureLayer.NAME  ));
+        LayerAssembly domainLayer = createLayer( DomainLayer.class );
+        LayerAssembly serviceLayer = createLayer( ServiceLayer.class );
+        LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );
+
+        connectivityLayer.uses( serviceLayer );
+        connectivityLayer.uses( domainLayer );
+        serviceLayer.uses( domainLayer );
+        domainLayer.uses( infraLayer );
+        infraLayer.uses( configLayer );
+    }
+}
+// END SNIPPET: application

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/config/ConfigurationLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/config/ConfigurationLayer.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/config/ConfigurationLayer.java
new file mode 100644
index 0000000..77e8d05
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/config/ConfigurationLayer.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.config;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+public class ConfigurationLayer implements LayerAssembler
+{
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        return layer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/connectivity/ConnectivityLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/connectivity/ConnectivityLayer.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/connectivity/ConnectivityLayer.java
new file mode 100644
index 0000000..0b657b2
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/connectivity/ConnectivityLayer.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.connectivity;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+public class ConnectivityLayer implements LayerAssembler
+{
+    public static final String NAME = "Connectivity";
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/DomainLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/DomainLayer.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/DomainLayer.java
new file mode 100644
index 0000000..5e585dd
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/DomainLayer.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.domain;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class DomainLayer extends LayeredLayerAssembler
+{
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        createModule( layer, InvoicingModule.class );
+        createModule( layer, OrderModule.class );
+        return layer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/InvoicingModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/InvoicingModule.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/InvoicingModule.java
new file mode 100644
index 0000000..ecc83f9
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/InvoicingModule.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.domain;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class InvoicingModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/OrderModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/OrderModule.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/OrderModule.java
new file mode 100644
index 0000000..49a6348
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/domain/OrderModule.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.domain;
+
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class OrderModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.entities( Order.class, Customer.class );
+        module.values( Address.class );
+        return module;
+    }
+
+    public interface Order
+    {
+        Association<Customer> customer();
+
+        Property<Address> invoicingAddress();
+
+        Property<Address> deliveryAddress();
+    }
+
+    public interface Customer
+    {
+    }
+
+    public interface Address
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/IndexingModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/IndexingModule.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/IndexingModule.java
new file mode 100644
index 0000000..7f3e689
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/IndexingModule.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.infrastructure;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class IndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public IndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/InfrastructureLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/InfrastructureLayer.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/InfrastructureLayer.java
new file mode 100644
index 0000000..1507555
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/InfrastructureLayer.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.infrastructure;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class InfrastructureLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Infrastructure Layer";
+    private final ModuleAssembly configModule;
+
+    public InfrastructureLayer( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        new StorageModule( configModule ).assemble( layer, layer.module( StorageModule.NAME ) );
+        new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );
+        createModule( layer, SerializationModule.class );
+        return layer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/SerializationModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/SerializationModule.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/SerializationModule.java
new file mode 100644
index 0000000..44cb35a
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/SerializationModule.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.infrastructure;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class SerializationModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module
+    )
+        throws AssemblyException
+    {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/StorageModule.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/StorageModule.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/StorageModule.java
new file mode 100644
index 0000000..b59e2e9
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/infrastructure/StorageModule.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.infrastructure;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+
+public class StorageModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Storage Module";
+    private final ModuleAssembly configModule;
+
+    public StorageModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/service/ServiceLayer.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/service/ServiceLayer.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/service/ServiceLayer.java
new file mode 100644
index 0000000..5e55350
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/assembly/service/ServiceLayer.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.assembly.service;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+public class ServiceLayer implements LayerAssembler
+{
+    public static final String NAME = "Service";
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/builder/ApplicationBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/builder/ApplicationBuilderTest.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/builder/ApplicationBuilderTest.java
new file mode 100644
index 0000000..d0ca6e5
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/builder/ApplicationBuilderTest.java
@@ -0,0 +1,136 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.builder;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.json.JSONException;
+import org.junit.Test;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.bootstrap.ClassScanner.findClasses;
+import static org.apache.polygene.bootstrap.ClassScanner.matches;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class ApplicationBuilderTest
+{
+    @Test
+    public void givenBuilderUseWhenBuildingApplicationExpectSuccess()
+        throws AssemblyException, ActivationException
+    {
+        ApplicationBuilder builder = new ApplicationBuilder( "Build from API test." );
+        builder.withLayer( "layer1" ).using( "layer2" ).using( "layer3" );
+        builder.withLayer( "layer2" );
+        builder.withLayer( "layer3" )
+               .withModule( "test module" )
+               .withAssemblers( findClasses( getClass() ).filter( matches( ".*ServiceAssembler" ) )
+                                                         .collect( toList() ) );
+        Application application = builder.newApplication();
+        Module module = application.findModule( "layer3", "test module" );
+        TestService service = module.findService( TestService.class ).get();
+        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
+    }
+
+    @Test
+    public void givenJsonWhenBuildingApplicationExpectSuccess()
+        throws JSONException, ActivationException, AssemblyException
+    {
+        ApplicationBuilder builder = ApplicationBuilder.fromJson( APPLICATION );
+        Application application = builder.newApplication();
+        Module module = application.findModule( "layer3", "test module" );
+        TestService service = module.findService( TestService.class ).get();
+        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
+    }
+
+    @Test
+    public void givenJsonInputStreamWhenBuildingApplicationExpectSuccess()
+        throws IOException, JSONException, ActivationException, AssemblyException
+    {
+        InputStream input = new ByteArrayInputStream( APPLICATION.getBytes( "UTF-8" ) );
+        ApplicationBuilder builder = ApplicationBuilder.fromJson( input );
+        Application application = builder.newApplication();
+        Module module = application.findModule( "layer3", "test module" );
+        TestService service = module.findService( TestService.class ).get();
+        assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) );
+    }
+
+
+    private static final String APPLICATION =
+        "{\n" +
+        "    \"name\": \"Build from JSON test.\",\n" +
+        "    \"layers\": [\n" +
+        "        {\n" +
+        "            \"name\": \"layer1\",\n" +
+        "            \"uses\": [ \"layer2\", \"layer3\"]\n" +
+        "        },\n" +
+        "        {\n" +
+        "            \"name\": \"layer2\"\n" +
+        "        },\n" +
+        "        {\n" +
+        "            \"name\": \"layer3\",\n" +
+        "            \"modules\" : [\n" +
+        "                {\n" +
+        "                    \"name\" : \"test module\",\n" +
+        "                    \"assemblers\" : [\n" +
+        "                            \"org.apache.polygene.bootstrap.builder.ApplicationBuilderTest$TestServiceAssembler\"\n" +
+        "                    ]\n" +
+        "                }\n" +
+        "            ]\n" +
+        "        }\n" +
+        "    ]\n" +
+        "}";
+
+    public static class TestServiceAssembler
+        implements Assembler
+    {
+        @Override
+        public void assemble( ModuleAssembly module )
+            throws AssemblyException
+        {
+            module.addServices( TestService.class );
+        }
+    }
+
+    @Mixins( TestService.TestMixin.class )
+    public interface TestService
+    {
+        String sayHello();
+
+        class TestMixin
+            implements TestService
+        {
+
+            @Override
+            public String sayHello()
+            {
+                return "Hello Polygene!";
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/somepackage/Test2Value.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/somepackage/Test2Value.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/somepackage/Test2Value.java
new file mode 100644
index 0000000..3902d92
--- /dev/null
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/somepackage/Test2Value.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.somepackage;
+
+import org.apache.polygene.api.value.ValueComposite;
+
+/**
+ */
+public interface Test2Value
+    extends ValueComposite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/AssemblySpecificationTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/AssemblySpecificationTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/AssemblySpecificationTest.java
deleted file mode 100644
index 6eac3fa..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/AssemblySpecificationTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-import org.apache.zest.api.type.HasTypes;
-import org.junit.Test;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class AssemblySpecificationTest
-{
-    @Test
-    public void givenSingleMatchingTypeWhenFilteringExpectTrue()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( String.class );
-        HasTypes hasTypes = new MockedHasTyoes( String.class );
-        assertThat( underTest.test( hasTypes ), equalTo(true) );
-    }
-
-    @Test
-    public void givenMultipleMatchingTypeWhenFilteringExpectTrue()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class, String.class );
-        HasTypes hasTypes = new MockedHasTyoes( String.class );
-        assertThat( underTest.test( hasTypes ), equalTo(true) );
-    }
-
-    @Test
-    public void givenSingleNonMatchingTypeWhenFilteringExpectFalse()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class );
-        HasTypes hasTypes = new MockedHasTyoes( Integer.class );
-        assertThat( underTest.test( hasTypes ), equalTo(false) );
-    }
-
-    @Test
-    public void givenMultipleMatchingTypeWhenFilteringAgainstMultipleExpectTrue()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, Integer.class, BigDecimal.class );
-        HasTypes hasTypes = new MockedHasTyoes( String.class, Integer.class );
-        assertThat( underTest.test( hasTypes ), equalTo(true) );
-    }
-
-    @Test
-    public void givenMultipleNonMatchingTypeWhenFilteringAgainstSingleExpectFalse()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class, String.class );
-        HasTypes hasTypes = new MockedHasTyoes( Integer.class );
-        assertThat( underTest.test( hasTypes ), equalTo(false) );
-    }
-
-    @Test
-    public void givenMultipleNonMatchingTypeWhenFilteringAgainstMultipleExpectFalse()
-    {
-        Predicate<HasTypes> underTest = AssemblySpecifications.ofAnyType( Long.class, BigDecimal.class );
-        HasTypes hasTypes = new MockedHasTyoes( String.class, Integer.class );
-        assertThat( underTest.test( hasTypes ), equalTo(false) );
-    }
-
-    private static class MockedHasTyoes
-        implements HasTypes
-    {
-        private final Class[] types;
-
-        public MockedHasTyoes( Class... types)
-        {
-            this.types = types;
-        }
-
-        @Override
-        public Stream<Class<?>> types()
-        {
-            return Arrays.stream(types);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/ClassScannerTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/ClassScannerTest.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/ClassScannerTest.java
deleted file mode 100644
index bb38ff5..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/ClassScannerTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.bootstrap.somepackage.Test2Value;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.apache.zest.bootstrap.ClassScanner.findClasses;
-import static org.apache.zest.bootstrap.ClassScanner.matches;
-
-/**
- * Test and showcase of the ClassScanner assembly utility.
- */
-public class ClassScannerTest
-{
-    @Test
-    public void testClassScannerFiles()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler singleton = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                new DefaultUnitOfWorkAssembler().assemble( module );
-
-                // Find all classes starting from TestValue, but include only the ones that are named *Value
-                findClasses( TestValue.class ).filter( matches( ".*Value" ) )
-                                              .forEach( module::values );
-            }
-        };
-
-        singleton.module().newValueBuilder( TestValue.class );
-        singleton.module().newValueBuilder( Test2Value.class );
-    }
-
-    @Test
-    public void testClassScannerJar()
-    {
-        Assert.assertEquals( 185, findClasses( Test.class ).count() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
deleted file mode 100644
index 2c73588..0000000
--- a/core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.service.importer.InstanceImporter;
-import org.apache.zest.api.service.importer.NewObjectImporter;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.api.structure.Module;
-
-@SuppressWarnings( "ALL" )
-public class DocumentationSupport
-{
-
-    public static Predicate<ObjectAssembly> hasMyTypeSpecification = new Predicate<ObjectAssembly>()
-    {
-
-        public boolean test( ObjectAssembly item )
-        {
-            return item.types().anyMatch( type -> type.equals(String.class) );
-        }
-
-    };
-
-    public static class objects
-            implements Assembler
-    {
-
-        public static class MyObject {}
-
-        // START SNIPPET: objects
-        @Override
-        public void assemble( ModuleAssembly module )
-                throws AssemblyException
-        {
-            module.objects( MyObject.class ).visibleIn( Visibility.layer );
-        }
-        // END SNIPPET: objects
-
-    }
-
-    public static class transients
-            implements Assembler
-    {
-
-        public static interface MyTransient {}
-
-        // START SNIPPET: transients
-        @Override
-        public void assemble( ModuleAssembly module )
-                throws AssemblyException
-        {
-            module.transients( MyTransient.class ).visibleIn( Visibility.layer );
-        }
-        // END SNIPPET: transients
-
-    }
-
-    public static class values
-            implements Assembler
-    {
-
-        public static interface MyValue {}
-
-        // START SNIPPET: values
-        @Override
-        public void assemble( ModuleAssembly module )
-                throws AssemblyException
-        {
-            module.values( MyValue.class ).visibleIn( Visibility.layer );
-        }
-        // END SNIPPET: values
-
-    }
-
-    public static class entities
-            implements Assembler
-    {
-
-        public static interface MyEntity {}
-
-        // START SNIPPET: entities
-        @Override
-        public void assemble( ModuleAssembly module )
-                throws AssemblyException
-        {
-            module.entities( MyEntity.class ).visibleIn( Visibility.layer );
-        }
-        // END SNIPPET: entities
-
-    }
-
-    public static class services
-            implements Assembler
-    {
-
-        public static interface MyService {}
-
-        // START SNIPPET: services
-        @Override
-        public void assemble( ModuleAssembly module )
-                throws AssemblyException
-        {
-            module.services( MyService.class ).visibleIn( Visibility.layer );
-        }
-        // END SNIPPET: services
-
-    }
-
-    public static class taggedServices
-        implements Assembler
-    {
-
-        public static interface MyService {}
-
-        // START SNIPPET: tagged-services
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-            module.services( MyService.class ).taggedWith( "foo", "bar" );
-        }
-        // END SNIPPET: tagged-services
-    }
-
-    public static class importedServices
-        implements Assembler
-    {
-
-        public static class MyService {}
-
-        // START SNIPPET: imported-services
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-            module.importedServices( MyService.class ).
-                importedBy( InstanceImporter.class ).
-                setMetaInfo( new MyService() );
-
-            // OR
-
-            module.objects( MyService.class );
-            module.importedServices( MyService.class ).
-                importedBy( NewObjectImporter.class );
-        }
-        // END SNIPPET: imported-services
-    }
-
-    public static class defaultPropertyValues
-        implements Assembler
-    {
-
-        public interface MyValue { Property<String> foo(); }
-        public interface MyEntity { Property<String> cathedral(); }
-
-        // START SNIPPET: properties-defaults
-        @Override
-        public void assemble( ModuleAssembly module )
-            throws AssemblyException
-        {
-            module.values( MyValue.class );
-            MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults();
-            myValueDefaults.foo().set( "bar" );
-
-            module.entities( MyEntity.class );
-            MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults();
-            myEntityDefaults.cathedral().set( "bazar" );
-        }
-        // END SNIPPET: properties-defaults
-    }
-
-    public static class singleton
-    {
-
-        public interface MyService { }
-        public interface Stuff { }
-
-        void singleton()
-            throws ActivationException, AssemblyException
-        {
-            // START SNIPPET: singleton
-            SingletonAssembler assembler = new SingletonAssembler()
-            {
-
-                @Override
-                public void assemble( ModuleAssembly module )
-                        throws AssemblyException
-                {
-                    module.services( MyService.class ).identifiedBy( "Foo" );
-                    module.services( MyService.class ).identifiedBy( "Bar" );
-                    module.objects( Stuff.class );
-                }
-
-            };
-            Module module = assembler.module();
-            Stuff stuff = module.newObject( Stuff.class );
-            // END SNIPPET: singleton
-        }
-
-    }
-
-    public static class pancake
-    {
-
-        public static class LoginAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class MenuAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class PerspectivesAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class ViewsAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class ReportingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class PdfAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class BookkeepingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class CashFlowAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class BalanceSheetAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class PricingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class ProductAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-
-        private static Energy4Java zest;
-
-        // START SNIPPET: pancake
-        public static void main( String[] args )
-                throws Exception
-        {
-            zest = new Energy4Java();
-            Assembler[][][] assemblers = new Assembler[][][]{
-                { // View Layer
-                    { // Login Module
-                        new LoginAssembler()
-                    // :
-                    },
-                    { // Main Workbench Module
-                        new MenuAssembler(),
-                        new PerspectivesAssembler(),
-                        new ViewsAssembler()
-                    // :
-                    },
-                    { // Printing Module
-                        new ReportingAssembler(),
-                        new PdfAssembler()
-                    // :
-                    }
-                },
-                { // Application Layer
-                    { // Accounting Module
-                        new BookkeepingAssembler(),
-                        new CashFlowAssembler(),
-                        new BalanceSheetAssembler()
-                    // :
-                    },
-                    { // Inventory Module
-                        new PricingAssembler(),
-                        new ProductAssembler()
-                    // :
-                    }
-                },
-                { // Domain Layer
-                // :
-                },
-                { // Infrastructure Layer
-                // :
-                }
-            };
-            ApplicationDescriptor model = newApplication( assemblers );
-            Application runtime = model.newInstance( zest.spi() );
-            runtime.activate();
-        }
-
-        private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers )
-                throws AssemblyException
-        {
-            return zest.newApplicationModel( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory )
-                        throws AssemblyException
-                {
-                    return appFactory.newApplicationAssembly( assemblers );
-                }
-
-            } );
-        }
-        // END SNIPPET: pancake
-
-    }
-
-    public static class full
-    {
-
-        public static class CustomerViewComposite{}
-        public static class CustomerEditComposite{}
-        public static class CustomerListViewComposite{}
-        public static class CustomerSearchComposite{}
-        public static class CustomerEntity{}
-        public static class CountryEntity{}
-        public static class AddressValue{}
-        public static class LdapAuthenticationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class ThrinkAuthorizationAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class UserTrackingAuditAssembler implements Assembler{ public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-        public static class NeoAssembler implements Assembler{ NeoAssembler( String path ) {} public void assemble( ModuleAssembly module ) throws AssemblyException { } }
-
-        // START SNIPPET: full
-        private static Energy4Java zest;
-
-        private static Application application;
-
-        public static void main( String[] args )
-                throws Exception
-        {
-            // Create a Polygene Runtime
-            zest = new Energy4Java();
-            application = zest.newApplication( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory )
-                        throws AssemblyException
-                {
-                    ApplicationAssembly assembly = appFactory.newApplicationAssembly();
-                    buildAssembly( assembly );
-                    return assembly;
-                }
-
-            } );
-            // activate the application
-            application.activate();
-        }
-
-        static void buildAssembly( ApplicationAssembly app ) throws AssemblyException
-        {
-            LayerAssembly webLayer = createWebLayer( app );
-            LayerAssembly domainLayer = createDomainLayer( app );
-            LayerAssembly persistenceLayer = createInfrastructureLayer( app );
-            LayerAssembly authLayer = createAuth2Layer( app );
-            LayerAssembly messagingLayer = createMessagingLayer( app );
-
-            webLayer.uses( domainLayer );
-            domainLayer.uses( authLayer );
-            domainLayer.uses( persistenceLayer );
-            domainLayer.uses( messagingLayer );
-        }
-
-        static LayerAssembly createWebLayer( ApplicationAssembly app ) throws AssemblyException
-        {
-            LayerAssembly layer = app.layer( "web-layer" );
-            createCustomerWebModule( layer );
-            return layer;
-        }
-
-        static LayerAssembly createDomainLayer( ApplicationAssembly app ) throws AssemblyException
-        {
-            LayerAssembly layer = app.layer( "domain-layer" );
-            createCustomerDomainModule( layer );
-            // :
-            // :
-            return layer;
-        }
-
-        static LayerAssembly createInfrastructureLayer( ApplicationAssembly app ) throws AssemblyException
-        {
-            LayerAssembly layer = app.layer( "infrastructure-layer" );
-            createPersistenceModule( layer );
-            return layer;
-        }
-
-        static LayerAssembly createMessagingLayer( ApplicationAssembly app ) throws AssemblyException
-        {
-            LayerAssembly layer = app.layer( "messaging-layer" );
-            createWebServiceModule( layer );
-            createMessagingPersistenceModule( layer );
-            return layer;
-        }
-
-        static LayerAssembly createAuth2Layer( ApplicationAssembly application ) throws AssemblyException
-        {
-            LayerAssembly layer = application.layer( "auth2-layer" );
-            createAuthModule( layer );
-            return layer;
-        }
-
-        static void createCustomerWebModule( LayerAssembly layer ) throws AssemblyException
-        {
-            ModuleAssembly assembly = layer.module( "customer-web-module" );
-            assembly.transients( CustomerViewComposite.class, CustomerEditComposite.class,
-                                 CustomerListViewComposite.class, CustomerSearchComposite.class );
-        }
-
-        static void createCustomerDomainModule( LayerAssembly layer ) throws AssemblyException
-        {
-            ModuleAssembly assembly = layer.module( "customer-domain-module" );
-            assembly.entities( CustomerEntity.class, CountryEntity.class );
-            assembly.values( AddressValue.class );
-        }
-
-        static void createAuthModule( LayerAssembly layer ) throws AssemblyException
-        {
-            ModuleAssembly assembly = layer.module( "auth-module" );
-            new LdapAuthenticationAssembler().assemble( assembly );
-            new ThrinkAuthorizationAssembler().assemble( assembly );
-            new UserTrackingAuditAssembler().assemble( assembly );
-        }
-
-        static void createPersistenceModule( LayerAssembly layer ) throws AssemblyException
-        {
-            ModuleAssembly assembly = layer.module( "persistence-module" );
-            // Someone has created an assembler for the Neo EntityStore
-            new NeoAssembler( "./neostore" ).assemble( assembly );
-        }
-
-        // END SNIPPET: full
-        private static void createWebServiceModule( LayerAssembly layer ) throws AssemblyException
-        {
-        }
-
-        private static void createMessagingPersistenceModule( LayerAssembly layer ) throws AssemblyException
-        {
-        }
-
-    }
-
-}


[38/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkDiscardOn.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkDiscardOn.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkDiscardOn.java
new file mode 100644
index 0000000..aec32d4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkDiscardOn.java
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork.concern;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Annotation to denote the unit of work discard policy.
+ * <p>
+ * By default, discard is applied on any method that has {@link UnitOfWorkPropagation} and any exception is thrown.
+ * </p>
+ * <p>
+ * Apply {@code UnitOfWorkDiscardOn} to override the default settings.
+ * </p>
+ * <p>
+ * Usage example:
+ * </p>
+ * <pre>
+ * <code>
+ *
+ * &#64;Concerns( UnitOfWorkConcern.class )
+ * public class MyBusinessServiceMixin implements BusinessService
+ * {
+ *   &#64;Structure UnitOfWorkFactory uowf;
+ *
+ *   &#64;UnitOfWorkDiscardOn( MyBusinessException.class )
+ *   public void myBusinessMethod()
+ *   {
+ *     // Must invoke current unit of work.
+ *     UnitOfWork uow = uowf.currentUnitOfWork();
+ *
+ *     // Perform business logic
+ *   }
+ * }
+ * </code>
+ * </pre>
+ *
+ * <p>
+ * The unit of work will be discarded iff {@code MyBusinessException} exceptions or its subclass is thrown from within
+ * {@code myBusinessMethod} method.
+ * </p>
+ */
+@Retention( RUNTIME )
+@Target( METHOD )
+@Inherited
+@Documented
+public @interface UnitOfWorkDiscardOn
+{
+    Class<? extends Throwable>[] value() default { Throwable.class };
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkPropagation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkPropagation.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkPropagation.java
new file mode 100644
index 0000000..b29a355
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkPropagation.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork.concern;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Annotation to denote the unit of work propagation.
+ * <p>
+ * Usage example:
+ * </p>
+ * <pre>
+ * <code>
+ *
+ * &#64;Concerns( UnitOfWorkConcern.class )
+ * public class MyBusinessServiceMixin implements BusinessService
+ * {
+ *   &#64;Structure UnitOfWorkFactory uowf;
+ *
+ *   &#64;UnitOfWorkPropagation
+ *   public void myBusinessMethod()
+ *   {
+ *     // Must invoke current unit of work.
+ *     UnitOfWork uow = uowf.currentUnitOfWork();
+ *
+ *     // Perform business logic
+ *   }
+ * }
+ * </code>
+ * </pre>
+ */
+@Retention( RUNTIME )
+@Target( METHOD )
+@Inherited
+@Documented
+public @interface UnitOfWorkPropagation
+{
+    Propagation value() default Propagation.REQUIRED;
+
+    String usecase() default "";
+
+    /**
+     * Propagation behaviors.
+     */
+    enum Propagation
+    {
+        /**
+         * Default propagation behavior.
+         * Behavior: <br>
+         * If no current transaction: creates a new UnitOfWork <br>
+         * If there is a current UnitOfWork: use the current UnitOfWork.
+         */
+        REQUIRED,
+
+        /**
+         * Behavior: <br>
+         * If no current UnitOfWork: throw an exception <br>
+         * If there is a current UnitOfWork: use the current UnitOfWork.
+         */
+        MANDATORY,
+
+        /**
+         * Behavior: <br>
+         * If no current UnitOfWork: creates a new UnitOfWork <br>
+         * If there is a current UnitOfWork: suspend the current UnitOfWork and create a new UnitOfWork.
+         */
+        REQUIRES_NEW
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkRetry.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkRetry.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkRetry.java
new file mode 100644
index 0000000..9f2d481
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkRetry.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork.concern;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.unitofwork.ConcurrentEntityModificationException;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * This annotation describes the retries that should occur in case of
+ * {@link org.apache.polygene.api.unitofwork.ConcurrentEntityModificationException}
+ * occurs.
+ */
+@Retention( RUNTIME )
+@Target( METHOD )
+@Inherited
+@Documented
+public @interface UnitOfWorkRetry
+{
+    /**
+     * Number of times that the UnitOfWork should be tried in total.
+     * The default value is 1, which means that the UnitOfWork will execute only one time. It is also the minimum
+     * value allowed.
+     *
+     * @return Number of times that the UnitOfWork will be executed. Must be 1 or higher. If a value of 0 or lower is
+     * given, the UnitOfWork is still executed one time.
+     */
+    int retries() default 1;
+
+    /**
+     * Number of milliseconds to wait before executing the second UnitOfOfWork.
+     * The default value is 0, which means that there is no delay and it is tried immediately.
+     *
+     * @return Number of milliseconds to wait before executing the second UnitOfOfWork.
+     */
+    long initialDelay() default 0;
+
+    /**
+     * Number of milliseconds to be added for each additional retry, beyond the second one.
+     * The default value is 10.
+     *
+     * The delay is defined as;
+     *
+     * <pre><code>
+     *
+     * Thread.sleep( initialDelay + retry * delayFactor );
+     * </code></pre>
+     * where retry will be 0 after first UnitOfWork had a {@link ConcurrentEntityModificationException} and is 1 after
+     * the first retry and so forth.
+     * <p>
+     * So, with the {@code retries=4, initialDelay=5, delayFactor=20} the 3 delays between the UnitOfWorks will be
+     * {@code 5ms, 25ms, 45ms}
+     * </p>
+     *
+     * @return The number of milliseconds per retry, except the first one, that should be added to the delay between
+     * tries.
+     */
+    long delayFactor() default 10;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/package.html b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/package.html
new file mode 100644
index 0000000..20aa625
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/package.html
@@ -0,0 +1,27 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>UnitOfWork Concerns.</h2>
+        <p>
+            UnitOfWork Concerns allow declarative UnitOfWork propagation, discard wrt. exceptions and automatic retry.
+        </p>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/package.html b/core/api/src/main/java/org/apache/polygene/api/unitofwork/package.html
new file mode 100644
index 0000000..70ff9e9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>UnitOfWork API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/usecase/Usecase.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/usecase/Usecase.java b/core/api/src/main/java/org/apache/polygene/api/usecase/Usecase.java
new file mode 100644
index 0000000..c47ce27
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/usecase/Usecase.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.usecase;
+
+import java.io.Serializable;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+
+/**
+ * A Usecase. A Usecase is used as a model for UnitOfWork, and helps
+ * implementations decide what to do in certain circumstances.
+ */
+public final class Usecase
+    implements Serializable, MetaInfoHolder
+{
+    public static final Usecase DEFAULT = new Usecase( "Default", new MetaInfo() );
+
+    private static final long serialVersionUID = 1L;
+    private final String name;
+    private final MetaInfo metaInfo;
+
+    Usecase( String name, MetaInfo metaInfo )
+    {
+        this.name = name;
+        this.metaInfo = metaInfo;
+    }
+
+    /**
+     * Name of the usecase.
+     *
+     * @return the name
+     */
+    public String name()
+    {
+        return name;
+    }
+
+    /**
+     * Meta-info for the usecase. This can be of any type, and is typically set when creating the usecase
+     * and read during the execution of the usecase.
+     *
+     * @param infoType the MetaInfo type to retrieve.
+     *
+     * @return the previously stored metaInfo of the given type for the usecase.
+     */
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public String toString()
+    {
+        return name + ", meta info:" + metaInfo;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/usecase/UsecaseBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/usecase/UsecaseBuilder.java b/core/api/src/main/java/org/apache/polygene/api/usecase/UsecaseBuilder.java
new file mode 100644
index 0000000..ae89aad
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/usecase/UsecaseBuilder.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.usecase;
+
+import org.apache.polygene.api.common.MetaInfo;
+
+/**
+ * Builder for Usecases.
+ */
+public final class UsecaseBuilder
+{
+    public static UsecaseBuilder buildUsecase( String aName )
+    {
+        return new UsecaseBuilder( aName );
+    }
+
+    public static Usecase newUsecase( String aName )
+    {
+        return new UsecaseBuilder( aName ).newUsecase();
+    }
+
+    private MetaInfo metaInfo = new MetaInfo();
+
+    private String name;
+
+    private UsecaseBuilder( String name )
+    {
+        this.name = name;
+    }
+
+    public UsecaseBuilder withMetaInfo( Object metaInfo )
+    {
+        this.metaInfo.set( metaInfo );
+        return this;
+    }
+
+    public Usecase newUsecase()
+    {
+        return new Usecase( name, metaInfo );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/usecase/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/usecase/package.html b/core/api/src/main/java/org/apache/polygene/api/usecase/package.html
new file mode 100644
index 0000000..1d55001
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/usecase/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Usecase API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Annotations.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Annotations.java b/core/api/src/main/java/org/apache/polygene/api/util/Annotations.java
new file mode 100644
index 0000000..b172945
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Annotations.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+import static org.apache.polygene.api.util.Classes.typeOf;
+
+/**
+ * Useful methods for handling Annotations.
+ */
+public final class Annotations
+{
+    public static final Function<Type, Stream<Annotation>> ANNOTATIONS_OF =
+        Classes.forTypes( type -> Arrays.stream( Classes.RAW_CLASS.apply( type ).getAnnotations() ) );
+
+    public static Predicate<Annotation> typeHasAnnotation( Class<? extends Annotation> annotationType )
+    {
+        return element -> hasAnnotation( annotationType ).test( type().apply( element ) );
+    }
+
+    public static Predicate<AnnotatedElement> hasAnnotation( final Class<? extends Annotation> annotationType )
+    {
+        return element -> element.getAnnotation( annotationType ) != null;
+    }
+
+    public static Function<Annotation, Class<? extends Annotation>> type()
+    {
+        return Annotation::annotationType;
+    }
+
+    public static Predicate<Annotation> isType( final Class<? extends Annotation> annotationType )
+    {
+        return annotation -> annotation.annotationType().equals( annotationType );
+    }
+
+    public static <T extends Annotation> T annotationOn( Type type, Class<T> annotationType )
+    {
+        return annotationType.cast( Classes.RAW_CLASS.apply( type ).getAnnotation( annotationType ) );
+    }
+
+    public static List<Annotation> findAccessorAndTypeAnnotationsIn(AccessibleObject accessor) {
+        Stream<Annotation> stream = Stream.concat(
+                Arrays.stream(accessor.getAnnotations()),
+                interfacesOf(typeOf(accessor)).flatMap(ANNOTATIONS_OF)
+        );
+        Collector<Annotation, ?, List<Annotation>> collector = Collectors.toList();
+        return stream.collect(collector);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Classes.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Classes.java b/core/api/src/main/java/org/apache/polygene/api/util/Classes.java
new file mode 100644
index 0000000..175be95
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Classes.java
@@ -0,0 +1,541 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.ModelDescriptor;
+
+import static java.util.stream.Stream.concat;
+import static java.util.stream.StreamSupport.stream;
+
+/**
+ * Useful methods for handling Classes.
+ */
+public final class Classes
+{
+    private final static Map<Type, Type> wrapperClasses = new HashMap<>();
+
+    static
+    {
+        wrapperClasses.put( boolean.class, Boolean.class );
+        wrapperClasses.put( byte.class, Byte.class );
+        wrapperClasses.put( short.class, Short.class );
+        wrapperClasses.put( char.class, Character.class );
+        wrapperClasses.put( int.class, Integer.class );
+        wrapperClasses.put( long.class, Long.class );
+        wrapperClasses.put( float.class, Float.class );
+        wrapperClasses.put( double.class, Double.class );
+    }
+
+    private final static Map<Type, Type> primitiveClasses = new HashMap<>();
+
+    static
+    {
+        primitiveClasses.put( boolean.class, Boolean.class );
+        primitiveClasses.put( byte.class, Byte.class );
+        primitiveClasses.put( short.class, Short.class );
+        primitiveClasses.put( char.class, Character.class );
+        primitiveClasses.put( int.class, Integer.class );
+        primitiveClasses.put( long.class, Long.class );
+        primitiveClasses.put( float.class, Float.class );
+        primitiveClasses.put( double.class, Double.class );
+    }
+
+    /**
+     * Convert from primitive class (int, short, double, etc.) to wrapper class (Integer, Short, Double, etc.).
+     * Return the same class if it's not a primitive class. This can therefore safely be used on all types
+     * to ensure that they are not primitives.
+     */
+    private static final Function<Type, Type> WRAPPER_CLASS = clazz -> {
+        Type wrapperClass = wrapperClasses.get( clazz );
+        return wrapperClass == null ? clazz : wrapperClass;
+    };
+
+    /**
+     * Convert from wrapper class (Integer, Short, Double, etc.) to primitive class (int, short, double, etc.).
+     * Return the same class if it's not a wrapper class. This can therefore safely be used on all types
+     * to ensure that they are primitives if possible.
+     */
+    @SuppressWarnings( "UnusedDeclaration" )
+    private static final Function<Type, Type> PRIMITIVE_CLASS = aClass -> {
+        Type primitiveClass = primitiveClasses.get( aClass );
+        return primitiveClass == null ? aClass : primitiveClass;
+    };
+
+    /**
+     * Function that extract the raw class of a type.
+     */
+    public static final Function<Type, Class<?>> RAW_CLASS = genericType -> {
+        // Calculate raw type
+        if( genericType instanceof Class )
+        {
+            return (Class<?>) genericType;
+        }
+        else if( genericType instanceof ParameterizedType )
+        {
+            return (Class<?>) ( (ParameterizedType) genericType ).getRawType();
+        }
+        else if( genericType instanceof TypeVariable )
+        {
+            return (Class<?>) ( (TypeVariable) genericType ).getGenericDeclaration();
+        }
+        else if( genericType instanceof WildcardType )
+        {
+            return (Class<?>) ( (WildcardType) genericType ).getUpperBounds()[ 0 ];
+        }
+        else if( genericType instanceof GenericArrayType )
+        {
+            Object temp = Array.newInstance( (Class<?>) ( (GenericArrayType) genericType ).getGenericComponentType(), 0 );
+            return temp.getClass();
+        }
+        throw new IllegalArgumentException( "Could not extract the raw class of " + genericType );
+    };
+
+    private static final Function<AccessibleObject, Type> TYPE_OF = accessor -> {
+        if( accessor instanceof Method )
+        {
+            return ( (Method) accessor ).getGenericReturnType();
+        }
+        return ( (Field) accessor ).getGenericType();
+    };
+
+    private static final Function<Type, Stream<Class<?>>> CLASS_HIERARCHY = new Function<Type, Stream<Class<?>>>()
+    {
+        @Override
+        public Stream<Class<?>> apply( Type type )
+        {
+            if( type == null )
+            {
+                return Stream.empty();
+            }
+            if( type.equals( Object.class ) )
+            {
+                return Stream.of( (Class<?>) type );
+            }
+            else
+            {
+                type = RAW_CLASS.apply( type );
+                Class superclass = ( (Class) type ).getSuperclass();
+                return concat( Stream.of( (Class<?>) type ), apply( superclass ) );
+            }
+        }
+    };
+
+    @SuppressWarnings( "raw" )
+    private static final Function<Type, Stream<? extends Type>> INTERFACES_OF = new Function<Type, Stream<? extends Type>>()
+    {
+        @Override
+        public Stream<? extends Type> apply( Type type )
+        {
+            Class clazz = RAW_CLASS.apply( type );
+
+            if( clazz.isInterface() )
+            {
+                Stream<? extends Type> genericInterfaces = Arrays.stream( clazz.getGenericInterfaces() );
+                Stream<? extends Type> intfaces = genericInterfaces.flatMap( INTERFACES_OF );
+                return concat( Stream.of( type ), intfaces );
+            }
+            else
+            {
+                if( type.equals( Object.class ) )
+                {
+                    return Arrays.stream( clazz.getGenericInterfaces() );
+                }
+                else
+                {
+                    return concat( Stream.of( clazz.getGenericInterfaces() ).flatMap( INTERFACES_OF ),
+                                   Stream.of( clazz.getSuperclass() ).flatMap( INTERFACES_OF ) );
+
+                }
+            }
+        }
+    };
+
+    private static final Function<Type, Stream<? extends Type>> TYPES_OF = type -> {
+        Class clazz = RAW_CLASS.apply( type );
+
+        if( clazz.isInterface() )
+        {
+            Stream<Type> intfaces = Arrays.stream( clazz.getGenericInterfaces() ).flatMap( INTERFACES_OF );
+            return concat( Stream.of( clazz ), intfaces );
+        }
+        else
+        {
+            return concat( Stream.of( clazz ),
+                           Stream.of( type ).flatMap( CLASS_HIERARCHY ).flatMap( INTERFACES_OF ) );
+        }
+    };
+
+    public static Type typeOf( AccessibleObject from )
+    {
+        return TYPE_OF.apply( from );
+    }
+
+    public static Stream<Type> typesOf( Stream<? extends Type> types )
+    {
+        return types.flatMap( TYPES_OF );
+    }
+
+    public static Stream<? extends Type> typesOf( Type type )
+    {
+        return TYPES_OF.apply( type );
+    }
+
+    public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types )
+    {
+        return types.flatMap( INTERFACES_OF );
+    }
+
+    public static Stream<? extends Type> interfacesOf( Type type )
+    {
+        return Stream.of( type ).flatMap( INTERFACES_OF );
+    }
+
+    public static Stream<Class<?>> classHierarchy( Class<?> type )
+    {
+        return Stream.of( type ).flatMap( CLASS_HIERARCHY );
+    }
+
+    public static Type wrapperClass( Type type )
+    {
+        return WRAPPER_CLASS.apply( type );
+    }
+
+    public static Predicate<Class<?>> isAssignableFrom( final Class<?> clazz )
+    {
+        return clazz::isAssignableFrom;
+    }
+
+    public static Predicate<Object> instanceOf( final Class<?> clazz )
+    {
+        return clazz::isInstance;
+    }
+
+    public static Predicate<Class<?>> hasModifier( final int classModifier )
+    {
+        return item -> ( item.getModifiers() & classModifier ) != 0;
+    }
+
+    public static <T> Function<Type, Stream<T>> forClassHierarchy( final Function<Class<?>, Stream<T>> function )
+    {
+        return type -> Stream.of( type ).flatMap( CLASS_HIERARCHY ).flatMap( function );
+    }
+
+    public static <T> Function<Type, Stream<T>> forTypes( final Function<Type, Stream<T>> function )
+    {
+        return type -> Stream.of( type ).flatMap( TYPES_OF ).flatMap( function );
+    }
+
+    @SuppressWarnings( "raw" )
+    public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces )
+    {
+        Set<Class<?>> newSet = new LinkedHashSet<>();
+        for( Class type : interfaces )
+        {
+            if( type.isInterface() && type.getDeclaredMethods().length > 0 )
+            {
+                newSet.add( type );
+            }
+        }
+
+        return newSet;
+    }
+
+    public static String simpleGenericNameOf( Type type )
+    {
+        StringBuilder sb = new StringBuilder();
+        simpleGenericNameOf( sb, type );
+        return sb.toString();
+    }
+
+    @SuppressWarnings( "raw" )
+    private static void simpleGenericNameOf( StringBuilder sb, Type type )
+    {
+        if( type instanceof Class )
+        {
+            sb.append( ( (Class) type ).getSimpleName() );
+        }
+        else if( type instanceof ParameterizedType )
+        {
+            ParameterizedType pt = (ParameterizedType) type;
+            simpleGenericNameOf( sb, pt.getRawType() );
+            sb.append( "<" );
+            boolean atLeastOne = false;
+            for( Type typeArgument : pt.getActualTypeArguments() )
+            {
+                if( atLeastOne )
+                {
+                    sb.append( ", " );
+                }
+                simpleGenericNameOf( sb, typeArgument );
+                atLeastOne = true;
+            }
+            sb.append( ">" );
+        }
+        else if( type instanceof GenericArrayType )
+        {
+            GenericArrayType gat = (GenericArrayType) type;
+            simpleGenericNameOf( sb, gat.getGenericComponentType() );
+            sb.append( "[]" );
+        }
+        else if( type instanceof TypeVariable )
+        {
+            TypeVariable tv = (TypeVariable) type;
+            sb.append( tv.getName() );
+        }
+        else if( type instanceof WildcardType )
+        {
+            WildcardType wt = (WildcardType) type;
+            sb.append( "? extends " );
+            boolean atLeastOne = false;
+            for( Type typeArgument : wt.getUpperBounds() )
+            {
+                if( atLeastOne )
+                {
+                    sb.append( ", " );
+                }
+                simpleGenericNameOf( sb, typeArgument );
+                atLeastOne = true;
+            }
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Don't know how to deal with type:" + type );
+        }
+    }
+
+    @SuppressWarnings( "UnusedDeclaration" )
+    public static <AnnotationType extends Annotation>
+    AnnotationType findAnnotationOfTypeOrAnyOfSuperTypes( Class<?> type, Class<AnnotationType> annotationClass )
+    {
+        return Stream.of( type )
+            .flatMap( TYPES_OF )
+            .map( RAW_CLASS )
+            .map( clazz -> clazz.getAnnotation( annotationClass ) )
+            .filter( Objects::nonNull )
+            .findAny().orElse( null );
+    }
+
+    public static Predicate<Member> memberNamed( final String name )
+    {
+        return item -> item.getName().equals( name );
+    }
+
+    /**
+     * Given a type variable, find what it resolves to given the declaring class where type
+     * variable was found and a top class that extends the declaring class.
+     *
+     * @param name           The TypeVariable name.
+     * @param declaringClass The class where the TypeVariable is declared.
+     * @param topClass       The top class that extends the declaringClass
+     *
+     * @return The Type instance of the given TypeVariable
+     */
+    @SuppressWarnings( "raw" )
+    public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass )
+    {
+        Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass );
+        if( type == null )
+        {
+            type = Object.class;
+        }
+        return type;
+    }
+
+    private static Type resolveTypeVariable( TypeVariable name,
+                                             Class declaringClass,
+                                             Map<TypeVariable, Type> mappings,
+                                             Class current
+    )
+    {
+        if( current.equals( declaringClass ) )
+        {
+            Type resolvedType = name;
+            while( resolvedType instanceof TypeVariable )
+            {
+                resolvedType = mappings.get( resolvedType );
+            }
+            return resolvedType;
+        }
+
+        Stream<? extends Type> stream = Arrays.stream( current.getGenericInterfaces() )
+            .flatMap( INTERFACES_OF )
+            .distinct();
+
+        Type genericSuperclass = current.getGenericSuperclass();
+        if( genericSuperclass != null )
+        {
+            stream = concat( stream, Stream.of( genericSuperclass ) );
+        }
+        return stream.map( type -> {
+            Class subClass;
+            if( type instanceof ParameterizedType )
+            {
+                subClass = extractTypeVariables( mappings, (ParameterizedType) type );
+            }
+            else
+            {
+                subClass = (Class) type;
+            }
+            return subClass;
+        } )
+            .map( subClass -> resolveTypeVariable( name, declaringClass, mappings, subClass ) )
+            .filter( type -> type != null )
+            .findAny().orElse( null );
+    }
+
+    private static Class extractTypeVariables( Map<TypeVariable, Type> mappings, ParameterizedType type )
+    {
+        Class subClass;
+        Type[] args = type.getActualTypeArguments();
+        Class clazz = (Class) type.getRawType();
+        TypeVariable[] vars = clazz.getTypeParameters();
+        for( int i = 0; i < vars.length; i++ )
+        {
+            TypeVariable var = vars[ i ];
+            Type mappedType = args[ i ];
+            mappings.put( var, mappedType );
+        }
+        subClass = (Class) type.getRawType();
+        return subClass;
+    }
+
+    /**
+     * Get URI for a class.
+     *
+     * @param clazz class
+     *
+     * @return URI
+     *
+     * @throws NullPointerException if clazz is null
+     */
+    @SuppressWarnings( "raw" )
+    public static String toURI( final Class clazz )
+        throws NullPointerException
+    {
+        return toURI( clazz.getName() );
+    }
+
+    /**
+     * Get URI for a class name.
+     * <p>
+     * Example:
+     * </p>
+     * <p>
+     * Class name com.example.Foo$Bar is converted to URI urn:polygene:com.example.Foo-Bar
+     * </p>
+     *
+     * @param className class name
+     *
+     * @return URI
+     *
+     * @throws NullPointerException if className is null
+     */
+    public static String toURI( String className )
+        throws NullPointerException
+    {
+        className = normalizeClassToURI( className );
+        return "urn:polygene:type:" + className;
+    }
+
+    /**
+     * Get class name from a URI
+     *
+     * @param uri URI
+     *
+     * @return class name
+     *
+     * @throws NullPointerException if uri is null
+     */
+    public static String toClassName( String uri )
+        throws NullPointerException
+    {
+        uri = uri.substring( "urn:polygene:type:".length() );
+        uri = denormalizeURIToClass( uri );
+        return uri;
+    }
+
+    public static String normalizeClassToURI( String className )
+    {
+        return className.replace( '$', '-' );
+    }
+
+    public static String denormalizeURIToClass( String uriPart )
+    {
+        return uriPart.replace( '-', '$' );
+    }
+
+    public static Predicate<ModelDescriptor> modelTypeSpecification( final String className )
+    {
+        return item ->
+            stream( item.types().spliterator(), false )
+                .map( Class::getName ).anyMatch( typeName -> typeName.equals( className ) );
+    }
+
+    @SuppressWarnings( "raw" )
+    public static Predicate<ModelDescriptor> exactTypeSpecification( final Class type )
+    {
+        return item -> item.types().anyMatch( clazz -> clazz.equals( type ) );
+    }
+
+    @SuppressWarnings( "raw" )
+    public static Predicate<ModelDescriptor> assignableTypeSpecification( final Class<?> type )
+    {
+        return item ->
+            item.types().anyMatch(
+                itemType -> !type.equals( itemType ) && type.isAssignableFrom( itemType )
+            );
+    }
+
+    @SuppressWarnings( "raw" )
+    public static String toString( Stream<? extends Class> types )
+    {
+        return "[" + types.map( Class::getSimpleName ).collect( Collectors.joining( "," ) ) + "]";
+    }
+
+    public static Function<Type, String> toClassName()
+    {
+        return type -> RAW_CLASS.apply( type ).getName();
+    }
+
+    private Classes()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Collectors.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Collectors.java b/core/api/src/main/java/org/apache/polygene/api/util/Collectors.java
new file mode 100644
index 0000000..e419b21
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Collectors.java
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.function.BinaryOperator;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import java.util.stream.Collector;
+
+public class Collectors
+{
+    /**
+     * Collect a single element.
+     * @param <T> Element type
+     * @return The single element
+     * @throws IllegalArgumentException if no or more than one element
+     */
+    public static <T>
+    Collector<T, ?, T> single()
+        throws IllegalArgumentException
+    {
+        Supplier<T> thrower = () ->
+        {
+            throw new IllegalArgumentException( "No or more than one element in stream" );
+        };
+        return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ),
+                                                              optional -> optional.orElseGet( thrower ) );
+    }
+
+    /**
+     * Eventually collect a single element.
+     * @param <T> Element type
+     * @return The single element, optional
+     * @throws IllegalArgumentException if more than one element
+     */
+    public static <T>
+    Collector<T, ?, Optional<T>> singleOrEmpty()
+        throws IllegalArgumentException
+    {
+        return java.util.stream.Collectors.reducing(
+            ( left, right ) ->
+            {
+                if( left != null && right != null )
+                {
+                    throw new IllegalArgumentException( "More than one element in stream" );
+                }
+                if( left != null )
+                {
+                    return left;
+                }
+                return right;
+            } );
+    }
+
+    public static <T, K, U, M extends Map<K, U>>
+    Collector<T, ?, M> toMap( Function<? super T, ? extends K> keyMapper,
+                              Function<? super T, ? extends U> valueMapper,
+                              Supplier<M> mapSupplier )
+    {
+        return java.util.stream.Collectors.toMap( keyMapper,
+                                                  valueMapper,
+                                                  throwingMerger(),
+                                                  mapSupplier );
+    }
+
+
+    public static <T extends Map.Entry<K, U>, K, U>
+    Collector<T, ?, Map<K, U>> toMap()
+    {
+        return java.util.stream.Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue );
+    }
+
+    public static <T extends Map.Entry<K, U>, K, U, M extends Map<K, U>>
+    Collector<T, ?, M> toMap( Supplier<M> mapSupplier )
+    {
+        return toMap( Map.Entry::getKey, Map.Entry::getValue, mapSupplier );
+    }
+
+    private static <T> BinaryOperator<T> throwingMerger()
+    {
+        return ( left, right ) ->
+        {
+            throw new IllegalStateException( String.format( "Duplicate key %s", left ) );
+        };
+    }
+
+    private Collectors() {}
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Constructors.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Constructors.java b/core/api/src/main/java/org/apache/polygene/api/util/Constructors.java
new file mode 100644
index 0000000..12f2e01
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Constructors.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * Useful methods for handling Constructors.
+ */
+public final class Constructors
+{
+    public static final Function<Type, Stream<Constructor<?>>> CONSTRUCTORS_OF =
+        Classes.forClassHierarchy( type -> Arrays.stream( type.getDeclaredConstructors() ) );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Fields.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Fields.java b/core/api/src/main/java/org/apache/polygene/api/util/Fields.java
new file mode 100644
index 0000000..c29c3bf
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Fields.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * Useful methods for handling Fields.
+ */
+public final class Fields
+{
+    public static final Function<Type, Stream<Field>> FIELDS_OF =
+        Classes.forClassHierarchy( type -> Arrays.stream( type.getDeclaredFields() ) );
+
+    public static final BiFunction<Class<?>, String, Field> FIELD_NAMED = ( clazz, name ) ->
+        FIELDS_OF.apply( clazz ).filter( Classes.memberNamed( name ) ).findFirst().orElse( null );
+
+    public static Stream<Field> fieldsOf( Type type )
+    {
+        return Stream.of( type ).flatMap( FIELDS_OF );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitor.java b/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitor.java
new file mode 100644
index 0000000..33fcb40
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitor.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Visitor to visit hierarchies.
+ */
+public interface HierarchicalVisitor<NODE, LEAF, ThrowableType extends Throwable> extends Visitor<LEAF, ThrowableType>
+{
+    /**
+     * Enter an instance of T
+     *
+     * @param visited the visited instance which is now entered
+     *
+     * @return true if the visitor pattern should continue, false if it should be aborted for this level
+     *
+     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
+     *                       get the exception in order to handle it properly.
+     */
+    boolean visitEnter( NODE visited )
+        throws ThrowableType;
+
+    /**
+     * Leave an instance of T
+     *
+     * @param visited the visited instance which is now left
+     *
+     * @return true if the visitor pattern should continue, false if it should be aborted for the level of this node
+     *
+     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
+     *                       get the exception in order to handle it properly.
+     */
+    boolean visitLeave( NODE visited )
+        throws ThrowableType;
+
+    @Override
+    boolean visit( LEAF visited )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitorAdapter.java b/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitorAdapter.java
new file mode 100644
index 0000000..4756b3c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/HierarchicalVisitorAdapter.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Generic Hierarchical Visitor interface.
+ */
+public class HierarchicalVisitorAdapter<NODE, LEAF, ThrowableType extends Throwable>
+    implements HierarchicalVisitor<NODE, LEAF, ThrowableType>
+{
+    @Override
+    public boolean visitEnter( NODE visited )
+        throws ThrowableType
+    {
+        return true;
+    }
+
+    @Override
+    public boolean visitLeave( NODE visited )
+        throws ThrowableType
+    {
+        return true;
+    }
+
+    @Override
+    public boolean visit( LEAF visited )
+        throws ThrowableType
+    {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/ListMap.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/ListMap.java b/core/api/src/main/java/org/apache/polygene/api/util/ListMap.java
new file mode 100644
index 0000000..4cba48e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/ListMap.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Map whose values are Lists of things. Create
+ * one ArrayList for each key that is added. The list does not allow
+ * duplicates.
+ */
+public final class ListMap<K, V>
+    extends HashMap<K, List<V>>
+{
+    public void add( K key, V value )
+    {
+        List<V> list = get( key );
+        if( list == null )
+        {
+            list = new ArrayList<V>();
+            put( key, list );
+        }
+        if( !list.contains( value ) )
+        {
+            list.add( value );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Methods.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Methods.java b/core/api/src/main/java/org/apache/polygene/api/util/Methods.java
new file mode 100644
index 0000000..bf0d4dd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Methods.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+
+/**
+ * Useful methods for handling Methods.
+ */
+public class Methods
+{
+    public static final Predicate<Type> HAS_METHODS =
+        item -> Classes.RAW_CLASS.apply( item ).getDeclaredMethods().length > 0;
+
+    public static final Function<Type, Stream<Method>> METHODS_OF = Classes.forTypes( type ->
+        Stream.of( type ).map( Classes.RAW_CLASS ).flatMap( clazz -> Arrays.stream( clazz.getDeclaredMethods() ) )
+    );
+
+    public static final BiFunction<Class<?>, String, Method> METHOD_NAMED = ( clazz, name ) ->
+        METHODS_OF.apply( clazz ).filter( Classes.memberNamed( name ) ).findFirst().orElse( null );
+
+
+    public static Stream<Method> methodsOf( Type type )
+    {
+        return Stream.of(type).flatMap( METHODS_OF );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/NullArgumentException.java b/core/api/src/main/java/org/apache/polygene/api/util/NullArgumentException.java
new file mode 100644
index 0000000..927a438
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/NullArgumentException.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Thrown if an argument to a method was null, and the method required
+ * it to be non-null.
+ */
+public class NullArgumentException
+    extends IllegalArgumentException
+{
+    private static final long serialVersionUID = 4815431779868729780L;
+
+    private NullArgumentException( String message )
+    {
+        super( message );
+    }
+
+    public static void validateNotNull( String parameterName, Object value )
+    {
+        if( value != null )
+        {
+            return;
+        }
+        String message = parameterName + " was null.";
+        throw new NullArgumentException( message );
+    }
+
+    public static void validateNotEmpty( String parameterName, String value )
+    {
+        if( value == null )
+        {
+            String message = parameterName + " was null.";
+            throw new NullArgumentException( message );
+        }
+        if( value.length() == 0 )
+        {
+            String message = parameterName + " was empty.";
+            throw new NullArgumentException( message );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Visitable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Visitable.java b/core/api/src/main/java/org/apache/polygene/api/util/Visitable.java
new file mode 100644
index 0000000..8d163a3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Visitable.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Interface that visitable objects should implement.
+ */
+public interface Visitable<T>
+{
+    <ThrowableType extends Throwable> boolean accept( Visitor<? super T, ThrowableType> visitor )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/VisitableHierarchy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/VisitableHierarchy.java b/core/api/src/main/java/org/apache/polygene/api/util/VisitableHierarchy.java
new file mode 100644
index 0000000..33015db
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/VisitableHierarchy.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Interface that visitable hierarchies of objects should implement.
+ */
+public interface VisitableHierarchy<NODE, LEAF>
+{
+    <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super NODE, ? super LEAF, ThrowableType> visitor )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/Visitor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/Visitor.java b/core/api/src/main/java/org/apache/polygene/api/util/Visitor.java
new file mode 100644
index 0000000..80f45a0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/Visitor.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+/**
+ * Generic Visitor interface.
+ */
+public interface Visitor<T, ThrowableType extends Throwable>
+{
+    /**
+     * Visit an instance of T
+     *
+     * @param visited the visited instance
+     *
+     * @return true if the visitor pattern should continue, false if it should be aborted
+     *
+     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
+     *                       get the exception in order to handle it properly.
+     */
+    boolean visit( T visited )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/util/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/util/package.html b/core/api/src/main/java/org/apache/polygene/api/util/package.html
new file mode 100644
index 0000000..cc0b40b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/util/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>API Utilities.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/MissingValueSerializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/MissingValueSerializationException.java b/core/api/src/main/java/org/apache/polygene/api/value/MissingValueSerializationException.java
new file mode 100644
index 0000000..00b1af7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/MissingValueSerializationException.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+public class MissingValueSerializationException extends ValueSerializationException
+{
+    public MissingValueSerializationException()
+    {
+    }
+
+    public MissingValueSerializationException( String message )
+    {
+        super( message );
+    }
+
+    public MissingValueSerializationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public MissingValueSerializationException( Throwable cause )
+    {
+        super( cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/NoSuchValueException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/NoSuchValueException.java b/core/api/src/main/java/org/apache/polygene/api/value/NoSuchValueException.java
new file mode 100644
index 0000000..4e5cb30
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/NoSuchValueException.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.util.stream.Collectors;
+import org.apache.polygene.api.composite.NoSuchCompositeException;
+import org.apache.polygene.api.structure.TypeLookup;
+
+/**
+ * Thrown when no visible value of the requested type is found.
+ */
+public class NoSuchValueException
+    extends NoSuchCompositeException
+{
+    public NoSuchValueException( String valueType, String moduleName, TypeLookup typeLookup )
+    {
+        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/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilder.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilder.java
new file mode 100644
index 0000000..fe7a8e1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilder.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * Builder for Values.
+ */
+public interface ValueBuilder<T>
+{
+    AssociationStateHolder state();
+
+    /**
+     * Get a representation of the state for the new Value.
+     * It is possible to access and update properties and associations,
+     * even immutable ones since the builder represents the initial state.
+     *
+     * @return a mutable instance of the Value type
+     */
+    T prototype();
+
+    /**
+     * Get a representation of the state of the given type for the new ValueComposite.
+     * This is primarily used if you want to provide state for a private mixin type.
+     *
+     * @param mixinType the mixin which you want to provide state for
+     *
+     * @return a proxy implementing the given mixin type
+     */
+    <K> K prototypeFor( Class<K> mixinType );
+
+    /**
+     * Create a new Composite instance.
+     *
+     * @return a new Composite instance
+     *
+     * @throws org.apache.polygene.api.common.ConstructionException
+     *          thrown if it was not possible to instantiate the Composite
+     */
+    T newInstance()
+        throws ConstructionException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderFactory.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderFactory.java
new file mode 100644
index 0000000..b23889c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderFactory.java
@@ -0,0 +1,107 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.PropertyDescriptor;
+
+/**
+ * Factory for Values and ValueBuilders.
+ */
+public interface ValueBuilderFactory
+{
+
+    /**
+     * Instantiate a Value of the given type.
+     *
+     * @param valueType the Value type to instantiate
+     *
+     * @return a new Value instance
+     *
+     * @throws NoSuchValueException if no value extending the mixinType has been registered
+     * @throws ConstructionException if the value could not be instantiated
+     */
+    <T> T newValue( Class<T> valueType )
+        throws NoSuchValueException, ConstructionException;
+
+    /**
+     * Create a builder for creating new Values that implements the given Value type.
+     * <p>The returned ValueBuilder can be reused to create several Values instances.</p>
+     *
+     * @param valueType an interface that describes the Composite to be instantiated
+     *
+     * @return a ValueBuilder for creation of ValueComposites implementing the interface
+     *
+     * @throws NoSuchValueException if no value extending the mixinType has been registered
+     */
+    <T> ValueBuilder<T> newValueBuilder( Class<T> valueType )
+        throws NoSuchValueException;
+
+    /**
+     * Create a builder for creating a new Value starting with the given prototype.
+     * <p>The returned ValueBuilder can only be used ONCE.</p>
+     *
+     * @param prototype a prototype the builder will use
+     *
+     * @return a ValueBuilder for creation of ValueComposites implementing the interface of the prototype
+     *
+     * @throws NoSuchValueException if no value extending the mixinType has been registered
+     */
+    <T> ValueBuilder<T> newValueBuilderWithPrototype( T prototype );
+
+    /**
+     * Create a builder for creating a new Value starting with the given state.
+     * <p>The returned ValueBuilder can only be used ONCE.</p>
+     *
+     * @param mixinType an interface that describes the Composite to be instantiated
+     * @param propertyFunction a function providing the state of properties
+     * @param associationFunction a function providing the state of associations
+     * @param manyAssociationFunction a function providing the state of many associations
+     * @param namedAssociationFunction a function providing the state of named associations
+     *
+     * @return a ValueBuilder for creation of ValueComposites implementing the interface
+     *
+     * @throws NoSuchValueException if no value extending the mixinType has been registered
+     */
+    <T> ValueBuilder<T> newValueBuilderWithState( Class<T> mixinType,
+                                                  Function<PropertyDescriptor, Object> propertyFunction,
+                                                  Function<AssociationDescriptor, EntityReference> associationFunction,
+                                                  Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+                                                  Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction );
+
+    /**
+     * Instantiate a Value of the given type using the serialized state given as String.
+     *
+     * @param valueType the Value type to instantiate
+     * @param serializedState  the state of the Value
+     *
+     * @return a new Value instance
+     *
+     * @throws NoSuchValueException if no value extending the mixinType has been registered
+     * @throws ConstructionException if the value could not be instantiated
+     */
+    <T> T newValueFromSerializedState( Class<T> valueType, String serializedState );
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderTemplate.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderTemplate.java
new file mode 100644
index 0000000..59fd667
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueBuilderTemplate.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import org.apache.polygene.api.structure.ModuleDescriptor;
+
+/**
+ * Builder template for Values.
+ */
+public abstract class ValueBuilderTemplate<T>
+{
+    Class<T> type;
+
+    protected ValueBuilderTemplate( Class<T> type )
+    {
+        this.type = type;
+    }
+
+    protected abstract void build( T prototype );
+
+    public T newInstance( ModuleDescriptor module )
+    {
+        ValueBuilder<T> builder = module.instance().newValueBuilder( type );
+        build( builder.prototype() );
+        return builder.newInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueComposite.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueComposite.java
new file mode 100644
index 0000000..be0b54a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueComposite.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import org.apache.polygene.api.association.AssociationMixin;
+import org.apache.polygene.api.association.ManyAssociationMixin;
+import org.apache.polygene.api.association.NamedAssociationMixin;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Immutable;
+
+/**
+ * ValueComposites are Composites that has state, and equality is defined from its values and not any reference nor
+ * instance references.
+ *
+ * <ul>
+ * <li>No Identity</li>
+ * <li>No Lifecycle</li>
+ * <li>Immutable</li>
+ * <li>equals()/hashCode() operates on the Properties</li>
+ * <li>Can have property and associations methods.</li>
+ * <li>Can not reference Services</li>
+ * <li>Can not have @Uses</li>
+ * </ul>
+ */
+@Immutable
+@Mixins( { AssociationMixin.class, ManyAssociationMixin.class, NamedAssociationMixin.class } )
+public interface ValueComposite
+    extends Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueDescriptor.java
new file mode 100644
index 0000000..b9b3f54
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueDescriptor.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.StatefulCompositeDescriptor;
+import org.apache.polygene.api.type.ValueCompositeType;
+
+/**
+ * Descriptor for ValueComposites.
+ */
+public interface ValueDescriptor
+    extends CompositeDescriptor, StatefulCompositeDescriptor
+{
+    ValueCompositeType valueType();
+
+    @Override
+    AssociationStateDescriptor state();
+}


[15/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
new file mode 100644
index 0000000..1263e29
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
@@ -0,0 +1,214 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.constraint.Constraint;
+import org.apache.polygene.runtime.composite.ConcernModel;
+import org.apache.polygene.runtime.composite.ConstraintDeclaration;
+import org.apache.polygene.runtime.composite.FragmentClassLoader;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.SideEffectModel;
+
+/**
+ * This helper is used when building the application model. It keeps track
+ * of already created classloaders and various models
+ */
+@SuppressWarnings("WeakerAccess")
+public class AssemblyHelper
+{
+    private Map<Class, Class> instantiationClasses = new HashMap<>();
+    private Map<Class, ConstraintDeclaration> constraintDeclarations = new HashMap<>();
+    private Map<ClassLoader, FragmentClassLoader> modifierClassLoaders = new HashMap<>();
+    private Map<Class<?>, AppliesToFilter> appliesToInstances = new HashMap<>();
+
+    protected MixinModel getMixinModel(Class mixinClass)
+    {
+        return new MixinModel( mixinClass, instantiationClass( mixinClass ) );
+    }
+
+    protected ConcernModel getConcernModel(Class concernClass)
+    {
+        return new ConcernModel( concernClass, instantiationClass( concernClass ) );
+    }
+
+    protected SideEffectModel getSideEffectModel(Class sideEffectClass)
+    {
+        return new SideEffectModel( sideEffectClass, instantiationClass( sideEffectClass ) );
+    }
+
+    protected Class instantiationClass(Class fragmentClass)
+    {
+        Class instantiationClass = fragmentClass;
+        if( !InvocationHandler.class.isAssignableFrom( fragmentClass ) )
+        {
+            instantiationClass = instantiationClasses.get( fragmentClass );
+
+            if( instantiationClass == null )
+            {
+                try
+                {
+                    FragmentClassLoader fragmentLoader = getModifierClassLoader( fragmentClass.getClassLoader() );
+                    instantiationClass = fragmentLoader.loadFragmentClass( fragmentClass );
+                    instantiationClasses.put( fragmentClass, instantiationClass );
+                }
+                catch( ClassNotFoundException | VerifyError e )
+                {
+                    throw new ConstructionException( "Could not generate mixin subclass " + fragmentClass.getName(), e );
+                }
+            }
+        }
+        return instantiationClass;
+    }
+
+    protected FragmentClassLoader getModifierClassLoader( ClassLoader classLoader )
+    {
+        FragmentClassLoader cl = modifierClassLoaders.get( classLoader );
+        if( cl == null )
+        {
+            cl = instantiateFragmentClassLoader( classLoader );
+            modifierClassLoaders.put( classLoader, cl );
+        }
+        return cl;
+    }
+
+    protected FragmentClassLoader instantiateFragmentClassLoader( ClassLoader classLoader )
+    {
+        return new FragmentClassLoader( classLoader );
+    }
+
+    public boolean appliesTo( Class<?> fragmentClass, Method method, Iterable<Class<?>> types, Class<?> mixinClass )
+    {
+        AppliesToFilter appliesToFilter = appliesToInstances.get( fragmentClass );
+        if( appliesToFilter == null )
+        {
+            appliesToFilter = createAppliesToFilter( fragmentClass );
+            appliesToInstances.put( fragmentClass, appliesToFilter );
+        }
+        for( Class<?> compositeType : types )
+        {
+            if( appliesToFilter.appliesTo( method, mixinClass, compositeType, fragmentClass ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected AppliesToFilter createAppliesToFilter( Class<?> fragmentClass )
+    {
+        AppliesToFilter result = null;
+        if( !InvocationHandler.class.isAssignableFrom( fragmentClass ) )
+        {
+            result = new TypedFragmentAppliesToFilter();
+            if( Modifier.isAbstract( fragmentClass.getModifiers() ) )
+            {
+                result = new AndAppliesToFilter( result, new ImplementsMethodAppliesToFilter() );
+            }
+        }
+        result = applyAppliesTo( result, fragmentClass );
+        if( result == null )
+        {
+            return AppliesToFilter.ALWAYS;
+        }
+        return result;
+    }
+
+    protected AppliesToFilter applyAppliesTo( AppliesToFilter existing, Class<?> modifierClass )
+    {
+        AppliesTo appliesTo = modifierClass.getAnnotation( AppliesTo.class );
+        if( appliesTo != null )
+        {
+            // Use "or" for all filters specified in the annotation
+            AppliesToFilter appliesToAnnotation = null;
+            for( Class<?> appliesToClass : appliesTo.value() )
+            {
+                AppliesToFilter filter;
+                if( AppliesToFilter.class.isAssignableFrom( appliesToClass ) )
+                {
+                    try
+                    {
+                        @SuppressWarnings("unchecked")
+                        Constructor<AppliesToFilter> cons = (Constructor<AppliesToFilter>) appliesToClass.getDeclaredConstructor();
+                        cons.setAccessible(true);
+                        filter = cons.newInstance();
+                    }
+                    catch( Exception e )
+                    {
+                        throw new ConstructionException( e );
+                    }
+                }
+                else if( Annotation.class.isAssignableFrom( appliesToClass ) )
+                {
+                    filter = new AnnotationAppliesToFilter( appliesToClass );
+                }
+                else // Type check
+                {
+                    filter = new TypeCheckAppliesToFilter( appliesToClass );
+                }
+
+                if( appliesToAnnotation == null )
+                {
+                    appliesToAnnotation = filter;
+                }
+                else
+                {
+                    appliesToAnnotation = new OrAppliesToFilter( appliesToAnnotation, filter );
+                }
+            }
+            // Add to the rest of the rules using "and"
+            if( existing == null )
+            {
+                return appliesToAnnotation;
+            }
+            else
+            {
+                return new AndAppliesToFilter( existing, appliesToAnnotation );
+            }
+        }
+        return existing;
+    }
+
+    public boolean appliesTo( Class<? extends Constraint<?, ?>> constraint,
+                              Class<? extends Annotation> annotationType,
+                              Type valueType
+    )
+    {
+        ConstraintDeclaration constraintDeclaration = constraintDeclarations.get( constraint );
+        if( constraintDeclaration == null )
+        {
+            constraintDeclaration = new ConstraintDeclaration( constraint );
+            constraintDeclarations.put( constraint, constraintDeclaration );
+        }
+
+        return constraintDeclaration.appliesTo( annotationType, valueType );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
new file mode 100644
index 0000000..1e0fb26
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
@@ -0,0 +1,909 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.constraint.Constraint;
+import org.apache.polygene.api.constraint.ConstraintDeclaration;
+import org.apache.polygene.api.constraint.Constraints;
+import org.apache.polygene.api.constraint.Name;
+import org.apache.polygene.api.entity.Lifecycle;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Initializable;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.property.Immutable;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.sideeffect.SideEffects;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.util.Annotations;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Fields;
+import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
+import org.apache.polygene.bootstrap.StateDeclarations;
+import org.apache.polygene.runtime.association.AssociationModel;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.AbstractConstraintModel;
+import org.apache.polygene.runtime.composite.CompositeConstraintModel;
+import org.apache.polygene.runtime.composite.CompositeMethodModel;
+import org.apache.polygene.runtime.composite.CompositeMethodsModel;
+import org.apache.polygene.runtime.composite.ConcernModel;
+import org.apache.polygene.runtime.composite.ConcernsModel;
+import org.apache.polygene.runtime.composite.ConstraintModel;
+import org.apache.polygene.runtime.composite.ConstraintsModel;
+import org.apache.polygene.runtime.composite.Genericpredicate;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.SideEffectModel;
+import org.apache.polygene.runtime.composite.SideEffectsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.composite.ValueConstraintsInstance;
+import org.apache.polygene.runtime.composite.ValueConstraintsModel;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.property.PropertiesModel;
+import org.apache.polygene.runtime.property.PropertyModel;
+
+import static java.util.stream.Stream.concat;
+import static org.apache.polygene.api.util.Annotations.isType;
+import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
+import static org.apache.polygene.api.util.Classes.classHierarchy;
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+import static org.apache.polygene.api.util.Classes.isAssignableFrom;
+import static org.apache.polygene.api.util.Classes.typeOf;
+import static org.apache.polygene.api.util.Classes.typesOf;
+import static org.apache.polygene.api.util.Classes.wrapperClass;
+
+/**
+ * Declaration of a Composite.
+ */
+public abstract class CompositeAssemblyImpl
+    implements HasTypes
+{
+    protected List<Class<?>> concerns = new ArrayList<>();
+    protected List<Class<?>> sideEffects = new ArrayList<>();
+    protected List<Class<?>> mixins = new ArrayList<>();
+    protected List<Class<?>> types = new ArrayList<>();
+    protected MetaInfo metaInfo = new MetaInfo();
+    protected Visibility visibility = Visibility.module;
+
+    protected boolean immutable;
+    protected PropertiesModel propertiesModel;
+    protected StateModel stateModel;
+    protected MixinsModel mixinsModel;
+    protected CompositeMethodsModel compositeMethodsModel;
+    private AssemblyHelper helper;
+    protected StateDeclarations stateDeclarations;
+
+    protected Set<String> registeredStateNames = new HashSet<>();
+
+    public CompositeAssemblyImpl( Class<?> mainType )
+    {
+        types.add( mainType );
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return types.stream();
+    }
+
+    protected StateModel createStateModel()
+    {
+        return new StateModel( propertiesModel );
+    }
+
+    protected MixinsModel createMixinsModel()
+    {
+        return new MixinsModel();
+    }
+
+    protected void buildComposite( AssemblyHelper helper,
+                                   StateDeclarations stateDeclarations
+    )
+    {
+        this.stateDeclarations = stateDeclarations;
+        this.helper = helper;
+        for( Class<?> compositeType : types )
+        {
+            metaInfo = new MetaInfo( metaInfo ).withAnnotations( compositeType );
+            addAnnotationsMetaInfo( compositeType, metaInfo );
+        }
+
+        immutable = metaInfo.get( Immutable.class ) != null;
+        propertiesModel = new PropertiesModel();
+        stateModel = createStateModel();
+        mixinsModel = createMixinsModel();
+//        compositeMethodsModel = new CompositeMethodsModel();
+        compositeMethodsModel = new CompositeMethodsModel( mixinsModel );
+
+        // Implement composite methods
+        List<Class<?>> constraintClasses = toList( constraintDeclarations( getAllTypes() ) );
+        List<Class<?>> concernClasses = toList( concat( concerns.stream(), concernDeclarations( getAllTypes() ) ) );
+        List<Class<?>> sideEffectClasses = toList( concat( sideEffects.stream(), sideEffectDeclarations( getAllTypes() ) ) );
+        List<Class<?>> mixinClasses = toList( concat( mixins.stream(), mixinDeclarations( getAllTypes() ) ) );
+        //noinspection unchecked
+        implementMixinType( types,
+                            constraintClasses,
+                            concernClasses,
+                            sideEffectClasses,
+                            mixinClasses
+        );
+
+        // Add state from methods and fields
+        //noinspection unchecked
+        addState( constraintClasses );
+    }
+
+    private List<Class<?>> toList( Stream<Class<?>> stream )
+    {
+        return stream.collect( Collectors.toList() );
+    }
+
+    protected void addAnnotationsMetaInfo( Class<?> type, MetaInfo compositeMetaInfo )
+    {
+        Class[] declaredInterfaces = type.getInterfaces();
+        for( int i = declaredInterfaces.length - 1; i >= 0; i-- )
+        {
+            addAnnotationsMetaInfo( declaredInterfaces[ i ], compositeMetaInfo );
+        }
+        compositeMetaInfo.withAnnotations( type );
+    }
+
+    protected void implementMixinType( List<? extends Class<?>> types,
+                                       List<Class<?>> constraintClasses,
+                                       List<Class<?>> concernClasses,
+                                       List<Class<?>> sideEffectClasses,
+                                       List<Class<?>> mixinClasses
+    )
+    {
+        Set<Class<?>> thisDependencies = new HashSet<>();
+        types.forEach( mixinType -> {
+            for( Method method : mixinType.getMethods() )
+            {
+                if( !compositeMethodsModel.isImplemented( method )
+                    && !Proxy.class.equals( method.getDeclaringClass().getSuperclass() )
+                    && !Proxy.class.equals( method.getDeclaringClass() )
+                    && !Modifier.isStatic( method.getModifiers() ) )
+                {
+                    MixinModel mixinModel = implementMethod( method, mixinClasses );
+                    ConcernsModel concernsModel = concernsFor(
+                        method,
+                        mixinModel.mixinClass(),
+                        concat( concernDeclarations( mixinModel.mixinClass() ),
+                                concernClasses.stream() )
+                    );
+                    SideEffectsModel sideEffectsModel = sideEffectsFor(
+                        method,
+                        mixinModel.mixinClass(),
+                        concat( sideEffectDeclarations( mixinModel.mixinClass() ),
+                                sideEffectClasses.stream() )
+                    );
+                    method.setAccessible( true );
+                    ConstraintsModel constraints = constraintsFor(
+                        method,
+                        toList( concat( constraintDeclarations( mixinModel.mixinClass() ),
+                                        constraintClasses.stream() ) )
+                    );
+                    CompositeMethodModel methodComposite = new CompositeMethodModel(
+                        method,
+                        constraints,
+                        concernsModel,
+                        sideEffectsModel,
+                        mixinsModel
+                    );
+
+                    Stream<? extends Dependencies> source = Stream.of( methodComposite, mixinModel );
+                    source.flatMap( Dependencies::dependencies )
+                          .filter( new DependencyModel.ScopeSpecification( This.class ) )
+                          .map( DependencyModel::rawInjectionType )
+                          .forEach( thisDependencies::add );
+
+                    interfacesOf( mixinModel.mixinClass() )
+                        .map( Classes.RAW_CLASS )
+                        .filter( clazz -> Stream.of( Initializable.class, Lifecycle.class, InvocationHandler.class )
+                                                .noneMatch( c -> c.equals( clazz ) ) )
+                        .forEach( thisDependencies::add );
+
+                    compositeMethodsModel.addMethod( methodComposite );
+                }
+            }
+            // Add type to set of mixin types
+            mixinsModel.addMixinType( mixinType );
+        } );
+
+        // Implement all @This dependencies that were found
+        thisDependencies.forEach( thisDependency -> {
+            // Add additional declarations from the @This type
+            Stream<Class<?>> typeConstraintClasses = concat(
+                constraintClasses.stream(),
+                constraintDeclarations( thisDependency ) );
+            Stream<Class<?>> typeConcernClasses = concat(
+                concernClasses.stream(),
+                concernDeclarations( thisDependency ) );
+            Stream<Class<?>> typeSideEffectClasses = concat(
+                sideEffectClasses.stream(),
+                sideEffectDeclarations( thisDependency ) );
+            Stream<Class<?>> typeMixinClasses = concat(
+                mixinClasses.stream(),
+                mixinDeclarations( thisDependency ) );
+            List<? extends Class<?>> singleton = Collections.singletonList( thisDependency );
+            implementMixinType( singleton,
+                                toList( typeConstraintClasses ),
+                                toList( typeConcernClasses ),
+                                toList( typeSideEffectClasses ),
+                                toList( typeMixinClasses )
+            );
+        } );
+    }
+
+    @SuppressWarnings( "raw" )
+    protected MixinModel implementMethod( Method method, List<Class<?>> mixinDeclarations )
+    {
+        MixinModel implementationModel = mixinsModel.mixinFor( method );
+        if( implementationModel != null )
+        {
+            return implementationModel;
+        }
+        Class mixinClass = findTypedImplementation( method, mixinDeclarations.stream() );
+        if( mixinClass != null )
+        {
+            return implementMethodWithClass( method, mixinClass );
+        }
+
+        // Check generic implementations
+        mixinClass = findGenericImplementation( method, mixinDeclarations.stream() );
+        if( mixinClass != null )
+        {
+            return implementMethodWithClass( method, mixinClass );
+        }
+
+        throw new InvalidCompositeException( "No implementation found for method \n    " + method.toGenericString()
+                                             + "\nin\n    " + types );
+    }
+
+    private Class<?> findTypedImplementation( final Method method, Stream<Class<?>> mixins )
+    {
+        // Check if mixinClass implements the method. If so, check if the mixinClass is generic or if the filter passes.
+        // If a mixinClass is both generic AND non-generic at the same time, then the filter applies to the non-generic
+        // side only.
+        Predicate<Class<?>> appliesToSpec = item -> helper.appliesTo( item, method, types, item );
+        return mixins.filter( isAssignableFrom( method.getDeclaringClass() )
+                                  .and( Genericpredicate.INSTANCE.or( appliesToSpec ) ) )
+                     .findFirst().orElse( null );
+    }
+
+    private Class<?> findGenericImplementation( final Method method, Stream<Class<?>> mixins )
+    {
+        // Check if mixinClass is generic and the applies-to filter passes
+        Predicate<Class<?>> appliesToSpec = item -> helper.appliesTo( item, method, types, item );
+        return mixins.filter( Genericpredicate.INSTANCE.and( appliesToSpec ) ).findFirst().orElse( null );
+    }
+
+    private MixinModel implementMethodWithClass( Method method, Class mixinClass )
+    {
+        MixinModel mixinModel = mixinsModel.getMixinModel( mixinClass );
+        if( mixinModel == null )
+        {
+            mixinModel = helper.getMixinModel( mixinClass );
+            mixinsModel.addMixinModel( mixinModel );
+        }
+
+        mixinsModel.addMethodMixin( method, mixinModel );
+
+        return mixinModel;
+    }
+
+    protected void addState( final List<Class<?>> constraintClasses )
+    {
+        // Add method state
+        compositeMethodsModel.accept( new HierarchicalVisitorAdapter<Object, Object, RuntimeException>()
+        {
+            @Override
+            public boolean visitEnter( Object visited )
+                throws RuntimeException
+            {
+                if( visited instanceof CompositeMethodModel )
+                {
+                    CompositeMethodModel methodModel = (CompositeMethodModel) visited;
+                    if( methodModel.method().getParameterTypes().length == 0 )
+                    {
+                        addStateFor( methodModel.method(), constraintClasses );
+                    }
+
+                    return false;
+                }
+
+                return super.visitEnter( visited );
+            }
+        } );
+
+        // Add field state
+        mixinsModel.accept( new HierarchicalVisitorAdapter<Object, Object, RuntimeException>()
+        {
+            @Override
+            public boolean visitEnter( Object visited )
+                throws RuntimeException
+            {
+                if( visited instanceof MixinModel )
+                {
+                    MixinModel model = (MixinModel) visited;
+                    Consumer<Field> addState = field -> addStateFor( field, constraintClasses );
+                    Fields.FIELDS_OF.apply( model.mixinClass() )
+                        .filter( Annotations.hasAnnotation( State.class ) )
+                        .forEach( addState );
+                    return false;
+                }
+                return super.visitEnter( visited );
+            }
+        } );
+    }
+
+    protected void addStateFor( AccessibleObject accessor, List<Class<?>> constraintClasses )
+    {
+        String stateName = QualifiedName.fromAccessor( accessor ).name();
+
+        if( registeredStateNames.contains( stateName ) )
+        {
+            return; // Skip already registered names
+        }
+
+        Class<?> accessorType = Classes.RAW_CLASS.apply( typeOf( accessor ) );
+        if( Property.class.isAssignableFrom( accessorType ) )
+        {
+            propertiesModel.addProperty( newPropertyModel( accessor, constraintClasses ) );
+            registeredStateNames.add( stateName );
+        }
+        else if( Association.class.isAssignableFrom( accessorType ) )
+        {
+            associationsModel().addAssociation( newAssociationModel( accessor, constraintClasses ) );
+            registeredStateNames.add( stateName );
+        }
+        else if( ManyAssociation.class.isAssignableFrom( accessorType ) )
+        {
+            manyAssociationsModel().addManyAssociation( newManyAssociationModel( accessor, constraintClasses ) );
+            registeredStateNames.add( stateName );
+        }
+        else if( NamedAssociation.class.isAssignableFrom( accessorType ) )
+        {
+            namedAssociationsModel().addNamedAssociation( newNamedAssociationModel( accessor, constraintClasses ) );
+            registeredStateNames.add( stateName );
+        }
+    }
+
+    protected AssociationsModel associationsModel()
+    {
+        return null;
+    }
+
+    protected ManyAssociationsModel manyAssociationsModel()
+    {
+        return null;
+    }
+
+    protected NamedAssociationsModel namedAssociationsModel()
+    {
+        return null;
+    }
+
+    protected PropertyModel newPropertyModel( AccessibleObject accessor,
+                                              List<Class<?>> constraintClasses
+    )
+    {
+        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
+        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
+        ValueConstraintsModel valueConstraintsModel = constraintsFor(
+            annotations.stream(),
+            GenericPropertyInfo.propertyTypeOf( accessor ),
+            ( (Member) accessor ).getName(),
+            optional,
+            constraintClasses,
+            accessor );
+        ValueConstraintsInstance valueConstraintsInstance = null;
+        if( valueConstraintsModel.isConstrained() )
+        {
+            valueConstraintsInstance = valueConstraintsModel.newInstance();
+        }
+        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
+        UseDefaults useDefaultsDeclaration = metaInfo.get( UseDefaults.class );
+        Object initialValue = stateDeclarations.initialValueOf( accessor );
+        if( initialValue == null && useDefaultsDeclaration != null )
+        {
+            initialValue = useDefaultsDeclaration.value();
+        }
+        boolean useDefaults = useDefaultsDeclaration != null || stateDeclarations.useDefaults( accessor );
+        boolean immutable = this.immutable || metaInfo.get( Immutable.class ) != null;
+        return new PropertyModel(
+            accessor,
+            immutable,
+            useDefaults,
+            valueConstraintsInstance,
+            metaInfo,
+            initialValue
+        );
+    }
+
+    // Model
+    private ConstraintsModel constraintsFor( Method method,
+                                             List<Class<?>> constraintClasses
+    )
+    {
+        List<ValueConstraintsModel> parameterConstraintModels = Collections.emptyList();
+        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+        Type[] parameterTypes = method.getGenericParameterTypes();
+        boolean constrained = false;
+        for( int i = 0; i < parameterAnnotations.length; i++ )
+        {
+            Annotation[] parameterAnnotation = parameterAnnotations[ i ];
+
+            Name nameAnnotation = (Name) Stream.of( parameterAnnotation ).filter( isType( Name.class ) )
+                                               .findFirst().orElse( null );
+            String name = nameAnnotation == null ? "param" + ( i + 1 ) : nameAnnotation.value();
+
+            boolean optional = Stream.of( parameterAnnotation ).filter( isType( Optional.class ) )
+                                     .findFirst().isPresent();
+            ValueConstraintsModel parameterConstraintsModel = constraintsFor(
+                Arrays.stream( parameterAnnotation ),
+                parameterTypes[ i ],
+                name,
+                optional,
+                constraintClasses,
+                method );
+            if( parameterConstraintsModel.isConstrained() )
+            {
+                constrained = true;
+            }
+
+            if( parameterConstraintModels.isEmpty() )
+            {
+                parameterConstraintModels = new ArrayList<>();
+            }
+            parameterConstraintModels.add( parameterConstraintsModel );
+        }
+
+        if( !constrained )
+        {
+            return new ConstraintsModel( Collections.<ValueConstraintsModel>emptyList() );
+        }
+        else
+        {
+            return new ConstraintsModel( parameterConstraintModels );
+        }
+    }
+
+    protected ValueConstraintsModel constraintsFor(
+        Stream<Annotation> constraintAnnotations,
+        Type valueType,
+        String name,
+        boolean optional,
+        Iterable<Class<?>> constraintClasses,
+        AccessibleObject accessor
+    )
+    {
+        valueType = wrapperClass( valueType );
+
+        List<AbstractConstraintModel> constraintModels = new ArrayList<>();
+        List<Annotation> filtered = constraintAnnotations
+            .filter( typeHasAnnotation( ConstraintDeclaration.class ) )
+            .collect( Collectors.toList() );
+
+        // TODO: This massive block below should be cleaned up.
+        nextConstraint:
+        for( Annotation constraintAnnotation : filtered )
+        {
+            // Check composite declarations first
+            Class<? extends Annotation> annotationType = constraintAnnotation.annotationType();
+            for( Class<?> constraint : constraintClasses )
+            {
+                Class<? extends Constraint<?, ?>> constraintType = (Class<? extends Constraint<?, ?>>) constraint;
+                if( helper.appliesTo( constraintType, annotationType, valueType ) )
+                {
+                    constraintModels.add( new ConstraintModel( constraintAnnotation, constraintType ) );
+                    continue nextConstraint;
+                }
+            }
+
+            // Check the annotation itself
+            Constraints constraints = annotationType.getAnnotation( Constraints.class );
+            if( constraints != null )
+            {
+                for( Class<? extends Constraint<?, ?>> constraintClass : constraints.value() )
+                {
+                    if( helper.appliesTo( constraintClass, annotationType, valueType ) )
+                    {
+                        constraintModels.add( new ConstraintModel( constraintAnnotation, constraintClass ) );
+                        continue nextConstraint;
+                    }
+                }
+            }
+
+            // No implementation found!
+            // Check if if it's a composite constraints
+            if( Arrays.stream( annotationType.getAnnotations() )
+                .anyMatch( typeHasAnnotation( ConstraintDeclaration.class ) ) )
+            {
+                ValueConstraintsModel valueConstraintsModel = constraintsFor(
+                    Arrays.stream( annotationType.getAnnotations() ),
+                    valueType,
+                    name,
+                    optional,
+                    constraintClasses,
+                    accessor );
+                CompositeConstraintModel compositeConstraintModel = new CompositeConstraintModel(
+                    constraintAnnotation,
+                    valueConstraintsModel );
+                constraintModels.add( compositeConstraintModel );
+            }
+            else
+            {
+                throw new InvalidCompositeException(
+                    "Cannot find implementation of constraint @"
+                    + annotationType.getSimpleName()
+                    + " for "
+                    + valueType
+                    + " in method "
+                    + ( (Member) accessor ).getName()
+                    + " of composite " + types );
+            }
+        }
+        return new ValueConstraintsModel( constraintModels, name, optional );
+    }
+
+    private ConcernsModel concernsFor( Method method,
+                                       Class<?> mixinClass,
+                                       Stream<Class<?>> concernClasses
+    )
+    {
+        List<ConcernModel> concernsFor = new ArrayList<>();
+        concernClasses.forEach( concern -> {
+            if( helper.appliesTo( concern, method, types, mixinClass ) )
+            {
+                addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
+            }
+            else
+            {
+                // Lookup method in mixin
+                if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
+                {
+                    try
+                    {
+                        Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
+                        if( helper.appliesTo( concern, mixinMethod, types, mixinClass ) )
+                        {
+                            addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
+                        }
+                    }
+                    catch( NoSuchMethodException e )
+                    {
+                        // Ignore
+                    }
+                }
+            }
+        } );
+
+        // Check annotations on method that have @Concerns annotations themselves
+        for( Annotation annotation : method.getAnnotations() )
+        {
+            @SuppressWarnings( "raw" )
+            Concerns concerns = annotation.annotationType().getAnnotation( Concerns.class );
+            if( concerns != null )
+            {
+                for( Class<?> concern : concerns.value() )
+                {
+                    if( helper.appliesTo( concern, method, types, mixinClass ) )
+                    {
+                        ConcernModel concernModel = helper.getConcernModel( concern );
+                        addConcernOrRepositionIfExists( concernsFor, concernModel );
+                    }
+                }
+            }
+        }
+
+        if( concernsFor.isEmpty() )
+        {
+            return ConcernsModel.EMPTY_CONCERNS;
+        }
+        else
+        {
+            return new ConcernsModel( concernsFor );
+        }
+    }
+
+    private void addConcernOrRepositionIfExists( List<ConcernModel> concernsFor, ConcernModel concernModel )
+    {
+        // This remove/add is to allow re-ordering of the concerns
+        concernsFor.remove( concernModel );
+        concernsFor.add( concernModel );
+    }
+
+    private SideEffectsModel sideEffectsFor( Method method,
+                                             Class<?> mixinClass,
+                                             Stream<Class<?>> sideEffectClasses
+    )
+    {
+        List<SideEffectModel> sideEffectsFor = new ArrayList<>();
+        sideEffectClasses.forEach( sideEffect -> {
+            SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
+            if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
+            {
+                addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
+            }
+            else
+            {
+                // Lookup method in mixin
+                if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
+                {
+                    try
+                    {
+                        Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
+                        if( helper.appliesTo( sideEffect, mixinMethod, types, mixinClass ) )
+                        {
+                            addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
+                        }
+                    }
+                    catch( NoSuchMethodException e )
+                    {
+                        // Ignore
+                    }
+                }
+            }
+        } );
+
+        // Check annotations on method that have @Concerns annotations themselves
+        for( Annotation annotation : method.getAnnotations() )
+        {
+            @SuppressWarnings( "raw" )
+            SideEffects sideEffects = annotation.annotationType().getAnnotation( SideEffects.class );
+            if( sideEffects != null )
+            {
+                for( Class<?> sideEffect : sideEffects.value() )
+                {
+                    if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
+                    {
+                        SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
+                        addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
+                    }
+                }
+            }
+        }
+
+        if( sideEffectsFor.isEmpty() )
+        {
+            return SideEffectsModel.EMPTY_SIDEEFFECTS;
+        }
+        else
+        {
+            return new SideEffectsModel( sideEffectsFor );
+        }
+    }
+
+    private void addSideEffectOrRepositionIfExists( List<SideEffectModel> sideEffectsFor,
+                                                    SideEffectModel sideEffectModel
+    )
+    {
+        // This add/remove is to allow reording of SideEffects.
+        sideEffectsFor.remove( sideEffectModel );
+        sideEffectsFor.add( sideEffectModel );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private Stream<Class<?>> constraintDeclarations( Class<?> type )
+    {
+        Stream<? extends Type> types = getTypes( type );
+        return constraintDeclarations( types );
+    }
+
+    private Stream<Class<?>> constraintDeclarations( Stream<? extends Type> types )
+    {
+        return types
+            .filter( mixinType -> Annotations.annotationOn( mixinType, Constraints.class ) != null )
+            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Constraints.class ).value() ) );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private Stream<Class<?>> concernDeclarations( Class<?> type )
+    {
+        Stream<? extends Type> types = getTypes( type );
+        return concernDeclarations( types );
+    }
+
+    private Stream<Class<?>> concernDeclarations( Stream<? extends Type> types )
+    {
+        return types
+            .filter( mixinType -> Annotations.annotationOn( mixinType, Concerns.class ) != null )
+            .flatMap( new Function<Type, Stream<? extends Class<?>>>()
+            {
+                @Override
+                public Stream<? extends Class<?>> apply( Type mixinType )
+                {
+                    return Arrays.stream( Annotations.annotationOn( mixinType, Concerns.class ).value() );
+                }
+            } );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected Stream<Class<?>> sideEffectDeclarations( Class<?> type )
+    {
+        Stream<? extends Type> types = getTypes( type );
+        return sideEffectDeclarations( types );
+    }
+
+    private Stream<Class<?>> sideEffectDeclarations( Stream<? extends Type> types )
+    {
+        return types
+            .filter( mixinType -> Annotations.annotationOn( mixinType, SideEffects.class ) != null )
+            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, SideEffects.class ).value() ) );
+    }
+
+    protected Stream<Class<?>> mixinDeclarations( Class<?> type )
+    {
+        //Stream<? extends Type> types = typesOf( type );
+        return mixinDeclarations( Stream.of( type ) );
+    }
+
+    private Stream<Class<?>> mixinDeclarations( Stream<? extends Class> types )
+    {
+        return types.flatMap( this::getTypes ).flatMap( Classes::typesOf )
+            .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
+            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
+    }
+
+    private Stream<Class> getAllTypes()
+    {
+        return this.types.stream().flatMap( this::getTypes );
+    }
+
+    private Stream<Class> getTypes( Class<?> clazz )
+    {
+        if( clazz.isInterface() )
+        {
+            return typesOf( clazz ).map( Classes.RAW_CLASS );
+        }
+        else
+        {
+            return classHierarchy( clazz ).map( Classes.RAW_CLASS );
+        }
+    }
+
+    public AssociationModel newAssociationModel( AccessibleObject accessor,
+                                                 List<Class<?>> constraintClasses
+    )
+    {
+        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
+        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
+
+        // Constraints for Association references
+        ValueConstraintsModel constraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
+            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance valueConstraintsInstance;
+        if( constraintsModel.isConstrained() )
+        {
+            valueConstraintsInstance = constraintsModel.newInstance();
+        }
+        else
+        {
+            valueConstraintsInstance = new ValueConstraintsInstance( Collections.emptyList(), ( (Member) accessor ).getName(), true );
+        }
+
+        // Constraints for the Association itself
+        constraintsModel = constraintsFor( annotations.stream(), Association.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance associationValueConstraintsInstance;
+        if( constraintsModel.isConstrained() )
+        {
+            associationValueConstraintsInstance = constraintsModel.newInstance();
+        }
+        else
+        {
+            associationValueConstraintsInstance = new ValueConstraintsInstance( Collections.emptyList(), ( (Member) accessor ).getName(), true );
+        }
+
+        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
+        return new AssociationModel( accessor, valueConstraintsInstance, associationValueConstraintsInstance, metaInfo );
+    }
+
+    public ManyAssociationModel newManyAssociationModel( AccessibleObject accessor,
+                                                         List<Class<?>> constraintClasses
+    )
+    {
+        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
+        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
+
+        // Constraints for entities in ManyAssociation
+        ValueConstraintsModel valueConstraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
+            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance valueConstraintsInstance = null;
+        if( valueConstraintsModel.isConstrained() )
+        {
+            valueConstraintsInstance = valueConstraintsModel.newInstance();
+        }
+
+        // Constraints for the ManyAssociation itself
+        valueConstraintsModel = constraintsFor( annotations.stream(), ManyAssociation.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance manyValueConstraintsInstance = null;
+        if( valueConstraintsModel.isConstrained() )
+        {
+            manyValueConstraintsInstance = valueConstraintsModel.newInstance();
+        }
+        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
+        return new ManyAssociationModel( accessor, valueConstraintsInstance, manyValueConstraintsInstance, metaInfo );
+    }
+
+    public NamedAssociationModel newNamedAssociationModel( AccessibleObject accessor,
+                                                           List<Class<?>> constraintClasses
+    )
+    {
+        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
+        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
+
+        // Constraints for entities in NamedAssociation
+        ValueConstraintsModel valueConstraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
+            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance valueConstraintsInstance = null;
+        if( valueConstraintsModel.isConstrained() )
+        {
+            valueConstraintsInstance = valueConstraintsModel.newInstance();
+        }
+
+        // Constraints for the NamedAssociation itself
+        valueConstraintsModel = constraintsFor( annotations.stream(), NamedAssociation.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
+        ValueConstraintsInstance namedValueConstraintsInstance = null;
+        if( valueConstraintsModel.isConstrained() )
+        {
+            namedValueConstraintsInstance = valueConstraintsModel.newInstance();
+        }
+        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
+        return new NamedAssociationModel( accessor, valueConstraintsInstance, namedValueConstraintsInstance, metaInfo );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
new file mode 100644
index 0000000..8bbee50
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.stream.Stream;
+import org.apache.polygene.bootstrap.ConfigurationAssembly;
+
+/**
+ * Declaration of a EntityComposite.
+ */
+public final class ConfigurationAssemblyImpl
+    implements ConfigurationAssembly
+{
+    private ValueAssemblyImpl value;
+    private EntityAssemblyImpl entity;
+
+    public ConfigurationAssemblyImpl( Class<?> mainType )
+    {
+        value = new ValueAssemblyImpl( mainType );
+        entity = new EntityAssemblyImpl( mainType );
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return value.types();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationDeclarationImpl.java
new file mode 100644
index 0000000..45c71d5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationDeclarationImpl.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ConfigurationDeclaration;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Declaration of a Composite. Created by {@link org.apache.polygene.bootstrap.ModuleAssembly#configurations(Class[])}.
+ */
+public final class ConfigurationDeclarationImpl
+    implements ConfigurationDeclaration
+{
+    private final Iterable<EntityAssemblyImpl> entities;
+    private final Iterable<ValueAssemblyImpl> values;
+
+    public ConfigurationDeclarationImpl( Iterable<EntityAssemblyImpl> entities, Iterable<ValueAssemblyImpl> values  )
+    {
+        this.entities = entities;
+        this.values = values;
+    }
+
+    @Override
+    public ConfigurationDeclaration setMetaInfo( Object info )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.metaInfo.set( info );
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.metaInfo.set( info );
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationDeclaration visibleIn( Visibility visibility )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.visibility = visibility;
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationDeclaration withConcerns( Class<?>... concerns )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.concerns.addAll( asList( concerns ) );
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.concerns.addAll( asList( concerns ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationDeclaration withSideEffects( Class<?>... sideEffects )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.sideEffects.addAll( asList( sideEffects ) );
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.sideEffects.addAll( asList( sideEffects ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationDeclaration withMixins( Class<?>... mixins )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.mixins.addAll( asList( mixins ) );
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.mixins.addAll( asList( mixins ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationDeclaration withTypes( Class<?>... types )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.types.addAll( asList( types ) );
+        }
+        for( ValueAssemblyImpl value : values )
+        {
+            value.types.addAll( asList( types ) );
+        }
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityAssemblyImpl.java
new file mode 100644
index 0000000..605084c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityAssemblyImpl.java
@@ -0,0 +1,121 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.bootstrap.AssociationDeclarations;
+import org.apache.polygene.bootstrap.EntityAssembly;
+import org.apache.polygene.bootstrap.ManyAssociationDeclarations;
+import org.apache.polygene.bootstrap.NamedAssociationDeclarations;
+import org.apache.polygene.bootstrap.StateDeclarations;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.entity.EntityMixinsModel;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.runtime.entity.EntityStateModel;
+
+/**
+ * Declaration of a EntityComposite.
+ */
+public final class EntityAssemblyImpl
+    extends CompositeAssemblyImpl
+    implements EntityAssembly
+{
+    private AssociationDeclarations associationDeclarations;
+    private ManyAssociationDeclarations manyAssociationDeclarations;
+    private NamedAssociationDeclarations namedAssociationDeclarations;
+    private AssociationsModel associationsModel;
+    private ManyAssociationsModel manyAssociationsModel;
+    private NamedAssociationsModel namedAssociationsModel;
+
+    public EntityAssemblyImpl( Class<?> entityType )
+    {
+        super( entityType );
+        // The composite must always implement EntityComposite, as a marker interface
+        if( !EntityComposite.class.isAssignableFrom( entityType ) )
+        {
+            types.add( EntityComposite.class );
+        }
+    }
+
+    @Override
+    protected MixinsModel createMixinsModel()
+    {
+        return new EntityMixinsModel();
+    }
+
+    @Override
+    protected AssociationsModel associationsModel()
+    {
+        return associationsModel;
+    }
+
+    @Override
+    protected ManyAssociationsModel manyAssociationsModel()
+    {
+        return manyAssociationsModel;
+    }
+
+    @Override
+    protected NamedAssociationsModel namedAssociationsModel()
+    {
+        return namedAssociationsModel;
+    }
+
+    @Override
+    protected StateModel createStateModel()
+    {
+        return new EntityStateModel( propertiesModel, associationsModel, manyAssociationsModel, namedAssociationsModel );
+    }
+
+    EntityModel newEntityModel(
+        ModuleDescriptor module,
+        StateDeclarations stateDeclarations,
+        AssociationDeclarations associationDecs,
+        ManyAssociationDeclarations manyAssociationDecs,
+        NamedAssociationDeclarations namedAssociationDecs,
+        AssemblyHelper helper
+    )
+    {
+        this.associationDeclarations = associationDecs;
+        this.manyAssociationDeclarations = manyAssociationDecs;
+        this.namedAssociationDeclarations = namedAssociationDecs;
+        try
+        {
+            associationsModel = new AssociationsModel();
+            manyAssociationsModel = new ManyAssociationsModel();
+            namedAssociationsModel = new NamedAssociationsModel();
+            buildComposite( helper, stateDeclarations );
+
+            return new EntityModel( module, types, visibility, metaInfo,
+                                    (EntityMixinsModel) mixinsModel,
+                                    (EntityStateModel) stateModel, compositeMethodsModel );
+        }
+        catch( Exception e )
+        {
+            throw new InvalidApplicationException( "Could not register " + types, e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityDeclarationImpl.java
new file mode 100644
index 0000000..ee8adf4
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/EntityDeclarationImpl.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.EntityDeclaration;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Declaration of a Composite. Created by {@link org.apache.polygene.bootstrap.ModuleAssembly#transients(Class[])}.
+ */
+public final class EntityDeclarationImpl
+    implements EntityDeclaration
+{
+    private final Iterable<EntityAssemblyImpl> entities;
+
+    public EntityDeclarationImpl( Iterable<EntityAssemblyImpl> entities )
+    {
+        this.entities = entities;
+    }
+
+    @Override
+    public EntityDeclaration setMetaInfo( Object info )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.metaInfo.set( info );
+        }
+        return this;
+    }
+
+    @Override
+    public EntityDeclaration visibleIn( Visibility visibility )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    public EntityDeclaration withConcerns( Class<?>... concerns )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.concerns.addAll( asList( concerns ) );
+        }
+        return this;
+    }
+
+    @Override
+    public EntityDeclaration withSideEffects( Class<?>... sideEffects )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.sideEffects.addAll( asList( sideEffects ) );
+        }
+        return this;
+    }
+
+    @Override
+    public EntityDeclaration withMixins( Class<?>... mixins )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.mixins.addAll( asList( mixins ) );
+        }
+        return this;
+    }
+
+    @Override
+    public EntityDeclaration withTypes( Class<?>... types )
+    {
+        for( EntityAssemblyImpl entity : entities )
+        {
+            entity.types.addAll( asList( types ) );
+        }
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImplementsMethodAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
new file mode 100644
index 0000000..fd5b04c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class ImplementsMethodAppliesToFilter
+    implements AppliesToFilter
+{
+    @Override
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        try
+        {
+            return !Modifier.isAbstract( fragmentClass.getMethod( method.getName(), method.getParameterTypes() )
+                                             .getModifiers() );
+        }
+        catch( NoSuchMethodException e )
+        {
+            return false;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java
new file mode 100644
index 0000000..c455aed
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceAssemblyImpl.java
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.importer.InstanceImporter;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.bootstrap.ImportedServiceAssembly;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.service.ImportedServiceModel;
+
+/**
+ * Declaration of an imported Service.
+ *
+ * Created by {@link org.apache.polygene.runtime.bootstrap.ModuleAssemblyImpl#importedServices(Class[])}.
+ */
+public final class ImportedServiceAssemblyImpl
+    implements ImportedServiceAssembly
+{
+    private final Class<?> serviceType;
+    private final ModuleAssemblyImpl moduleAssembly;
+    @SuppressWarnings( "raw" )
+    Class<? extends ServiceImporter> serviceProvider = InstanceImporter.class;
+    String identity;
+    boolean importOnStartup = false;
+    MetaInfo metaInfo = new MetaInfo();
+    Visibility visibility = Visibility.module;
+    List<Class<? extends Activator<?>>> activators = new ArrayList<>();
+
+    public ImportedServiceAssemblyImpl( Class<?> serviceType, ModuleAssemblyImpl moduleAssembly )
+    {
+        this.serviceType = serviceType;
+        this.moduleAssembly = moduleAssembly;
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return Stream.of( serviceType );
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    void addImportedServiceModel( ModuleDescriptor module, List<ImportedServiceModel> serviceModels )
+    {
+        try
+        {
+            Identity id;
+            if( identity == null )
+            {
+                id = generateId( serviceModels, serviceType );
+            }
+            else
+            {
+                id = new StringIdentity( identity );
+            }
+
+            ImportedServiceModel serviceModel = new ImportedServiceModel( module,
+                                                                          serviceType,
+                                                                          visibility,
+                                                                          serviceProvider,
+                                                                          id,
+                                                                          importOnStartup,
+                                                                          new MetaInfo( metaInfo ).withAnnotations( serviceType ),
+                                                                          new ActivatorsModel( activators ),
+                                                                          moduleAssembly.name() );
+            serviceModels.add( serviceModel );
+        }
+        catch( Exception e )
+        {
+            throw new InvalidApplicationException( "Could not register " + serviceType.getName(), e );
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    private Identity generateId( List<ImportedServiceModel> serviceModels, Class serviceType )
+    {
+        // Find reference that is not yet used
+        int idx = 0;
+        Identity id = new StringIdentity( serviceType.getSimpleName() );
+        boolean invalid;
+        do
+        {
+            invalid = false;
+            for( ImportedServiceModel serviceModel : serviceModels )
+            {
+                if( serviceModel.identity().equals( id ) )
+                {
+                    idx++;
+                    id = new StringIdentity( serviceType.getSimpleName() + "_" + idx );
+                    invalid = true;
+                    break;
+                }
+            }
+        }
+        while( invalid );
+        return id;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceDeclarationImpl.java
new file mode 100644
index 0000000..257414e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ImportedServiceDeclarationImpl.java
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.qualifier.ServiceTags;
+import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
+
+/**
+ * Declaration of an imported Service.
+ */
+public final class ImportedServiceDeclarationImpl
+    implements ImportedServiceDeclaration
+{
+    private final Iterable<ImportedServiceAssemblyImpl> assemblies;
+
+    public ImportedServiceDeclarationImpl( Iterable<ImportedServiceAssemblyImpl> assemblies )
+    {
+        this.assemblies = assemblies;
+    }
+
+    @Override
+    public ImportedServiceDeclaration importOnStartup()
+    {
+        for( ImportedServiceAssemblyImpl assembly : assemblies )
+        {
+            assembly.importOnStartup = true;
+        }
+        return this;
+    }
+
+    @Override
+    public ImportedServiceDeclaration visibleIn( Visibility visibility )
+    {
+        for( ImportedServiceAssemblyImpl assembly : assemblies )
+        {
+            assembly.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    @SuppressWarnings( "raw" )
+    public ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> sip )
+    {
+        for( ImportedServiceAssemblyImpl assembly : assemblies )
+        {
+            assembly.serviceProvider = sip;
+        }
+        return this;
+    }
+
+    @Override
+    public ImportedServiceDeclaration identifiedBy( String identity )
+    {
+        for( ImportedServiceAssemblyImpl assembly : assemblies )
+        {
+            assembly.identity = identity;
+        }
+        return this;
+    }
+
+    @Override
+    public ImportedServiceDeclaration taggedWith( String... tags )
+    {
+        for( ImportedServiceAssemblyImpl serviceAssembly : assemblies )
+        {
+            ServiceTags previousTags = serviceAssembly.metaInfo.get( ServiceTags.class );
+            if( previousTags != null )
+            {
+                List<String> tagList = new ArrayList<>();
+                Collections.addAll( tagList, previousTags.tags() );
+                Collections.addAll( tagList, tags );
+                serviceAssembly.metaInfo.set( new ServiceTags( tagList.toArray( new String[ tagList.size() ] ) ) );
+            }
+            else
+            {
+                serviceAssembly.metaInfo.set( new ServiceTags( tags ) );
+            }
+        }
+
+        return this;
+    }
+
+    @Override
+    public ImportedServiceDeclaration setMetaInfo( Object serviceAttribute )
+    {
+        for( ImportedServiceAssemblyImpl assembly : assemblies )
+        {
+            assembly.metaInfo.set( serviceAttribute );
+        }
+        return this;
+    }
+
+    @Override
+    @SafeVarargs
+    public final ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
+    {
+        for ( ImportedServiceAssemblyImpl serviceAssembly : assemblies ) {
+            serviceAssembly.activators.addAll( Arrays.asList( activators ) );
+        }
+        return this;
+    }
+}
\ No newline at end of file


[57/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyEqualityTest.java
index 1dc9df9..fbccfa2 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyEqualityTest.java
@@ -127,11 +127,11 @@ public class PropertyEqualityTest
     public void givenValuesOfTheSameTypeWhenTestingPropertyDescriptorEqualityExpectEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
         PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );
 
         Some other = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
+        ValueDescriptor otherDescriptor = polygene.api().valueDescriptorFor( other );
         PropertyDescriptor otherCharPropDesc = otherDescriptor.state().findPropertyModelByName( "characterProperty" );
 
         assertThat( "PropertyDescriptors equal",
@@ -146,11 +146,11 @@ public class PropertyEqualityTest
     public void givenValuesOfCommonTypesWhenTestingPropertyDescriptorEqualityExpectEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
         PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );
 
         PrimitivesValue primitive = buildPrimitivesValue( valueBuilderFactory );
-        ValueDescriptor primitiveDescriptor = zest.api().valueDescriptorFor( primitive );
+        ValueDescriptor primitiveDescriptor = polygene.api().valueDescriptorFor( primitive );
         PropertyDescriptor primitiveCharPropDesc = primitiveDescriptor.state()
             .findPropertyModelByName( "characterProperty" );
 
@@ -166,11 +166,11 @@ public class PropertyEqualityTest
     public void givenValuesOfDifferentTypesWhenTestingPropertyDescriptorEqualityExpectNotEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
         PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );
 
         Other other = buildOtherValue( valueBuilderFactory );
-        ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
+        ValueDescriptor otherDescriptor = polygene.api().valueDescriptorFor( other );
         PropertyDescriptor otherCharPropDesc = otherDescriptor.state().findPropertyModelByName( "characterProperty" );
 
         assertThat( "PropertyDescriptors not equal",

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
index 6a00cea..d59b6ed 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceVisibilityTest.java
@@ -49,7 +49,7 @@ public class ServiceVisibilityTest
 {
     public static final Identity TEST_IDENTITY = new StringIdentity( "123" );
 
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Module module;
     private Application app;
     private UnitOfWorkFactory uowf;
@@ -58,7 +58,7 @@ public class ServiceVisibilityTest
     public void setup()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         Assembler[][][] assemblers = new Assembler[][][]
             {
@@ -81,7 +81,7 @@ public class ServiceVisibilityTest
                   }
                 }
             };
-        app = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         app.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java
index 4b7f500..19b91e2 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/transients/TransientVisibilityTest.java
@@ -49,7 +49,7 @@ import org.junit.Test;
 public class TransientVisibilityTest
 {
     public static final Identity TEST_IDENTITY = new StringIdentity( "123" );
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Module module;
     private Application app;
     private UnitOfWorkFactory uowf;
@@ -58,7 +58,7 @@ public class TransientVisibilityTest
     public void setup()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         Assembler[][][] assemblers = new Assembler[][][]
             {
@@ -81,7 +81,7 @@ public class TransientVisibilityTest
                   }
                 }
             };
-        app = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         app.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueEqualityTest.java
index aae3503..fa57b28 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueEqualityTest.java
@@ -65,10 +65,10 @@ public class ValueEqualityTest
     public void givenValuesOfTheSameTypeWhenTestingValueDescriptorEqualityExpectEquals()
     {
         Some some = buildSomeValue(valueBuilderFactory);
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
 
         Some other = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
+        ValueDescriptor otherDescriptor = polygene.api().valueDescriptorFor( other );
 
         assertThat( "ValueDescriptors equal",
                     someDescriptor,
@@ -82,10 +82,10 @@ public class ValueEqualityTest
     public void givenValuesOfCommonTypesWhenTestingValueDescriptorEqualityExpectNotEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
 
         PrimitivesValue primitive = buildPrimitivesValue( valueBuilderFactory );
-        ValueDescriptor primitiveDescriptor = zest.api().valueDescriptorFor( primitive );
+        ValueDescriptor primitiveDescriptor = polygene.api().valueDescriptorFor( primitive );
 
         assertThat( "ValueDescriptors not equal",
                     someDescriptor,
@@ -99,10 +99,10 @@ public class ValueEqualityTest
     public void givenValuesOfDifferentTypesWhenTestingValueDescriptorEqualityExpectNotEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        ValueDescriptor someDescriptor = zest.api().valueDescriptorFor( some );
+        ValueDescriptor someDescriptor = polygene.api().valueDescriptorFor( some );
 
         Other other = buildOtherValue( valueBuilderFactory );
-        ValueDescriptor otherDescriptor = zest.api().valueDescriptorFor( other );
+        ValueDescriptor otherDescriptor = polygene.api().valueDescriptorFor( other );
 
         assertThat( "ValueDescriptors not equal",
                     someDescriptor,
@@ -119,10 +119,10 @@ public class ValueEqualityTest
     public void givenValuesOfSameTypesAndSameStateWhenTestingValueStateEqualityExpectEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
+        AssociationStateHolder someState = polygene.spi().stateOf( (ValueComposite) some );
 
         Some some2 = buildSomeValue( valueBuilderFactory );
-        AssociationStateHolder some2State = zest.spi().stateOf( (ValueComposite) some2 );
+        AssociationStateHolder some2State = polygene.spi().stateOf( (ValueComposite) some2 );
 
         assertThat( "ValueStates equal",
                     someState,
@@ -136,10 +136,10 @@ public class ValueEqualityTest
     public void givenValuesOfSameTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
+        AssociationStateHolder someState = polygene.spi().stateOf( (ValueComposite) some );
 
         Some some2 = buildSomeValueWithDifferentState( valueBuilderFactory );
-        AssociationStateHolder some2State = zest.spi().stateOf( (ValueComposite) some2 );
+        AssociationStateHolder some2State = polygene.spi().stateOf( (ValueComposite) some2 );
 
         assertThat( "ValueStates not equal",
                     someState,
@@ -153,10 +153,10 @@ public class ValueEqualityTest
     public void givenValuesOfDifferentTypesAndSameStateWhenTestingValueStateEqualityExpectEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
+        AssociationStateHolder someState = polygene.spi().stateOf( (ValueComposite) some );
 
         AnotherSome anotherSome = buildAnotherSomeValue( valueBuilderFactory );
-        AssociationStateHolder anotherSomeState = zest.spi().stateOf( (ValueComposite) anotherSome );
+        AssociationStateHolder anotherSomeState = polygene.spi().stateOf( (ValueComposite) anotherSome );
 
         assertThat( "ValueStates equal",
                     someState,
@@ -170,10 +170,10 @@ public class ValueEqualityTest
     public void givenValuesOfDifferentTypesAndDifferentStateWhenTestingValueStateEqualityExpectNotEquals()
     {
         Some some = buildSomeValue( valueBuilderFactory );
-        AssociationStateHolder someState = zest.spi().stateOf( (ValueComposite) some );
+        AssociationStateHolder someState = polygene.spi().stateOf( (ValueComposite) some );
 
         AnotherSome anotherSome = buildAnotherSomeValueWithDifferentState( valueBuilderFactory );
-        AssociationStateHolder anotherSomeState = zest.spi().stateOf( (ValueComposite) anotherSome );
+        AssociationStateHolder anotherSomeState = polygene.spi().stateOf( (ValueComposite) anotherSome );
 
         assertThat( "ValueStates not equal",
                     someState,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
index 018e8fa..4dff8ae 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueVisibilityTest.java
@@ -50,7 +50,7 @@ public class ValueVisibilityTest
 {
 
     public static final Identity TEST_IDENTIY = new StringIdentity( "123" );
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Module module;
     private Application app;
     private UnitOfWorkFactory uowf;
@@ -59,7 +59,7 @@ public class ValueVisibilityTest
     public void setup()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         Assembler[][][] assemblers = new Assembler[][][]
             {
@@ -82,7 +82,7 @@ public class ValueVisibilityTest
                   }
                 }
             };
-        app = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         app.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java
index 70ef489..b7dfe66 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/visibility/VisibilityInUnitOfWorkTest.java
@@ -141,8 +141,8 @@ public class VisibilityInUnitOfWorkTest
     private Application createApplication()
         throws AssemblyException
     {
-        Energy4Java zest = new Energy4Java();
-        return zest.newApplication( appFactory -> {
+        Energy4Java polygene = new Energy4Java();
+        return polygene.newApplication( appFactory -> {
             ApplicationAssembly appAssembly = appFactory.newApplicationAssembly();
             LayerAssembly layer1 = appAssembly.layer( "layer1" );
             ModuleAssembly myModule = layer1.module( "My Module" );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/test/ASMTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/test/ASMTest.java b/core/runtime/src/test/java/org/apache/polygene/test/ASMTest.java
index f24a487..5179e8f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/test/ASMTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/test/ASMTest.java
@@ -172,8 +172,8 @@ public class ASMTest
         MethodVisitor mv;
         AnnotationVisitor av0;
 
-        cw.visit( V1_6, ACC_PUBLIC + ACC_SUPER, "org/apache/zest/satisfiedBy/SomeMixin_Stub", null,
-                  "org/apache/zest/satisfiedBy/SomeMixin", null );
+        cw.visit( V1_6, ACC_PUBLIC + ACC_SUPER, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", null,
+                  "org/apache/polygene/satisfiedBy/SomeMixin", null );
 
         {
             fv = cw.visitField( ACC_PUBLIC, "_instance", "Lorg/apache/polygene/spi/composite/CompositeInvoker;", null, null );
@@ -203,7 +203,7 @@ public class ASMTest
             mv = cw.visitMethod( ACC_PUBLIC, "<init>", "()V", null, null );
             mv.visitCode();
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitMethodInsn( INVOKESPECIAL, "org/apache/zest/satisfiedBy/SomeMixin", "<init>", "()V", false );
+            mv.visitMethodInsn( INVOKESPECIAL, "org/apache/polygene/satisfiedBy/SomeMixin", "<init>", "()V", false );
             mv.visitInsn( RETURN );
             mv.visitMaxs( 1, 1 );
             mv.visitEnd();
@@ -213,7 +213,7 @@ public class ASMTest
             mv.visitCode();
             mv.visitVarInsn( ALOAD, 0 );
             mv.visitVarInsn( ALOAD, 1 );
-            mv.visitMethodInsn( INVOKESPECIAL, "org/apache/zest/satisfiedBy/SomeMixin", "<init>", "(Ljava/lang/String;)V", false );
+            mv.visitMethodInsn( INVOKESPECIAL, "org/apache/polygene/satisfiedBy/SomeMixin", "<init>", "(Ljava/lang/String;)V", false );
             mv.visitInsn( RETURN );
             mv.visitMaxs( 2, 2 );
             mv.visitEnd();
@@ -227,11 +227,11 @@ public class ASMTest
             mv.visitTryCatchBlock( l0, l1, l2, "java/lang/Throwable" );
             mv.visitLabel( l0 );
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitFieldInsn( GETFIELD, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "_instance",
+            mv.visitFieldInsn( GETFIELD, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "_instance",
                                "Lorg/apache/polygene/spi/composite/CompositeInvoker;" );
-            mv.visitFieldInsn( GETSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m1", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( GETSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m1", "Ljava/lang/reflect/Method;" );
             mv.visitInsn( ACONST_NULL );
-            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/spi/composite/CompositeInvoker", "invokeComposite",
+            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/spi/composite/CompositeInvoker", "invokeComposite",
                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
             mv.visitTypeInsn( CHECKCAST, "java/lang/String" );
             mv.visitLabel( l1 );
@@ -260,9 +260,9 @@ public class ASMTest
             mv.visitTryCatchBlock( l0, l1, l3, "java/lang/Throwable" );
             mv.visitLabel( l0 );
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitFieldInsn( GETFIELD, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "_instance",
+            mv.visitFieldInsn( GETFIELD, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "_instance",
                                "Lorg/apache/polygene/spi/composite/CompositeInvoker;" );
-            mv.visitFieldInsn( GETSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m2", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( GETSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m2", "Ljava/lang/reflect/Method;" );
             mv.visitInsn( ICONST_2 );
             mv.visitTypeInsn( ANEWARRAY, "java/lang/Object" );
             mv.visitInsn( DUP );
@@ -274,7 +274,7 @@ public class ASMTest
             mv.visitVarInsn( ILOAD, 2 );
             mv.visitMethodInsn( INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false );
             mv.visitInsn( AASTORE );
-            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/spi/composite/CompositeInvoker", "invokeComposite",
+            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/spi/composite/CompositeInvoker", "invokeComposite",
                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
             mv.visitTypeInsn( CHECKCAST, "java/lang/String" );
             mv.visitLabel( l1 );
@@ -305,9 +305,9 @@ public class ASMTest
             mv.visitTryCatchBlock( l0, l1, l2, "java/lang/Throwable" );
             mv.visitLabel( l0 );
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitFieldInsn( GETFIELD, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "_instance",
+            mv.visitFieldInsn( GETFIELD, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "_instance",
                                "Lorg/apache/polygene/spi/composite/CompositeInvoker;" );
-            mv.visitFieldInsn( GETSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m3", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( GETSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m3", "Ljava/lang/reflect/Method;" );
             mv.visitIntInsn( BIPUSH, 11 );
             mv.visitTypeInsn( ANEWARRAY, "java/lang/Object" );
             mv.visitInsn( DUP );
@@ -362,7 +362,7 @@ public class ASMTest
             mv.visitIntInsn( BIPUSH, 10 );
             mv.visitVarInsn( ALOAD, 13 );
             mv.visitInsn( AASTORE );
-            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/spi/composite/CompositeInvoker", "invokeComposite",
+            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/spi/composite/CompositeInvoker", "invokeComposite",
                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
             mv.visitInsn( POP );
             mv.visitLabel( l1 );
@@ -385,40 +385,40 @@ public class ASMTest
         }
         {
             mv = cw.visitMethod( ACC_PUBLIC, "multiEx", "(Ljava/lang/String;)V", null,
-                                 new String[]{ "org/apache/zest/satisfiedBy/Exception1", "org/apache/zest/satisfiedBy/Exception2" } );
+                                 new String[]{ "org/apache/polygene/satisfiedBy/Exception1", "org/apache/polygene/satisfiedBy/Exception2" } );
             mv.visitCode();
             Label l0 = new Label();
             Label l1 = new Label();
             Label l2 = new Label();
-            mv.visitTryCatchBlock( l0, l1, l2, "org/apache/zest/satisfiedBy/Exception1" );
+            mv.visitTryCatchBlock( l0, l1, l2, "org/apache/polygene/satisfiedBy/Exception1" );
             Label l3 = new Label();
-            mv.visitTryCatchBlock( l0, l1, l3, "org/apache/zest/satisfiedBy/Exception2" );
+            mv.visitTryCatchBlock( l0, l1, l3, "org/apache/polygene/satisfiedBy/Exception2" );
             Label l4 = new Label();
             mv.visitTryCatchBlock( l0, l1, l4, "java/lang/Throwable" );
             mv.visitLabel( l0 );
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitFieldInsn( GETFIELD, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "_instance",
+            mv.visitFieldInsn( GETFIELD, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "_instance",
                                "Lorg/apache/polygene/spi/composite/CompositeInvoker;" );
-            mv.visitFieldInsn( GETSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m4", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( GETSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m4", "Ljava/lang/reflect/Method;" );
             mv.visitInsn( ICONST_1 );
             mv.visitTypeInsn( ANEWARRAY, "java/lang/Object" );
             mv.visitInsn( DUP );
             mv.visitInsn( ICONST_0 );
             mv.visitVarInsn( ALOAD, 1 );
             mv.visitInsn( AASTORE );
-            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/spi/composite/CompositeInvoker", "invokeComposite",
+            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/spi/composite/CompositeInvoker", "invokeComposite",
                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
             mv.visitInsn( POP );
             mv.visitLabel( l1 );
             Label l5 = new Label();
             mv.visitJumpInsn( GOTO, l5 );
             mv.visitLabel( l2 );
-            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "org/apache/zest/satisfiedBy/Exception1" } );
+            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "org/apache/polygene/satisfiedBy/Exception1" } );
             mv.visitVarInsn( ASTORE, 2 );
             mv.visitVarInsn( ALOAD, 2 );
             mv.visitInsn( ATHROW );
             mv.visitLabel( l3 );
-            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "org/apache/zest/satisfiedBy/Exception2" } );
+            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "org/apache/polygene/satisfiedBy/Exception2" } );
             mv.visitVarInsn( ASTORE, 2 );
             mv.visitVarInsn( ALOAD, 2 );
             mv.visitInsn( ATHROW );
@@ -446,11 +446,11 @@ public class ASMTest
             mv.visitTryCatchBlock( l0, l1, l2, "java/lang/Throwable" );
             mv.visitLabel( l0 );
             mv.visitVarInsn( ALOAD, 0 );
-            mv.visitFieldInsn( GETFIELD, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "_instance",
+            mv.visitFieldInsn( GETFIELD, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "_instance",
                                "Lorg/apache/polygene/spi/composite/CompositeInvoker;" );
-            mv.visitFieldInsn( GETSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m5", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( GETSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m5", "Ljava/lang/reflect/Method;" );
             mv.visitInsn( ACONST_NULL );
-            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/spi/composite/CompositeInvoker", "invokeComposite",
+            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/spi/composite/CompositeInvoker", "invokeComposite",
                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
             mv.visitTypeInsn( CHECKCAST, "java/lang/Integer" );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false );
@@ -482,7 +482,7 @@ public class ASMTest
             mv.visitTypeInsn( ANEWARRAY, "java/lang/Class" );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
                                 "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
-            mv.visitFieldInsn( PUTSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m1", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( PUTSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m1", "Ljava/lang/reflect/Method;" );
             mv.visitLdcInsn( Type.getType( "Lorg/apache/polygene/satisfiedBy/Other;" ) );
             mv.visitLdcInsn( "foo" );
             mv.visitInsn( ICONST_2 );
@@ -497,7 +497,7 @@ public class ASMTest
             mv.visitInsn( AASTORE );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
                                 "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
-            mv.visitFieldInsn( PUTSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m2", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( PUTSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m2", "Ljava/lang/reflect/Method;" );
             mv.visitLdcInsn( Type.getType( "Lorg/apache/polygene/satisfiedBy/Other;" ) );
             mv.visitLdcInsn( "bar" );
             mv.visitIntInsn( BIPUSH, 11 );
@@ -548,7 +548,7 @@ public class ASMTest
             mv.visitInsn( AASTORE );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
                                 "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
-            mv.visitFieldInsn( PUTSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m3", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( PUTSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m3", "Ljava/lang/reflect/Method;" );
             mv.visitLdcInsn( Type.getType( "Lorg/apache/polygene/satisfiedBy/Other;" ) );
             mv.visitLdcInsn( "multiEx" );
             mv.visitInsn( ICONST_1 );
@@ -559,14 +559,14 @@ public class ASMTest
             mv.visitInsn( AASTORE );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
                                 "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
-            mv.visitFieldInsn( PUTSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m4", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( PUTSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m4", "Ljava/lang/reflect/Method;" );
             mv.visitLdcInsn( Type.getType( "Lorg/apache/polygene/satisfiedBy/Other;" ) );
             mv.visitLdcInsn( "unwrapResult" );
             mv.visitInsn( ICONST_0 );
             mv.visitTypeInsn( ANEWARRAY, "java/lang/Class" );
             mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
                                 "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
-            mv.visitFieldInsn( PUTSTATIC, "org/apache/zest/satisfiedBy/SomeMixin_Stub", "m5", "Ljava/lang/reflect/Method;" );
+            mv.visitFieldInsn( PUTSTATIC, "org/apache/polygene/satisfiedBy/SomeMixin_Stub", "m5", "Ljava/lang/reflect/Method;" );
             mv.visitLabel( l1 );
             Label l3 = new Label();
             mv.visitJumpInsn( GOTO, l3 );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/spi/build.gradle
----------------------------------------------------------------------
diff --git a/core/spi/build.gradle b/core/spi/build.gradle
index 05d6f4a..7aa42b4 100644
--- a/core/spi/build.gradle
+++ b/core/spi/build.gradle
@@ -21,11 +21,11 @@
 jar { manifest { name = "Apache Polygene\u2122 Core SPI" } }
 
 dependencies {
-  compile zest.core.api
+  compile polygene.core.api
   compile libraries.org_json
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
-  testRuntime zest.core.runtime
+  testRuntime polygene.core.runtime
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/spi/dev-status.xml
----------------------------------------------------------------------
diff --git a/core/spi/dev-status.xml b/core/spi/dev-status.xml
index 994ff62..ba367e6 100644
--- a/core/spi/dev-status.xml
+++ b/core/spi/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/build.gradle
----------------------------------------------------------------------
diff --git a/core/testsupport/build.gradle b/core/testsupport/build.gradle
index 5099a20..932d44a 100644
--- a/core/testsupport/build.gradle
+++ b/core/testsupport/build.gradle
@@ -21,8 +21,8 @@
 jar { manifest { name = "Apache Polygene\u2122 Core TestSupport" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.junit
 
-  testRuntime zest.core.runtime
+  testRuntime polygene.core.runtime
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/dev-status.xml
----------------------------------------------------------------------
diff --git a/core/testsupport/dev-status.xml b/core/testsupport/dev-status.xml
index 06868c6..2e7c7ff 100644
--- a/core/testsupport/dev-status.xml
+++ b/core/testsupport/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/src/docs/testsupport.txt
----------------------------------------------------------------------
diff --git a/core/testsupport/src/docs/testsupport.txt b/core/testsupport/src/docs/testsupport.txt
index 4163a5b..d0abd44 100644
--- a/core/testsupport/src/docs/testsupport.txt
+++ b/core/testsupport/src/docs/testsupport.txt
@@ -36,7 +36,7 @@ In most cases, you will probably use the AbstractPolygeneTest class to simplify
 
 [snippet,java]
 --------------
-source=tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
+source=tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
 tag=step1
 --------------
 
@@ -45,7 +45,7 @@ What goes into that module is declared in the assembly() method;
 
 [snippet,java]
 --------------
-source=tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
+source=tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
 tag=step2
 --------------
 
@@ -53,7 +53,7 @@ In this case we declare that we have a ValueComposite of type org.apache.polygen
 
 [snippet,java]
 --------------
-source=tutorials/hello/src/main/java/org/apache/zest/tutorials/hello/Hello.java
+source=tutorials/hello/src/main/java/org/apache/polygene/tutorials/hello/Hello.java
 tag=body
 --------------
 
@@ -64,7 +64,7 @@ And then we create the actual test;
 
 [snippet,java]
 --------------
-source=tutorials/hello/src/test/java/org/apache/zest/tutorials/hello/HelloTest.java
+source=tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
 tag=step3
 --------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
index 7d81352..18e1c24 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
@@ -40,7 +40,7 @@ public abstract class AbstractPolygeneBaseTest
     protected PolygeneAPI api;
     protected PolygeneSPI spi;
 
-    protected Energy4Java zest;
+    protected Energy4Java polygene;
     protected ApplicationDescriptor applicationModel;
     protected Application application;
 
@@ -48,7 +48,7 @@ public abstract class AbstractPolygeneBaseTest
     public void setUp()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
         applicationModel = newApplication();
         if( applicationModel == null )
         {
@@ -57,7 +57,7 @@ public abstract class AbstractPolygeneBaseTest
         }
         application = newApplicationInstance( applicationModel );
         initApplication( application );
-        api = spi = zest.spi();
+        api = spi = polygene.spi();
         application.activate();
     }
 
@@ -73,7 +73,7 @@ public abstract class AbstractPolygeneBaseTest
 
     protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
     {
-        return applicationModel.newInstance( zest.api() );
+        return applicationModel.newInstance( polygene.api() );
     }
 
     protected ApplicationDescriptor newApplication()
@@ -94,7 +94,7 @@ public abstract class AbstractPolygeneBaseTest
 
         try
         {
-            return zest.newApplicationModel( assembler );
+            return polygene.newApplicationModel( assembler );
         }
         catch( AssemblyException e )
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
index dc47566..4f85962 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
@@ -43,7 +43,7 @@ public abstract class AbstractPolygeneScenarioTest
     static protected PolygeneAPI api;
     static protected PolygeneSPI spi;
 
-    static protected Energy4Java zest;
+    static protected Energy4Java polygene;
     static protected ApplicationDescriptor applicationModel;
     static protected Application application;
 
@@ -56,16 +56,16 @@ public abstract class AbstractPolygeneScenarioTest
     public static void setUp()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
         applicationModel = newApplication();
         if( applicationModel == null )
         {
             // An AssemblyException has occurred that the Test wants to check for.
             return;
         }
-        application = applicationModel.newInstance( zest.spi() );
+        application = applicationModel.newInstance( polygene.spi() );
         initApplication( application );
-        api = spi = zest.spi();
+        api = spi = polygene.spi();
         application.activate();
 
         // Assume only one module
@@ -81,7 +81,7 @@ public abstract class AbstractPolygeneScenarioTest
         ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm );
         try
         {
-            return zest.newApplicationModel( assembler );
+            return polygene.newApplicationModel( assembler );
         }
         catch( AssemblyException e )
         {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractPlainValueSerializationTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractPlainValueSerializationTest.java
index 6ce5076..29d17ef 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractPlainValueSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractPlainValueSerializationTest.java
@@ -232,7 +232,7 @@ public abstract class AbstractPlainValueSerializationTest
     }
 
     @Test
-    public void zest142RegressionTest()
+    public void polygene142RegressionTest()
         throws Exception
     {
         if( getClass().getName().equals( "org.apache.polygene.valueserialization.stax.StaxPlainValueSerializationTest" ) )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/doap.rdf
----------------------------------------------------------------------
diff --git a/doap.rdf b/doap.rdf
index 1159202..9fbc5de 100644
--- a/doap.rdf
+++ b/doap.rdf
@@ -29,17 +29,17 @@
 
   =======================================================================
 -->
-  <Project rdf:about="http://zest.apache.org/">
+  <Project rdf:about="http://polygene.apache.org/">
     <created>2008-12-17</created>
     <license rdf:resource="http://usefulinc.com/doap/licenses/asl20" />
     <name>Apache Polygene</name>
-    <homepage rdf:resource="https://zest.apache.org/" />
-    <asfext:pmc rdf:resource="https://zest.apache.org" />
+    <homepage rdf:resource="https://polygene.apache.org/" />
+    <asfext:pmc rdf:resource="https://polygene.apache.org" />
     <shortdesc>Apache Polygene is a community based effort exploring Composite Oriented Programming for domain centric application development.</shortdesc>
     <description>Apache Polygene is a community based effort exploring Composite Oriented Programming for domain centric application development. This includes evolved concepts from Aspect Oriented Programming, Dependency Injection and Domain Driven Design. Composite Oriented Programming allows developers to work with 'fragments', smaller than classes, and 'compose' fragments into larger 'composites' which acts like the regular objects. Polygene also tackles the enforcement of application composition, i.e. composites are declared in modules, modules are contained in layers and access between layers are controlled/enforced. Apache Polygene\u2122 (Java Edition), first Apache Polygene sub-project, is an implementation of Composite Oriented Programming, using the standard Java platform, without the use of any pre-processors or new language elements. Everything you know from Java still applies and you can leverage both your experience and toolkits to become more productive with Composite Or
 iented Programming today.</description>
     <bug-database rdf:resource="https://issues.apache.org/jira/browse/ZEST" />
     <mailing-list rdf:resource="https://www.apache.org/foundation/mailinglists.html" />
-    <download-page rdf:resource="https://zest.apache.org/download.html" />
+    <download-page rdf:resource="https://polygene.apache.org/download.html" />
     <programming-language>Java</programming-language>
     <programming-language>C#</programming-language>
     <programming-language>Scala</programming-language>
@@ -48,14 +48,14 @@
     <category rdf:resource="http://projects.apache.org/category/library" />
     <repository>
       <SVNRepository>
-        <location rdf:resource="http://svn.apache.org/repos/asf/zest/"/>
-        <browse rdf:resource="http://svn.apache.org/viewcvs.cgi/zest/"/>
+        <location rdf:resource="http://svn.apache.org/repos/asf/polygene/"/>
+        <browse rdf:resource="http://svn.apache.org/viewcvs.cgi/polygene/"/>
       </SVNRepository>
     </repository>
     <repository>
       <GitRepository>
-        <location rdf:resource="https://git-wip-us.apache.org/repos/asf/zest-java.git"/>
-        <browse rdf:resource="https://github.com/apache/zest-java"/>
+        <location rdf:resource="https://git-wip-us.apache.org/repos/asf/polygene-java.git"/>
+        <browse rdf:resource="https://github.com/apache/polygene-java"/>
       </GitRepository>
     </repository>
     <maintainer>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-ehcache/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/cache-ehcache/build.gradle b/extensions/cache-ehcache/build.gradle
index 2cdd3bc..9845cb1 100644
--- a/extensions/cache-ehcache/build.gradle
+++ b/extensions/cache-ehcache/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Ehcache Cache Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension: EhCache" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'constraints' )
   compile libraries.ehcache
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-ehcache/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/cache-ehcache/dev-status.xml b/extensions/cache-ehcache/dev-status.xml
index dd1f1d9..e6cf5af 100644
--- a/extensions/cache-ehcache/dev-status.xml
+++ b/extensions/cache-ehcache/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-ehcache/src/docs/cache-ehcache.txt
----------------------------------------------------------------------
diff --git a/extensions/cache-ehcache/src/docs/cache-ehcache.txt b/extensions/cache-ehcache/src/docs/cache-ehcache.txt
index 36444f6..3ffcfbd 100644
--- a/extensions/cache-ehcache/src/docs/cache-ehcache.txt
+++ b/extensions/cache-ehcache/src/docs/cache-ehcache.txt
@@ -40,7 +40,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/cache-ehcache/src/test/java/org/apache/zest/cache/ehcache/EhCacheTest.java
+source=extensions/cache-ehcache/src/test/java/org/apache/polygene/cache/ehcache/EhCacheTest.java
 tag=assembly
 ----
 
@@ -51,6 +51,6 @@ Here are the configuration properties for the EhCache EntityStore Cache:
 
 [snippet,java]
 ----
-source=extensions/cache-ehcache/src/main/java/org/apache/zest/cache/ehcache/EhCacheConfiguration.java
+source=extensions/cache-ehcache/src/main/java/org/apache/polygene/cache/ehcache/EhCacheConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-memcache/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/build.gradle b/extensions/cache-memcache/build.gradle
index e1b58ed..597c41c 100644
--- a/extensions/cache-memcache/build.gradle
+++ b/extensions/cache-memcache/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 Memcache Cache Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Cache - Memcache" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.spymemcached
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-memcache/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/dev-status.xml b/extensions/cache-memcache/dev-status.xml
index dd1f1d9..e6cf5af 100644
--- a/extensions/cache-memcache/dev-status.xml
+++ b/extensions/cache-memcache/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/cache-memcache/src/docs/cache-memcache.txt
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/src/docs/cache-memcache.txt b/extensions/cache-memcache/src/docs/cache-memcache.txt
index 12a075e..ef2adf3 100644
--- a/extensions/cache-memcache/src/docs/cache-memcache.txt
+++ b/extensions/cache-memcache/src/docs/cache-memcache.txt
@@ -47,7 +47,7 @@ Assembly is done using the +MemcacheAssembler+:
 
 [snippet,java]
 ----
-source=extensions/cache-memcache/src/test/java/org/apache/zest/cache/memcache/MemcacheCachePoolTest.java
+source=extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
 tag=assembly
 ----
 
@@ -58,7 +58,7 @@ Here are the configuration properties for the Memcache EntityStore Cache:
 
 [snippet,java]
 ----
-source=extensions/cache-memcache/src/main/java/org/apache/zest/cache/memcache/MemcacheConfiguration.java
+source=extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/MemcacheConfiguration.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-file/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/build.gradle b/extensions/entitystore-file/build.gradle
index 6235259..83789b2 100644
--- a/extensions/entitystore-file/build.gradle
+++ b/extensions/entitystore-file/build.gradle
@@ -21,15 +21,15 @@
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - File system" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
-  compile zest.library( 'constraints' )
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
+  compile polygene.library( 'constraints' )
+  compile polygene.library( 'fileconfig' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-file/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/dev-status.xml b/extensions/entitystore-file/dev-status.xml
index f4cca09..8d582e2 100644
--- a/extensions/entitystore-file/dev-status.xml
+++ b/extensions/entitystore-file/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-file/src/docs/es-file.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/docs/es-file.txt b/extensions/entitystore-file/src/docs/es-file.txt
index 6a383f0..72946dc 100644
--- a/extensions/entitystore-file/src/docs/es-file.txt
+++ b/extensions/entitystore-file/src/docs/es-file.txt
@@ -37,7 +37,7 @@ Assembly is done as follows:
 
 [snippet,java]
 ----
-source=extensions/entitystore-file/src/test/java/org/apache/zest/entitystore/file/FileEntityStoreTest.java
+source=extensions/entitystore-file/src/test/java/org/apache/polygene/entitystore/file/FileEntityStoreTest.java
 tag=assembly
 ----
 
@@ -47,13 +47,13 @@ Here are the configuration properties for the File EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-file/src/main/java/org/apache/zest/entitystore/file/FileEntityStoreConfiguration.java
+source=extensions/entitystore-file/src/main/java/org/apache/polygene/entitystore/file/FileEntityStoreConfiguration.java
 tag=config
 ----
 
 +directory+ is optional and represent the directory where the File EntityStore will keep its persisted state.
 
-It defaults to System.getProperty( "user.dir" ) + "/zest/filestore"
+It defaults to System.getProperty( "user.dir" ) + "/polygene/filestore"
 If the given path is not absolute, then it's relative to the current working directory.
 If you use the <<library-fileconfig>> then this property value is ignored and FileConfig is prefered.
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-geode/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/build.gradle b/extensions/entitystore-geode/build.gradle
index 5855834..79ef02b 100644
--- a/extensions/entitystore-geode/build.gradle
+++ b/extensions/entitystore-geode/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Geode EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Geode" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
   compile libraries.geode
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-geode/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/dev-status.xml b/extensions/entitystore-geode/dev-status.xml
index 331defe..c79727f 100644
--- a/extensions/entitystore-geode/dev-status.xml
+++ b/extensions/entitystore-geode/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-geode/src/docs/es-geode.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/src/docs/es-geode.txt b/extensions/entitystore-geode/src/docs/es-geode.txt
index 944df47..301fa21 100644
--- a/extensions/entitystore-geode/src/docs/es-geode.txt
+++ b/extensions/entitystore-geode/src/docs/es-geode.txt
@@ -36,7 +36,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-geode/src/test/java/org/apache/zest/entitystore/geode/GeodeEntityStoreTest.java
+source=extensions/entitystore-geode/src/test/java/org/apache/polygene/entitystore/geode/GeodeEntityStoreTest.java
 tag=assembly
 ----
 
@@ -46,6 +46,6 @@ Here are the configuration properties for the Geode EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-geode/src/main/java/org/apache/zest/entitystore/geode/GeodeConfiguration.java
+source=extensions/entitystore-geode/src/main/java/org/apache/polygene/entitystore/geode/GeodeConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/README.persistent
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/README.persistent b/extensions/entitystore-hazelcast/README.persistent
index e8baf5b..70bc272 100644
--- a/extensions/entitystore-hazelcast/README.persistent
+++ b/extensions/entitystore-hazelcast/README.persistent
@@ -17,7 +17,7 @@ Implementation is set as follow:
 
     <?xml version="1.0" encoding="UTF-8"?>
     <hazelcast>
-        <map name="zest.data">
+        <map name="polygene.data">
             <map-store enabled="true">
                 <!--
                    Name of the class implementing MapLoader and/or MapStore.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/build.gradle b/extensions/entitystore-hazelcast/build.gradle
index be18394..bf88c81 100644
--- a/extensions/entitystore-hazelcast/build.gradle
+++ b/extensions/entitystore-hazelcast/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Hazelcast EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Hazelcast" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
   compile libraries.hazelcast
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/dev-status.xml b/extensions/entitystore-hazelcast/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/entitystore-hazelcast/dev-status.xml
+++ b/extensions/entitystore-hazelcast/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt b/extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt
index cb02522..1f3ef5a 100644
--- a/extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt
+++ b/extensions/entitystore-hazelcast/src/docs/es-hazelcast.txt
@@ -35,7 +35,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-hazelcast/src/test/java/org/apache/zest/entitystore/hazelcast/HazelcastEntityStoreTest.java
+source=extensions/entitystore-hazelcast/src/test/java/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreTest.java
 tag=assembly
 ----
 
@@ -45,7 +45,7 @@ Here are the configuration properties for the Hazelcast EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-hazelcast/src/main/java/org/apache/zest/entitystore/hazelcast/HazelcastConfiguration.java
+source=extensions/entitystore-hazelcast/src/main/java/org/apache/polygene/entitystore/hazelcast/HazelcastConfiguration.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreService.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreService.properties b/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreService.properties
index 1d1abe0..e898a18 100644
--- a/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreService.properties
+++ b/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/HazelcastEntityStoreService.properties
@@ -18,4 +18,4 @@
 #
 #
 
-mapName=zest.data
\ No newline at end of file
+mapName=polygene.data
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/hazelcast.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/hazelcast.xml b/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/hazelcast.xml
index d69073e..cc52305 100644
--- a/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/hazelcast.xml
+++ b/extensions/entitystore-hazelcast/src/test/resources/org/apache/polygene/entitystore/hazelcast/hazelcast.xml
@@ -19,7 +19,7 @@
   ~
   -->
 <hazelcast>
-  <map name="zest.data">
+  <map name="polygene.data">
     <map-store enabled="true">
       <!--
          Name of the class implementing MapLoader and/or MapStore.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jclouds/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/build.gradle b/extensions/entitystore-jclouds/build.gradle
index 8a4c4ef..32a56d2 100644
--- a/extensions/entitystore-jclouds/build.gradle
+++ b/extensions/entitystore-jclouds/build.gradle
@@ -23,17 +23,17 @@ description = "Apache Polygene\u2122 JClouds EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - JClouds" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
+  compile polygene.library( 'fileconfig' )
   compile libraries.jclouds_core
   compile libraries.jclouds_blobstore
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
   runtime libraries.jaxb_api
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
   testCompile libraries.jclouds_filesystem
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jclouds/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/dev-status.xml b/extensions/entitystore-jclouds/dev-status.xml
index a58277d..ff99de4 100644
--- a/extensions/entitystore-jclouds/dev-status.xml
+++ b/extensions/entitystore-jclouds/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <codebase>stable</codebase>
         <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jclouds/src/docs/es-jclouds.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/docs/es-jclouds.txt b/extensions/entitystore-jclouds/src/docs/es-jclouds.txt
index 6067168..7f8b053 100644
--- a/extensions/entitystore-jclouds/src/docs/es-jclouds.txt
+++ b/extensions/entitystore-jclouds/src/docs/es-jclouds.txt
@@ -44,7 +44,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-jclouds/src/test/java/org/apache/zest/entitystore/jclouds/JCloudsTransientTest.java
+source=extensions/entitystore-jclouds/src/test/java/org/apache/polygene/entitystore/jclouds/JCloudsTransientTest.java
 tag=assembly
 ----
 
@@ -54,6 +54,6 @@ Here are the configuration properties for the JClouds EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-jclouds/src/main/java/org/apache/zest/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java
+source=extensions/entitystore-jclouds/src/main/java/org/apache/polygene/entitystore/jclouds/JCloudsMapEntityStoreConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jdbm/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/build.gradle b/extensions/entitystore-jdbm/build.gradle
index 0cc01c7..822686f 100644
--- a/extensions/entitystore-jdbm/build.gradle
+++ b/extensions/entitystore-jdbm/build.gradle
@@ -23,15 +23,15 @@ description = "Apache Polygene\u2122 JDBM EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - JDBM" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
+  compile polygene.library( 'fileconfig' )
   compile libraries.jdbm
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jdbm/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/dev-status.xml b/extensions/entitystore-jdbm/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/entitystore-jdbm/dev-status.xml
+++ b/extensions/entitystore-jdbm/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-jdbm/src/docs/es-jdbm.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/docs/es-jdbm.txt b/extensions/entitystore-jdbm/src/docs/es-jdbm.txt
index 3ef8224..c50edb5 100644
--- a/extensions/entitystore-jdbm/src/docs/es-jdbm.txt
+++ b/extensions/entitystore-jdbm/src/docs/es-jdbm.txt
@@ -35,7 +35,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/DocumentationSupport.java
+source=extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/DocumentationSupport.java
 tag=UsingAssembler
 ----
 
@@ -45,12 +45,12 @@ Here are the configuration properties for the JDBM EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-jdbm/src/main/java/org/apache/zest/entitystore/jdbm/JdbmConfiguration.java
+source=extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmConfiguration.java
 tag=config
 ----
 
 +file+ is optional and represent the file where the JDBM EntityStore will keep its persisted state.
 
-It defaults to System.getProperty( "user.dir" ) + "/zest/jdbmstore.data"
+It defaults to System.getProperty( "user.dir" ) + "/polygene/jdbmstore.data"
 If the given path is not absolute, then it's relative to the current working directory.
 If you use the <<library-fileconfig>> then this property value is ignored and FileConfig is prefered.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-leveldb/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/build.gradle b/extensions/entitystore-leveldb/build.gradle
index 6b7b401..cd98455 100644
--- a/extensions/entitystore-leveldb/build.gradle
+++ b/extensions/entitystore-leveldb/build.gradle
@@ -23,17 +23,17 @@ description = "Apache Polygene\u2122 LevelDB EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - LevelDB" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
+  compile polygene.library( 'fileconfig' )
   compile libraries.leveldb_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
   runtime libraries.leveldb_java
   runtime libraries.leveldb_jni_all
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-leveldb/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/dev-status.xml b/extensions/entitystore-leveldb/dev-status.xml
index 331defe..c79727f 100644
--- a/extensions/entitystore-leveldb/dev-status.xml
+++ b/extensions/entitystore-leveldb/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-leveldb/src/docs/es-leveldb.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/docs/es-leveldb.txt b/extensions/entitystore-leveldb/src/docs/es-leveldb.txt
index 8fae082..940a645 100644
--- a/extensions/entitystore-leveldb/src/docs/es-leveldb.txt
+++ b/extensions/entitystore-leveldb/src/docs/es-leveldb.txt
@@ -43,7 +43,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-leveldb/src/test/java/org/apache/zest/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
+source=extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java
 tag=assembly
 ----
 
@@ -53,7 +53,7 @@ Here are the configuration properties for the LevelDB EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-leveldb/src/main/java/org/apache/zest/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
+source=extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreConfiguration.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/package.html b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/package.html
index cce0867..bda6cf6 100644
--- a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/package.html
+++ b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/package.html
@@ -27,7 +27,7 @@
         <p>
             By default use the native implementation through JNI bindings and fallback to the pure java implementation
             if not available on the current platform. Used implementation can be forced using the
-            {@link org.apache.zest.entitystore.leveldb.LevelDBEntityStoreConfiguration#flavour()} property.
+            {@link org.apache.polygene.entitystore.leveldb.LevelDBEntityStoreConfiguration#flavour()} property.
         </p>
         <p>See:</p>
         <ul>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-memory/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/build.gradle b/extensions/entitystore-memory/build.gradle
index 339f40c..4833d92 100644
--- a/extensions/entitystore-memory/build.gradle
+++ b/extensions/entitystore-memory/build.gradle
@@ -21,12 +21,12 @@
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Memory" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-memory/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/dev-status.xml b/extensions/entitystore-memory/dev-status.xml
index 3ab4fb7..b307e0b 100644
--- a/extensions/entitystore-memory/dev-status.xml
+++ b/extensions/entitystore-memory/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-memory/src/docs/es-memory.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/src/docs/es-memory.txt b/extensions/entitystore-memory/src/docs/es-memory.txt
index 9bba9af..f2adf4a 100644
--- a/extensions/entitystore-memory/src/docs/es-memory.txt
+++ b/extensions/entitystore-memory/src/docs/es-memory.txt
@@ -35,7 +35,7 @@ Assembly is done as follows:
 
 [snippet,java]
 ----
-source=extensions/entitystore-memory/src/test/java/org/apache/zest/entitystore/memory/MemoryEntityStoreTest.java
+source=extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-mongodb/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/build.gradle b/extensions/entitystore-mongodb/build.gradle
index d3d57bb..5b78435 100644
--- a/extensions/entitystore-mongodb/build.gradle
+++ b/extensions/entitystore-mongodb/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 MongoDB EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - MongoDB" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
   compile libraries.mongodb
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
   testCompile libraries.embed_mongo
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-mongodb/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/dev-status.xml b/extensions/entitystore-mongodb/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/entitystore-mongodb/dev-status.xml
+++ b/extensions/entitystore-mongodb/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-mongodb/src/docs/es-mongodb.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/docs/es-mongodb.txt b/extensions/entitystore-mongodb/src/docs/es-mongodb.txt
index 8c7e55e..658e2a9 100644
--- a/extensions/entitystore-mongodb/src/docs/es-mongodb.txt
+++ b/extensions/entitystore-mongodb/src/docs/es-mongodb.txt
@@ -36,7 +36,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-mongodb/src/test/java/org/apache/zest/entitystore/mongodb/MongoMapEntityStoreTest.java
+source=extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java
 tag=assembly
 ----
 
@@ -46,6 +46,6 @@ Here are the configuration properties for the MongoDB EntityStore:
 
 [snippet,java]
 ----
-source=extensions/entitystore-mongodb/src/main/java/org/apache/zest/entitystore/mongodb/MongoEntityStoreConfiguration.java
+source=extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoEntityStoreConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-preferences/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/build.gradle b/extensions/entitystore-preferences/build.gradle
index f26d9c7..1339e8e 100644
--- a/extensions/entitystore-preferences/build.gradle
+++ b/extensions/entitystore-preferences/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 Preferences EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Preferences" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-preferences/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/dev-status.xml b/extensions/entitystore-preferences/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/entitystore-preferences/dev-status.xml
+++ b/extensions/entitystore-preferences/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-preferences/src/docs/es-preferences.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/docs/es-preferences.txt b/extensions/entitystore-preferences/src/docs/es-preferences.txt
index dfb111b..e93e26d 100644
--- a/extensions/entitystore-preferences/src/docs/es-preferences.txt
+++ b/extensions/entitystore-preferences/src/docs/es-preferences.txt
@@ -37,6 +37,6 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-preferences/src/test/java/org/apache/zest/entitystore/DocumentationSupport.java
+source=extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
 tag=assembly
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-redis/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/build.gradle b/extensions/entitystore-redis/build.gradle
index dd062f4..44a0dd6 100644
--- a/extensions/entitystore-redis/build.gradle
+++ b/extensions/entitystore-redis/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Redis EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Redis" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
   compile libraries.jedis
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-redis/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/dev-status.xml b/extensions/entitystore-redis/dev-status.xml
index 7ff397b..273df00 100644
--- a/extensions/entitystore-redis/dev-status.xml
+++ b/extensions/entitystore-redis/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-redis/src/docs/es-redis.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/docs/es-redis.txt b/extensions/entitystore-redis/src/docs/es-redis.txt
index 11d1def..20ac8e1 100644
--- a/extensions/entitystore-redis/src/docs/es-redis.txt
+++ b/extensions/entitystore-redis/src/docs/es-redis.txt
@@ -35,7 +35,7 @@ Assembly is done using the provided Assembler.
 
 [snippet,java]
 ----
-source=extensions/entitystore-redis/src/test/java/org/apache/zest/entitystore/redis/RedisMapEntityStoreTest.java
+source=extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
 tag=assembly
 ----
 
@@ -46,6 +46,6 @@ Here are the configuration properties for the Redis client:
 
 [snippet,java]
 ----
-source=extensions/entitystore-redis/src/main/java/org/apache/zest/entitystore/redis/RedisEntityStoreConfiguration.java
+source=extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisEntityStoreConfiguration.java
 tag=config
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-riak/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/build.gradle b/extensions/entitystore-riak/build.gradle
index dff2f13..7b6de87 100644
--- a/extensions/entitystore-riak/build.gradle
+++ b/extensions/entitystore-riak/build.gradle
@@ -23,15 +23,15 @@ description = "Apache Polygene\u2122 Riak EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - Riak" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'locking' )
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'locking' )
+  compile polygene.library( 'constraints' )
   compile libraries.riak
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-riak/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/dev-status.xml b/extensions/entitystore-riak/dev-status.xml
index 7ff397b..273df00 100644
--- a/extensions/entitystore-riak/dev-status.xml
+++ b/extensions/entitystore-riak/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>


[56/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-riak/src/docs/es-riak.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/docs/es-riak.txt b/extensions/entitystore-riak/src/docs/es-riak.txt
index b2a2c69..834410a 100644
--- a/extensions/entitystore-riak/src/docs/es-riak.txt
+++ b/extensions/entitystore-riak/src/docs/es-riak.txt
@@ -39,7 +39,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-riak/src/test/java/org/apache/zest/entitystore/riak/RiakMapEntityStoreTest.java
+source=extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java
 tag=assembly
 ----
 
@@ -49,7 +49,7 @@ Here are the available configuration properties:
 
 [snippet,java]
 ----
-source=extensions/entitystore-riak/src/main/java/org/apache/zest/entitystore/riak/RiakEntityStoreConfiguration.java
+source=extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakEntityStoreConfiguration.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-sql/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/build.gradle b/extensions/entitystore-sql/build.gradle
index 4ffe7fb..f8b494a 100644
--- a/extensions/entitystore-sql/build.gradle
+++ b/extensions/entitystore-sql/build.gradle
@@ -23,18 +23,18 @@ description = "Apache Polygene\u2122 SQL EntityStore Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - EntityStore - SQL" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'sql' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'sql' )
   compile libraries.javaSqlGenerator
   compile( libraries.javaSqlGeneratorImpl ) {
     exclude group: 'junit'
   }
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'sql-dbcp' )
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'sql-dbcp' )
+  testCompile polygene.extension( 'valueserialization-orgjson' )
   testCompile libraries.derby // Needed at compile time for polite test shutdown
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-sql/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/dev-status.xml b/extensions/entitystore-sql/dev-status.xml
index f4cca09..8d582e2 100644
--- a/extensions/entitystore-sql/dev-status.xml
+++ b/extensions/entitystore-sql/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-sql/src/docs/es-sql.txt
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/docs/es-sql.txt b/extensions/entitystore-sql/src/docs/es-sql.txt
index 2649872..50e9f31 100644
--- a/extensions/entitystore-sql/src/docs/es-sql.txt
+++ b/extensions/entitystore-sql/src/docs/es-sql.txt
@@ -52,7 +52,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
 == Configuration ==
 
 SQL EntityStore Configuration is optional and provides only one configuration property: `schemaName` defaulted to
-'zest_es'. On SQL databases that don't support schemas this configuration property is simply ignored.
+'polygene_es'. On SQL databases that don't support schemas this configuration property is simply ignored.
 
 The assembly snippets below show the DataSource assembly alongside the SQL EntityStore assembly. Remember to configure
 the DataSource properly, see <<library-sql>> and <<howto-configure-service>>.
@@ -66,7 +66,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-sql/src/test/java/org/apache/zest/entitystore/sql/PostgreSQLEntityStoreTest.java
+source=extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
 tag=assembly
 ----
 
@@ -86,7 +86,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-sql/src/test/java/org/apache/zest/entitystore/sql/MySQLEntityStoreTest.java
+source=extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
 tag=assembly
 ----
 
@@ -109,7 +109,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-sql/src/test/java/org/apache/zest/entitystore/sql/SQLiteEntityStoreTest.java
+source=extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
 tag=assembly
 ----
 
@@ -129,7 +129,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-sql/src/test/java/org/apache/zest/entitystore/sql/H2SQLEntityStoreTest.java
+source=extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
 tag=assembly
 ----
 
@@ -150,7 +150,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/entitystore-sql/src/test/java/org/apache/zest/entitystore/sql/DerbySQLEntityStoreTest.java
+source=extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
index a348346..bcadde1 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/internal/SQLs.java
@@ -22,9 +22,9 @@ package org.apache.polygene.entitystore.sql.internal;
 public interface SQLs
 {
 
-    String DEFAULT_SCHEMA_NAME = "zest_es";
+    String DEFAULT_SCHEMA_NAME = "polygene_es";
 
-    String TABLE_NAME = "zest_entities";
+    String TABLE_NAME = "polygene_entities";
 
     String ENTITY_PK_COLUMN_NAME = "entity_pk";
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-elasticsearch/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/build.gradle b/extensions/indexing-elasticsearch/build.gradle
index 7889bcc..7d5089c 100644
--- a/extensions/indexing-elasticsearch/build.gradle
+++ b/extensions/indexing-elasticsearch/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 ElasticSearch Index/Query Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Index/Query - ElasticSearch" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'fileconfig' )
   compile libraries.elasticsearch
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-elasticsearch/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/dev-status.xml b/extensions/indexing-elasticsearch/dev-status.xml
index 013a05a..a8ce0d7 100644
--- a/extensions/indexing-elasticsearch/dev-status.xml
+++ b/extensions/indexing-elasticsearch/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
     <status>
         <!--none,early,beta,stable,mature-->
         <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt b/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt
index 307d327..42f0616 100644
--- a/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt
+++ b/extensions/indexing-elasticsearch/src/docs/index-elasticsearch.txt
@@ -54,7 +54,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java
+source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
 tag=filesystem
 ----
 
@@ -67,7 +67,7 @@ Here are the configuration properties for the filesystem ElasticSearch Index/Que
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchConfiguration.java
+source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
 tag=config
 ----
 
@@ -82,7 +82,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java
+source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
 tag=cluster
 ----
 
@@ -94,7 +94,7 @@ properties defined in the filesystem configuration, see above.
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchClusterConfiguration.java
+source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchClusterConfiguration.java
 tag=config
 ----
 
@@ -109,7 +109,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/test/java/org/apache/zest/index/elasticsearch/DocumentationSupport.java
+source=extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/DocumentationSupport.java
 tag=client
 ----
 
@@ -121,7 +121,7 @@ Note that the `clusterName` is ignored as this is managed by the client.
 
 [snippet,java]
 ----
-source=extensions/indexing-elasticsearch/src/main/java/org/apache/zest/index/elasticsearch/ElasticSearchConfiguration.java
+source=extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
 tag=client
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
index c94857a..ed25cbe 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/ElasticSearchConfiguration.java
@@ -31,13 +31,13 @@ public interface ElasticSearchConfiguration
 
     /**
      * Cluster name.
-     * Defaults to 'zest_cluster'.
+     * Defaults to 'polygene_cluster'.
      */
     @Optional Property<String> clusterName();
 
     /**
      * Index name.
-     * Defaults to 'zest_index'.
+     * Defaults to 'polygene_index'.
      */
     @Optional Property<String> index();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/internal/AbstractElasticSearchSupport.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/internal/AbstractElasticSearchSupport.java b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/internal/AbstractElasticSearchSupport.java
index db1d87e..d899958 100644
--- a/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/internal/AbstractElasticSearchSupport.java
+++ b/extensions/indexing-elasticsearch/src/main/java/org/apache/polygene/index/elasticsearch/internal/AbstractElasticSearchSupport.java
@@ -31,9 +31,9 @@ public abstract class AbstractElasticSearchSupport
     implements ElasticSearchSupport
 {
     protected static final Logger LOGGER = LoggerFactory.getLogger( ElasticSearchSupport.class );
-    protected static final String DEFAULT_CLUSTER_NAME = "zest_cluster";
-    protected static final String DEFAULT_INDEX_NAME = "zest_index";
-    protected static final String ENTITIES_TYPE = "zest_entities";
+    protected static final String DEFAULT_CLUSTER_NAME = "polygene_cluster";
+    protected static final String DEFAULT_INDEX_NAME = "polygene_index";
+    protected static final String ENTITIES_TYPE = "polygene_entities";
 
     protected Client client;
     protected String index;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-rdf/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/build.gradle b/extensions/indexing-rdf/build.gradle
index e353501..44ec675 100644
--- a/extensions/indexing-rdf/build.gradle
+++ b/extensions/indexing-rdf/build.gradle
@@ -23,17 +23,17 @@ description = "Apache Polygene\u2122 RDF Index/Query Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Index/Query - RDF" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'rdf' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'rdf' )
   compile libraries.sesame
   compile libraries.commons_lang
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
-  testCompile zest.extension( 'entitystore-preferences' )
-  testCompile zest.extension( 'entitystore-jdbm' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
+  testCompile polygene.extension( 'entitystore-preferences' )
+  testCompile polygene.extension( 'entitystore-jdbm' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-rdf/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/dev-status.xml b/extensions/indexing-rdf/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/indexing-rdf/dev-status.xml
+++ b/extensions/indexing-rdf/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-rdf/src/docs/index-rdf.txt
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/docs/index-rdf.txt b/extensions/indexing-rdf/src/docs/index-rdf.txt
index 81fe248..20ce6d1 100644
--- a/extensions/indexing-rdf/src/docs/index-rdf.txt
+++ b/extensions/indexing-rdf/src/docs/index-rdf.txt
@@ -35,7 +35,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/DocumentationSupport.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/DocumentationSupport.java
 tag=memory
 ----
 
@@ -49,7 +49,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/DocumentationSupport.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/DocumentationSupport.java
 tag=native
 ----
 
@@ -59,7 +59,7 @@ Here are the configuration properties for the Native RDF Index/Query:
 
 [snippet,java]
 ----
-source=libraries/rdf/src/main/java/org/apache/zest/library/rdf/repository/NativeConfiguration.java
+source=libraries/rdf/src/main/java/org/apache/polygene/library/rdf/repository/NativeConfiguration.java
 tag=config
 ----
 
@@ -72,7 +72,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/DocumentationSupport.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/DocumentationSupport.java
 tag=rdbms
 ----
 
@@ -82,7 +82,7 @@ Here are the configuration properties for the RDBMS based RDF Index/Query:
 
 [snippet,java]
 ----
-source=libraries/rdf/src/main/java/org/apache/zest/library/rdf/repository/RdbmsRepositoryConfiguration.java
+source=libraries/rdf/src/main/java/org/apache/polygene/library/rdf/repository/RdbmsRepositoryConfiguration.java
 tag=config
 ----
 
@@ -95,138 +95,138 @@ details of the Entity model that is being indexed.
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query1
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query2
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query3
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query4
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query5
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query6
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query7
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query8
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query9
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query10
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query11
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query12
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query13
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query14
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query15
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query16
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query17
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query18
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query19
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query20
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query21
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query22
 ----
 
 [snippet,java]
 ----
-source=extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+source=extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
 tag=query24
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
index d37360b..1d57ef0 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
@@ -177,8 +177,8 @@ public class Qi95IssueTest
     )
         throws AssemblyException
     {
-        Energy4Java zest = new Energy4Java();
-        Application application = zest.newApplication( new ApplicationAssembler()
+        Energy4Java polygene = new Energy4Java();
+        Application application = polygene.newApplication( new ApplicationAssembler()
         {
             @Override
             public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-solr/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/build.gradle b/extensions/indexing-solr/build.gradle
index bcca341..6cd924e 100644
--- a/extensions/indexing-solr/build.gradle
+++ b/extensions/indexing-solr/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Solr Indexing Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Indexing - Solr" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'fileconfig' )
-  compile zest.library( 'rdf' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'fileconfig' )
+  compile polygene.library( 'rdf' )
   compile libraries.solr
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.servlet_api
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-solr/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/dev-status.xml b/extensions/indexing-solr/dev-status.xml
index 0b68bdd..7299a21 100644
--- a/extensions/indexing-solr/dev-status.xml
+++ b/extensions/indexing-solr/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-solr/src/docs/index-solr.txt
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/docs/index-solr.txt b/extensions/indexing-solr/src/docs/index-solr.txt
index 9f8ad58..b79a0a0 100644
--- a/extensions/indexing-solr/src/docs/index-solr.txt
+++ b/extensions/indexing-solr/src/docs/index-solr.txt
@@ -37,7 +37,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-solr/src/test/java/org/apache/zest/index/solr/SolrQueryServiceTest.java
+source=extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-sql/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/build.gradle b/extensions/indexing-sql/build.gradle
index df5f7f6..e1403a3 100644
--- a/extensions/indexing-sql/build.gradle
+++ b/extensions/indexing-sql/build.gradle
@@ -23,18 +23,18 @@ description = "Apache Polygene\u2122 SQL Indexing Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Indexing - SQL" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'sql' )
-  compile zest.extension( 'reindexer' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'sql' )
+  compile polygene.extension( 'reindexer' )
   compile libraries.javaSqlGenerator
   compile( libraries.javaSqlGeneratorImpl ) {
     exclude group: 'junit'
   }
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'sql-dbcp' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'sql-dbcp' )
 
   testRuntime libraries.logback
   testRuntime libraries.derby

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-sql/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/dev-status.xml b/extensions/indexing-sql/dev-status.xml
index b99d6bc..762e250 100644
--- a/extensions/indexing-sql/dev-status.xml
+++ b/extensions/indexing-sql/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-sql/instructions.txt
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/instructions.txt b/extensions/indexing-sql/instructions.txt
index 43449dd..0f45830 100644
--- a/extensions/indexing-sql/instructions.txt
+++ b/extensions/indexing-sql/instructions.txt
@@ -29,6 +29,6 @@ These instructions are for preparing your out-of-box PostgreSQL installation so
 2.3. This will open new window, erase any text which pgAdmin generates there for you.
 2.4. Then navigate to your PostgreSQL installation directory, then into 'share', and then into 'contrib'. Open file 'ltree.sql' in your favorite text editor.
 2.5. Select all text, copy it, and paste to SQL query window which you opened in stage 2.2.
-2.6. If you know what you are doing, you may change the line 'SET search_path = public;' to make search_path be 'pg_catalog', or name of schema that Polygene\u2122 application will use ('zest' by default). It's ok to leave it to 'public' though.
+2.6. If you know what you are doing, you may change the line 'SET search_path = public;' to make search_path be 'pg_catalog', or name of schema that Polygene\u2122 application will use ('polygene' by default). It's ok to leave it to 'public' though.
 2.7. Hit F5 or go Query -> Execute Query to execute the SQL. It should print some notices into output window but no errors nor warnings should be present.
 2.8. Ltree type should be now installed to your PostgreSQL installation.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/indexing-sql/src/docs/index-sql.txt
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/docs/index-sql.txt b/extensions/indexing-sql/src/docs/index-sql.txt
index a46c9de..7de12dd 100644
--- a/extensions/indexing-sql/src/docs/index-sql.txt
+++ b/extensions/indexing-sql/src/docs/index-sql.txt
@@ -43,7 +43,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
 == Configuration ==
 
 SQL Index/Query Configuration is optional and provides only one configuration property: `schemaName` defaulted to
-'zest_es'. On SQL databases that don't support schemas this configuration property is simply ignored.
+'polygene_es'. On SQL databases that don't support schemas this configuration property is simply ignored.
 
 The assembly snippets below show the DataSource assembly alongside the SQL Index/Query assembly. Remember to configure
 the DataSource properly, see <<library-sql>> and <<howto-configure-service>>.
@@ -55,7 +55,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/indexing-sql/src/test/java/org/apache/zest/index/sql/postgresql/SQLTestHelper.java
+source=extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/SQLTestHelper.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/metrics-codahale/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/build.gradle b/extensions/metrics-codahale/build.gradle
index da6cef8..8221b66 100644
--- a/extensions/metrics-codahale/build.gradle
+++ b/extensions/metrics-codahale/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 Codahale Metrics Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Metrics - Codahale" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.codahale_metrics
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'jmx' )
-  testCompile zest.library( 'metrics' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'jmx' )
+  testCompile polygene.library( 'metrics' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/metrics-codahale/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/dev-status.xml b/extensions/metrics-codahale/dev-status.xml
index fb63508..bd10cdc 100644
--- a/extensions/metrics-codahale/dev-status.xml
+++ b/extensions/metrics-codahale/dev-status.xml
@@ -19,10 +19,10 @@
   ~
   -->
 
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/metrics-codahale/src/docs/metrics-codahale.txt
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/docs/metrics-codahale.txt b/extensions/metrics-codahale/src/docs/metrics-codahale.txt
index 6e29384..06409b2 100644
--- a/extensions/metrics-codahale/src/docs/metrics-codahale.txt
+++ b/extensions/metrics-codahale/src/docs/metrics-codahale.txt
@@ -36,7 +36,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=extensions/metrics-codahale/src/test/java/org/apache/zest/metrics/codahale/CodahaleMetricsTest.java
+source=extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
 tag=assembly
 ----
 
@@ -50,6 +50,6 @@ provide accessor to it:
 
 [snippet,java]
 ----
-source=extensions/metrics-codahale/src/test/java/org/apache/zest/metrics/codahale/CodahaleMetricsTest.java
+source=extensions/metrics-codahale/src/test/java/org/apache/polygene/metrics/codahale/CodahaleMetricsTest.java
 tag=registry
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/migration/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/migration/build.gradle b/extensions/migration/build.gradle
index ad1902f..57ec29e 100644
--- a/extensions/migration/build.gradle
+++ b/extensions/migration/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Migration Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - Migration" }}
 
 dependencies {
-  compile zest.core.spi
+  compile polygene.core.spi
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/migration/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/migration/dev-status.xml b/extensions/migration/dev-status.xml
index c5d4441..9cf2f2a 100644
--- a/extensions/migration/dev-status.xml
+++ b/extensions/migration/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/reindexer/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/reindexer/build.gradle b/extensions/reindexer/build.gradle
index 8577e55..67f9341 100644
--- a/extensions/reindexer/build.gradle
+++ b/extensions/reindexer/build.gradle
@@ -21,14 +21,14 @@
 jar { manifest { description = "Apache Polygene\u2122 Reindexer Extension" } }
 
 dependencies {
-  compile zest.core.spi
+  compile polygene.core.spi
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'entitystore-jdbm' )
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'entitystore-jdbm' )
+  testCompile polygene.extension( 'indexing-rdf' )
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/reindexer/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/reindexer/dev-status.xml b/extensions/reindexer/dev-status.xml
index 259bfcf..40cdc31 100644
--- a/extensions/reindexer/dev-status.xml
+++ b/extensions/reindexer/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/reindexer/src/docs/reindexer.txt
----------------------------------------------------------------------
diff --git a/extensions/reindexer/src/docs/reindexer.txt b/extensions/reindexer/src/docs/reindexer.txt
index 924eaae..e8f19ed 100644
--- a/extensions/reindexer/src/docs/reindexer.txt
+++ b/extensions/reindexer/src/docs/reindexer.txt
@@ -33,7 +33,7 @@ The `Reindexer` is totally under your control and doesn't kick in automatically
 
 [snippet,java]
 ----
-source=extensions/reindexer/src/test/java/org/apache/zest/index/reindexer/ReindexerTest.java
+source=extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
 tag=assembly
 ----
 
@@ -42,7 +42,7 @@ It will be bound to the `EntityStore` that is Visible, ask for all Entities, by
 
 [snippet,java]
 ----
-source=extensions/reindexer/src/test/java/org/apache/zest/index/reindexer/ReindexerTest.java
+source=extensions/reindexer/src/test/java/org/apache/polygene/index/reindexer/ReindexerTest.java
 tag=usage
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-jackson/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/build.gradle b/extensions/valueserialization-jackson/build.gradle
index 65ba750..156a63e 100644
--- a/extensions/valueserialization-jackson/build.gradle
+++ b/extensions/valueserialization-jackson/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Jackson ValueSerialization Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - ValueSerialization - Jackson" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.jackson_mapper
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-jackson/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/dev-status.xml b/extensions/valueserialization-jackson/dev-status.xml
index ea33ccd..7fa50ff 100644
--- a/extensions/valueserialization-jackson/dev-status.xml
+++ b/extensions/valueserialization-jackson/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>beta</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-jackson/src/docs/vs-jackson.txt
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/docs/vs-jackson.txt b/extensions/valueserialization-jackson/src/docs/vs-jackson.txt
index ee7b4f2..8605125 100644
--- a/extensions/valueserialization-jackson/src/docs/vs-jackson.txt
+++ b/extensions/valueserialization-jackson/src/docs/vs-jackson.txt
@@ -35,7 +35,7 @@ Assembly is done as follows:
 
 [snippet,java]
 ----
-source=extensions/valueserialization-jackson/src/test/java/org/apache/zest/valueserialization/jackson/JacksonPlainValueSerializationTest.java
+source=extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-orgjson/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-orgjson/build.gradle b/extensions/valueserialization-orgjson/build.gradle
index 60dabfb..170fa1a 100644
--- a/extensions/valueserialization-orgjson/build.gradle
+++ b/extensions/valueserialization-orgjson/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 org.json ValueSerialization Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - ValueSerialization - org.json" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-orgjson/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-orgjson/dev-status.xml b/extensions/valueserialization-orgjson/dev-status.xml
index 481fae8..dbb4472 100644
--- a/extensions/valueserialization-orgjson/dev-status.xml
+++ b/extensions/valueserialization-orgjson/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-orgjson/src/docs/vs-orgjson.txt
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-orgjson/src/docs/vs-orgjson.txt b/extensions/valueserialization-orgjson/src/docs/vs-orgjson.txt
index b307f15..bbf50f7 100644
--- a/extensions/valueserialization-orgjson/src/docs/vs-orgjson.txt
+++ b/extensions/valueserialization-orgjson/src/docs/vs-orgjson.txt
@@ -35,7 +35,7 @@ Assembly is done as follows:
 
 [snippet,java]
 ----
-source=extensions/valueserialization-orgjson/src/test/java/org/apache/zest/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
+source=extensions/valueserialization-orgjson/src/test/java/org/apache/polygene/valueserialization/orgjson/OrgJsonPlainValueSerializationTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-stax/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/build.gradle b/extensions/valueserialization-stax/build.gradle
index 0176c27..f2bce54 100644
--- a/extensions/valueserialization-stax/build.gradle
+++ b/extensions/valueserialization-stax/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 StaX ValueSerialization Extension"
 jar { manifest { name = "Apache Polygene\u2122 Extension - ValueSerialization - StaX" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.commons_lang
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-stax/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/dev-status.xml b/extensions/valueserialization-stax/dev-status.xml
index ea33ccd..7fa50ff 100644
--- a/extensions/valueserialization-stax/dev-status.xml
+++ b/extensions/valueserialization-stax/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>beta</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/extensions/valueserialization-stax/src/docs/vs-stax.txt
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/docs/vs-stax.txt b/extensions/valueserialization-stax/src/docs/vs-stax.txt
index b65df68..416caf4 100644
--- a/extensions/valueserialization-stax/src/docs/vs-stax.txt
+++ b/extensions/valueserialization-stax/src/docs/vs-stax.txt
@@ -35,7 +35,7 @@ Assembly is done as follows:
 
 [snippet,java]
 ----
-source=extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxPlainValueSerializationTest.java
+source=extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/alarm/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/alarm/build.gradle b/libraries/alarm/build.gradle
index 597edb3..4afecaf 100644
--- a/libraries/alarm/build.gradle
+++ b/libraries/alarm/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 Alarm Library provides industrial automation s
 jar { manifest { name = "Apache Polygene\u2122 Library - Alarm - APi" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/alarm/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/alarm/dev-status.xml b/libraries/alarm/dev-status.xml
index 2fd37c0..c65f229 100644
--- a/libraries/alarm/dev-status.xml
+++ b/libraries/alarm/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/alarm/src/docs/alarm.txt
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/docs/alarm.txt b/libraries/alarm/src/docs/alarm.txt
index c795261..372adb2 100644
--- a/libraries/alarm/src/docs/alarm.txt
+++ b/libraries/alarm/src/docs/alarm.txt
@@ -76,7 +76,7 @@ provide an _Identity_ of the Alarm, which must survive restarts. The code could
 
 [snippet,java]
 --------------
-source=libraries/alarm/src/test/java/org/apache/zest/library/alarm/AlarmProxyTest.java
+source=libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmProxyTest.java
 tag=documentation
 --------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/circuitbreaker/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/build.gradle b/libraries/circuitbreaker/build.gradle
index 79bcb79..31112b5 100644
--- a/libraries/circuitbreaker/build.gradle
+++ b/libraries/circuitbreaker/build.gradle
@@ -24,12 +24,12 @@ description = "Apache Polygene\u2122 Circuit Breaker Library provides a framework f
 jar { manifest { name = "Apache Polygene\u2122 Library - Circuit Breaker" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'jmx' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'jmx' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.awaitility
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/circuitbreaker/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/dev-status.xml b/libraries/circuitbreaker/dev-status.xml
index 8992f31..b59299c 100644
--- a/libraries/circuitbreaker/dev-status.xml
+++ b/libraries/circuitbreaker/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
     <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/circuitbreaker/src/docs/circuitbreaker.txt
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/docs/circuitbreaker.txt b/libraries/circuitbreaker/src/docs/circuitbreaker.txt
index b67e083..91d9df9 100644
--- a/libraries/circuitbreaker/src/docs/circuitbreaker.txt
+++ b/libraries/circuitbreaker/src/docs/circuitbreaker.txt
@@ -70,7 +70,7 @@ Here is a code snippet that demonstrate how to create a CircuitBreaker and how i
 
 [snippet,java]
 ----
-source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/CircuitBreakerTest.java
+source=libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/CircuitBreakerTest.java
 tag=direct
 ----
 
@@ -88,7 +88,7 @@ Here is how to declare such a Service:
 
 [snippet,java]
 ----
-source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
+source=libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
 tag=service
 ----
 
@@ -106,7 +106,7 @@ Here is how it goes:
 
 [snippet,java]
 ----
-source=libraries/circuitbreaker/src/test/java/org/apache/zest/library/circuitbreaker/jmx/CircuitBreakerManagementSample.java
+source=libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/jmx/CircuitBreakerManagementSample.java
 tag=jmx
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/constraints/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/constraints/build.gradle b/libraries/constraints/build.gradle
index a1ca1d4..3c125e0 100644
--- a/libraries/constraints/build.gradle
+++ b/libraries/constraints/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 Constraint Library provides common set of cons
 jar { manifest { name = "Apache Polygene\u2122 Library - Constraints"}}
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/constraints/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/constraints/dev-status.xml b/libraries/constraints/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/constraints/dev-status.xml
+++ b/libraries/constraints/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/constraints/src/docs/constraints.txt
----------------------------------------------------------------------
diff --git a/libraries/constraints/src/docs/constraints.txt b/libraries/constraints/src/docs/constraints.txt
index c37f839..aa5a1a3 100644
--- a/libraries/constraints/src/docs/constraints.txt
+++ b/libraries/constraints/src/docs/constraints.txt
@@ -41,7 +41,7 @@ Here are some examples:
 
 [snippet,java]
 ----
-source=libraries/constraints/src/test/java/org/apache/zest/library/constraints/TestCaseComposite.java
+source=libraries/constraints/src/test/java/org/apache/polygene/library/constraints/TestCaseComposite.java
 tag=constraints
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/fileconfig/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/build.gradle b/libraries/fileconfig/build.gradle
index 69291ac..11899a9 100644
--- a/libraries/fileconfig/build.gradle
+++ b/libraries/fileconfig/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 File Configuration Library provides platform s
 jar { manifest { name = "Apache Polygene\u2122 Library - FileConfig" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/fileconfig/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/dev-status.xml b/libraries/fileconfig/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/fileconfig/dev-status.xml
+++ b/libraries/fileconfig/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/fileconfig/src/docs/fileconfig.txt
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/src/docs/fileconfig.txt b/libraries/fileconfig/src/docs/fileconfig.txt
index 4a6f523..437c972 100644
--- a/libraries/fileconfig/src/docs/fileconfig.txt
+++ b/libraries/fileconfig/src/docs/fileconfig.txt
@@ -35,7 +35,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
 
 [snippet,java]
 ----
-source=libraries/fileconfig/src/main/java/org/apache/zest/library/fileconfig/FileConfiguration.java
+source=libraries/fileconfig/src/main/java/org/apache/polygene/library/fileconfig/FileConfiguration.java
 tag=fileconfig
 ----
 
@@ -43,7 +43,7 @@ To use it you simply need to use the FileConfigurationAssembler in your applicat
 
 [snippet,java]
 ----
-source=libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
+source=libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
 tag=simple
 ----
 
@@ -57,7 +57,7 @@ as meta info of this service:
 
 [snippet,java]
 ----
-source=libraries/fileconfig/src/test/java/org/apache/zest/library/fileconfig/FileConfigurationTest.java
+source=libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
 tag=override
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/http/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/http/build.gradle b/libraries/http/build.gradle
index d84a985..fb7b4ec 100644
--- a/libraries/http/build.gradle
+++ b/libraries/http/build.gradle
@@ -23,16 +23,16 @@ description = "Apache Polygene\u2122 Http Library provides embedded Jetty for Apach
 jar { manifest { name = "Apache Polygene\u2122 Library - Http" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'jmx' )
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'jmx' )
+  compile polygene.library( 'constraints' )
   compile libraries.bouncy_castle
   compile libraries.jetty_webapp
   compile libraries.jetty_jmx
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.http_client
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/http/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/http/dev-status.xml b/libraries/http/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/http/dev-status.xml
+++ b/libraries/http/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/http/src/docs/http.txt
----------------------------------------------------------------------
diff --git a/libraries/http/src/docs/http.txt b/libraries/http/src/docs/http.txt
index 5e4ec22..0856fa3 100644
--- a/libraries/http/src/docs/http.txt
+++ b/libraries/http/src/docs/http.txt
@@ -39,7 +39,7 @@ EventListeners in HttpService are assembled as Services, so one have to declare
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/FooServletContextListenerService.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/FooServletContextListenerService.java
 tag=context-listener
 ----
 
@@ -49,7 +49,7 @@ Servlets in HttpService are assembled as Services, so one have to declare a Serv
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/HelloWorldServletService.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/HelloWorldServletService.java
 tag=servletservice
 ----
 
@@ -59,7 +59,7 @@ It's the same for Filters. As an example here is the bundled UnitOfWorkFilterSer
 
 [snippet,java]
 ----
-source=libraries/http/src/main/java/org/apache/zest/library/http/UnitOfWorkFilterService.java
+source=libraries/http/src/main/java/org/apache/polygene/library/http/UnitOfWorkFilterService.java
 tag=filterservice
 ----
 
@@ -71,7 +71,7 @@ The HTTP library provide a JettyServiceAssembler and a fluent API to easily asse
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/JettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/JettyServiceTest.java
 tag=assembly
 ----
 
@@ -84,7 +84,7 @@ Module for the sake of clarity:
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/JettyJMXStatisticsTest.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java
 tag=jmx
 ----
 
@@ -106,7 +106,7 @@ Simply change from JettyServiceAssembler to SecureJettyServiceAssembler:
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/SecureJettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/SecureJettyServiceTest.java
 tag=assemblyssl
 ----
 
@@ -123,7 +123,7 @@ SecureJettyConfiguration default during assembly:
 
 [snippet,java]
 ----
-source=libraries/http/src/test/java/org/apache/zest/library/http/MutualSecureJettyServiceTest.java
+source=libraries/http/src/test/java/org/apache/polygene/library/http/MutualSecureJettyServiceTest.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/invocation-cache/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/invocation-cache/build.gradle b/libraries/invocation-cache/build.gradle
index 1d86bba..317d41f 100644
--- a/libraries/invocation-cache/build.gradle
+++ b/libraries/invocation-cache/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Invocation Cache Library provides caching fram
 jar { manifest { name = "Apache Polygene\u2122 Library - Invocation Cache" } }
 
 dependencies {
-  compile zest.core.api
-  compile zest.library( 'jmx' )
+  compile polygene.core.api
+  compile polygene.library( 'jmx' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/invocation-cache/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/invocation-cache/dev-status.xml b/libraries/invocation-cache/dev-status.xml
index aceb724..fd9e5a4 100644
--- a/libraries/invocation-cache/dev-status.xml
+++ b/libraries/invocation-cache/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/invocation-cache/src/docs/invocation-cache.txt
----------------------------------------------------------------------
diff --git a/libraries/invocation-cache/src/docs/invocation-cache.txt b/libraries/invocation-cache/src/docs/invocation-cache.txt
index c46581a..edb6ed2 100644
--- a/libraries/invocation-cache/src/docs/invocation-cache.txt
+++ b/libraries/invocation-cache/src/docs/invocation-cache.txt
@@ -63,7 +63,7 @@ Let's say that we have some service that is very expensive to call.
 
 [snippet,java]
 ----
-source=libraries/invocation-cache/src/test/java/org/apache/zest/library/invocationcache/DocumentationSupport.java
+source=libraries/invocation-cache/src/test/java/org/apache/polygene/library/invocationcache/DocumentationSupport.java
 tag=composite
 ----
 
@@ -73,7 +73,7 @@ provided.
 
 [snippet,java]
 ----
-source=libraries/invocation-cache/src/test/java/org/apache/zest/library/invocationcache/DocumentationSupport.java
+source=libraries/invocation-cache/src/test/java/org/apache/polygene/library/invocationcache/DocumentationSupport.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/jmx/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/jmx/build.gradle b/libraries/jmx/build.gradle
index 4bc21b9..3f7543d 100644
--- a/libraries/jmx/build.gradle
+++ b/libraries/jmx/build.gradle
@@ -25,12 +25,12 @@ description = "Apache Polygene\u2122 JMX Library provides Java Management Extension
 jar { manifest { name = "Apache Polygene\u2122 Library - JMX" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/jmx/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/jmx/dev-status.xml b/libraries/jmx/dev-status.xml
index 58aa498..97fd7ff 100644
--- a/libraries/jmx/dev-status.xml
+++ b/libraries/jmx/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/jmx/src/docs/jmx.txt
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/docs/jmx.txt b/libraries/jmx/src/docs/jmx.txt
index 62eb4f2..7817d72 100644
--- a/libraries/jmx/src/docs/jmx.txt
+++ b/libraries/jmx/src/docs/jmx.txt
@@ -45,7 +45,7 @@ JMX Support for Polygene\u2122 applications:
 
 [snippet,java]
 ----
-source=libraries/jmx/src/test/java/org/apache/zest/library/jmx/JMXTest.java
+source=libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
 tag=assembly
 ----
 
@@ -53,6 +53,6 @@ Managing the MX Beans Server from your Polygene\u2122 application using the `JMXCon
 
 [snippet,java]
 ----
-source=libraries/jmx/src/test/java/org/apache/zest/library/jmx/JMXTest.java
+source=libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
 tag=connector
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-groovy/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/build.gradle b/libraries/lang-groovy/build.gradle
index 867b4ad..640f708 100644
--- a/libraries/lang-groovy/build.gradle
+++ b/libraries/lang-groovy/build.gradle
@@ -25,12 +25,12 @@ jar { manifest { name = "Apache Polygene\u2122 Library - Scripting - Groovy" } }
 apply plugin: 'groovy'
 
 dependencies {
-  compile zest.core.api
+  compile polygene.core.api
   compile libraries.groovy
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-groovy/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/dev-status.xml b/libraries/lang-groovy/dev-status.xml
index cfdfa90..a8d21fc 100644
--- a/libraries/lang-groovy/dev-status.xml
+++ b/libraries/lang-groovy/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-groovy/src/docs/lang-groovy.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/docs/lang-groovy.txt b/libraries/lang-groovy/src/docs/lang-groovy.txt
index 178cb5f..029f241 100644
--- a/libraries/lang-groovy/src/docs/lang-groovy.txt
+++ b/libraries/lang-groovy/src/docs/lang-groovy.txt
@@ -38,7 +38,7 @@ All examples below are based on this type:
 
 [snippet,java]
 ----
-source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeaker.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeaker.java
 tag=speaker
 ----
 
@@ -52,7 +52,7 @@ Having this Groovy class compiled ;
 .HelloSpeakerMixin.groovy
 [snippet,groovy]
 ----
-source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerMixin.groovy
+source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerMixin.groovy
 tag=direct
 ----
 
@@ -60,7 +60,7 @@ assemble it directly:
 
 [snippet,java]
 ----
-source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerTest.java
 tag=direct
 ----
 
@@ -72,7 +72,7 @@ Declare a Groovy class in a classpath resource file located in the same package
 .HelloSpeaker.groovy
 [snippet,groovy]
 ----
-source=libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.groovy
+source=libraries/lang-groovy/src/test/resources/org/apache/polygene/library/groovy/HelloSpeaker.groovy
 tag=script
 ----
 
@@ -80,7 +80,7 @@ Then assemble it with the +GroovyMixin+:
 
 [snippet,java]
 ----
-source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerTest.java
 tag=script
 ----
 
@@ -94,7 +94,7 @@ Implement single composites methods, each in a classpath resource file located i
 .HelloSpeaker.sayHello.groovy
 [snippet,groovy]
 ----
-source=libraries/lang-groovy/src/test/resources/org/apache/zest/library/groovy/HelloSpeaker.sayHello.groovy
+source=libraries/lang-groovy/src/test/resources/org/apache/polygene/library/groovy/HelloSpeaker.sayHello.groovy
 tag=script
 ----
 
@@ -102,7 +102,7 @@ Then assemble it with the +GroovyMixin+:
 
 [snippet,java]
 ----
-source=libraries/lang-groovy/src/test/groovy/org/apache/zest/library/groovy/HelloSpeakerTest.java
+source=libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/HelloSpeakerTest.java
 tag=script
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-javascript/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/build.gradle b/libraries/lang-javascript/build.gradle
index 7c99eff..eee1a59 100644
--- a/libraries/lang-javascript/build.gradle
+++ b/libraries/lang-javascript/build.gradle
@@ -24,13 +24,13 @@ jar { manifest { name = "Apache Polygene\u2122 Library - Scripting - JavaScript" }
 
 
 dependencies {
-  compile zest.core.api
-  compile zest.library( 'scripting' )
+  compile polygene.core.api
+  compile polygene.library( 'scripting' )
   compile libraries.javascript
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-javascript/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/dev-status.xml b/libraries/lang-javascript/dev-status.xml
index ceee3a0..7a96a31 100644
--- a/libraries/lang-javascript/dev-status.xml
+++ b/libraries/lang-javascript/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/lang-javascript/src/docs/lang-javascript.txt
----------------------------------------------------------------------
diff --git a/libraries/lang-javascript/src/docs/lang-javascript.txt b/libraries/lang-javascript/src/docs/lang-javascript.txt
index 542b64c..d50fda5 100644
--- a/libraries/lang-javascript/src/docs/lang-javascript.txt
+++ b/libraries/lang-javascript/src/docs/lang-javascript.txt
@@ -37,7 +37,7 @@ includes the package, and has "." replaced with "/".
 
 Example: 
 
-    org/apache/zest/samples/hello/domain/HelloWorldSpeaker.say.js
+    org/apache/polygene/samples/hello/domain/HelloWorldSpeaker.say.js
 
 That means that the HelloWorldSpeaker.say.js file may be co-located with the 
 class files in the same package. It is currently not supported to place the 
@@ -50,6 +50,6 @@ interface or at assembly time.
 
 [snippet,java]
 ----
-source=libraries/lang-javascript/src/test/java/org/apache/zest/library/javascript/HelloSpeaker.java
+source=libraries/lang-javascript/src/test/java/org/apache/polygene/library/javascript/HelloSpeaker.java
 tag=mixin
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/locking/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/locking/build.gradle b/libraries/locking/build.gradle
index 321c4f5..eda2aa0 100644
--- a/libraries/locking/build.gradle
+++ b/libraries/locking/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 Locking Library provides lock management for m
 jar { manifest { name = "Apache Polygene\u2122 Library - Locking" } }
 
 dependencies {
-  compile zest.core.api
+  compile polygene.core.api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/locking/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/locking/dev-status.xml b/libraries/locking/dev-status.xml
index 58aa498..97fd7ff 100644
--- a/libraries/locking/dev-status.xml
+++ b/libraries/locking/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/locking/src/docs/locking.txt
----------------------------------------------------------------------
diff --git a/libraries/locking/src/docs/locking.txt b/libraries/locking/src/docs/locking.txt
index bebce16..9e100b9 100644
--- a/libraries/locking/src/docs/locking.txt
+++ b/libraries/locking/src/docs/locking.txt
@@ -61,7 +61,7 @@ or apply it during assembly, in case that is the only choice (such as existing/e
 
 [snippet,java]
 ----
-source=libraries/locking/src/test/java/org/apache/zest/library/locking/DocumentationSupport.java
+source=libraries/locking/src/test/java/org/apache/polygene/library/locking/DocumentationSupport.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/logging/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/logging/build.gradle b/libraries/logging/build.gradle
index 19a015f..b985f05 100644
--- a/libraries/logging/build.gradle
+++ b/libraries/logging/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 Logging Library provides an advanced logging f
 jar { manifest { name = "Apache Polygene\u2122 Library - Logging" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'constraints' )
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'indexing-rdf' )
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/logging/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/logging/dev-status.xml b/libraries/logging/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/logging/dev-status.xml
+++ b/libraries/logging/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/logging/src/docs/logging.txt
----------------------------------------------------------------------
diff --git a/libraries/logging/src/docs/logging.txt b/libraries/logging/src/docs/logging.txt
index 1cb9074..3fc862f 100644
--- a/libraries/logging/src/docs/logging.txt
+++ b/libraries/logging/src/docs/logging.txt
@@ -61,7 +61,7 @@ To produce debugging output in your code you just need to add the field
 
 [snippet,java]
 -----------
-source=libraries/logging/src/test/java/org/apache/zest/library/logging/docsupport/LoggingDocs.java
+source=libraries/logging/src/test/java/org/apache/polygene/library/logging/docsupport/LoggingDocs.java
 tag=logging1
 -----------
 
@@ -69,7 +69,7 @@ and then check for null at each usage
 
 [snippet,java]
 -----------
-source=libraries/logging/src/test/java/org/apache/zest/library/logging/docsupport/LoggingDocs.java
+source=libraries/logging/src/test/java/org/apache/polygene/library/logging/docsupport/LoggingDocs.java
 tag=logging2
 -----------
 
@@ -93,7 +93,7 @@ interface or the mixin implementation. You will also need to add the TraceConcer
 
 [snippet,java]
 -----------
-source=libraries/logging/src/test/java/org/apache/zest/library/logging/docsupport/LoggingDocs.java
+source=libraries/logging/src/test/java/org/apache/polygene/library/logging/docsupport/LoggingDocs.java
 tag=logging3
 -----------
 
@@ -110,6 +110,6 @@ sideeffects and mixins to composites during the bootstrap phase instead of hard-
 
 [snippet,java]
 -----------
-source=libraries/logging/src/test/java/org/apache/zest/library/logging/docsupport/LoggingDocs.java
+source=libraries/logging/src/test/java/org/apache/polygene/library/logging/docsupport/LoggingDocs.java
 tag=logging4
 -----------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/metrics/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/metrics/build.gradle b/libraries/metrics/build.gradle
index ed46966..bd32c34 100644
--- a/libraries/metrics/build.gradle
+++ b/libraries/metrics/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Metrics Library."
 jar { manifest { name = "Apache Polygene\u2122 Library - Metrics" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'metrics-codahale' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'metrics-codahale' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/metrics/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/metrics/dev-status.xml b/libraries/metrics/dev-status.xml
index 778e6b6..aeeb8e4 100644
--- a/libraries/metrics/dev-status.xml
+++ b/libraries/metrics/dev-status.xml
@@ -19,10 +19,10 @@
   ~
   -->
 
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/metrics/src/docs/metrics.txt
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/docs/metrics.txt b/libraries/metrics/src/docs/metrics.txt
index d76f476..d4b0f57 100644
--- a/libraries/metrics/src/docs/metrics.txt
+++ b/libraries/metrics/src/docs/metrics.txt
@@ -50,7 +50,7 @@ Example;
 
 [snippet,java]
 ----
-source=libraries/metrics/src/test/java/org/apache/zest/library/metrics/DocumentationSupport.java
+source=libraries/metrics/src/test/java/org/apache/polygene/library/metrics/DocumentationSupport.java
 tag=capture
 ----
 
@@ -60,7 +60,7 @@ Any of the method declarations should work. From the testcases we have the follo
 
 [snippet,java]
 ----
-source=libraries/metrics/src/test/java/org/apache/zest/library/metrics/AbstractTimingCaptureTest.java
+source=libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
 tag=complex-capture
 ----
 


[32/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/Query.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/Query.java b/core/api/src/main/java/org/apache/zest/api/query/Query.java
deleted file mode 100644
index 4e985b8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/Query.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-import java.io.Serializable;
-import java.util.stream.Stream;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.query.grammar.OrderBy;
-
-/**
- * This represents a Query in an indexing system. It is created from a
- * {@link QueryBuilder}, which decides the "where" clause in the query.
- * <p>
- * Additional limitations, such as paging, ordering, and variables, can be set on
- * a Query before it is executed by calling one of find(), iterator(),
- * or count().
- * </p>
- * <p>
- * DDD tip: typically Queries are created in the Domain Model and passed to the UI,
- * which sets the order and paging before executing it.
- * </p>
- */
-public interface Query<T>
-    extends Iterable<T>, Serializable
-{
-    /**
-     * Set the ordering rules. If many segments are used for ordering
-     * then they will be applied in order.
-     *
-     * @param segments the segments to order by
-     *
-     * @return the Query
-     */
-    Query<T> orderBy( OrderBy... segments );
-
-    /**
-     * Append an ordering rule to the existing segments.
-     *
-     * @param property the property to order by
-     * @param order the order to apply
-     *
-     * @return the Query
-     */
-    Query<T> orderBy( final Property<?> property, final OrderBy.Order order );
-
-    /**
-     * Append an ascending ordering rule to the existing segments.
-     *
-     * @param property the property to order by
-     *
-     * @return the Query
-     */
-    Query<T> orderBy( Property<?> property );
-
-    /**
-     * Set the index of the first result. Default is 0 (zero).
-     *
-     * @param firstResult which index to use as the first one
-     *
-     * @return the Query
-     */
-    Query<T> firstResult( int firstResult );
-
-    /**
-     * Set how many results should be returned. Default is that
-     * there is no limit set.
-     *
-     * @param maxResults that shouldbe returned
-     *
-     * @return the query
-     */
-    Query<T> maxResults( int maxResults );
-
-    /**
-     * Get the first Entity that matches the criteria. This
-     * executes the Query.
-     *
-     * @return the first found Entity or null if none were found
-     *
-     * @throws QueryExecutionException if the query fails
-     */
-    T find()
-        throws QueryExecutionException;
-
-    /**
-     * Set the value of a named variable.
-     *
-     * @param name  of the variable
-     * @param value of the variable
-     *
-     * @return the query
-     */
-    Query<T> setVariable( String name, Object value );
-
-    /**
-     * Get the value of a named variable.
-     *
-     * @param name of the variable
-     *
-     * @return value of the variable
-     */
-    <V> V getVariable( String name );
-
-    /**
-     * Get the result type of this Query
-     *
-     * @return the result type
-     */
-    Class<T> resultType();
-
-    /**
-     * Count how many results would be returned by this Query.
-     * This executes the Query.
-     *
-     * @return result count
-     *
-     * @throws QueryExecutionException if the query fails
-     */
-    long count()
-        throws QueryExecutionException;
-
-    /**
-     * @return Stream results
-     */
-    Stream<T> stream();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
deleted file mode 100644
index 7baed9b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilder.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * QueryBuilders are used to create {@link Query} instances.
- * Iteratively add where() clauses to the query, and then use
- * {@link org.apache.zest.api.unitofwork.UnitOfWork#newQuery(QueryBuilder)}  to instantiate the Query.
- * QueryBuilders are immutable, so when adding new where-clauses you get new instances. This
- *
- * DDD tip: Query objects are not executed immediately, so they
- * should be constructed in the domain model and handed over to
- * the UI, which can then further constrain it before actual
- * execution.
- */
-public interface QueryBuilder<T>
-{
-    /**
-     * Add a where-clause to the Query. Use {@link QueryExpressions}
-     * to create the expression.
-     *
-     * @param specification the where clause
-     *
-     * @return a new builder with the added where-clause
-     */
-    QueryBuilder<T> where( Predicate<Composite> specification );
-
-    /**
-     * Create a new query with the declared where-clauses that will be evaluated against the iterable entries.
-     *
-     * @param iterable collection of objects (composites?)
-     *
-     * @return a new Query instance
-     */
-    Query<T> newQuery( Iterable<T> iterable );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java b/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java
deleted file mode 100644
index 6aad9a3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryBuilderFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-/**
- * This is used to create QueryBuilders.
- *
- * @see QueryBuilder
- */
-public interface QueryBuilderFactory
-{
-    /**
-     * Create a new QueryBuilder.
-     *
-     * @param resultType the type of the result that you want
-     *
-     * @return a QueryBuilder
-     *
-     * @throws MissingIndexingSystemException if there is no EntityFinder service available
-     */
-    <T> QueryBuilder<T> newQueryBuilder( Class<T> resultType )
-        throws MissingIndexingSystemException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryException.java
deleted file mode 100644
index fe27b54..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-/**
- * Base class for Query exceptions.
- */
-public abstract class QueryException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = -3602596752342902060L;
-
-    public QueryException()
-    {
-    }
-
-    public QueryException( final String message )
-    {
-        super( message );
-    }
-
-    public QueryException( final String message, final Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java
deleted file mode 100644
index 1360717..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryExecutionException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-/**
- * Throw this exception if a query could not be executed
- */
-public final class QueryExecutionException
-    extends QueryException
-{
-    private static final long serialVersionUID = 5147421865890379209L;
-
-    public QueryExecutionException( String message )
-    {
-        super( message );
-    }
-
-    public QueryExecutionException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java
deleted file mode 100644
index 4589915..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressionException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-/**
- * Throw this exception if a QueryExpression is invalid.
- */
-public class QueryExpressionException
-    extends QueryException
-{
-
-    private static final long serialVersionUID = 1L;
-
-    public QueryExpressionException( String message )
-    {
-        super( message );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java b/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
deleted file mode 100644
index ffd29eb..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/QueryExpressions.java
+++ /dev/null
@@ -1,940 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.function.Predicate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.injection.scope.State;
-import org.apache.zest.api.property.GenericPropertyInfo;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.query.grammar.AndPredicate;
-import org.apache.zest.api.query.grammar.AssociationFunction;
-import org.apache.zest.api.query.grammar.AssociationNotNullPredicate;
-import org.apache.zest.api.query.grammar.AssociationNullPredicate;
-import org.apache.zest.api.query.grammar.ContainsAllPredicate;
-import org.apache.zest.api.query.grammar.ContainsPredicate;
-import org.apache.zest.api.query.grammar.EqPredicate;
-import org.apache.zest.api.query.grammar.GePredicate;
-import org.apache.zest.api.query.grammar.GtPredicate;
-import org.apache.zest.api.query.grammar.LePredicate;
-import org.apache.zest.api.query.grammar.LtPredicate;
-import org.apache.zest.api.query.grammar.ManyAssociationContainsPredicate;
-import org.apache.zest.api.query.grammar.ManyAssociationFunction;
-import org.apache.zest.api.query.grammar.MatchesPredicate;
-import org.apache.zest.api.query.grammar.NamedAssociationContainsNamePredicate;
-import org.apache.zest.api.query.grammar.NamedAssociationContainsPredicate;
-import org.apache.zest.api.query.grammar.NamedAssociationFunction;
-import org.apache.zest.api.query.grammar.NePredicate;
-import org.apache.zest.api.query.grammar.Notpredicate;
-import org.apache.zest.api.query.grammar.OrPredicate;
-import org.apache.zest.api.query.grammar.OrderBy;
-import org.apache.zest.api.query.grammar.PropertyFunction;
-import org.apache.zest.api.query.grammar.PropertyNotNullPredicate;
-import org.apache.zest.api.query.grammar.PropertyNullPredicate;
-import org.apache.zest.api.query.grammar.PropertyReference;
-import org.apache.zest.api.query.grammar.Variable;
-import org.apache.zest.api.util.NullArgumentException;
-
-import static org.apache.zest.api.identity.HasIdentity.IDENTITY_METHOD;
-
-/**
- * Static factory methods for query expressions and operators.
- */
-public final class QueryExpressions
-{
-    // This is used for eq(Association,Composite)
-
-    // Templates and variables -----------------------------------------------|
-
-    /**
-     * Create a Query Template using the given type.
-     *
-     * @param <T> the type of the template
-     * @param clazz a class declaring the type of the template
-     *
-     * @return a new Query Template
-     */
-    public static <T> T templateFor( Class<T> clazz )
-    {
-        NullArgumentException.validateNotNull( "Template class", clazz );
-
-        if( clazz.isInterface() )
-        {
-            return clazz.cast( Proxy.newProxyInstance( clazz.getClassLoader(),
-                                                       array( clazz ),
-                                                       new TemplateHandler<T>( null, null, null, null ) ) );
-        }
-        else
-        {
-            try
-            {
-                T mixin = clazz.newInstance();
-                for( Field field : clazz.getFields() )
-                {
-                    if( field.getAnnotation( State.class ) != null )
-                    {
-                        if( field.getType().equals( Property.class ) )
-                        {
-                            field.set( mixin,
-                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
-                                                               array( field.getType() ),
-                                                               new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) ) );
-                        }
-                        else if( field.getType().equals( Association.class ) )
-                        {
-                            field.set( mixin,
-                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
-                                                               array( field.getType() ),
-                                                               new AssociationReferenceHandler<>( new AssociationFunction<T>( null, null, null, field ) ) ) );
-                        }
-                        else if( field.getType().equals( ManyAssociation.class ) )
-                        {
-                            field.set( mixin,
-                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
-                                                               array( field.getType() ),
-                                                               new ManyAssociationReferenceHandler<>( new ManyAssociationFunction<T>( null, null, null, field ) ) ) );
-                        }
-                        else if( field.getType().equals( NamedAssociation.class ) )
-                        {
-                            field.set( mixin,
-                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
-                                                               array( field.getType() ),
-                                                               new NamedAssociationReferenceHandler<>( new NamedAssociationFunction<T>( null, null, null, field ) ) ) );
-                        }
-                    }
-                }
-                return mixin;
-            }
-            catch( IllegalAccessException | IllegalArgumentException | InstantiationException | SecurityException e )
-            {
-                throw new IllegalArgumentException( "Cannot use class as template", e );
-            }
-        }
-    }
-
-    /**
-     * Create a Query Template using the given mixin class and association.
-     *
-     * @param <T> the type of the template
-     * @param mixinType  a class declaring the type of the template
-     * @param association an association
-     *
-     * @return a new Query Template
-     */
-    public static <T> T templateFor( final Class<T> mixinType, Association<?> association )
-    {
-        NullArgumentException.validateNotNull( "Mixin class", mixinType );
-        NullArgumentException.validateNotNull( "Association", association );
-        return mixinType.cast( Proxy.newProxyInstance( mixinType.getClassLoader(),
-                                                       array( mixinType ),
-                                                       new TemplateHandler<T>( null,
-                                                                               association( association ),
-                                                                               null,
-                                                                               null ) ) );
-    }
-
-    public static <T> T oneOf( final ManyAssociation<T> association )
-    {
-        NullArgumentException.validateNotNull( "Association", association );
-        return association.get( 0 );
-    }
-
-    public static <T> T oneOf( final NamedAssociation<T> association )
-    {
-        NullArgumentException.validateNotNull( "Association", association );
-        Iterator<String> iterator = association.iterator();
-        return association.get( iterator.hasNext() ? iterator.next() : null );
-    }
-
-    /**
-     * Create a new Query Variable.
-     *
-     * @param name a name for the Variable
-     *
-     * @return a new Query Variable.
-     */
-    public static Variable variable( String name )
-    {
-        NullArgumentException.validateNotNull( "Variable name", name );
-        return new Variable( name );
-    }
-
-    /**
-     * Create a new Query Template PropertyFunction.
-     *
-     * @param <T> type of the Property
-     * @param property a Property
-     *
-     * @return a new Query Template PropertyFunction
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> PropertyFunction<T> property( Property<T> property )
-    {
-        return ( (PropertyReferenceHandler<T>) Proxy.getInvocationHandler( property ) ).property();
-    }
-
-    /**
-     * Create a new Query Property instance.
-     *
-     * @param <T> type of the Property
-     * @param mixinClass mixin of the Property
-     * @param fieldName name of the Property field
-     *
-     * @return a new Query Property instance for the given mixin and property name.
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> Property<T> property( Class<?> mixinClass, String fieldName )
-    {
-        try
-        {
-            Field field = mixinClass.getField( fieldName );
-            if( !Property.class.isAssignableFrom( field.getType() ) )
-            {
-                throw new IllegalArgumentException( "Field must be of type Property<?>" );
-            }
-            return (Property<T>) Proxy.newProxyInstance(
-                mixinClass.getClassLoader(),
-                array( field.getType() ),
-                new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) );
-        }
-        catch( NoSuchFieldException e )
-        {
-            throw new IllegalArgumentException( "No such field '" + fieldName + "' in mixin " + mixinClass.getName() );
-        }
-    }
-
-    /**
-     * Create a new Query Template AssociationFunction.
-     *
-     * @param <T> type of the Association
-     * @param association an Association
-     *
-     * @return a new Query Template AssociationFunction
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> AssociationFunction<T> association( Association<T> association )
-    {
-        return ( (AssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).association();
-    }
-
-    /**
-     * Create a new Query Template ManyAssociationFunction.
-     *
-     * @param <T> type of the ManyAssociation
-     * @param association a ManyAssociation
-     *
-     * @return a new Query Template ManyAssociationFunction
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> ManyAssociationFunction<T> manyAssociation( ManyAssociation<T> association )
-    {
-        return ( (ManyAssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).manyAssociation();
-    }
-
-    /**
-     * Create a new Query Template NamedAssociationFunction.
-     *
-     * @param <T> type of the NamedAssociation
-     * @param association a NamedAssociation
-     *
-     * @return a new Query Template NamedAssociationFunction
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> NamedAssociationFunction<T> namedAssociation( NamedAssociation<T> association )
-    {
-        return ( (NamedAssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).namedAssociation();
-    }
-
-    // And/Or/Not ------------------------------------------------------------|
-    /**
-     * Create a new AND specification.
-     *
-     * @param left first operand
-     * @param right second operand
-     * @param optionalRight optional operands
-     *
-     * @return a new AND specification
-     */
-    @SafeVarargs
-    public static AndPredicate and( Predicate<Composite> left,
-                                    Predicate<Composite> right,
-                                    Predicate<Composite>... optionalRight
-    )
-    {
-        List<Predicate<Composite>> predicates = new ArrayList<>( 2 + optionalRight.length );
-        predicates.add( left );
-        predicates.add( right );
-        Collections.addAll( predicates, optionalRight );
-        return new AndPredicate( predicates );
-    }
-
-    /**
-     * Create a new OR specification.
-     *
-     * @param specs operands
-     *
-     * @return a new OR specification
-     */
-    @SafeVarargs
-    public static OrPredicate or( Predicate<Composite>... specs )
-    {
-        return new OrPredicate( Arrays.asList( specs ) );
-    }
-
-    /**
-     * Create a new NOT specification.
-     *
-     * @param operand specification to be negated
-     *
-     * @return a new NOT specification
-     */
-    public static Notpredicate not( Predicate<Composite> operand )
-    {
-        return new Notpredicate( operand );
-    }
-
-    // Comparisons -----------------------------------------------------------|
-
-    /**
-     * Create a new EQUALS specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new EQUALS specification for a Property.
-     */
-    public static <T> EqPredicate<T> eq( Property<T> property, T value )
-    {
-        return new EqPredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new EQUALS specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new EQUALS specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> EqPredicate<T> eq( Property<T> property, Variable variable )
-    {
-        return new EqPredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new EQUALS specification for an Association.
-     *
-     * @param association an Association
-     * @param value its value
-     *
-     * @return a new EQUALS specification for an Association.
-     */
-    public static <T> EqPredicate<Identity> eq( Association<T> association, T value )
-    {
-        return new EqPredicate<>(
-                new PropertyFunction<>(
-                        null,
-                        association(association),
-                        null,
-                        null,
-                        IDENTITY_METHOD),
-                ((HasIdentity) value).identity().get());
-    }
-
-    /**
-     * Create a new GREATER OR EQUALS specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new GREATER OR EQUALS specification for a Property.
-     */
-    public static <T> GePredicate<T> ge( Property<T> property, T value )
-    {
-        return new GePredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new GREATER OR EQUALS specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new GREATER OR EQUALS specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> GePredicate<T> ge( Property<T> property, Variable variable )
-    {
-        return new GePredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new GREATER THAN specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new GREATER THAN specification for a Property.
-     */
-    public static <T> GtPredicate<T> gt( Property<T> property, T value )
-    {
-        return new GtPredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new GREATER THAN specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new GREATER THAN specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> GtPredicate<T> gt( Property<T> property, Variable variable )
-    {
-        return new GtPredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new LESS OR EQUALS specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new LESS OR EQUALS specification for a Property.
-     */
-    public static <T> LePredicate<T> le( Property<T> property, T value )
-    {
-        return new LePredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new LESS OR EQUALS specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new LESS OR EQUALS specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> LePredicate<T> le( Property<T> property, Variable variable )
-    {
-        return new LePredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new LESSER THAN specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new LESSER THAN specification for a Property.
-     */
-    public static <T> LtPredicate<T> lt( Property<T> property, T value )
-    {
-        return new LtPredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new LESSER THAN specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new LESSER THAN specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> LtPredicate<T> lt( Property<T> property, Variable variable )
-    {
-        return new LtPredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new NOT EQUALS specification for a Property.
-     *
-     * @param property a Property
-     * @param value its value
-     *
-     * @return a new NOT EQUALS specification for a Property.
-     */
-    public static <T> NePredicate<T> ne( Property<T> property, T value )
-    {
-        return new NePredicate<>( property( property ), value );
-    }
-
-    /**
-     * Create a new NOT EQUALS specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new NOT EQUALS specification for a Property using a named Variable.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> NePredicate<T> ne( Property<T> property, Variable variable )
-    {
-        return new NePredicate( property( property ), variable );
-    }
-
-    /**
-     * Create a new REGULAR EXPRESSION specification for a Property.
-     *
-     * @param property a Property
-     * @param regexp its value
-     *
-     * @return a new REGULAR EXPRESSION specification for a Property.
-     */
-    public static MatchesPredicate matches( Property<String> property, String regexp )
-    {
-        return new MatchesPredicate( property( property ), regexp );
-    }
-
-    /**
-     * Create a new REGULAR EXPRESSION specification for a Property using a named Variable.
-     *
-     * @param property a Property
-     * @param variable a Query Variable
-     *
-     * @return a new REGULAR EXPRESSION specification for a Property using a named Variable.
-     */
-    public static MatchesPredicate matches( Property<String> property, Variable variable )
-    {
-        return new MatchesPredicate( property( property ), variable );
-    }
-
-    // Null checks -----------------------------------------------------------|
-
-    /**
-     * Create a new NOT NULL specification for a Property.
-     *
-     * @param property a Property
-     *
-     * @return a new NOT NULL specification for a Property.
-     */
-    public static <T> PropertyNotNullPredicate<T> isNotNull( Property<T> property )
-    {
-        return new PropertyNotNullPredicate<>( property( property ) );
-    }
-
-    /**
-     * Create a new NULL specification for a Property.
-     *
-     * @param property a Property
-     *
-     * @return a new NULL specification for a Property.
-     */
-    public static <T> PropertyNullPredicate<T> isNull( Property<T> property )
-    {
-        return new PropertyNullPredicate<>( property( property ) );
-    }
-
-    /**
-     * Create a new NOT NULL specification for an Association.
-     *
-     * @param association an Association
-     *
-     * @return a new NOT NULL specification for an Association.
-     */
-    public static <T> AssociationNotNullPredicate<T> isNotNull( Association<T> association )
-    {
-        return new AssociationNotNullPredicate<>( association( association ) );
-    }
-
-    /**
-     * Create a new NULL specification for an Association.
-     *
-     * @param association an Association
-     *
-     * @return a new NULL specification for an Association.
-     */
-    public static <T> AssociationNullPredicate<T> isNull( Association<T> association )
-    {
-        return new AssociationNullPredicate<>( association( association ) );
-    }
-
-    // Collections -----------------------------------------------------------|
-
-    /**
-     * Create a new CONTAINS ALL specification for a Collection Property.
-     *
-     * @param collectionProperty a Collection Property
-     * @param values its values
-     *
-     * @return a new CONTAINS ALL specification for a Collection Property.
-     */
-    public static <T> ContainsAllPredicate<T> containsAll( Property<? extends Collection<T>> collectionProperty,
-                                                           Collection<T> values )
-    {
-        NullArgumentException.validateNotNull( "Values", values );
-        return new ContainsAllPredicate<>( property( collectionProperty ), values );
-    }
-
-    /**
-     * Create a new CONTAINS ALL specification for a Collection Property using named Variables.
-     *
-     * @param collectionProperty a Collection Property
-     * @param variables named Variables
-     *
-     * @return a new CONTAINS ALL specification for a Collection Property using named Variables.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> ContainsAllPredicate<T> containsAllVariables(
-        Property<? extends Collection<T>> collectionProperty,
-        Collection<Variable> variables )
-    {
-        NullArgumentException.validateNotNull( "Variables", variables );
-        return new ContainsAllPredicate( property( collectionProperty ), variables );
-    }
-
-    /**
-     * Create a new CONTAINS specification for a Collection Property.
-     *
-     * @param collectionProperty a Collection Property
-     * @param value the value
-     *
-     * @return a new CONTAINS specification for a Collection Property.
-     */
-    public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
-                                                         T value )
-    {
-        NullArgumentException.validateNotNull( "Value", value );
-        return new ContainsPredicate<>( property( collectionProperty ), value );
-    }
-
-    /**
-     * Create a new CONTAINS specification for a Collection Property using named Variables.
-     *
-     * @param collectionProperty a Collection Property
-     * @param variable named Variable
-     *
-     * @return a new CONTAINS specification for a Collection Property using named Variables.
-     */
-    @SuppressWarnings( {"raw", "unchecked"} )
-    public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
-                                                         Variable variable )
-    {
-        NullArgumentException.validateNotNull( "Variable", variable );
-        return new ContainsPredicate( property( collectionProperty ), variable );
-    }
-
-    /**
-     * Create a new CONTAINS specification for a ManyAssociation.
-     *
-     * @param manyAssoc  a ManyAssociation
-     * @param value the value
-     *
-     * @return a new CONTAINS specification for a ManyAssociation.
-     */
-    public static <T> ManyAssociationContainsPredicate<T> contains( ManyAssociation<T> manyAssoc, T value )
-    {
-        return new ManyAssociationContainsPredicate<>( manyAssociation( manyAssoc ), value );
-    }
-
-    /**
-     * Create a new CONTAINS specification for a NamedAssociation.
-     *
-     * @param namedAssoc  a NamedAssociation
-     * @param value the value
-     *
-     * @return a new CONTAINS specification for a NamedAssociation.
-     */
-    public static <T> NamedAssociationContainsPredicate<T> contains( NamedAssociation<T> namedAssoc, T value )
-    {
-        return new NamedAssociationContainsPredicate<>( namedAssociation( namedAssoc ), value );
-    }
-
-    /**
-     * Create a new CONTAINS NAME specification for a NamedAssociation.
-     *
-     * @param namedAssoc  a NamedAssociation
-     * @param name the name
-     *
-     * @return a new CONTAINS NAME specification for a NamedAssociation.
-     */
-    public static <T> NamedAssociationContainsNamePredicate<T> containsName( NamedAssociation<T> namedAssoc,
-                                                                                 String name )
-    {
-        return new NamedAssociationContainsNamePredicate<>( namedAssociation( namedAssoc ), name );
-    }
-
-    // Ordering --------------------------------------------------------------|
-    /**
-     * Create a new Query ascending order segment for a Property.
-     *
-     * @param <T> type of the Property
-     * @param property a Property
-     *
-     * @return a new Query ascending order segment for a Property.
-     */
-    public static <T> OrderBy orderBy( final Property<T> property )
-    {
-        return orderBy( property, OrderBy.Order.ASCENDING );
-    }
-
-    /**
-     * Create a new Query ordering segment for a Property.
-     *
-     * @param <T> type of the Property
-     * @param property a Property
-     * @param order ascending or descending
-     *
-     * @return a new Query ordering segment for a Property.
-     */
-    public static <T> OrderBy orderBy( final Property<T> property, final OrderBy.Order order )
-    {
-        return new OrderBy( property( property ), order );
-    }
-
-    // Query Templates InvocationHandlers ------------------------------------|
-
-    private static class TemplateHandler<T>
-        implements InvocationHandler
-    {
-        private final PropertyFunction<?> compositeProperty;
-        private final AssociationFunction<?> compositeAssociation;
-        private final ManyAssociationFunction<?> compositeManyAssociation;
-        private final NamedAssociationFunction<?> compositeNamedAssociation;
-
-        private TemplateHandler( PropertyFunction<?> compositeProperty,
-                                 AssociationFunction<?> compositeAssociation,
-                                 ManyAssociationFunction<?> compositeManyAssociation,
-                                 NamedAssociationFunction<?> compositeNamedAssociation
-        )
-        {
-            this.compositeProperty = compositeProperty;
-            this.compositeAssociation = compositeAssociation;
-            this.compositeManyAssociation = compositeManyAssociation;
-            this.compositeNamedAssociation = compositeNamedAssociation;
-        }
-
-        @Override
-        public Object invoke( Object o, Method method, Object[] objects )
-            throws Throwable
-        {
-            if( Property.class.isAssignableFrom( method.getReturnType() ) )
-            {
-                return Proxy.newProxyInstance(
-                    method.getReturnType().getClassLoader(),
-                    array( method.getReturnType() ),
-                    new PropertyReferenceHandler<>( new PropertyFunction<T>( compositeProperty,
-                                                                             compositeAssociation,
-                                                                             compositeManyAssociation,
-                                                                             compositeNamedAssociation,
-                                                                             method ) ) );
-            }
-            else if( Association.class.isAssignableFrom( method.getReturnType() ) )
-            {
-                return Proxy.newProxyInstance(
-                    method.getReturnType().getClassLoader(),
-                    array( method.getReturnType() ),
-                    new AssociationReferenceHandler<>( new AssociationFunction<T>( compositeAssociation,
-                                                                                   compositeManyAssociation,
-                                                                                   compositeNamedAssociation,
-                                                                                   method ) ) );
-            }
-            else if( ManyAssociation.class.isAssignableFrom( method.getReturnType() ) )
-            {
-                return Proxy.newProxyInstance(
-                    method.getReturnType().getClassLoader(),
-                    array( method.getReturnType() ),
-                    new ManyAssociationReferenceHandler<>( new ManyAssociationFunction<T>( compositeAssociation,
-                                                                                           compositeManyAssociation,
-                                                                                           compositeNamedAssociation,
-                                                                                           method ) ) );
-            }
-            else if( NamedAssociation.class.isAssignableFrom( method.getReturnType() ) )
-            {
-                return Proxy.newProxyInstance(
-                    method.getReturnType().getClassLoader(),
-                    array( method.getReturnType() ),
-                    new NamedAssociationReferenceHandler<>( new NamedAssociationFunction<T>( compositeAssociation,
-                                                                                             compositeManyAssociation,
-                                                                                             compositeNamedAssociation,
-                                                                                             method ) ) );
-            }
-
-            return null;
-        }
-    }
-
-    private static class PropertyReferenceHandler<T>
-        implements InvocationHandler
-    {
-        private final PropertyFunction<T> property;
-
-        private PropertyReferenceHandler( PropertyFunction<T> property )
-        {
-            this.property = property;
-        }
-
-        private PropertyFunction<T> property()
-        {
-            return property;
-        }
-
-        @Override
-        public Object invoke( Object o, final Method method, Object[] objects )
-            throws Throwable
-        {
-            if( method.equals( Property.class.getMethod( "get" ) ) )
-            {
-                Type propertyType = GenericPropertyInfo.propertyTypeOf( property.accessor() );
-                if( propertyType.getClass().equals( Class.class ) )
-                {
-                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
-                                                   array( (Class<?>) propertyType, PropertyReference.class ),
-                                                   new TemplateHandler<T>( property, null, null, null ) );
-                }
-            }
-
-            return null;
-        }
-    }
-
-    private static class AssociationReferenceHandler<T>
-        implements InvocationHandler
-    {
-        private final AssociationFunction<T> association;
-
-        private AssociationReferenceHandler( AssociationFunction<T> association )
-        {
-            this.association = association;
-        }
-
-        private AssociationFunction<T> association()
-        {
-            return association;
-        }
-
-        @Override
-        public Object invoke( Object o, final Method method, Object[] objects )
-            throws Throwable
-        {
-            if( method.equals( Association.class.getMethod( "get" ) ) )
-            {
-                Type associationType = GenericAssociationInfo.associationTypeOf( association.accessor() );
-                if( associationType.getClass().equals( Class.class ) )
-                {
-                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
-                                                   array( (Class) associationType, PropertyReference.class ),
-                                                   new TemplateHandler<T>( null, association, null, null ) );
-                }
-            }
-
-            return null;
-        }
-    }
-
-    private static class ManyAssociationReferenceHandler<T>
-        implements InvocationHandler
-    {
-        private final ManyAssociationFunction<T> manyAssociation;
-
-        private ManyAssociationReferenceHandler( ManyAssociationFunction<T> manyAssociation )
-        {
-            this.manyAssociation = manyAssociation;
-        }
-
-        public ManyAssociationFunction<T> manyAssociation()
-        {
-            return manyAssociation;
-        }
-
-        @Override
-        public Object invoke( Object o, final Method method, Object[] objects )
-            throws Throwable
-        {
-            if( method.equals( ManyAssociation.class.getMethod( "get", Integer.TYPE ) ) )
-            {
-                Type manyAssociationType = GenericAssociationInfo.associationTypeOf( manyAssociation.accessor() );
-                if( manyAssociationType.getClass().equals( Class.class ) )
-                {
-                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
-                                                   array( (Class) manyAssociationType, PropertyReference.class ),
-                                                   new TemplateHandler<T>( null, null, manyAssociation, null ) );
-                }
-            }
-
-            return null;
-        }
-    }
-
-    private static class NamedAssociationReferenceHandler<T>
-        implements InvocationHandler
-    {
-        private final NamedAssociationFunction<T> namedAssociation;
-
-        private NamedAssociationReferenceHandler( NamedAssociationFunction<T> namedAssociation )
-        {
-            this.namedAssociation = namedAssociation;
-        }
-
-        public NamedAssociationFunction<T> namedAssociation()
-        {
-            return namedAssociation;
-        }
-
-        @Override
-        public Object invoke( Object o, final Method method, Object[] objects )
-            throws Throwable
-        {
-            if( method.equals( NamedAssociation.class.getMethod( "get", String.class ) ) )
-            {
-                Type namedAssociationType = GenericAssociationInfo.associationTypeOf( namedAssociation.accessor() );
-                if( namedAssociationType.getClass().equals( Class.class ) )
-                {
-                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
-                                                   array( (Class) namedAssociationType, PropertyReference.class ),
-                                                   new TemplateHandler<T>( null, null, null, namedAssociation ) );
-                }
-            }
-
-            return null;
-        }
-    }
-
-    @SafeVarargs
-    private static <T> T[] array( T... array )
-    {
-        return array;
-    }
-
-    private QueryExpressions()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
deleted file mode 100644
index bd6c694..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AndPredicate.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.Collection;
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * AND Specification.
- */
-public class AndPredicate
-    extends BinaryPredicate
-{
-    public AndPredicate( Collection<Predicate<Composite>> operands )
-    {
-        super( operands );
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Predicate<Composite> master = t -> true;
-        for( Predicate<Composite> p : operands )
-        {
-            master = master.and( p );
-        }
-        return master.test( item );
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder( "(" );
-        String and = "";
-        for( Predicate<Composite> operand : operands )
-        {
-            sb.append( and ).append( operand );
-            and = " and ";
-        }
-        return sb.append( ")" ).toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationFunction.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationFunction.java
deleted file mode 100644
index 965dcc0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationFunction.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.util.function.Function;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.query.QueryExpressionException;
-import org.apache.zest.api.util.Classes;
-
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Function to get Entity Associations
- */
-public class AssociationFunction<T>
-    implements Function<Composite, Association<T>>
-{
-    private final AssociationFunction<?> traversedAssociation;
-    private final ManyAssociationFunction<?> traversedManyAssociation;
-    private final NamedAssociationFunction<?> traversedNamedAssociation;
-    private final AccessibleObject accessor;
-
-    public AssociationFunction( AssociationFunction<?> traversedAssociation,
-                                ManyAssociationFunction<?> traversedManyAssociation,
-                                NamedAssociationFunction<?> traversedNamedAssociation,
-                                AccessibleObject accessor
-    )
-    {
-        this.traversedAssociation = traversedAssociation;
-        this.traversedManyAssociation = traversedManyAssociation;
-        this.traversedNamedAssociation = traversedNamedAssociation;
-        this.accessor = accessor;
-
-        Type returnType = typeOf( accessor );
-        if( !Association.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) )
-            && !ManyAssociation.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) )
-            && !NamedAssociation.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) ) )
-        {
-            throw new QueryExpressionException( "Unsupported association type:" + returnType );
-        }
-        Type associationTypeAsType = GenericAssociationInfo.toAssociationType( returnType );
-        if( !( associationTypeAsType instanceof Class ) )
-        {
-            throw new QueryExpressionException( "Unsupported association type:" + associationTypeAsType );
-        }
-    }
-
-    public AssociationFunction<?> traversedAssociation()
-    {
-        return traversedAssociation;
-    }
-
-    public ManyAssociationFunction<?> traversedManyAssociation()
-    {
-        return traversedManyAssociation;
-    }
-
-    public NamedAssociationFunction<?> traversedNamedAssociation()
-    {
-        return traversedNamedAssociation;
-    }
-
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public Association<T> apply( Composite entity )
-    {
-        try
-        {
-            Object target = entity;
-            if( traversedAssociation != null )
-            {
-                Association<?> association = traversedAssociation.apply( entity );
-                if( association == null )
-                {
-                    return null;
-                }
-                target = association.get();
-            }
-            else if( traversedManyAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot evaluate a ManyAssociation" );
-            }
-            else if( traversedNamedAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot evaluate a NamedAssociation" );
-            }
-
-            if( target == null )
-            {
-                return null;
-            }
-
-            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
-            return ( (AssociationStateHolder) handler.state() ).associationFor( accessor );
-        }
-        catch( IllegalArgumentException e )
-        {
-            throw e;
-        }
-        catch( Throwable e )
-        {
-            throw new IllegalArgumentException( e );
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        if( traversedAssociation != null )
-        {
-            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
-        }
-        else
-        {
-            return ( (Member) accessor ).getName();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
deleted file mode 100644
index 29ce85e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNotNullPredicate.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Association not null Specification.
- */
-public class AssociationNotNullPredicate<T>
-    extends ExpressionPredicate
-{
-    private AssociationFunction<T> association;
-
-    public AssociationNotNullPredicate( AssociationFunction<T> association )
-    {
-        this.association = association;
-    }
-
-    public AssociationFunction<T> association()
-    {
-        return association;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        try
-        {
-            Association<T> assoc = association.apply( item );
-
-            if( assoc == null )
-            {
-                return false;
-            }
-
-            return assoc.get() != null;
-        }
-        catch( IllegalArgumentException e )
-        {
-            return false;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return association.toString() + " is not null";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
deleted file mode 100644
index a304ae0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/AssociationNullPredicate.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Association null Specification.
- */
-public class AssociationNullPredicate<T>
-    extends ExpressionPredicate
-{
-    private AssociationFunction<T> association;
-
-    public AssociationNullPredicate( AssociationFunction<T> association )
-    {
-        this.association = association;
-    }
-
-    public AssociationFunction<T> association()
-    {
-        return association;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        try
-        {
-            Association<T> assoc = association.apply( item );
-
-            if( assoc == null )
-            {
-                return true;
-            }
-
-            return assoc.get() == null;
-        }
-        catch( IllegalArgumentException e )
-        {
-            return true;
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return association.toString() + " is null";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
deleted file mode 100644
index 4e2e218..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/BinaryPredicate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Base binary Specification, used for AND and OR Specifications..
- */
-public abstract class BinaryPredicate
-    extends ExpressionPredicate
-{
-    protected final Collection<Predicate<Composite>> operands;
-
-    protected BinaryPredicate( Collection<Predicate<Composite>> operands )
-    {
-        this.operands = Collections.unmodifiableCollection( operands );
-    }
-
-    public Collection<Predicate<Composite>> operands()
-    {
-        return operands;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
deleted file mode 100644
index 41fb7f5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ComparisonPredicate.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Base comparison Specification.
- */
-public abstract class ComparisonPredicate<T>
-    extends ExpressionPredicate
-{
-    protected final PropertyFunction<T> property;
-    protected final T value;
-
-    public ComparisonPredicate( PropertyFunction<T> property, T value )
-    {
-        this.property = property;
-        this.value = value;
-    }
-
-    public PropertyFunction<T> property()
-    {
-        return property;
-    }
-
-    @Override
-    public final boolean test( Composite item )
-    {
-        try
-        {
-            Property<T> prop = property.apply( item );
-
-            if( prop == null )
-            {
-                return false;
-            }
-
-            T propValue = prop.get();
-            if( propValue == null )
-            {
-                return false;
-            }
-
-            return compare( propValue );
-        }
-        catch( IllegalArgumentException e )
-        {
-            return false;
-        }
-    }
-
-    protected abstract boolean compare( T value );
-
-    public T value()
-    {
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
deleted file mode 100644
index 52a1b27..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsAllPredicate.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Contains All Specification.
- */
-public class ContainsAllPredicate<T>
-    extends ExpressionPredicate
-{
-    private PropertyFunction<? extends Collection<T>> collectionProperty;
-    private Collection<T> valueCollection;
-
-    public ContainsAllPredicate( PropertyFunction<? extends Collection<T>> collectionProperty,
-                                 Collection<T> valueCollection
-    )
-    {
-        this.collectionProperty = collectionProperty;
-        this.valueCollection = Collections.unmodifiableCollection( valueCollection );
-    }
-
-    public PropertyFunction<? extends Collection<T>> collectionProperty()
-    {
-        return collectionProperty;
-    }
-
-    public Collection<T> containedValues()
-    {
-        return valueCollection;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Collection<T> collection = collectionProperty.apply( item ).get();
-
-        if( collection == null )
-        {
-            return false;
-        }
-
-        for( T value : valueCollection )
-        {
-            if( !collection.contains( value ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-
-    @Override
-    public String toString()
-    {
-        return collectionProperty + " contains " + valueCollection;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
deleted file mode 100644
index c8b90fd..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ContainsPredicate.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.Collection;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Contains Specification.
- */
-public class ContainsPredicate<T>
-    extends ExpressionPredicate
-{
-    private PropertyFunction<? extends Collection<T>> collectionProperty;
-    private T value;
-
-    public ContainsPredicate( PropertyFunction<? extends Collection<T>> collectionProperty, T value )
-    {
-        this.collectionProperty = collectionProperty;
-        this.value = value;
-    }
-
-    public PropertyFunction<? extends Collection<T>> collectionProperty()
-    {
-        return collectionProperty;
-    }
-
-    public T value()
-    {
-        return value;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Collection<T> collection = collectionProperty.apply( item ).get();
-
-        if( collection == null )
-        {
-            return false;
-        }
-
-        return collection.contains( value );
-    }
-
-    @Override
-    public String toString()
-    {
-        return collectionProperty + " contains " + value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
deleted file mode 100644
index d06b4e6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/EqPredicate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Equals Specification.
- */
-public class EqPredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public EqPredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    protected boolean compare( T value )
-    {
-        return value.equals( this.value );
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "=" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
deleted file mode 100644
index 4fca55d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ExpressionPredicate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * Base expression Specification.
- */
-public abstract class ExpressionPredicate
-    implements Predicate<Composite>
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
deleted file mode 100644
index 232cff6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/GePredicate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Greater or equals Specification.
- */
-public class GePredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public GePredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    protected boolean compare( T value )
-    {
-        return ( (Comparable) value ).compareTo( this.value ) >= 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + ">=" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
deleted file mode 100644
index d26c8ee..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/GtPredicate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Greater than Specification.
- */
-public class GtPredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public GtPredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    protected boolean compare( T value )
-    {
-        return ( (Comparable) value ).compareTo( this.value ) > 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + ">" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
deleted file mode 100644
index 504ab91..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/LePredicate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Less or equals Specification.
- */
-public class LePredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public LePredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    protected boolean compare( T value )
-    {
-        return ( (Comparable) value ).compareTo( this.value ) <= 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "<=" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/LtPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/LtPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/LtPredicate.java
deleted file mode 100644
index 8723743..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/LtPredicate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Lesser than Specification.
- */
-public class LtPredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public LtPredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    protected boolean compare( T value )
-    {
-        return ( (Comparable) value ).compareTo( this.value ) < 0;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "<" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationContainsPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationContainsPredicate.java
deleted file mode 100644
index 1e71ff8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationContainsPredicate.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * ManyAssociation Contains Specification.
- */
-public class ManyAssociationContainsPredicate<T>
-    extends ExpressionPredicate
-{
-    private final ManyAssociationFunction<T> manyAssociationFunction;
-    private final T value;
-
-    public ManyAssociationContainsPredicate( ManyAssociationFunction<T> manyAssociationFunction, T value )
-    {
-        this.manyAssociationFunction = manyAssociationFunction;
-        this.value = value;
-    }
-
-    public ManyAssociationFunction<T> manyAssociation()
-    {
-        return manyAssociationFunction;
-    }
-
-    public T value()
-    {
-        return value;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        ManyAssociation<T> collection = manyAssociationFunction.apply( item );
-        if( collection == null )
-        {
-            return false;
-        }
-        return collection.contains( value );
-    }
-
-    @Override
-    public String toString()
-    {
-        return manyAssociationFunction + " contains:" + value;
-    }
-}


[46/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationMixin.java b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationMixin.java
new file mode 100644
index 0000000..0ed4db1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationMixin.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.injection.scope.State;
+
+/**
+ * Generic mixin for associations.
+ */
+@AppliesTo( { ManyAssociationMixin.AssociationFilter.class } )
+public final class ManyAssociationMixin
+    implements InvocationHandler
+{
+    @State
+    private AssociationStateHolder associations;
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return associations.manyAssociationFor( method );
+    }
+
+    /**
+     * ManyAssociations generic mixin AppliesToFilter.
+     */
+    static class AssociationFilter
+        implements AppliesToFilter
+    {
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
+        {
+            return ManyAssociation.class.isAssignableFrom( method.getReturnType() );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationWrapper.java b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationWrapper.java
new file mode 100644
index 0000000..8465995
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociationWrapper.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * If you want to catch calls to ManyAssociations, then create a GenericConcern
+ * that wraps the Polygene-supplied ManyAssociation instance with ManyAssociationWrappers. Override
+ * methods to perform your custom code.
+ */
+public class ManyAssociationWrapper
+    implements ManyAssociation<Object>
+{
+    protected ManyAssociation<Object> next;
+
+    public ManyAssociationWrapper( ManyAssociation<Object> next )
+    {
+        this.next = next;
+    }
+
+    public ManyAssociation<Object> next()
+    {
+        return next;
+    }
+
+    @Override
+    public int count()
+    {
+        return next.count();
+    }
+
+    @Override
+    public boolean contains( Object entity )
+    {
+        return next.contains( entity );
+    }
+
+    @Override
+    public boolean add( int i, Object entity )
+    {
+        return next.add( i, entity );
+    }
+
+    @Override
+    public boolean add( Object entity )
+    {
+        return next.add( entity );
+    }
+
+    @Override
+    public boolean remove( Object entity )
+    {
+        return next.remove( entity );
+    }
+
+    @Override
+    public Object get( int i )
+    {
+        return next.get( i );
+    }
+
+    @Override
+    public List<Object> toList()
+    {
+        return next.toList();
+    }
+
+    @Override
+    public Set<Object> toSet()
+    {
+        return next.toSet();
+    }
+
+    @Override
+    public Stream<EntityReference> references()
+    {
+        return next.references();
+    }
+
+    @Override
+    public Iterator<Object> iterator()
+    {
+        return next.iterator();
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return next.hashCode();
+    }
+
+    @Override
+    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
+    public boolean equals( Object obj )
+    {
+        return next.equals( obj );
+    }
+
+    @Override
+    public String toString()
+    {
+        return next.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java
new file mode 100644
index 0000000..6b5f7a6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociation.java
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * Association to named Entities.
+ * The Iterable&lt;String&gt; returns the names in the association set.
+ * @param <T> Parameterized associatee type
+ */
+public interface NamedAssociation<T>
+    extends Iterable<String>, AbstractAssociation
+{
+    /**
+     * @return The number of named associations in this NamedAssociation.
+     */
+    int count();
+
+    /**
+     * Checks if there is an association with the given name.
+     * @param name The name of the association we are checking if it exists.
+     * @return true if it exists, false otherwise
+     */
+    boolean containsName( String name );
+
+    /**
+     * Adds a named assocation.
+     * @param name The name of the association.
+     * @param entity The entity for this named association.
+     * @return true if putted, false otherwise
+     */
+    boolean put( String name, T entity );
+
+    /**
+     * Remove a named association.
+     * @param name The name of the association.
+     * @return true if removed, false otherwise
+     */
+    boolean remove( String name );
+
+    /**
+     * Retrieves a named association.
+     * @param name The name of the association.
+     * @return The entity that has previously been associated.
+     */
+    T get( String name );
+
+    /**
+     * Checks if the entity is present.
+     * Note that this is potentially a very slow operation, depending on the size of the NamedAssociation.
+     * @param entity The entity to look for.
+     * @return The name of the entity if found, otherwise null.
+     */
+    String nameOf( T entity );
+
+    /**
+     * @return A fully populated Map with the content of this NamedAssociation.
+     */
+    Map<String, T> toMap();
+
+    /**
+     * Returns a stream of the references to the associated entities.
+     * @return the references to the associated entities.
+     */
+    Stream<Map.Entry<String, EntityReference>> references();
+
+    /** Returns the EntityReference for the Association with the given name.
+     *
+     * @param name The name of the association to return the EntityReference for
+     * @return The EntityReference of the association.
+     */
+    EntityReference referenceOf( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationMixin.java b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationMixin.java
new file mode 100644
index 0000000..ea1ed12
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationMixin.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.injection.scope.State;
+
+/**
+ * Generic mixin for NamedAssociations.
+ */
+@AppliesTo( NamedAssociationMixin.AssociationFilter.class )
+public final class NamedAssociationMixin
+    implements InvocationHandler
+{
+    @State
+    private AssociationStateHolder associations;
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return associations.namedAssociationFor( method );
+    }
+
+    /**
+     * NamedAssociations generic mixin AppliesToFilter.
+     */
+    static class AssociationFilter
+        implements AppliesToFilter
+    {
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
+        {
+            return NamedAssociation.class.isAssignableFrom( method.getReturnType() );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationWrapper.java b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationWrapper.java
new file mode 100644
index 0000000..4a2dcf1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/NamedAssociationWrapper.java
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * If you want to catch calls to NamedAssociations, then create a GenericConcern
+ * that wraps the Polygene-supplied NamedAssociations instance with NamedAssociationsWrapper. Override
+ * methods to perform your custom code.
+ */
+public class NamedAssociationWrapper
+    implements NamedAssociation<Object>
+{
+    protected NamedAssociation<Object> next;
+
+    public NamedAssociationWrapper( NamedAssociation<Object> next )
+    {
+        this.next = next;
+    }
+
+    public NamedAssociation<Object> next()
+    {
+        return next;
+    }
+
+    @Override
+    public Iterator<String> iterator()
+    {
+        return next.iterator();
+    }
+
+    @Override
+    public int count()
+    {
+        return next.count();
+    }
+
+    @Override
+    public boolean containsName( String name )
+    {
+        return next.containsName( name );
+    }
+
+    @Override
+    public boolean put( String name, Object entity )
+    {
+        return next.put( name, entity );
+    }
+
+    @Override
+    public boolean remove( String name )
+    {
+        return next.remove( name );
+    }
+
+    @Override
+    public Object get( String name )
+    {
+        return next.get( name );
+    }
+
+    @Override
+    public String nameOf( Object entity )
+    {
+        return next.nameOf( entity );
+    }
+
+    @Override
+    public Map<String, Object> toMap()
+    {
+        return next.toMap();
+    }
+
+    @Override
+    public Stream<Map.Entry<String, EntityReference>> references()
+    {
+        return next.references();
+    }
+
+    @Override
+    public EntityReference referenceOf( String name )
+    {
+        return next.referenceOf( name );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return next.hashCode();
+    }
+
+    @Override
+    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
+    public boolean equals( Object obj )
+    {
+        return next.equals( obj );
+    }
+
+    @Override
+    public String toString()
+    {
+        return next.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/package.html b/core/api/src/main/java/org/apache/polygene/api/association/package.html
new file mode 100644
index 0000000..d478216
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Association API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/cache/CacheOptions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/cache/CacheOptions.java b/core/api/src/main/java/org/apache/polygene/api/cache/CacheOptions.java
new file mode 100644
index 0000000..35a0cfd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/cache/CacheOptions.java
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.cache;
+
+/**
+ * CacheOptions is a metaInfo class for the Cache system for Entity persistence.
+ * CacheOptions should be assigned to the Usecase of the UnitOfWork, to give hint on caching to entity stores.
+ * See {@link org.apache.polygene.api.usecase.UsecaseBuilder} on how to set the metaInfo on Usecases.
+ */
+public final class CacheOptions
+{
+    public static final CacheOptions ALWAYS = new CacheOptions( true, true, true );
+    public static final CacheOptions NEVER = new CacheOptions( false, false, false );
+
+    private final boolean cacheOnRead;
+    private final boolean cacheOnWrite;
+    private final boolean cacheOnNew;
+
+    /**
+     * Constructor for CacheOptions.
+     *
+     * @param cacheOnRead  if true, give the hint to the Cache system that it may not be a good idea to cache the
+     *                     read values. This is useful when it is known that the read will be over a large set and
+     *                     shouldn't affect the existing cached entities. For instance, when traversing the EntityStore
+     *                     this option is set to false.
+     * @param cacheOnWrite if true, give the hint to the Cache system that it may not be a good idea to cache the
+     *                     entity when the value is updated. If this is false, the cache should be emptied from any
+     *                     cached entity instead of updated. There are few cases when this is useful, and if this is
+     *                     false, it makes sense that the <i>cacheOnRead</i> is also false.
+     * @param cacheOnNew   if true, give the hint to the Cache system that it may not be a good idea to cache a newly
+     *                     created Entity, as it is not likely to be read in the near future. This is useful when
+     *                     batch inserts are being made.
+     */
+    public CacheOptions( boolean cacheOnRead, boolean cacheOnWrite, boolean cacheOnNew )
+    {
+        this.cacheOnRead = cacheOnRead;
+        this.cacheOnWrite = cacheOnWrite;
+        this.cacheOnNew = cacheOnNew;
+    }
+
+    /**
+     * @return if true, give the hint to the Cache system that it may not be a good idea to cache the
+     *         read values. This is useful when it is known that the read will be over a large set and
+     *         shouldn't affect the existing cached entities. For instance, when traversing the EntityStore
+     */
+    public boolean cacheOnRead()
+    {
+        return cacheOnRead;
+    }
+
+    /**
+     * @return if true, give the hint to the Cache system that it may not be a good idea to cache the
+     *         entity when the value is updated. If this is false, the cache should be emptied from any
+     *         cached entity instead of updated. There are few cases when this is useful, and if this is
+     *         false, it makes sense that the <i>cacheOnRead</i> is also false.
+     */
+    public boolean cacheOnWrite()
+    {
+        return cacheOnWrite;
+    }
+
+    /**
+     * @return if true, give the hint to the Cache system that it may not be a good idea to cache a newly
+     *         created Entity, as it is not likely to be read in the near future. This is useful when
+     *         batch inserts are being made.
+     */
+    public boolean cacheOnNew()
+    {
+        return cacheOnNew;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/cache/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/cache/package.html b/core/api/src/main/java/org/apache/polygene/api/cache/package.html
new file mode 100644
index 0000000..a2109c1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/cache/package.html
@@ -0,0 +1,43 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Cache API.</h2>
+        <p>
+            The Cache API/SPI is an extension point for Entity Store caching.
+        </p>
+        <p>
+            The API part is only to allow caching options to be passed to the underlying extension in a uniform and
+            standard way. CacheOptions are to be passed as meta info on the optional Cache extension that is specified
+            during assembly phase. Example;
+        </p>
+<pre><code>
+public void assemble( ModuleAssembly module )
+{
+    CacheOptions options = new CacheOptions( true, true, false );
+    module.addServices( EhCacheService.class ).setMetaInfo( options );
+}
+</code></pre>
+        <p>
+            Not all EntityStore implementations use the Cache extension, so check the implementation details of the
+            EntityStore whether the cache extension can bring any benefits or not.
+        </p>
+    </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/AppliesTo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/AppliesTo.java b/core/api/src/main/java/org/apache/polygene/api/common/AppliesTo.java
new file mode 100644
index 0000000..9e88103
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/AppliesTo.java
@@ -0,0 +1,111 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Fragments that implement InvocationHandler and which should only be applied to methods that have a particular
+ * annotation or implement a known interface should use this annotation.
+ * <p>
+ * &#64;AppliesTo can specify one of;
+ * </p>
+ * <ul>
+ * <li>An annotation,</li>
+ * <li>An interface,</li>
+ * <li>An AppliesToFilter implementation.</li>
+ * </ul>
+ * <p>
+ * Example with annotation:
+ * </p>
+ * <pre><code>
+ *
+ * &#64;AppliesTo( Sessional.class )   // Tells Polygene to apply this concern on methods with &#64;Sessional annotation
+ * public class SessionConcern extends GenericConcern
+ * {
+ *     public Object invoke( Object proxy, Method method, Object[] args )
+ *         throws Throwable
+ *     {
+ *         ... do session stuff ...
+ *     }
+ * }
+ *
+ * &#64;Retention( RetentionPolicy.RUNTIME )
+ * &#64;Target( ElementType.METHOD )
+ * &#64;Documented
+ * &#64;Inherited
+ * public @interface Sessional
+ * {
+ * }
+ *
+ * public class MyMixin
+ *     implements My
+ * {
+ *     &#64;Sessional
+ *     public void doSomethingSessional()
+ *     {
+ *        // ... do your logic wrapped in a session
+ *     }
+ *
+ *     public void doSomethingWithoutSession()
+ *     {
+ *        // ... do stuff that are not wrapped in session.
+ *     }
+ * }
+ *
+ * public interface My
+ * {
+ *     void doSomethingSessional();
+ *
+ *     void doSomethingWithoutSession();
+ * }
+ *
+ * &#64;Concerns( SessionConcern.class )
+ * &#64;Mixins( MyMixin.class )
+ * public interface MyComposite extends My, TransientComposite
+ * {}
+ * </code></pre>
+ * <p>
+ * The doSomethingWithoutSession method do not have the &#64;Sessional annotation, therefore the SessionConcern will
+ * not be placed into the call sequence of these methods, and
+ * vice-versa. The &#64;Sessional annotation can be placed either on the interface method or the implementation
+ * method, depending on whether it is a contract or implementation detail.
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface AppliesTo
+{
+    /**
+     * List of interfaces, annotations or AppliesToFilter
+     * implementation classes.
+     * If one of them matches the current element it will be
+     * accepted, so this list can be considered an "or".
+     *
+     * @return array of classes or interfaces to be used by the filter
+     */
+    Class<?>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/AppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/AppliesToFilter.java b/core/api/src/main/java/org/apache/polygene/api/common/AppliesToFilter.java
new file mode 100644
index 0000000..122beba
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/AppliesToFilter.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.reflect.Method;
+
+/**
+ * Implementations of this interface can be specified in the &#64;AppliesTo.
+ * <p>
+ * AppliesTo filters are one of the driving technologies in Polygene. They allow you to apply fragments (Mixins,
+ * Concerns, SideEffects), often generic ones, depending on the context that they are evaluated under. This
+ * mechanism is heavily used internally in Polygene to achieve many other features.
+ * </p>
+ * <p>
+ * The starting point is the basic use of AppliesToFilter, where the &#64;AppliesTo annotation is given an
+ * AppliesToFilter implementation as an argument, for instance at a Mixin implementation;
+ * </p>
+ * <pre><code>
+ * &#64;AppliesTo( MyAppliesToFilter.class )
+ * public class SomeMixin
+ *     implements InvocationHandler
+ * {
+ *
+ * }
+ *
+ * public class MyAppliesToFilter
+ *     implements AppliesToFilter
+ * {
+ *     public boolean appliesTo( Method method, Class&lt;?&gt; mixin, Class&lt;?&gt; compositeType, Class&lt;?&gt; fragmentClass )
+ *     {
+ *         return method.getName().startsWith( "my" );
+ *     }
+ * }
+ * </code></pre>
+ * <p>
+ * In the case above, the generic mixin will only be applied to the methods that that is defined by the
+ * AppliesToFilter. This is the primary way to define limits on the application of generic fragments, since
+ * especially mixins are rarely applied to all methods.
+ * </p>
+ */
+public interface AppliesToFilter
+{
+    /**
+     * This is an internal AppliesToFilter which is assigned if no other AppliesToFilters are found for a given
+     * fragment.
+     * <p>
+     * There is no reason for user code to use this AppliesToFilter directly, and should be perceived as an
+     * internal class in Polygene.
+     * </p>
+     */
+    AppliesToFilter ALWAYS = new AppliesToFilter()
+    {
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+        {
+            return true;
+        }
+    };
+
+    /**
+     * Check if the Fragment should be applied or not. Will be call when applied to Mixins, Concerns, SideEffects.
+     *
+     * @param method        method that is invoked
+     * @param mixin         mixin implementation for the method
+     * @param compositeType composite type
+     * @param fragmentClass fragment that is being applies
+     *
+     * @return true if the filter passes, otherwise false
+     */
+    boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/ConstructionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/ConstructionException.java b/core/api/src/main/java/org/apache/polygene/api/common/ConstructionException.java
new file mode 100644
index 0000000..04a1b3a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/ConstructionException.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+/**
+ * Thrown when a Fragment or object could not be instantiated.
+ * This includes, but not be limited to;
+ * <ul>
+ * <li>private constructor.</li>
+ * <li>abstract class for Constraints.</li>
+ * <li>interface instead of a class.</li>
+ * <li>useful constructor missing.</li>
+ * <li>exception thrown in the constructor.</li>
+ * <li>Subclassing of org.apache.polygene.api.property.Property</li>
+ * </ul>
+ * <p>
+ * See the nested exception for additional details.
+ * </p>
+ */
+public class ConstructionException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    public ConstructionException()
+    {
+    }
+
+    public ConstructionException( String message )
+    {
+        super( message );
+    }
+
+    public ConstructionException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public ConstructionException( Throwable cause )
+    {
+        super( cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/InvalidApplicationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/InvalidApplicationException.java b/core/api/src/main/java/org/apache/polygene/api/common/InvalidApplicationException.java
new file mode 100644
index 0000000..fccd4bb
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/InvalidApplicationException.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+/**
+ * Thrown when an application is considered to not be constructed properly.
+ * This happens primarily when client code tries to instantiate Composites
+ * and objects which have not been registered in the ModuleAssembly.
+ */
+public class InvalidApplicationException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    public InvalidApplicationException( String string )
+    {
+        super( string );
+    }
+
+    public InvalidApplicationException( String string, Throwable cause )
+    {
+        super( string, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/MetaInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/MetaInfo.java b/core/api/src/main/java/org/apache/polygene/api/common/MetaInfo.java
new file mode 100644
index 0000000..c3f3a11
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/MetaInfo.java
@@ -0,0 +1,154 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.sideeffect.SideEffects;
+import org.apache.polygene.api.util.Classes;
+
+import static java.util.Arrays.asList;
+import static org.apache.polygene.api.util.Classes.typesOf;
+
+/**
+ * Used to declare and access meta-info.
+ * <p>
+ * <strong>This is effectively an internal class and should not be used directly.</strong>
+ * </p>
+ * <p>
+ * MetaInfo can be set on composites during the assembly phase, a.k.a the bootstrap
+ * process. MetaInfo is any additional data that one wishes to associate at the 'class level' instead of instance
+ * level of a composite declaration.
+ * </p>
+ * <p>
+ * To set the MetaInfo on a Composite, call the {@code setMetaInfo()} methods on the various composite declaration
+ * types, such as;
+ * </p>
+ * <pre><code>
+ * public void assemble( ModuleAssembly module )
+ *     throws AssemblyException
+ * {
+ *     Map&lt;String,String&gt; properties = ...;
+ *     module.services( MyService.class ).setMetaInfo( properties );
+ * }
+ * </code></pre>
+ * <p>
+ * which can later be retrieved by calling the {@code metaInfo()} method on the composite itself. For the example
+ * above that would be;
+ * </p>
+ * <pre><code>
+ * &#64;Mixins(MyServiceMixin.class)
+ * public interface MyService extends ServiceComposite
+ * {
+ *
+ * }
+ *
+ * public abstract class MyServiceMixin
+ *     implements MyService
+ * {
+ *     private Properties props;
+ *
+ *     public MyServiceMixin()
+ *     {
+ *         props = metaInfo( Map.class );
+ *     }
+ * }
+ * </code></pre>
+ */
+public final class MetaInfo
+{
+    private final static Collection<Class> ignored;
+
+    static
+    {
+        ignored = new HashSet<>( 4, 0.8f ); // Optimize size used.
+        ignored.addAll( asList( Mixins.class, Concerns.class, SideEffects.class ) );
+    }
+
+    private final Map<Class<?>, Object> metaInfoMap;
+
+    public MetaInfo()
+    {
+        metaInfoMap = new LinkedHashMap<>();
+    }
+
+    public MetaInfo( MetaInfo metaInfo )
+    {
+        metaInfoMap = new LinkedHashMap<>();
+        metaInfoMap.putAll( metaInfo.metaInfoMap );
+    }
+
+    public void set( Object metaInfo )
+    {
+        if( metaInfo instanceof Annotation )
+        {
+            Annotation annotation = (Annotation) metaInfo;
+            metaInfoMap.put( annotation.annotationType(), metaInfo );
+        }
+        else
+        {
+            Class<?> metaInfoclass = metaInfo.getClass();
+            typesOf( metaInfoclass )
+                .map( Classes.RAW_CLASS )
+                .forEach( type -> metaInfoMap.put( type, metaInfo ) );
+        }
+    }
+
+    public <T> T get( Class<T> metaInfoType )
+    {
+        return metaInfoType.cast( metaInfoMap.get( metaInfoType ) );
+    }
+
+    public <T> void add( Class<T> infoType, T info )
+    {
+        metaInfoMap.put( infoType, info );
+    }
+
+    public MetaInfo withAnnotations( AnnotatedElement annotatedElement )
+    {
+        for( Annotation annotation : annotatedElement.getAnnotations() )
+        {
+            if( !ignored.contains( annotation.annotationType() )
+                && get( annotation.annotationType() ) == null )
+            {
+                set( annotation );
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public String toString()
+    {
+        return metaInfoMap.toString();
+    }
+
+    public void remove( Class serviceFinderClass )
+    {
+        metaInfoMap.remove( serviceFinderClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/Optional.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/Optional.java b/core/api/src/main/java/org/apache/polygene/api/common/Optional.java
new file mode 100644
index 0000000..049417e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/Optional.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to denote that something is optional.
+ * <ul>
+ * <li>
+ * If applied to a method parameter, then the value is allowed to be null. Default
+ * is that method parameters have to be non-null.
+ * </li>
+ * <li>
+ * If applied to a Property declaration, then the value may be null after construction of
+ * the instance, or may be set to null at a later time.
+ * </li>
+ * <li>
+ * If applied to an injected member field, it is allowed tha none get injected. For instance, an <code>&#64;Optional
+ * &#64;Service</code> would allow a service to not have been declared and the field will be null.
+ * </li>
+ * </ul>
+ * <p>
+ * Optionality is not the default in Polygene, and if injections, property values and parameters in methods are not
+ * non-null, the Polygene runtime will throw an {@link org.apache.polygene.api.constraint.ConstraintViolationException}, indicating
+ * which field/property/parameter in which composite and mixin the problem has been detected.
+ * </p>
+ * <p>
+ * Example;
+ * </p>
+ * <pre><code>
+ * &#64;Optional &#64;Service
+ * MyService service;   // If no MyService instance is declared and visible to this service injection point
+ *                      // the 'service' field will be null.
+ *
+ * &#64;Service
+ * YourService other;   // If no YourService instance is declared and visible to this service injection point
+ *                      // the Polygene runtime will throw a ConstraintViolationException.
+ *
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD } )
+@Documented
+public @interface Optional
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/QualifiedName.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/QualifiedName.java b/core/api/src/main/java/org/apache/polygene/api/common/QualifiedName.java
new file mode 100644
index 0000000..b0d0f18
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/QualifiedName.java
@@ -0,0 +1,258 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.io.Serializable;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import org.apache.polygene.api.util.NullArgumentException;
+
+/**
+ * QualifiedName is a representation of Property names to their full declaration.
+ * <p>
+ * A QualifiedName is created by combining the name of a method and the name of the type that declares the method.
+ * This class also contains many static utility methods to manage QualifiedName instances.
+ * </p>
+ * <p>
+ * <strong>NOTE: Unless you do very generic libraries, entity stores and other extensions that is deeply coupled into
+ * the Polygene runtime, it is very unlikely you will need to use this class directly.</strong>
+ * </p>
+ * <p>
+ * It is also important to notice that the QualifiedName needs to be long-term stable, as the names are written
+ * to persistent storage. So any changes in the formatting <strong>must be made in a backward-compatible manner
+ * </strong>.
+ * </p>
+ * <p>
+ * The QualifiedName has two intrinsic parts, one being the {@code type} and the other the {@code name}. The
+ * {@code type} comes from the class where the QualifiedName originates from and internally kept as a {@link TypeName}
+ * instance. The name is the name from the method name. When the QualifiedName instance is converted to an external
+ * string representation, via the offical and formal {@link #toString()} method, the {@code type} is normalized, i.e.
+ * any dollar characters ($) in the name are replaced by dashes (-), to make them URI friendly.
+ * </p>
+ * <p>
+ * QualifiedName instances are immutable, implements {@link #hashCode()} and {@link #equals(Object)} as a value
+ * object and can safely be used as keys in {@link java.util.Map}.
+ */
+public final class QualifiedName
+    implements Comparable<QualifiedName>, Serializable
+{
+    private final TypeName typeName;
+    private final String name;
+
+    /**
+     * Creates a QualifiedName from a method.
+     * <p>
+     * This factory method will create a QualifiedName from the Method itself.
+     *
+     * </p>
+     *
+     * @param method Type method that returns a Property, for which the QualifiedName will be representing.
+     *
+     * @return A QualifiedName representing this method.
+     *
+     * @throws NullArgumentException If the {@code method} argument passed is null.
+     */
+    public static QualifiedName fromAccessor( AccessibleObject method )
+    {
+        NullArgumentException.validateNotNull( "method", method );
+        return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() );
+    }
+
+    /**
+     * Creates a QualifiedName instance from the Class and a given name.
+     * <p>
+     * This factory method converts the {@code type} to a {@link TypeName} and appends the given {@code name}.
+     *
+     * @param type The Class that is the base of the QualifiedName.
+     * @param name The qualifier name which will be appended to the base name derived from the {@code type} argument.
+     *
+     * @return A QualifiedName instance representing the {@code type} and {@code name} arguments.
+     *
+     * @throws NullArgumentException if any of the two arguments are {@code null}, or if the name string is empty.
+     */
+    public static QualifiedName fromClass( Class type, String name )
+    {
+        return new QualifiedName( TypeName.nameOf( type ), name );
+    }
+
+    /**
+     * Creates a Qualified name from a type as string and a name qualifier.
+     *
+     * @param type The type name as a a string, which must be properly formatted. No checks for correctly formatted
+     *             type name is performed.
+     * @param name The qualifier name which will be appended to the base name derived from the {@code type} argument.
+     *
+     * @return A QualifiedName instance representing the {@code type} and {@code name} arguments.
+     *
+     * @throws NullArgumentException if any of the two arguments are {@code null} or either string is empty.
+     */
+    public static QualifiedName fromName( String type, String name )
+    {
+        return new QualifiedName( TypeName.nameOf( type ), name );
+    }
+
+    /**
+     * Creates a QualifiedName from the external string format of QualifiedName.
+     * <p>
+     * This factory method is the reverse of {@link QualifiedName#toString() }  method, and creates a new QualifiedName
+     * instance from the string representation of the QualifiedName.
+     * </p>
+     *
+     * @param fullQualifiedName The QualifiedName external string representation to be converted back into a QualifiedName
+     *                      instance.
+     *
+     * @return The QualifiedName instance represented by the {@code qualifiedName} argument.
+     *
+     * @throws IllegalArgumentException If the {@code qualifiedName} argument has wrong format.
+     */
+    public static QualifiedName fromFQN( String fullQualifiedName )
+    {
+        NullArgumentException.validateNotEmpty( "qualifiedName", fullQualifiedName );
+        int idx = fullQualifiedName.lastIndexOf( ":" );
+        if( idx == -1 )
+        {
+            throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is not a qualified name" );
+        }
+        final String type = fullQualifiedName.substring( 0, idx );
+        final String name = fullQualifiedName.substring( idx + 1 );
+        return new QualifiedName( TypeName.nameOf( type ), name );
+    }
+
+    QualifiedName( TypeName typeName, String name )
+    {
+        NullArgumentException.validateNotNull( "typeName", typeName );
+        NullArgumentException.validateNotEmpty( "name", name );
+        this.typeName = typeName;
+        this.name = name;
+    }
+
+    /**
+     * Returns the normalized string of the type part of the QualifiedName.
+     *
+     * <p>
+     * The normalized type name means that all dollar ($) characters have been replaced by dashes (-).
+     * </p>
+     *
+     * @return the normalized string of the type part of the QualifiedName.
+     */
+    public String type()
+    {
+        return typeName.normalized();
+    }
+
+    /**
+     * Returns the name component of the QualifiedName.
+     *
+     * @return the name component of the QualifiedName.
+     */
+    public String name()
+    {
+        return name;
+    }
+
+    /**
+     * Returns the URI of the QualifiedName.
+     *
+     * <p>
+     * The URI is the {@link #toNamespace()} followed by the {@code name} component.
+     * <p>
+     *
+     * @return the URI of the QualifiedName.
+     *
+     * @see #toNamespace()
+     */
+    public String toURI()
+    {
+        return toNamespace() + name;
+    }
+
+    /**
+     * Return the URI of the {@link TypeName} component of the QualifiedName.
+     * <p>
+     * The URI of the {@link TypeName} component is in the form of;
+     * </p>
+     * <pre>
+     * "urn:polygene:type:" normalizedClassName
+     * </pre>
+     * <p>
+     * where {@code normalizedClassName} is the fully-qualified class name having had any dollar ($) characters replaced
+     * by URI friendly dashes (-), with a trailing hash (#). Examples;
+     * </p>
+     * <pre>
+     * urn:polygene:type:org.apache.polygene.api.common.QualifiedName#
+     * urn:polygene:type:org.apache.polygene.samples.MyClass-MyInnerClass#
+     * </pre>
+     *
+     * @return the URI of the {@link TypeName} component of the QualifiedName.
+     */
+    public String toNamespace()
+    {
+        return typeName.toURI() + "#";
+    }
+
+    /**
+     * Return the formal and official, long-term stable, external string representation of a QualifiedName.
+     * <p>
+     * This returns the {@link org.apache.polygene.api.common.TypeName#toString()} followed by the {@code name} component.
+     * </p>
+     *
+     * @return the formal and official, long-term stable, external string representation of a QualifiedName.
+     */
+    @Override
+    public String toString()
+    {
+        return typeName + ":" + name;
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        QualifiedName that = (QualifiedName) o;
+
+        return name.equals( that.name ) && typeName.equals( that.typeName );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return 31 * typeName.hashCode() + name.hashCode();
+    }
+
+    @Override
+    public int compareTo( QualifiedName other )
+    {
+        final int result = typeName.compareTo( other.typeName );
+        if( result != 0 )
+        {
+            return result;
+        }
+        return name.compareTo( other.name );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/TypeName.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/TypeName.java b/core/api/src/main/java/org/apache/polygene/api/common/TypeName.java
new file mode 100644
index 0000000..8ee64c8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/TypeName.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.io.Serializable;
+import java.lang.reflect.Type;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.NullArgumentException;
+
+/**
+ * Represents a Type name.
+ */
+public final class TypeName
+    implements Serializable, Comparable<TypeName>
+{
+    private final String name;
+
+    public static TypeName nameOf( Class type )
+    {
+        NullArgumentException.validateNotNull( "type", type );
+        return new TypeName( type.getName() );
+    }
+
+    public static TypeName nameOf( Type type )
+    {
+        return nameOf( Classes.RAW_CLASS.apply( type ) );
+    }
+
+    public static TypeName nameOf( String typeName )
+    {
+        return new TypeName( typeName );
+    }
+
+    private TypeName( String name )
+    {
+        NullArgumentException.validateNotEmpty( "name", name );
+        this.name = name;
+    }
+
+    public String normalized()
+    {
+        return Classes.normalizeClassToURI( name );
+    }
+
+    public String toURI()
+    {
+        return Classes.toURI( name );
+    }
+
+    public String name()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+
+    public boolean isClass( final Class<?> type )
+    {
+        return type.getName().equals( name );
+    }
+
+    @Override
+    public boolean equals( final Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        final TypeName other = (TypeName) o;
+
+        return name.equals( other.name );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return name.hashCode();
+    }
+
+    @Override
+    public int compareTo( final TypeName typeName )
+    {
+        return this.name.compareTo( typeName.name );
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/UseDefaults.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/UseDefaults.java b/core/api/src/main/java/org/apache/polygene/api/common/UseDefaults.java
new file mode 100644
index 0000000..8876ae7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/UseDefaults.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to denote that the initial value of a Property will be the default value for the type if none is
+ * specified during construction.
+ * <p>
+ * These are the default values used for various types:
+ * </p>
+ * <pre>
+ * Byte: 0
+ * Short: 0
+ * Character: 0
+ * Integer: 0
+ * Long: 0L
+ * Double: 0.0d
+ * Float: 0.0f
+ * Boolean: false
+ * String: ""
+ * List: empty java.util.ArrayList
+ * Set: empty java.util.HashSet
+ * Collection: empty java.util.ArrayList
+ * enum: first declared value
+ * </pre>
+ * <p>
+ * If this annotation is not used, the property will be set to null, and unless {@code &#64;Optional} is declared
+ * is not allowed.
+ * </p>
+ * <p>
+ * The <code>&#64;UseDefaults</code> annotation can also have a value in its declaration. This value is used,
+ * unless it is overridden in the assembly (see below). Java does not support generic types of annotation values,
+ * so it accepts String values, which are deserialized from JSON using the ValueSerialization SPI. This allows
+ * for (albeit somewhat tedious) any object type to have a default value declared on it. If the property type is
+ * String, then no value deserialization is done.
+ * </p>
+ * <p>
+ * It is also possible to change the default values for Composites during the assembly. This is done by calling the
+ * {@code org.apache.polygene.bootstrap.ModuleAssembly#forMixin(Class)} method.
+ * </p>
+ * <p>
+ * Example;
+ * Let's assume that we have the following mixin type;
+ *
+ * <pre><code>
+ * public interface SomeType
+ * {
+ *     &#64;UseDefaults
+ *     Property&lt;String&gt; someValue();
+ * }
+ * </code></pre>
+ * And that we want to have {@code someValue()} to be initialized to "&lt;unknown&gt;" instead of the empty string.
+ * Then we need to declare the default for that with the following in the assembler.
+ * <pre><code>
+ * public void assemble( ModuleAssembly module )
+ * {
+ *     module.forMixin( SomeType.class ).declareDefaults().someValue().set( "&lt;unknown&gt;" );
+ * }
+ * }
+ * </code></pre>
+ */
+@SuppressWarnings( "JavadocReference" )
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.METHOD, ElementType.FIELD } )
+@Documented
+public @interface UseDefaults
+{
+    String value() default "";
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/Visibility.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/Visibility.java b/core/api/src/main/java/org/apache/polygene/api/common/Visibility.java
new file mode 100644
index 0000000..6120143
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/Visibility.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.common;
+
+/**
+ * Visibility is a core concept in the Polygene structure system. It defines the locale of composites and objects, i.e.
+ * how far they can be 'seen' and therefor be used.
+ * <p>
+ * When a Composite or Object is declared in the assembly phase, and no visibility is set, only other
+ * composites/objects within the same module can use that declaration. For a declared composite/object to be usable
+ * from other modules a higher visibility must be set, either that the Composite/Object can be used by others within
+ * the same Layer, or even to be used by those in the layer above.
+ * </p>
+ */
+public enum Visibility
+{
+    /**
+     * Artifact is visible only in the declaring module (default)
+     */
+    module,
+    /**
+     * Artifact is visible to all modules in the same layer
+     */
+    layer,
+    /**
+     * Artifact is visible to other modules in the same layer and any modules in extending layers
+     */
+    application
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/common/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/common/package.html b/core/api/src/main/java/org/apache/polygene/api/common/package.html
new file mode 100644
index 0000000..38a7a39
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/common/package.html
@@ -0,0 +1,84 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Common API.</h2>
+        <p>
+            The Common API package is a collection of really low-level types needed at the core of the Polygene\u2122 Runtime. It is also
+            a collection of types that are not particularly cohesive, and effectively this package contains the loose ends
+            that does not belong elsewhere.
+        </p>
+        <p>
+            In this package, you can safely ignore the following classes;
+        </p>
+        <ul>
+            <li>MetaInfo</li>
+            <li>QualifiedName</li>
+            <li>TypeName</li>
+        </ul>
+        <p>UNLESS you are into deep integration into the Polygene\u2122 Runtime.</p>
+
+        <h3>&#64;AppliesTo and AppliesToFilter</h3>
+        <p>
+            This tandem of interface + annotation are primarily used for Generic Fragments, to indicate which methods on the
+            interface the fragment should be applied to.
+        </p>
+
+        <h3>&#64;Optional</h3>
+        <p>
+            In Polygene\u2122, method arguments, property values and injected fields are not allowed to be null by default. To allow
+            any of these to be null, i.e. undeclared, it is required that the argument, field or method is marked with the
+            &#64;Optional annotation.
+        </p>
+
+        <h3>&#64;UseDefaults</h3>
+        <p>
+            Since null is not allowed without the &#64;Optional annotation, it can sometimes by tedious to initialize all
+            the property values. And the &#64;UseDefaults annotation allows us to declare that Polygene\u2122 should set the Property
+            to a default value. These are either the pre-defined ones, or can be set per property declaration during the
+            assembly.
+        </p>
+
+        <h3>&#64;Visibility</h3>
+        <p>
+            Visibility is another innovative concept in Polygene\u2122, which leverage the structure system (Application, Layer, Module)
+            to limit the 'reach' when requesting composites and objects. The Visibility is declared per Composite/Object,
+            preferably in the most restrictive mode possible, and the visibility resolver will ensure a predictable resolution
+            algorithm;
+        </p>
+        <ol>
+            <li>Search the module of the caller first. If one and only one composite type fulfilling the request is available
+                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
+                continue to the next step.
+            </li>
+            <li>Search all modules in the Layer of the caller for composite that has a declaration other than
+                <code>Visibility.module</code>. If one and only one composite type fulfilling the request is available
+                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
+                continue to the next step.
+            </li>
+            <li>Search all modules in the Layer(s) (if any) directly below of the caller for composite that has a declaration of
+                <code>Visibility.application</code>. If one and only one composite type fulfilling the request is available
+                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
+                continue to the next step.
+            </li>
+            <li>Throw an NoSuchCompositeException (or related) exception.</li>
+        </ol>
+    </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/AmbiguousTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/AmbiguousTypeException.java b/core/api/src/main/java/org/apache/polygene/api/composite/AmbiguousTypeException.java
new file mode 100644
index 0000000..8c96697
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/AmbiguousTypeException.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * This Exception is thrown when more than one Composite implements a MixinType
+ * that one tries to use to create a Composite instance from.
+ * <p>
+ * For instance;
+ * </p>
+ * <pre><code>
+ * public interface AbcComposite extends TransientComposite, Abc
+ * {}
+ *
+ * public interface DefComposite extends TransientComposite, Def
+ * {}
+ *
+ * public interface Abc
+ * {}
+ *
+ * public interface Def extends Abc
+ * {}
+ *
+ *
+ * TransientBuilder cb = factory.newTransientBuilder( Abc.class );
+ * </code></pre>
+ * <p>
+ * In the code above, both the AbcComposite and DefComposite implement Abc, and therefore
+ * the <code>newTransientBuilder</code> method can not unambiguously figure out which
+ * one is intended.
+ * </p>
+ */
+public class AmbiguousTypeException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    public AmbiguousTypeException( String message )
+    {
+        super( message );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/Composite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/Composite.java b/core/api/src/main/java/org/apache/polygene/api/composite/Composite.java
new file mode 100644
index 0000000..42f5e77
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/Composite.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.PropertyMixin;
+
+/**
+ * Base Composite interface.
+ * <p>
+ * All Composite objects must implement this interface. Let the
+ * Composite interface extend this one. An implementation will be provided
+ * by the framework.
+ * </p>
+ * <p>
+ * Properties and associations are handled by default.
+ * </p>
+ */
+@Mixins( { PropertyMixin.class } )
+public interface Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
new file mode 100644
index 0000000..6c32c81
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeContext.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+
+/**
+ * Thread-associated composites. This is basically a ThreadLocal which maintains a reference
+ * to a TransientComposite instance for each thread. This can be used to implement various context
+ * patterns without having to pass the context explicitly as a parameter to methods.
+ */
+public class CompositeContext<T extends TransientComposite>
+    extends ThreadLocal<T>
+{
+    private ModuleDescriptor module;
+    private Class<T> type;
+
+    public CompositeContext( ModuleDescriptor module, Class<T> type )
+    {
+        this.module = module;
+        this.type = type;
+    }
+
+    @Override
+    protected T initialValue()
+    {
+        return module.instance().newTransient( type );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public T proxy()
+    {
+        TransientComposite composite = get();
+
+        Stream<Class<?>> types = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite ).types();
+        return (T) Proxy.newProxyInstance(
+            composite.getClass().getClassLoader(),
+            types.toArray( Class[]::new ),
+            new ContextInvocationhandler() );
+    }
+
+    private class ContextInvocationhandler
+        implements InvocationHandler
+    {
+
+        @Override
+        public Object invoke( Object object, Method method, Object[] objects )
+            throws Throwable
+        {
+            try
+            {
+                return method.invoke( get(), objects );
+            }
+            catch( InvocationTargetException e )
+            {
+                throw e.getTargetException();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/CompositeDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeDescriptor.java
new file mode 100644
index 0000000..bd5d65e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeDescriptor.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.util.stream.Stream;
+
+/**
+ * Composite Descriptor.
+ */
+public interface CompositeDescriptor
+    extends ModelDescriptor
+{
+    Class<?> primaryType();
+
+    Stream<Class<?>> mixinTypes();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInstance.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInstance.java b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInstance.java
new file mode 100644
index 0000000..03e6dc8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInstance.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.InvocationHandler;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * Composite Instance.
+ */
+public interface CompositeInstance
+    extends InvocationHandler, CompositeInvoker, HasTypes, MetaInfoHolder
+{
+    <T> T proxy();
+
+    <T> T newProxy( Class<T> mixinType )
+        throws IllegalArgumentException;
+
+    ModuleDescriptor module();
+
+    CompositeDescriptor descriptor();
+
+    StateHolder state();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInvoker.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInvoker.java b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInvoker.java
new file mode 100644
index 0000000..7cf6fe5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/CompositeInvoker.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.Method;
+
+/**
+ * Composite method invoker.
+ * <p>
+ * All composites must implement this interface. Methods that are invoked
+ * may reside either in the public Composite interface or in any internal mixins.
+ * </p>
+ * <p>
+ * <strong><i>NOTE:</i></strong>Client code should never use method in this class. We have not been able to hide this
+ * from client code, but IF we find a way to do, this interface may disappear.
+ * </p>
+ */
+public interface CompositeInvoker
+{
+
+    Object invokeComposite( Method method, Object[] args )
+        throws Throwable;
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/ConstructorDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/ConstructorDescriptor.java
new file mode 100644
index 0000000..dd09eae
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/ConstructorDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * Composite constructor descriptor.
+ */
+public interface ConstructorDescriptor
+{
+    Constructor<?> constructor();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/DecoratorMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/DecoratorMixin.java b/core/api/src/main/java/org/apache/polygene/api/composite/DecoratorMixin.java
new file mode 100644
index 0000000..1707f3e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/DecoratorMixin.java
@@ -0,0 +1,106 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import org.apache.polygene.api.injection.scope.Uses;
+
+/**
+ * Generic decorator mixin that allows a Composite to wrap
+ * any other Composite as long as they share an interface.
+ * <p>
+ * Can be used to effectively implement
+ * singleton mixins, since the decorated object can be shared between
+ * many instances.
+ * </p>
+ */
+public class DecoratorMixin
+    implements InvocationHandler
+{
+    private Object delegate;
+
+    public DecoratorMixin( @Uses Object delegate )
+    {
+        if( delegate instanceof Class )
+        {
+            Thread.dumpStack();
+        }
+        this.delegate = delegate;
+    }
+
+    @Override
+    public Object invoke( Object object, Method method, Object[] args )
+        throws Throwable
+    {
+        if( delegate instanceof InvocationHandler )
+        {
+            InvocationHandler handler = (InvocationHandler) delegate;
+            return handler.invoke( object, method, args );
+        }
+        else
+        {
+            try
+            {
+                return method.invoke( delegate, args );
+            }
+            catch( InvocationTargetException e )
+            {
+                throw e.getCause();
+            }
+            catch( IllegalArgumentException e )
+            {
+                String message = constructMessage( method, args );
+                throw new IllegalArgumentException( message, e );
+            }
+        }
+    }
+
+    private String constructMessage( Method method, Object[] args )
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append( "\nmethod: " );
+        builder.append( method.getDeclaringClass().getName() );
+        builder.append( "." );
+        builder.append( method.getName() );
+        builder.append( "\ndelegate: " );
+        builder.append( delegate );
+        builder.append( "\ndelegateType: " );
+        builder.append( delegate == null ? "n/a" : delegate.getClass().getName() );
+        builder.append( "\narguments: \n" );
+        for( Object arg : args )
+        {
+            builder.append( "    " );
+            Class argClass = arg.getClass();
+            if( Proxy.isProxyClass( argClass ) )
+            {
+                builder.append( Proxy.getInvocationHandler( arg ).getClass().getName() );
+            }
+            else
+            {
+                builder.append( argClass.getName() );
+            }
+            builder.append( '\n' );
+        }
+        return builder.toString();
+    }
+}


[50/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index ebd7b5d..4147856 100644
--- a/build.gradle
+++ b/build.gradle
@@ -15,9 +15,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-import org.apache.zest.gradle.AllProjectsPlugin
-import org.apache.zest.gradle.RootProjectPlugin
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationPlugin
+import org.apache.polygene.gradle.AllProjectsPlugin
+import org.apache.polygene.gradle.RootProjectPlugin
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationPlugin
 
 apply plugin: DependenciesDeclarationPlugin
 apply from: 'dependencies.gradle'

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
new file mode 100644
index 0000000..6c9a2c0
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/AllProjectsPlugin.groovy
@@ -0,0 +1,208 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.dependencies.DependenciesPlugin
+import org.apache.polygene.gradle.publish.PublishingPlugin
+import org.gradle.api.JavaVersion
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.compile.JavaCompile
+import org.gradle.api.tasks.javadoc.Javadoc
+import org.gradle.api.tasks.testing.Test
+import org.gradle.api.tasks.testing.logging.TestExceptionFormat
+import org.gradle.external.javadoc.StandardJavadocDocletOptions
+import org.nosphere.honker.gradle.HonkerExtension
+import org.nosphere.honker.gradle.HonkerGenDependenciesTask
+import org.nosphere.honker.gradle.HonkerGenLicenseTask
+import org.nosphere.honker.gradle.HonkerGenNoticeTask
+import org.nosphere.honker.gradle.HonkerLicenseOverrideCandidate
+
+@CompileStatic
+class AllProjectsPlugin implements Plugin<Project>
+{
+  @Override
+  void apply( final Project project )
+  {
+    project.defaultTasks = [ 'classes', 'test' ]
+    project.group = project.name == 'org.apache.polygene' ?
+                    'org.apache.polygene' :
+                    project.name.substring( 0, project.name.lastIndexOf( '.' ) )
+
+    applyDefaultVersion( project )
+    applyPolygeneExtension( project )
+
+    configureJava( project )
+    project.plugins.apply DependenciesPlugin
+    configureJavadoc( project )
+    configureTest( project )
+    if( CodeProjectsPlugin.isCodeProject( project ) )
+    {
+      project.plugins.apply CodeProjectsPlugin
+    }
+    configureDependencyReport( project )
+    configureHonker( project )
+    project.plugins.apply PublishingPlugin
+  }
+
+  private static void applyDefaultVersion( Project project )
+  {
+    if( project.version == 'unspecified' )
+    {
+      project.version = System.properties.version ?: '0'
+    }
+  }
+
+  private static void applyPolygeneExtension( Project project )
+  {
+    project.extensions.create( "polygene", PolygeneExtension, project )
+  }
+
+  private static void configureJava( Project project )
+  {
+    project.plugins.apply 'java'
+    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
+    javaConvention.targetCompatibility = JavaVersion.VERSION_1_8
+    javaConvention.sourceCompatibility = JavaVersion.VERSION_1_8
+    project.tasks.withType( JavaCompile ) { JavaCompile task ->
+      task.options.encoding = 'UTF-8'
+      // Deprecation warnings for all compilations
+      task.options.compilerArgs << "-Xlint:deprecation"
+      // Unchecked warnings for non-test core compilations
+      if( 'org.apache.polygene.core' == project.group && !task.name.toLowerCase( Locale.US ).contains( 'test' ) )
+      {
+        task.options.compilerArgs << "-Xlint:unchecked"
+      }
+    }
+  }
+
+  private static void configureJavadoc( Project project )
+  {
+    project.tasks.withType( Javadoc ) { Javadoc task ->
+      def options = task.options as StandardJavadocDocletOptions
+      options.encoding = 'UTF-8'
+      options.docEncoding = 'UTF-8'
+      options.charSet = 'UTF-8'
+      options.noTimestamp = true
+      options.links = [
+        'http://docs.oracle.com/javase/8/docs/api/',
+        'https://stleary.github.io/JSON-java/',
+        'http://junit.org/junit4/javadoc/latest/'
+      ]
+      // exclude '**/internal/**'
+    }
+  }
+
+  private static void configureTest( Project project )
+  {
+    // Match --max-workers and Test maxParallelForks, use 1 if parallel is disabled
+    def parallel = project.gradle.startParameter.parallelProjectExecutionEnabled
+    def maxTestWorkers = ( parallel ? project.gradle.startParameter.maxWorkerCount : 1 ) as int
+    // The space in the directory name is intentional
+    def allTestsDir = project.file( "$project.buildDir/tmp/test files" )
+    project.tasks.withType( Test ) { Test testTask ->
+      testTask.onlyIf { !project.hasProperty( 'skipTests' ) }
+      testTask.testLogging.info.exceptionFormat = TestExceptionFormat.FULL
+      testTask.maxHeapSize = '1g'
+      testTask.maxParallelForks = maxTestWorkers
+      testTask.systemProperties = [ 'proxySet' : System.properties[ 'proxySet' ],
+                                    'proxyHost': System.properties[ 'proxyHost' ],
+                                    'proxyPort': System.properties[ 'proxyPort' ] ]
+      testTask.reports.html.enabled = true
+      def testDir = new File( allTestsDir, testTask.name )
+      def workDir = new File( testDir, 'work' )
+      def tmpDir = new File( testDir, 'tmp' )
+      def homeDir = new File( testDir, 'home' )
+      testTask.workingDir = workDir
+      testTask.systemProperties << ( [
+        'user.dir'      : workDir.absolutePath,
+        'java.io.tmpdir': tmpDir.absolutePath,
+        'home.dir'      : homeDir.absolutePath
+      ] as Map<String, Object> )
+      testTask.environment << ( [
+        'HOME'       : homeDir.absolutePath,
+        'USERPROFILE': homeDir.absolutePath
+      ] as Map<String, Object> )
+      testTask.doFirst { Test task ->
+        [ workDir, tmpDir, homeDir ]*.mkdirs()
+      }
+      testTask.doLast { Test task ->
+        if( !task.state.failure )
+        {
+          project.delete testDir
+        }
+      }
+    }
+  }
+
+  // Dependency Report generate only the runtime configuration
+  // The report is packaged in the SDK distributions
+  private static void configureDependencyReport( Project project )
+  {
+    project.plugins.apply 'project-report'
+    // TODO Fails with no task found
+    // def dependencyReport = project.tasks.getByName( 'dependencyReport' ) as DependencyReportTask
+    // dependencyReport.configurations = [ project.configurations.getByName( 'runtime' ) ] as Set
+  }
+
+  private static void configureHonker( Project project )
+  {
+    project.plugins.apply 'org.nosphere.honker'
+    def honkerGenDependencies = project.tasks.getByName( 'honkerGenDependencies' ) as HonkerGenDependenciesTask
+    def honkerGenLicense = project.tasks.getByName( 'honkerGenLicense' ) as HonkerGenLicenseTask
+    def honkerGenNotice = project.tasks.getByName( 'honkerGenNotice' ) as HonkerGenNoticeTask
+    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
+    def mainSourceSet = javaConvention.sourceSets.getByName( 'main' )
+    mainSourceSet.output.dir( [ builtBy: honkerGenDependencies ] as Map<String, Object>,
+                              honkerGenDependencies.outputDir )
+    mainSourceSet.output.dir( [ builtBy: honkerGenLicense ] as Map<String, Object>,
+                              honkerGenLicense.outputDir )
+    mainSourceSet.output.dir( [ builtBy: honkerGenNotice ] as Map<String, Object>,
+                              honkerGenNotice.outputDir )
+    def honker = project.extensions.getByType( HonkerExtension )
+    // Project License, applied to all submodules
+    honker.license 'Apache 2'
+    // Dependencies (transitive or not) with no license information, overriding them
+    honker.licenseOverride { HonkerLicenseOverrideCandidate candidate ->
+      if( candidate.group == 'asm' || candidate.module == 'prefuse-core' )
+      {
+        candidate.license = 'BSD 3-Clause'
+      }
+      if( candidate.group == 'javax.websocket'
+        || candidate.group == 'javax.xml.bind' )
+      {
+        candidate.license = 'CDDL'
+      }
+      if( candidate.group == 'org.apache.httpcomponents'
+        || candidate.group == 'net.java.dev.jna'
+        || candidate.group == 'lucene'
+        || candidate.group == 'jdbm'
+        || candidate.group == 'org.osgi'
+        || candidate.group.startsWith( 'org.restlet' ) )
+      {
+        candidate.license = 'Apache 2'
+      }
+    }
+    honkerGenNotice.header = 'Apache Polygene'
+    honkerGenNotice.footer = 'This product includes software developed at\n' +
+                             'The Apache Software Foundation (http://www.apache.org/).\n'
+    project.tasks.getByName( 'check' ).dependsOn project.tasks.getByName( 'honkerCheck' )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
new file mode 100644
index 0000000..6aa345b
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/CodeProjectsPlugin.groovy
@@ -0,0 +1,146 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
+import org.apache.polygene.gradle.doc.AsciidocBuildInfoPlugin
+import org.apache.polygene.gradle.version.VersionClassPlugin
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.plugins.osgi.OsgiManifest
+import org.gradle.api.tasks.javadoc.Javadoc
+import org.gradle.jvm.tasks.Jar
+import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
+import org.gradle.testing.jacoco.tasks.JacocoReport
+
+@CompileStatic
+class CodeProjectsPlugin implements Plugin<Project>
+{
+  static boolean isCodeProject( Project project )
+  {
+    [ 'src/main/java', 'src/test/java',
+      'src/main/groovy', 'src/test/groovy' ].collect { path ->
+      new File( "$project.projectDir/$path" )
+    }.any { dir -> dir.isDirectory() }
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    project.plugins.apply VersionClassPlugin
+    project.plugins.apply AsciidocBuildInfoPlugin
+
+    configureJar( project )
+    configureSupplementaryArchives( project )
+
+    configureJacoco( project )
+    configureCheckstyle( project )
+  }
+
+  private static void configureJar( Project project )
+  {
+    project.plugins.apply 'osgi'
+    def jar = project.tasks.getByName( 'jar' ) as Jar
+    def manifest = jar.manifest as OsgiManifest
+    manifest.attributes( [
+      license    : 'http://www.apache.org/licenses/LICENSE-2.0.txt',
+      docURL     : 'https://polygene.apache.org/',
+      description: project.description ?:
+                   'Apache Polygene\u2122 (Java Edition) is a platform for Composite Oriented Programming',
+      vendor     : 'The Apache Software Foundation, https://www.apache.org',
+    ] )
+    manifest.instruction '-debug', 'true'
+  }
+
+  private static void configureSupplementaryArchives( Project project )
+  {
+    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
+    def sourceJar = project.tasks.create( 'sourceJar', Jar ) { Jar task ->
+      task.description = 'Builds -sources.jar'
+      task.classifier = 'sources'
+      task.from javaConvention.sourceSets.getByName( 'main' ).allSource
+    }
+    def testSourceJar = project.tasks.create( 'testSourceJar', Jar ) { Jar task ->
+      task.description = 'Builds -testsources.jar'
+      task.classifier = 'testsources'
+      task.from javaConvention.sourceSets.getByName( 'test' ).allSource
+    }
+    def javadoc = project.tasks.getByName( 'javadoc' ) as Javadoc
+    def javadocJar = project.tasks.create( 'javadocJar', Jar ) { Jar task ->
+      task.description = 'Builds -javadoc.jar'
+      task.classifier = 'javadoc'
+      task.from javadoc.destinationDir
+      task.dependsOn javadoc
+    }
+    project.artifacts.add( 'archives', sourceJar )
+    project.artifacts.add( 'archives', testSourceJar )
+    project.artifacts.add( 'archives', javadocJar )
+  }
+
+  private static void configureJacoco( Project project )
+  {
+    def dependencies = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
+    project.plugins.apply 'jacoco'
+    def jacoco = project.extensions.getByType( JacocoPluginExtension )
+    jacoco.toolVersion = dependencies.buildToolsVersions.jacoco
+    project.tasks.withType( JacocoReport ) { JacocoReport task ->
+      task.group = TaskGroups.VERIFICATION
+      task.description = 'Generates test coverage report.'
+    }
+  }
+
+  private static void configureCheckstyle( Project project )
+  {
+    // project.plugins.apply 'checkstyle'
+    //    if( name == "org.apache.polygene.core.runtime" )
+    //    {
+    //      checkstyleMain {
+    //        configFile = new File( "$rootProject.projectDir.absolutePath/etc/polygene-runtime-checkstyle.xml" )
+    //        ignoreFailures = true
+    //      }
+    //    }
+    //    else
+    //    {
+    //      checkstyleMain {
+    //        configFile = new File( rootProject.projectDir.absolutePath.toString() + '/etc/polygene-api-checkstyle.xml' )
+    //        ignoreFailures = true
+    //        reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
+    //      }
+    //    }
+    //    checkstyleTest {
+    //      configFile = new File( "$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
+    //      ignoreFailures = true
+    //    }
+    //
+    //    checkstyleVersion {
+    //      configFile = new File( "$rootProject.projectDir.absolutePath/etc/polygene-tests-checkstyle.xml" )
+    //      ignoreFailures = true
+    //    }
+    //    // Create checkstyle report
+    //    task checkstyleReport( type: XsltTask, dependsOn: check ) {
+    //      source project.checkstyle.reportsDir
+    //      include '*.xml'
+    //      destDir = file( "build/reports/checkstyle/" )
+    //      extension = 'html'
+    //      stylesheetFile = file( "$rootProject.projectDir/etc/checkstyle-noframes.xsl" )
+    //    }
+    //
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
new file mode 100644
index 0000000..c05a584
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
@@ -0,0 +1,262 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.apache.rat.gradle.RatTask
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
+import org.apache.polygene.gradle.dist.DistributionPlugin
+import org.apache.polygene.gradle.release.ReleaseSpecExtension
+import org.apache.polygene.gradle.release.ReleaseSpecPlugin
+import org.apache.polygene.gradle.test.AggregatedJacocoReportTask
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.Copy
+import org.gradle.api.tasks.javadoc.Javadoc
+import org.gradle.api.tasks.testing.Test
+import org.gradle.api.tasks.testing.TestReport
+import org.gradle.external.javadoc.StandardJavadocDocletOptions
+
+@CompileStatic
+class RootProjectPlugin implements Plugin<Project>
+{
+  static final String PROJECT_TITLE = 'Apache Polygene\u2122 (Java Edition) SDK'
+  static final String PROJECT_DESCRIPTION = 'Apache Polygene\u2122 (Java Edition) is a framework for domain centric ' +
+                                            'application development, including evolved concepts from AOP, DI and DDD.'
+
+  static class TaskNames
+  {
+    static final String GO_OFFLINE = 'goOffline'
+    static final String GLOBAL_TEST_REPORT = 'globalTestReport'
+    static final String JAVADOCS = 'javadocs'
+    static final String ARCHIVE_JAVADOCS = 'archiveJavadocs'
+    static final String BUILD_ALL = 'buildAll'
+  }
+
+  @Override
+  void apply( Project project )
+  {
+    project.plugins.apply ReleaseSpecPlugin
+
+    applyProjectMetadata( project )
+    applyHelperTasks( project )
+    applyPlugins( project )
+
+    configureJacoco( project )
+    configureTestReport( project )
+    configureJavadocs( project )
+    configureRat( project )
+
+    project.plugins.apply DistributionPlugin
+    configureReleaseTask( project )
+  }
+
+  private static void applyProjectMetadata( Project project )
+  {
+    def extraProperties = project.extensions.extraProperties
+    extraProperties.set 'title', PROJECT_TITLE
+    extraProperties.set 'description', PROJECT_DESCRIPTION
+  }
+
+  private static void applyHelperTasks( Project project )
+  {
+    project.tasks.create( TaskNames.GO_OFFLINE ) { Task task ->
+      task.group = TaskGroups.HELP
+      task.description = 'Resolves all dependencies configuration'
+      task.doLast {
+        def allConfigurations = project.allprojects.collect { Project each ->
+          each.configurations
+        }.flatten() as Set<Configuration>
+        allConfigurations*.resolvedConfiguration
+      }
+    }
+    def buildAll = project.tasks.create( TaskNames.BUILD_ALL )
+    buildAll.group = TaskGroups.BUILD
+    buildAll.description = 'Builds all'
+    buildAll.dependsOn 'javadocs', 'check', 'jar',
+                       project.subprojects.collect { p -> p.tasks.getByName( 'dependencyReport' ) },
+                       project.subprojects.collect { p -> p.tasks.getByName( 'assemble' ) },
+                       ':org.apache.polygene.manual:website'
+  }
+
+  private static void applyPlugins( Project project )
+  {
+    project.plugins.apply 'org.nosphere.apache.rat'
+  }
+
+  private static void configureJacoco( Project project )
+  {
+    def dependencies = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
+    project.configurations.create( 'jacoco' )
+    project.dependencies.add( 'jacoco', "org.jacoco:org.jacoco.ant:${ dependencies.buildToolsVersions.jacoco }" )
+    def task = project.tasks.create( 'coverageReport', AggregatedJacocoReportTask ) { AggregatedJacocoReportTask task ->
+      task.group = TaskGroups.VERIFICATION
+      task.description = 'Generates global coverage report'
+      task.dependsOn project.subprojects.collect( { Project p -> p.tasks.getByName( 'test' ) } )
+    }
+    project.tasks.getByName( 'check' ).dependsOn task
+  }
+
+  private static void configureTestReport( Project project )
+  {
+    project.tasks.create( TaskNames.GLOBAL_TEST_REPORT, TestReport ) { TestReport task ->
+      task.group = TaskGroups.VERIFICATION
+      task.description = 'Generates global test report'
+      task.destinationDir = project.file( "$project.buildDir/reports/tests" )
+      task.reportOn project.subprojects.collect { it.tasks.getByName( 'test' ) }
+    }
+    def test = project.tasks.getByName( 'test' ) as Test
+    test.dependsOn project.subprojects.collect { it.tasks.getByName( 'test' ) }
+    test.dependsOn project.tasks.getByName( TaskNames.GLOBAL_TEST_REPORT )
+    test.reports.html.enabled = false
+  }
+
+  private static void configureJavadocs( Project project )
+  {
+    def zest = project.extensions.getByType( PolygeneExtension )
+    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
+    project.tasks.create( TaskNames.JAVADOCS, Javadoc ) { Javadoc task ->
+      task.group = TaskGroups.DOCUMENTATION
+      task.description = 'Builds the whole SDK public Javadoc'
+      task.dependsOn ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS
+      def options = task.options as StandardJavadocDocletOptions
+      options.docFilesSubDirs = true
+      options.encoding = "UTF-8"
+      options.overview = "${ project.projectDir }/src/javadoc/overview.html"
+      task.title = "${ PROJECT_TITLE } ${ project.version }"
+      def apiSources = releaseSpec.approvedProjects.findAll { approved ->
+        ( approved.name.startsWith( 'org.apache.polygene.core' ) &&
+          !approved.name.startsWith( 'org.apache.polygene.core.runtime' ) ) ||
+        approved.name.startsWith( 'org.apache.polygene.library' ) ||
+        approved.name.startsWith( 'org.apache.polygene.extension' ) ||
+        approved.name.startsWith( 'org.apache.polygene.tool' )
+      }
+      task.source apiSources.collect { each ->
+        each.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( 'main' ).allJava
+      }
+      task.destinationDir = project.file( "${ project.convention.getPlugin( JavaPluginConvention ).docsDir }/javadocs" )
+      task.classpath = project.files( apiSources.collect { apiProject ->
+        apiProject.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( 'main' ).compileClasspath
+      } )
+      options.group( [
+        "Core API"      : [ "org.apache.polygene.api",
+                            "org.apache.polygene.api.*" ],
+        "Core Bootstrap": [ "org.apache.polygene.bootstrap",
+                            "org.apache.polygene.bootstrap.*" ],
+        "Core SPI"      : [ "org.apache.polygene.spi",
+                            "org.apache.polygene.spi.*" ],
+        "Libraries"     : [ "org.apache.polygene.library.*" ],
+        "Extensions"    : [ "org.apache.polygene.valueserialization.*",
+                            "org.apache.polygene.entitystore.*",
+                            "org.apache.polygene.index.*",
+                            "org.apache.polygene.metrics.*",
+                            "org.apache.polygene.cache.*",
+                            "org.apache.polygene.migration",
+                            "org.apache.polygene.migration.*" ],
+        "Tools"         : [ "org.apache.polygene.tools.*",
+                            "org.apache.polygene.envisage",
+                            "org.apache.polygene.envisage.*" ],
+        "Test Support"  : [ "org.apache.polygene.test",
+                            "org.apache.polygene.test.*" ]
+      ] )
+    }
+    project.tasks.create( TaskNames.ARCHIVE_JAVADOCS, Copy ) { Copy task ->
+      task.group = TaskGroups.DOCUMENTATION
+      task.description = 'Copy SDK public Javadoc to ../polygene-web'
+      task.dependsOn TaskNames.JAVADOCS
+      task.from 'build/docs/javadoc/'
+      if( zest.developmentVersion )
+      {
+        task.into( "$project.projectDir/../polygene-web/site/content/java/develop/javadocs/" )
+      }
+      else
+      {
+        task.into( "$project.projectDir/../polygene-web/site/content/java/$project.version/javadocs/" )
+      }
+    }
+  }
+
+  private static void configureRat( Project project )
+  {
+    def rat = project.tasks.getByName( 'rat' ) as RatTask
+    rat.group = TaskGroups.VERIFICATION
+    rat.onlyIf { project.version != '0' }
+    rat.excludes = [
+      '**/.DS_Store/**', '**/._*',
+      // Git Files
+      '**/.git/**', '**/.gitignore',
+      // Gradle Files
+      'gradle/wrapper/**', '**/gradlew', '**/gradlew.bat', '**/.gradle/**',
+      // Build Output
+      '**/build/**', '**/derby.log', 'out/**',
+      // IDE Files
+      '**/.idea/**', '**/*.iml', '**/*.ipr', '**/*.iws',
+      '**/.settings/**', '**/.classpath', '**/.project',
+      '**/.gradletasknamecache', '**/private/cache/**',
+      '**/.nb-gradle-properties', '**/.nb-gradle/**',
+      // JSON files are not allowed to have comments, according to http://www.json.org/ and http://www.ietf.org/rfc/rfc4627.txt
+      '**/*.json',
+      // Various Text Resources
+      '**/README.*', '**/README*.*', '**/TODO',
+      '**/src/main/resources/**/*.txt',
+      '**/src/test/resources/**/*.txt',
+      'libraries/rest-server/src/main/resources/**/*.htm',
+      'libraries/rest-server/src/main/resources/**/*.atom',
+      'tools/qidea/src/main/resources/**/*.ft',
+      'tools/qidea/src/main/resources/**/*.template',
+      // Graphic Resources
+      '**/*.svg', '**/*.gif', '**/*.png', '**/*.jpg', '**/*.psd',
+      // Keystores
+      '**/*.jceks',
+      // Syntax Highlighter - MIT
+      'manual/**/sh*.css', 'manual/**/sh*.js',
+      // jQuery & plugins - MIT
+      'manual/**/jquery*.js',
+      // W3C XML Schemas - W3C Software License
+      'samples/rental/src/main/resources/*.xsd',
+      // Polygene Generator Heroes Templates - MIT
+      'tools/generator-polygene/app/templates/Heroes/**',
+      // templates that will become the user's source files, should not have license headers
+      'tools/shell/src/dist/etc/templates/**',
+    ]
+  }
+
+  private static void configureReleaseTask( Project project )
+  {
+    def zest = project.extensions.getByType( PolygeneExtension )
+    def release = project.tasks.create( 'release' )
+    release.description = 'Builds, tests and uploads the release artifacts'
+    release.group = TaskGroups.RELEASE
+    release.doFirst {
+      if( zest.developmentVersion )
+      {
+        throw new GradleException( "Cannot release development version $project.version, use '-Dversion=X.Y.Z'" )
+      }
+    }
+    release.dependsOn 'checkReleaseSpec',
+                      'rat',
+                      'archiveJavadocs',
+                      ':org.apache.polygene.manual:copyWebsite',
+                      project.allprojects.collect { it.tasks.getByName( 'uploadArchives' ) },
+                      'dist'
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
new file mode 100644
index 0000000..61d3d0d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/TaskGroups.groovy
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import org.gradle.api.plugins.ApplicationPlugin
+import org.gradle.api.plugins.BasePlugin
+import org.gradle.api.plugins.HelpTasksPlugin
+import org.gradle.api.plugins.JavaBasePlugin
+import org.gradle.language.base.plugins.LifecycleBasePlugin
+
+class TaskGroups
+{
+  static final String HELP = HelpTasksPlugin.HELP_GROUP
+  static final String BUILD = LifecycleBasePlugin.BUILD_GROUP
+  static final String VERIFICATION = LifecycleBasePlugin.VERIFICATION_GROUP
+  static final String DOCUMENTATION = JavaBasePlugin.DOCUMENTATION_GROUP
+  static final String DISTRIBUTION = ApplicationPlugin.APPLICATION_GROUP
+  static final String DISTRIBUTION_VERIFICATION = 'distribution verification'
+  static final String PERFORMANCE = 'performance'
+  static final String PERFORMANCE_VERIFICATION = 'performance verification'
+  static final String RELEASE = 'release'
+  static final String RELEASE_VERIFICATION = 'release verification'
+  static final String UPLOAD = BasePlugin.UPLOAD_GROUP
+  static final String SAMPLES = 'samples'
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
new file mode 100644
index 0000000..41e472a
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+import org.gradle.api.artifacts.Dependency
+
+@CompileStatic
+class PolygeneExtension
+{
+  private final Project project
+  final Core core
+
+  PolygeneExtension( Project project )
+  {
+    this.project = project
+    this.core = new Core()
+  }
+
+  boolean isDevelopmentVersion()
+  {
+    return project.version == '0' || project.version.toString().contains( 'SNAPSHOT' )
+  }
+
+  boolean isReleaseVersion()
+  {
+    return !isDevelopmentVersion()
+  }
+
+  class Core
+  {
+    Dependency api = core( 'api' )
+    Dependency spi = core( 'spi' )
+    Dependency runtime = core( 'runtime' )
+    Dependency bootstrap = core( 'bootstrap' )
+    Dependency testsupport = core( 'testsupport' )
+  }
+
+  private Dependency core( String name )
+  {
+    return dependency( 'org.apache.polygene.core', "org.apache.polygene.core.$name" )
+  }
+
+  Dependency library( String name )
+  {
+    return dependency( 'org.apache.polygene.libraries', "org.apache.polygene.library.$name" )
+  }
+
+  Dependency extension( String name )
+  {
+    return dependency( 'org.apache.polygene.extensions', "org.apache.polygene.extension.$name" )
+  }
+
+  Dependency tool( String name )
+  {
+    return dependency( 'org.apache.polygene.tools', "org.apache.polygene.tool.$name" )
+  }
+
+  private Dependency dependency( String group, String name )
+  {
+    project.dependencies.project( path: ":$group:$name" )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
new file mode 100644
index 0000000..c91f0b2
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.dependencies
+
+import groovy.transform.CompileStatic
+import org.gradle.api.artifacts.DependencySubstitution
+import org.gradle.api.artifacts.component.ModuleComponentSelector
+import org.gradle.internal.BiAction
+
+@CompileStatic
+class DependenciesDeclarationExtension
+{
+  final Map<String, String> repositoriesUrls = [ : ]
+  final Map<String, Object> libraries = [ : ]
+  final Map<String, List<Object>> defaultDependencies = [ : ]
+  BiAction<DependencySubstitution, ModuleComponentSelector> dependencySubstitutionSpec
+  final Map<String, String> buildToolsVersions = [ : ]
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
new file mode 100644
index 0000000..cb90182
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationPlugin.groovy
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.dependencies
+
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+
+class DependenciesDeclarationPlugin implements Plugin<Project>
+{
+  @Override
+  void apply( Project project )
+  {
+    project.extensions.create( 'dependenciesDeclaration', DependenciesDeclarationExtension )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
new file mode 100644
index 0000000..660406d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesPlugin.groovy
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.dependencies
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Action
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.artifacts.Configuration
+import org.gradle.api.artifacts.DependencySubstitution
+import org.gradle.api.artifacts.component.ModuleComponentSelector
+import org.gradle.api.artifacts.repositories.MavenArtifactRepository
+
+@CompileStatic
+class DependenciesPlugin implements Plugin<Project>
+{
+  @Override
+  void apply( final Project project )
+  {
+    def dependenciesDeclaration = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
+    applyRepositories( project, dependenciesDeclaration )
+    applyLibraries( project, dependenciesDeclaration )
+    applyDependencyResolutionRules( project, dependenciesDeclaration )
+    applyDefaultDependencies( project, dependenciesDeclaration )
+  }
+
+  private static void applyRepositories( Project project, DependenciesDeclarationExtension declaration )
+  {
+    declaration.repositoriesUrls.each { name, url ->
+      project.repositories.maven { MavenArtifactRepository repo ->
+        repo.name = name
+        repo.url = url
+      }
+    }
+  }
+
+  private static void applyLibraries( Project project, DependenciesDeclarationExtension declaration )
+  {
+    project.extensions.extraProperties.set 'libraries', declaration.libraries
+  }
+
+  private static void applyDependencyResolutionRules( Project project, DependenciesDeclarationExtension declaration )
+  {
+    project.configurations.all(
+      { Configuration configuration ->
+        configuration.resolutionStrategy.dependencySubstitution.all(
+          { DependencySubstitution dep ->
+            if( dep.requested instanceof ModuleComponentSelector )
+            {
+              def selector = dep.requested as ModuleComponentSelector
+              declaration.dependencySubstitutionSpec.execute dep, selector
+            }
+          } as Action<DependencySubstitution> )
+      } as Action<Configuration> )
+  }
+
+  private static void applyDefaultDependencies( Project project, DependenciesDeclarationExtension declaration )
+  {
+    declaration.defaultDependencies.each { String configuration, List<Object> dependencies ->
+      dependencies.each { dependency ->
+        if( dependency instanceof Collection )
+        {
+          dependency.each { subdep ->
+            project.dependencies.add( configuration, subdep )
+          }
+        }
+        else
+        {
+          project.dependencies.add( configuration, dependency )
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy
new file mode 100644
index 0000000..0a4a49b
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/DistributionPlugin.groovy
@@ -0,0 +1,387 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.dist
+
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
+import org.apache.rat.gradle.RatTask
+import org.apache.tools.ant.filters.ReplaceTokens
+import org.apache.polygene.gradle.RootProjectPlugin
+import org.apache.polygene.gradle.TaskGroups
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
+import org.apache.polygene.gradle.release.ReleaseSpecExtension
+import org.apache.polygene.gradle.release.ReleaseSpecPlugin
+import org.gradle.api.Action
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.file.CopySpec
+import org.gradle.api.file.FileCopyDetails
+import org.gradle.api.tasks.Copy
+import org.gradle.api.tasks.GradleBuild
+import org.gradle.api.tasks.bundling.Compression
+import org.gradle.api.tasks.bundling.Tar
+import org.gradle.api.tasks.bundling.Zip
+
+@CompileStatic
+class DistributionPlugin implements Plugin<Project>
+{
+  static class TaskNames
+  {
+    static final String UNPACK_SOURCE_DIST = 'unpackSrcDist'
+    static final String UNPACK_BINARY_DIST = 'unpackBinDist'
+    static final String CHECK_SOURCE_DIST = 'checkSrcDist'
+    static final String CHECK_BINARY_DIST = 'checkBinDist'
+    static final String CHECK_BINARY_DIST_RAT = 'checkBinDist_rat'
+    static final String GENERATE_MAVEN_OFFLINE_HELPERS = 'generateMavenGoOfflineHelpers'
+    static final String GENERATE_GRADLE_OFFLINE_HELPERS = 'generateGradleGoOfflineHelpers'
+    static final String CHECK_MAVEN_OFFLINE_HELPERS = 'checkMavenGoOfflineHelpers'
+    static final String CHECK_GRADLE_OFFLINE_HELPERS = 'checkGradleGoOfflineHelpers'
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    configureSourceDistribution( project )
+    configureBinaryDistribution( project )
+    configureDistributionChecksums( project )
+    configureHelperTasks( project )
+  }
+
+  private static void configureSourceDistribution( Project project )
+  {
+    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
+    def srcDistFilesCopySpec = project.copySpec { CopySpec spec ->
+      spec.from '.'
+      spec.include '*.txt'
+      spec.include 'doap.rdf'
+      spec.include '*.gradle'
+      spec.include 'gradlew*'
+      spec.include 'gradle/**'
+      spec.include 'etc/**'
+      spec.include 'buildSrc/**'
+      spec.include 'src/**'
+      releaseSpec.approvedProjects.each { p ->
+        def relPath = new File( project.projectDir.toURI().relativize( p.projectDir.toURI() ).toString() )
+        spec.include "$relPath/**"
+      }
+      spec.include 'manual/**'
+      spec.include 'samples/**'
+      spec.include 'tests/**'
+      spec.include 'tutorials/**'
+      spec.include 'tools/shell/**'
+      // Filtered, see below
+      spec.exclude 'settings.gradle'
+      spec.exclude 'gradle.properties'
+      // Excludes
+      spec.exclude '**/build/**'             // Build output
+      spec.exclude 'derby.log'               // Derby test garbage
+      spec.exclude '**/*.iml'                // IDEA files
+      spec.exclude '**/*.ipr'                // IDEA files
+      spec.exclude '**/*.iws'                // IDEA files
+      spec.exclude '**/.idea'                // IDEA files
+      spec.exclude '**/out/**'               // IDEA build output
+      spec.exclude '**/.classpath'           // Eclipse files
+      spec.exclude '**/.project'             // Eclipse files
+      spec.exclude '**/.settings'            // Eclipse files
+      spec.exclude '**/.nb-gradle/**'        // Netbeans files
+      spec.exclude '**/.nb-gradle*'          // Netbeans files
+      spec.exclude '**/.git/**'              // Git directories
+      spec.exclude '**/.git*'                // Git files
+      spec.exclude '**/.gradle/**'           // Gradle management files
+      spec.exclude '**/.gradletasknamecache' // Gradle cache
+      spec.into '.'
+    }
+    def srcDistFilteredFilesTask = project.tasks.create( 'srcDistFilteredFiles' )
+    srcDistFilteredFilesTask.description = 'Apply release specification to source distribution build scripts'
+    // Generates various files for the source distribution
+    // - settings.gradle
+    // - gradle.properties to set version !
+    def filteredDir = new File( "$project.buildDir/tmp/srcDistFilteredFiles" )
+    srcDistFilteredFilesTask.outputs.file filteredDir
+    srcDistFilteredFilesTask.doLast {
+      // Settings
+      def settingsFile = new File( filteredDir, 'settings.gradle' )
+      settingsFile.parentFile.mkdirs()
+      def filteredSettings = ''
+      project.file( 'settings.gradle' ).readLines().each { line ->
+        if( line.contains( '\'libraries:' ) || line.contains( '\'extensions:' ) || line.contains( '\'tools:' ) )
+        {
+          def accepted = false
+          releaseSpec.approvedProjects.collect { it.projectDir }.each { acceptedProjectDir ->
+            if( line.contains( "'${ acceptedProjectDir.parentFile.name }:${ acceptedProjectDir.name }'" ) )
+            {
+              accepted = true
+            }
+          }
+          if( accepted )
+          {
+            filteredSettings += "$line\n"
+          }
+        }
+        else
+        {
+          filteredSettings += "$line\n"
+        }
+      }
+      settingsFile.text = filteredSettings
+      // gradle.properties
+      def gradlePropsFile = new File( filteredDir, 'gradle.properties' )
+      gradlePropsFile.parentFile.mkdirs()
+      gradlePropsFile.text = project.file( 'gradle.properties' ).text +
+                             "\nskipSigning=true\nskipAsciidocIfAbsent=true\n\nversion=$project.version\n"
+    }
+    def srcDistFilteredFilesCopySpec = project.copySpec { CopySpec spec ->
+      spec.from srcDistFilteredFilesTask
+      spec.into '.'
+    }
+    def srcDistCopySpec = project.copySpec { CopySpec spec ->
+      spec.into "apache-polygene-java-$project.version-src"
+      spec.with srcDistFilesCopySpec
+      spec.with srcDistFilteredFilesCopySpec
+    }
+
+    def zipSources = project.tasks.create( 'zipSources', Zip ) { Zip task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = 'Assemble .zip source distribution'
+      task.baseName = 'apache-polygene-java'
+      task.with srcDistCopySpec
+      task.classifier = 'src'
+    }
+    def tarSources = project.tasks.create( 'tarSources', Tar ) { Tar task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = 'Assemble .tar.gz source distribution'
+      task.baseName = 'apache-polygene-java'
+      task.with srcDistCopySpec
+      task.compression = Compression.GZIP
+      task.classifier = 'src'
+    }
+    project.artifacts.add( 'archives', zipSources )
+    project.artifacts.add( 'archives', tarSources )
+
+    project.tasks.create( TaskNames.UNPACK_SOURCE_DIST, Copy ) { Copy task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = "Unpack source distribution"
+      task.with srcDistCopySpec
+      task.into 'build/unpacked-distributions/src'
+    }
+
+    def unpackedSrcDistDir = project.file( "build/unpacked-distributions/src/apache-polygene-java-$project.version-src" )
+    project.tasks.create( TaskNames.CHECK_SOURCE_DIST, GradleBuild.class, { GradleBuild task ->
+      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
+      task.description = "Check the source distribution by running the 'check' and 'assemble' tasks inside"
+      task.dependsOn TaskNames.UNPACK_SOURCE_DIST
+      task.buildFile = "$unpackedSrcDistDir/build.gradle"
+      task.tasks = [ 'check', 'assemble' ]
+    } as Action<GradleBuild> )
+  }
+
+  private static void configureBinaryDistribution( Project project )
+  {
+    configureGoOfflineHelpers( project )
+
+    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
+    def reportsDistCopySpec = project.copySpec { CopySpec spec ->
+      spec.from "$project.buildDir/reports"
+      spec.into 'docs/reports'
+    }
+    def docsCopySpec = project.copySpec { CopySpec spec ->
+      spec.from 'build/docs'
+      spec.from 'manual/build/docs/website'
+      spec.into 'docs'
+    }
+    def runtimeDependenciesListCopySpec = project.copySpec { CopySpec spec ->
+      releaseSpec.approvedProjects.collect { p ->
+        spec.into( 'libs/' ) { CopySpec sub ->
+          sub.from "$p.buildDir/reports/project/dependencies.txt"
+          sub.rename 'dependencies.txt', "${ p.name }-${ p.version }-runtime-deps.txt"
+        }
+      }
+      spec.into( '.' ) { CopySpec sub ->
+        sub.from project.tasks.getByName( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS ).outputs
+        sub.from project.tasks.getByName( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS ).outputs
+      }
+    }
+    def libsCopySpec = project.copySpec { CopySpec spec ->
+      releaseSpec.approvedProjects.collect { proj ->
+        spec.into( 'libs/' ) { CopySpec sub ->
+          sub.from proj.configurations.getByName( 'archives' ).artifacts.files
+          sub.exclude '**-testsources.jar'
+          sub.exclude '**/*.asc'
+        }
+      }
+    }
+    def extraDistTextCopySpec = project.copySpec { CopySpec spec ->
+      releaseSpec.approvedProjects.collect { p ->
+        spec.from project.fileTree( dir: "$p.projectDir/src/dist/", include: '**', exclude: "**/*.jar*" )
+        spec.eachFile { FileCopyDetails fcd ->
+          fcd.filter( ReplaceTokens, tokens: [ version: project.version ] )
+        }
+      }
+      spec.into '.'
+    }
+    def extraDistBinCopySpec = project.copySpec { CopySpec spec ->
+      releaseSpec.approvedProjects.collect { p ->
+        spec.from "$p.projectDir/src/dist/"
+        spec.include '**/*.jar'
+        spec.include '**/*.jar_'
+      }
+      spec.into '.'
+    }
+    def binDistNoticesCopySpec = project.copySpec { CopySpec spec ->
+      spec.from "$project.projectDir/LICENSE.txt"
+      spec.from "$project.projectDir/src/bin-dist"
+      spec.into '.'
+    }
+    def binDistImage = project.copySpec { CopySpec spec ->
+      spec.into "apache-polygene-java-$project.version-bin"
+      spec.with binDistNoticesCopySpec
+      spec.with docsCopySpec
+      spec.with reportsDistCopySpec
+      spec.with runtimeDependenciesListCopySpec
+      spec.with extraDistTextCopySpec
+      spec.with extraDistBinCopySpec
+      spec.with libsCopySpec
+    }
+
+    def zipBinaries = project.tasks.create( 'zipBinaries', Zip ) { Zip task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = 'Assemble .zip binary distribution'
+      task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
+      task.baseName = 'apache-polygene-java'
+      task.classifier = 'bin'
+      task.with binDistImage
+    }
+    def tarBinaries = project.tasks.create( 'tarBinaries', Tar ) { Tar task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = 'Assemble .tar.gz binary distribution'
+      task.dependsOn project.tasks.getByName( RootProjectPlugin.TaskNames.BUILD_ALL )
+      task.baseName = 'apache-polygene-java'
+      task.classifier = 'bin'
+      task.compression = Compression.GZIP
+      task.with binDistImage
+    }
+    project.artifacts.add( 'archives', zipBinaries )
+    project.artifacts.add( 'archives', tarBinaries )
+
+    project.tasks.create( TaskNames.UNPACK_BINARY_DIST, Copy ) { Copy task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = "Unpack binary distribution"
+      task.with binDistImage
+      task.into 'build/unpacked-distributions/bin'
+    }
+
+    configureBinaryDistributionCheck( project )
+  }
+
+  private static void configureGoOfflineHelpers( Project project )
+  {
+    def externalRepos = project.rootProject.extensions.getByType( DependenciesDeclarationExtension ).repositoriesUrls
+    def approvedProjectsTask = project.tasks.getByName( ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS )
+    def genOfflineMaven = project.tasks.create( TaskNames.GENERATE_MAVEN_OFFLINE_HELPERS,
+                                                GoOfflineHelpersTasks.GenerateMaven )
+    def genOfflineGradle = project.tasks.create( TaskNames.GENERATE_GRADLE_OFFLINE_HELPERS,
+                                                 GoOfflineHelpersTasks.GenerateGradle )
+    genOfflineMaven.repositories = externalRepos
+    genOfflineGradle.repositories = externalRepos
+    [ genOfflineMaven, genOfflineGradle ].each { task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.dependsOn approvedProjectsTask
+    }
+    def checkOfflineMaven = project.tasks.create( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS,
+                                                  GoOfflineHelpersTasks.CheckMaven )
+    checkOfflineMaven.group = TaskGroups.DISTRIBUTION_VERIFICATION
+    checkOfflineMaven.description = 'Check binary distribution Maven dependencies download helper'
+    checkOfflineMaven.dependsOn genOfflineMaven
+    def checkOfflineGradle = project.tasks.create( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS,
+                                                   GoOfflineHelpersTasks.CheckGradle )
+    checkOfflineGradle.group = TaskGroups.DISTRIBUTION_VERIFICATION
+    checkOfflineGradle.description = 'Check binary distribution Gradle dependencies download helper'
+    checkOfflineGradle.dependsOn genOfflineGradle
+    [ checkOfflineMaven, checkOfflineGradle ].each { task ->
+      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
+      task.dependsOn TaskNames.UNPACK_BINARY_DIST
+    }
+  }
+
+  private static void configureBinaryDistributionCheck( Project project )
+  {
+    def unpackedBinDistDir = project.file( "build/unpacked-distributions/bin/apache-polygene-java-$project.version-bin" )
+    project.tasks.create( TaskNames.CHECK_BINARY_DIST_RAT, RatTask, { RatTask task ->
+      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
+      task.description = "Checks binary distribution using Apache RAT"
+      task.dependsOn TaskNames.UNPACK_BINARY_DIST
+      task.inputDir = unpackedBinDistDir.absolutePath
+      task.reportDir = project.file( 'build/reports/rat-bin-dist' )
+      task.excludes = [
+        '.gradle/**',
+        'docs/reports/**',
+        'docs/javadocs/**',
+        'etc/templates/**',
+        'libs/**'
+      ]
+    } as Action<RatTask> )
+    project.tasks.getByName( TaskNames.CHECK_MAVEN_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckMaven task ->
+      task.directory = unpackedBinDistDir
+    }
+    project.tasks.getByName( TaskNames.CHECK_GRADLE_OFFLINE_HELPERS ) { GoOfflineHelpersTasks.CheckGradle task ->
+      task.directory = unpackedBinDistDir
+      task.mustRunAfter TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
+    }
+    project.tasks.create( TaskNames.CHECK_BINARY_DIST ) { Task task ->
+      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
+      task.description = 'Checks binary distribution'
+      task.dependsOn TaskNames.CHECK_BINARY_DIST_RAT
+      task.dependsOn TaskNames.CHECK_MAVEN_OFFLINE_HELPERS
+      task.dependsOn TaskNames.CHECK_GRADLE_OFFLINE_HELPERS
+    }
+  }
+
+  @CompileStatic( TypeCheckingMode.SKIP )
+  private static void configureDistributionChecksums( Project project )
+  {
+    project.tasks.withType( Zip ) { Zip task ->
+      task.doLast {
+        project.ant.checksum file: task.archivePath, algorithm: 'MD5'
+        project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
+      }
+    }
+    project.tasks.withType( Tar ) { Tar task ->
+      task.doLast {
+        project.ant.checksum file: task.archivePath, algorithm: 'MD5'
+        project.ant.checksum file: task.archivePath, algorithm: 'SHA-512'
+      }
+    }
+  }
+
+  private static void configureHelperTasks( Project project )
+  {
+    project.tasks.create( 'dist', Copy ) { Copy task ->
+      task.group = TaskGroups.DISTRIBUTION
+      task.description = "Assembles source and binary distributions"
+      task.dependsOn 'install'
+      task.from project.tasks.getByName( 'unpackBinDist' )
+      task.into "$project.buildDir/dist"
+    }
+    project.tasks.create( 'checkDists' ) { Task task ->
+      task.group = TaskGroups.DISTRIBUTION_VERIFICATION
+      task.description = "Checks source and binary distributions"
+      task.dependsOn TaskNames.CHECK_SOURCE_DIST, TaskNames.CHECK_BINARY_DIST
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
new file mode 100644
index 0000000..415a0bb
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dist/GoOfflineHelpersTasks.groovy
@@ -0,0 +1,345 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.dist
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.release.ReleaseSpecExtension
+import org.apache.polygene.gradle.tasks.ExecLogged
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+import org.gradle.api.artifacts.Dependency
+import org.gradle.api.artifacts.ProjectDependency
+import org.gradle.api.artifacts.result.ResolvedComponentResult
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputFile
+import org.gradle.api.tasks.Internal
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.process.ExecSpec
+
+/**
+ * Tasks to generate and check go-offline maven and gradle helpers bundled with the binary distribution.
+ */
+@CompileStatic
+interface GoOfflineHelpersTasks
+{
+  class GenerateMaven extends DefaultTask
+  {
+    static final String POM_FILENAME = 'go-offline.pom'
+
+    @Input
+    Map<String, String> repositories = [ : ]
+
+    @Internal
+    File outputDir = new File( project.buildDir, 'go-offline-helpers' )
+
+    @OutputFile
+    File getMavenGoOfflineHelper()
+    {
+      return new File( outputDir, POM_FILENAME )
+    }
+
+    GenerateMaven()
+    {
+      super();
+      outputs.upToDateWhen { false }
+    }
+
+    @TaskAction
+    void generate()
+    {
+      outputDir.mkdirs()
+      def components = Utils.resolveAllRuntimeComponents( project )
+      def maven = generateMaven( components )
+      mavenGoOfflineHelper.text = maven
+    }
+
+    private String generateMaven( Set<ResolvedComponentResult> components )
+    {
+      def pom = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'xml' )
+      pom += '<project>\n  <modelVersion>4.0.0</modelVersion>\n'
+      pom +=
+        "  <groupId>org.apache.polygene</groupId>\n  <artifactId>go-offline-helper</artifactId>\n  <version>$project.version</version>\n"
+      pom += '  <packaging>pom</packaging>\n'
+      pom +=
+        '  <!--\n  This pom has the sole purpose of downloading all dependencies in a directory relative to this file named \'dependencies\'.\n'
+      pom += "  Use the following command:\n\n  mvn -f $POM_FILENAME validate\n  -->\n  <repositories>\n"
+      repositories.entrySet().each { repo ->
+        pom += "    <repository><id>go-offline-repo-$repo.key</id><url>${ repo.value }</url></repository>\n"
+      }
+      pom += '  </repositories>\n  <dependencies>\n'
+      components.each { comp ->
+        pom += '    <dependency>\n'
+        pom += "      <groupId>$comp.moduleVersion.group</groupId>\n"
+        pom += "      <artifactId>$comp.moduleVersion.name</artifactId>\n"
+        pom += "      <version>$comp.moduleVersion.version</version>\n"
+        pom += '    </dependency>\n'
+      }
+      pom += """  </dependencies>\n  <build><plugins><plugin>
+    <groupId>org.apache.maven.plugins</groupId>
+    <artifactId>maven-dependency-plugin</artifactId>
+    <version>2.10</version>
+    <executions>
+      <execution>
+        <id>go-offline-jars</id><phase>validate</phase>
+        <goals><goal>copy-dependencies</goal></goals>
+        <configuration>
+          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
+          <excludeTransitive>true</excludeTransitive>
+        </configuration>
+      </execution>
+      <execution>
+        <id>go-offline-sources</id><phase>validate</phase>
+        <goals><goal>copy-dependencies</goal></goals>
+        <configuration>
+          <classifier>sources</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
+          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
+          <excludeTransitive>true</excludeTransitive>
+        </configuration>
+      </execution>
+      <execution>
+        <id>go-offline-javadocs</id><phase>validate</phase>
+        <goals><goal>copy-dependencies</goal></goals>
+        <configuration>
+          <classifier>javadoc</classifier><failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
+          <outputDirectory>\${project.basedir}/dependencies</outputDirectory>
+          <excludeTransitive>true</excludeTransitive>
+        </configuration>
+      </execution>
+    </executions>
+  </plugin></plugins></build>
+</project>
+"""
+      return pom
+    }
+  }
+
+  class GenerateGradle extends DefaultTask
+  {
+    static final String BUILD_SCRIPT_FILENAME = 'go-offline.gradle'
+
+    @Input
+    Map<String, String> repositories = [ : ]
+
+    @Internal
+    File outputDir = new File( project.buildDir, 'go-offline-helpers' )
+
+    @OutputFile
+    File getGradleGoOfflineHelper()
+    {
+      return new File( outputDir, BUILD_SCRIPT_FILENAME )
+    }
+
+    GenerateGradle()
+    {
+      super();
+      outputs.upToDateWhen { false }
+    }
+
+    @TaskAction
+    void generate()
+    {
+      outputDir.mkdirs()
+      def components = Utils.resolveAllRuntimeComponents( project )
+      def gradle = generateGradle( components )
+      gradleGoOfflineHelper.text = gradle
+    }
+
+    private String generateGradle( Set<ResolvedComponentResult> components )
+    {
+      def build = Utils.licenseHeader( project.file( 'etc/header.txt' ).text, 'java' )
+      build += '// This gradle build file has the sole purpose of downloading all dependencies in a directory\n'
+      build += '// relative to this file named \'dependencies\'.\n'
+      build += "// Use the following command: gradle -b $BUILD_SCRIPT_FILENAME download\n"
+      build += 'apply plugin: \'java\'\nconfigurations { download }\nrepositories {\n'
+      repositories.entrySet().each { repo ->
+        build += "  maven { url '${ repo.value }' }\n"
+      }
+      build += '}\ndependencies {\n'
+      components.each { comp ->
+        def depCoords = "${ comp.moduleVersion.group }:${ comp.moduleVersion.name }:${ comp.moduleVersion.version }"
+        build += "  download( '$depCoords' ) { transitive = false }\n"
+      }
+      build += """}
+task download( type: Copy ) {
+  outputs.upToDateWhen { false }
+  def sources = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
+    project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'sources' ] )
+  }
+  def javadocs = configurations.download.resolvedConfiguration.resolvedArtifacts.collect { artifact ->
+    project.dependencies.create( [ group: artifact.moduleVersion.id.group, name: artifact.moduleVersion.id.name, version: artifact.moduleVersion.id.version, classifier: 'javadoc' ] )
+  }
+  from configurations.download
+  from configurations.detachedConfiguration( sources as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
+  from configurations.detachedConfiguration( javadocs as Dependency[] ).resolvedConfiguration.lenientConfiguration.getFiles( Specs.SATISFIES_ALL )
+  into file( 'dependencies/' )
+}
+"""
+      return build
+    }
+  }
+
+  class CheckMaven extends DefaultTask
+  {
+    @Internal
+    File directory
+
+    @InputFile
+    File getMavenGoOfflineHelper()
+    {
+      return new File( directory, GenerateMaven.POM_FILENAME )
+    }
+
+    CheckMaven()
+    {
+      super();
+      description = 'Check the binary distribution Maven go-offline helper'
+      outputs.upToDateWhen { false }
+      onlyIf { Utils.isMvnInstalled() }
+    }
+
+    @TaskAction
+    void check()
+    {
+      def dependenciesDir = new File( directory, 'dependencies' )
+      project.delete dependenciesDir
+      def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
+      def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
+      def command = [ 'mvn', '-e', '-f', GenerateMaven.POM_FILENAME, 'validate' ] as Object[]
+      ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
+        spec.workingDir directory
+        spec.commandLine command
+      }
+      Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateMaven.POM_FILENAME )
+    }
+  }
+
+  class CheckGradle extends DefaultTask
+  {
+    @Internal
+    File directory
+
+    @InputFile
+    File getGradleGoOfflineHelper()
+    {
+      return new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
+    }
+
+    CheckGradle()
+    {
+      super();
+      description = 'Check the binary distribution Gradle go-offline helper'
+      outputs.upToDateWhen { false }
+    }
+
+    @TaskAction
+    void check()
+    {
+      def buildScript = new File( directory, GenerateGradle.BUILD_SCRIPT_FILENAME )
+      def dependenciesDir = new File( directory, 'dependencies' )
+      project.delete dependenciesDir
+      def outLog = project.file( "$project.buildDir/tmp/$name/stdout.log" )
+      def errLog = project.file( "$project.buildDir/tmp/$name/stderr.log" )
+      ExecLogged.execLogged( project, outLog, errLog ) { ExecSpec spec ->
+        spec.workingDir project.projectDir
+        spec.commandLine './gradlew', '-u', '-s', '-b', buildScript.absolutePath, 'download'
+      }
+      Utils.checkAllJarsArePresent( project, dependenciesDir, GenerateGradle.BUILD_SCRIPT_FILENAME )
+    }
+  }
+
+  static class Utils
+  {
+    // Do the global dependency resolution here so there won't be any surprise when using the helpers
+    // This also allow to apply the resolution strategy defined in libraries.gradle
+    // WARN some of our modules depends on != versions of some artifacts, this resolution flatten this using the most up to date
+    private static Set<ResolvedComponentResult> resolveAllRuntimeComponents( Project rootProject )
+    {
+      def allRuntimeDeps = getAllRuntimeDependencies( rootProject )
+      def configuration = rootProject.configurations.findByName( 'goOfflineHelpers' )
+      if( !configuration )
+      {
+        configuration = rootProject.configurations.create( 'goOfflineHelpers' )
+        allRuntimeDeps.each { set -> rootProject.dependencies.add( configuration.name, set ) }
+      }
+      return configuration.incoming.resolutionResult.allComponents.findAll { ResolvedComponentResult comp ->
+        !comp.moduleVersion.group.startsWith( 'org.apache.polygene' )
+      } as Set<ResolvedComponentResult>
+    }
+
+    private static List<Dependency> getAllRuntimeDependencies( Project rootProject )
+    {
+      def releaseSpec = rootProject.extensions.getByType( ReleaseSpecExtension )
+      def allDependencies = releaseSpec.approvedProjects.collect { project ->
+        project.configurations.getByName( 'runtime' ).allDependencies
+      }.flatten() as List<Dependency>
+      return allDependencies.findAll { Dependency dep ->
+        !( dep instanceof ProjectDependency ) && dep.name != null && !dep.group.startsWith( 'org.apache.polygene' )
+      }
+    }
+
+    private static void checkAllJarsArePresent( Project rootProject, File dependenciesDir, String helper )
+    {
+      def allDependencies = getAllRuntimeDependencies( rootProject )
+      allDependencies.each { Dependency dep ->
+        def jarName = "${ dep.name }-${ dep.version }.jar"
+        def jarFile = new File( dependenciesDir, jarName )
+        if( !jarFile.exists() )
+        {
+          throw new GradleException( "Binary distribution $helper failed!\n" +
+                                     "\tMissing: $dep\n" +
+                                     "\tin $jarFile" );
+        }
+      }
+    }
+
+    private static boolean isMvnInstalled()
+    {
+      def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
+      def flattened = pathDirs.collect( { String pathDir -> new File( pathDir, 'mvn' ) } ).flatten() as List<File>
+      return flattened.find( { File pathDir -> pathDir.isFile() } ) != null
+    }
+
+    // Generate license headers with comment styles
+    private static String licenseHeader( String base, String flavour )
+    {
+      def header
+      switch( flavour )
+      {
+        case 'java': case 'groovy': case 'js':
+          header = licenseHeader_wrap( base, '/*', ' * ', ' */' ); break
+        case 'xml': case 'html':
+          header = licenseHeader_wrap( base, '<!--', '  ', '-->' ); break
+        case 'txt': case 'shell': case 'python': case 'ruby':
+          header = licenseHeader_wrap( base, null, '# ', null ); break
+        case 'adoc': case 'asciidoc':
+          header = licenseHeader_wrap( base, null, '// ', null ); break
+        default:
+          header = base
+      }
+      header
+    }
+
+    private static String licenseHeader_wrap( String base, String top, String left, String bottom )
+    {
+      ( top ? "$top\n" : '' ) + base.readLines().collect { "${ left }${ it }" }.join( '\n' ) + '\n' +
+      ( bottom ? "$bottom\n" : '' )
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
new file mode 100644
index 0000000..f8edcfb
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/AsciidocBuildInfoPlugin.groovy
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.doc
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.gradle.api.Project
+import org.gradle.api.Plugin
+
+@CompileStatic
+class AsciidocBuildInfoPlugin implements Plugin<Project>
+{
+  final static String TASK_NAME = 'makeAsciidocBuildInfo'
+
+  def void apply( Project project )
+  {
+    def buildInfoDir = new File( project.buildDir, "docs/buildinfo" );
+
+    def makeAsciidocBuildInfoTask = project.tasks.create( TASK_NAME )
+    makeAsciidocBuildInfoTask.group = TaskGroups.DOCUMENTATION
+    makeAsciidocBuildInfoTask.description = 'Generates asciidoc artifact snippet'
+    makeAsciidocBuildInfoTask.doLast {
+      buildInfoDir.mkdirs()
+
+      // GroupID, ArtifactID, Version table in artifact.txt
+      def artifactTableFile = new File( buildInfoDir, "artifact.txt" )
+      def artifactTable = """
+        |.Artifact
+        |[role="artifact", options="header,autowidth"]
+        ||===================================================
+        ||Group ID|Artifact ID|Version
+        ||${ project.group }|${ project.name }|${ project.version }
+        ||===================================================
+        """.stripMargin()
+      artifactTableFile.withWriter { out -> out.println( artifactTable ) }
+    }
+
+    // Declare inputs/outputs
+    if( project.getBuildFile() != null && project.getBuildFile().exists() )
+    {
+      makeAsciidocBuildInfoTask.getInputs().file( project.getBuildFile() )
+    }
+    makeAsciidocBuildInfoTask.getOutputs().file( buildInfoDir )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
new file mode 100644
index 0000000..a043aa0
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
@@ -0,0 +1,292 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.doc
+
+import groovy.io.FileType
+import groovy.transform.CompileStatic
+import groovy.transform.TypeCheckingMode
+import java.security.MessageDigest
+import org.apache.polygene.gradle.PolygeneExtension
+import org.apache.polygene.gradle.release.ReleaseSpecExtension
+import org.apache.polygene.gradle.tasks.ExecLogged
+import org.gradle.api.Action;
+import org.gradle.api.DefaultTask
+import org.gradle.api.file.CopySpec
+import org.gradle.api.tasks.Internal
+import org.gradle.api.tasks.TaskAction
+import org.gradle.api.tasks.Input
+import org.gradle.api.tasks.InputDirectory
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.process.ExecSpec
+
+// TODO: try to use dependencies for FOP and execute within the same JVM.
+// TODO: move the bulk of resources into this plugin, instead of sitting in the project.
+@CompileStatic
+class DocumentationTask extends DefaultTask
+{
+  @Input def String docName
+  @Input def String docType
+
+  @InputDirectory def File getCommonResourcesDir() { project.file( 'src/resources' ) }
+  @InputDirectory def File getConfigDir() { project.file( 'src/conf' ) }
+  @InputDirectory def File getDocsDir() { project.file( 'src/docs' ) }
+  @InputDirectory def File getSrcMainDir() { project.file( 'src/main' ) }
+  @InputDirectory def File getXslDir() { project.file( 'src/xsl' ) }
+  @InputDirectory def File getBuildSrcDir() { project.rootProject.file( 'buildSrc/src' ) }
+
+  @InputFiles def getSubProjectsDocsDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/docs' ) } }
+  @InputFiles def getSubProjectsTestDirs() { project.rootProject.subprojects.collect { p -> p.file( 'src/test' ) } }
+
+  @OutputDirectory def File getOutputDir() { project.file( "${ project.buildDir }/docs/${ docName }/" ) }
+
+  @Internal def File getTempAsciidocDir() { project.file( "${ project.buildDir }/tmp-asciidoc" ) }
+  @Internal def File getTempDir() { project.file( "${ project.buildDir }/tmp/docs/${ docName }" ) }
+
+  @TaskAction
+  def void generate()
+  {
+    installAsciidocFilters()
+
+    [ outputDir, tempAsciidocDir, tempDir ].each { it.deleteDir() }
+    [ outputDir, tempAsciidocDir, tempDir ].each { it.mkdirs() }
+
+    copySubProjectsDocsResources()
+    generateAsciidocAccordingToReleaseSpecification()
+    generateXDoc()
+    generateChunkedHtml()
+    // generateSingleHtml()
+    // generatePdf()
+  }
+
+  def void installAsciidocFilters()
+  {
+    def digester = MessageDigest.getInstance( 'SHA' )
+    def filtersDir = project.rootProject.file( 'buildSrc/src/asciidoc/filters' )
+    def userHome = new File( System.getProperty( 'user.home' ) )
+    def dotAsciidocFiltersDir = new File( userHome, '.asciidoc/filters' )
+    def installSnippets = false
+    filtersDir.eachFileRecurse( FileType.FILES ) { originalFile ->
+      def targetFile = new File( dotAsciidocFiltersDir,
+                                 ( originalFile.toURI() as String ) - ( filtersDir.toURI() as String ) )
+      if( !targetFile.exists() )
+      {
+        installSnippets = true
+      }
+      else
+      {
+        def originalDigest = digester.digest( originalFile.bytes )
+        def targetDigest = digester.digest( targetFile.bytes )
+        if( originalDigest != targetDigest )
+        {
+          installSnippets = true
+        }
+      }
+    }
+    if( installSnippets )
+    {
+      dotAsciidocFiltersDir.mkdirs()
+      project.rootProject.copy { CopySpec spec ->
+        spec.from filtersDir
+        spec.into dotAsciidocFiltersDir
+      }
+      dotAsciidocFiltersDir.eachFileRecurse( FileType.FILES ) { file ->
+        if( file.name.endsWith( '.py' ) )
+        {
+          chmod( file, '755' )
+        }
+      }
+      println "Polygene Asciidoc Filters Installed!"
+    }
+  }
+
+  @CompileStatic( TypeCheckingMode.SKIP )
+  def void chmod( File file, String permissions )
+  {
+    ant.chmod( file: file.absolutePath, perm: permissions )
+  }
+
+  def void copySubProjectsDocsResources()
+  {
+    project.rootProject.subprojects.each { p ->
+      p.copy { CopySpec spec ->
+        spec.from p.file( 'src/docs/resources' )
+        spec.into outputDir
+        spec.include '**'
+      }
+    }
+  }
+
+  def void generateAsciidocAccordingToReleaseSpecification()
+  {
+    def zest = project.extensions.getByType( PolygeneExtension )
+    project.copy { CopySpec spec ->
+      spec.from docsDir
+      spec.into tempAsciidocDir
+      spec.include '**'
+    }
+    if( zest.releaseVersion )
+    {
+      def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
+      def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
+      def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
+      [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
+        def filteredFileContent = ''
+        asciidocFile.readLines().each { line ->
+          if( line.startsWith( 'include::' ) )
+          {
+            def approved = false
+            def releaseApprovedProjects = project.rootProject.extensions.
+              getByType( ReleaseSpecExtension ).approvedProjects
+            releaseApprovedProjects.collect { it.projectDir }.each { approvedProjectDir ->
+              if( line.contains( "${ approvedProjectDir.parentFile.name }/${ approvedProjectDir.name }" ) )
+              {
+                approved = true
+              }
+            }
+            if( approved )
+            {
+              filteredFileContent += "$line\n"
+            }
+          }
+          else
+          {
+            filteredFileContent += "$line\n"
+          }
+        }
+        asciidocFile.text = filteredFileContent
+      }
+    }
+  }
+
+  def void generateXDoc()
+  {
+    def outLog = getLogFile( 'adoc-2-docbook', 'stdout' )
+    def errLog = getLogFile( 'adoc-2-docbook', 'stderr' )
+    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
+      spec.executable = 'asciidoc'
+      spec.workingDir = '..'
+      def commonResourcesPath = relativePath( project.rootDir, commonResourcesDir )
+      def asciidocConfigPath = relativePath( project.rootDir, new File( configDir, 'asciidoc.conf' ) )
+      def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
+      def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
+      def xdocOutputPath = relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
+      def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
+      spec.args = [
+        '--attribute', 'revnumber=' + project.version,
+        '--attribute', 'level1=' + ( docType == 'article' ? 1 : 0 ),
+        '--attribute', 'level2=' + ( docType == 'article' ? 2 : 1 ),
+        '--attribute', 'level3=' + ( docType == 'article' ? 3 : 2 ),
+        '--attribute', 'level4=' + ( docType == 'article' ? 4 : 3 ),
+        '--attribute', 'importdir=' + commonResourcesPath,
+        '--backend', 'docbook',
+        '--attribute', 'docinfo1',
+        '--doctype', docType,
+        '--conf-file=' + asciidocConfigPath,
+        '--conf-file=' + docbookConfigPath,
+        '--conf-file=' + linkimagesConfigPath,
+        '--out-file', xdocOutputPath,
+        asciidocIndexPath
+      ]
+    } as Action<? super ExecSpec> )
+  }
+
+  def void generateChunkedHtml()
+  {
+    project.copy { CopySpec spec ->
+      spec.from commonResourcesDir
+      spec.into outputDir
+      spec.include '**'
+    }
+    project.copy { CopySpec spec ->
+      spec.from "$docsDir/$docName/resources"
+      spec.into outputDir
+      spec.include '**'
+    }
+    def outLog = getLogFile( 'docbook-2-chunked-html', 'stdout' )
+    def errLog = getLogFile( 'docbook-2-chunked-html', 'stderr' )
+    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
+      def xsltFile = "$docsDir/$docName/xsl/chunked.xsl"
+      def outputPath = relativePath( project.projectDir, outputDir ) + '/'
+      spec.executable = 'xsltproc'
+      spec.args = [
+        '--nonet',
+        '--noout',
+        '--output', outputPath,
+        xsltFile,
+        "$tempDir/xdoc-temp.xml"
+      ]
+    } as Action<? super ExecSpec> )
+  }
+
+  def void generateSingleHtml()
+  {
+    def outLog = getLogFile( 'docbook-2-html', 'stdout' )
+    def errLog = getLogFile( 'docbook-2-html', 'stderr' )
+    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
+      // XML_CATALOG_FILES=
+      String xsltFile = "$xslDir/xhtml.xsl"
+      spec.executable = 'xsltproc'
+      spec.args = [
+        '--nonet',
+        '--noout',
+        '--output', "$outputDir/${ docName }.html",
+        xsltFile,
+        "$tempDir/xdoc-temp.xml"
+      ]
+    } as Action<? super ExecSpec> )
+  }
+
+  def void generatePdf()
+  {
+    // $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
+    def outLog = getLogFile( 'docbook-2-fo', 'stdout' )
+    def errLog = getLogFile( 'docbook-2-fo', 'stderr' )
+    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
+      String xsltFile = "$xslDir/fo.xsl"
+      spec.executable = 'xsltproc'
+      spec.args = [
+        '--nonet',
+        '--output', "$tempDir/${ docName }.fo",
+        xsltFile,
+        "$tempDir/xdoc-temp.xml"
+      ]
+    } as Action<? super ExecSpec> )
+
+    // $ fop article.fo article.pdf
+    outLog = getLogFile( 'fo-2-pdf', 'stdout' )
+    errLog = getLogFile( 'fo-2-pdf', 'stderr' )
+    ExecLogged.execLogged( project, outLog, errLog, { ExecSpec spec ->
+      spec.executable = 'fop'
+      spec.args = [
+        "$tempDir/${ docName }.fo",
+        "$outputDir/${ docName }.pdf"
+      ]
+    } as Action<? super ExecSpec> )
+  }
+
+  private File getLogFile( String step, String stream )
+  {
+    return project.file( "${ project.buildDir }/tmp/${ name }/${ step }-${ stream }.log" )
+  }
+
+  private static String relativePath( File root, File target )
+  {
+    new File( root.toURI().relativize( target.toURI() ).toString() ).path
+  }
+}


[22/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BootstrapException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BootstrapException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BootstrapException.java
new file mode 100644
index 0000000..e590d0a
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BootstrapException.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * This exception is thrown if no ApplicationFactory provider can be found
+ */
+public class BootstrapException
+    extends RuntimeException
+{
+    public BootstrapException( String message )
+    {
+        super( message );
+    }
+
+    public BootstrapException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ClassScanner.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ClassScanner.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ClassScanner.java
new file mode 100644
index 0000000..5850e95
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ClassScanner.java
@@ -0,0 +1,182 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.security.CodeSource;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
+
+/**
+ * Scan classpath for classes that matches given criteria. Useful for automated assemblies with lots of similar classes.
+ */
+public class ClassScanner
+{
+    private static final ValidClass VALID_CLASS_PREDICATE = new ValidClass();
+
+    /**
+     * Get all classes from the same package of the given class, and recursively in all subpackages.
+     * <p>
+     * This only works if the seed class is loaded from a file: URL. Jar files are possible as well. Abstract classes
+     * are not included in the results. For further filtering use e.g. Stream.filter.
+     * </p>
+     * @param seedClass starting point for classpath scanning
+     *
+     * @return Stream of all concrete classes in the same package as the seedclass, and also all classes in subpackages.
+     */
+    public static Stream<? extends Class<?>> findClasses( final Class<?> seedClass )
+    {
+        CodeSource codeSource = seedClass.getProtectionDomain().getCodeSource();
+        if( codeSource == null )
+        {
+            return Stream.of();
+        }
+
+        URL location = codeSource.getLocation();
+
+        if( !location.getProtocol().equals( "file" ) )
+        {
+            throw new IllegalArgumentException(
+                "Can only enumerate classes from file system locations. URL is:" + location );
+        }
+
+        final File file;
+        try
+        {
+            file = new File( location.toURI().getPath() );
+        }
+        catch( URISyntaxException e )
+        {
+            throw new IllegalArgumentException(
+                "The file location of codebase is invalid. Can not convert to URI. URL is:" + location );
+        }
+
+        if( file.getName().endsWith( ".jar" ) )
+        {
+            try
+            {
+                final String packageName = seedClass.getPackage().getName().replace( '.', '/' );
+
+                JarFile jarFile = new JarFile( file );
+                List<JarEntry> entries = Collections.list( jarFile.entries() );
+                try
+                {
+                    return entries.stream()
+                                  .filter( jarEntry -> jarEntry.getName().startsWith( packageName )
+                                                       && jarEntry.getName().endsWith( ".class" ) )
+                                  .map( jarEntry ->
+                                        {
+                                            String name = jarEntry.getName();
+                                            name = name.substring( 0, name.length() - 6 );
+                                            name = name.replace( '/', '.' );
+                                            try
+                                            {
+                                                return seedClass.getClassLoader().loadClass( name );
+                                            }
+                                            catch( ClassNotFoundException e )
+                                            {
+                                                return null;
+                                            }
+                                        } )
+                                  .filter( VALID_CLASS_PREDICATE );
+                }
+                finally
+                {
+                    jarFile.close();
+                }
+            }
+            catch( IOException e )
+            {
+                throw new IllegalArgumentException( "Could not open jar file " + file, e );
+            }
+        }
+        else
+        {
+            final File path = new File( file, seedClass.getPackage().getName().replace( '.', File.separatorChar ) );
+            Stream<File> classFiles = findFiles( path, candidate -> candidate.getName().endsWith( ".class" ) );
+            return classFiles
+                .map( classFile ->
+                      {
+                          String fileName = classFile.getAbsolutePath().substring( file.toString().length() + 1 );
+                          fileName = fileName.replace( File.separatorChar, '.' ).substring( 0, fileName.length() - 6 );
+                          try
+                          {
+                              return seedClass.getClassLoader().loadClass( fileName );
+                          }
+                          catch( ClassNotFoundException e )
+                          {
+                              return null;
+                          }
+                      } )
+                .filter( VALID_CLASS_PREDICATE );
+        }
+    }
+
+    /**
+     * Useful specification for filtering classes based on a regular expression matching the class names.
+     * <p>
+     * Example: matches(".*Model") -&gt; match only class names that end with Model
+     * </p>
+     *
+     * @param regex The regular expression to be matched.
+     *
+     * @return regex class name specification
+     */
+    public static Predicate<Class<?>> matches( String regex )
+    {
+        final Pattern pattern = Pattern.compile( regex );
+        return aClass -> pattern.matcher( aClass.getName() ).matches();
+    }
+
+    private static Stream<File> findFiles( File directory, final Predicate<File> filter )
+    {
+        File[] listedFiles = directory.listFiles();
+        if( listedFiles == null )
+        {
+            return Stream.of();
+        }
+        return Stream.concat( Stream.of( listedFiles ).filter( filter ),
+                              Stream.of( listedFiles )
+                                    .filter( File::isDirectory )
+                                    .map( dir -> findFiles( dir, filter ) )
+                                    .flatMap( Function.identity() ) );
+    }
+
+    private static class ValidClass
+        implements Predicate<Class<?>>
+    {
+        @Override
+        public boolean test( Class<?> item )
+        {
+            return ( item.isInterface() || !Modifier.isAbstract( item.getModifiers() ) )
+                   && ( !item.isEnum() && !item.isAnonymousClass() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
new file mode 100644
index 0000000..c827e04
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single ConfigurationComposite in a Module.
+ */
+public interface ConfigurationAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationDeclaration.java
new file mode 100644
index 0000000..080cbb7
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationDeclaration.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring configurations. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#configurations(Class[])}.
+ */
+public interface ConfigurationDeclaration
+{
+    /**
+     * Set additional metainfo for this configuration declaration.
+     *
+     * @param info metainfo that can be retrieved from the CompositeDescriptor.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration setMetaInfo( Object info );
+
+    /**
+     * Set visibility for declared entities.
+     *
+     * @param visibility The {@link Visibility} that this ConfigurationComposite will have.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration visibleIn( Visibility visibility );
+
+    /**
+     * Declare additional concerns for these configurations.
+     *
+     * @param concerns The concerns that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withConcerns( Class<?>... concerns );
+
+    /**
+     * Declare additional side-effects for these configurations.
+     *
+     * @param sideEffects The sideeffects that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withSideEffects( Class<?>... sideEffects );
+
+    /**
+     * Declare additional mixins for these configurations.
+     * <p>
+     * This can be useful to override any default mixins from the configuration interface.
+     * </p>
+     * @param mixins The mixins that are to be added to the ConfigurationComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withMixins( Class<?>... mixins );
+
+    /**
+     * Declare additional interfaces for these declared interfaces.
+     * <p>
+     * This can be useful to add types that the Configuration should implement, but
+     * which you do not want to include in the entity interface itself.
+     * </p>
+     * @param types list of interfaces to add
+     *
+     * @return This instance for a fluid DSL
+     */
+    ConfigurationDeclaration withTypes( Class<?>... types );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
new file mode 100644
index 0000000..88c84f1
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.spi.PolygeneSPI;
+
+/**
+ * Main bootstrap class for starting Polygene and creating new applications.
+ * <p>
+ * Instantiate this and call one of the factory methods to get started.
+ * </p>
+ * <p>
+ * This class will use the Service Loader mechanism in Java to try to locate a runtime that implements
+ * the PolygeneRuntime interface. This avoids a direct dependency from the bootstrap to the runtime.
+ * </p>
+ */
+public final class Energy4Java
+{
+    private PolygeneRuntime runtime;
+
+    public Energy4Java( RuntimeFactory runtimeFactory )
+    {
+        this( runtimeFactory.createRuntime() );
+    }
+
+    public Energy4Java()
+    {
+        this( new RuntimeFactory.StandaloneApplicationRuntimeFactory().createRuntime() );
+    }
+
+    public Energy4Java( PolygeneRuntime runtime )
+    {
+        if( runtime == null )
+        {
+            throw new BootstrapException( "Can not create Polygene without a Polygene Runtime." );
+        }
+        this.runtime = runtime;
+    }
+
+    public ApplicationDescriptor newApplicationModel( ApplicationAssembler assembler )
+        throws AssemblyException
+    {
+        ApplicationAssembly assembly = assembler.assemble( runtime.applicationAssemblyFactory() );
+
+        if( assembly == null )
+        {
+            throw new AssemblyException( "Application assembler did not return any ApplicationAssembly" );
+        }
+
+        try
+        {
+            ApplicationModelFactory modelFactory = runtime.applicationModelFactory();
+            return modelFactory.newApplicationModel( assembly );
+        }
+        catch( RuntimeException e )
+        {
+            throw new AssemblyException( "Unable to create Application Model.", e );
+        }
+    }
+
+    public Application newApplication( ApplicationAssembler assembler, Object... importedServiceInstances )
+        throws AssemblyException
+    {
+        ApplicationDescriptor model = newApplicationModel( assembler );
+        return model.newInstance( runtime.spi(), importedServiceInstances );
+    }
+
+    public PolygeneSPI spi()
+    {
+        return runtime.spi();
+    }
+
+    public PolygeneAPI api()
+    {
+        return runtime.spi();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityAssembly.java
new file mode 100644
index 0000000..7a3ce0a
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single EntityComposite in a Module.
+ */
+public interface EntityAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityDeclaration.java
new file mode 100644
index 0000000..32f7e60
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/EntityDeclaration.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring entities. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#entities(Class[])}.
+ */
+public interface EntityDeclaration
+{
+    /**
+     * Set additional metainfo for this entity declaration.
+     *
+     * @param info metainfo that can be retrieved from the EntityDescriptor.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration setMetaInfo( Object info );
+
+    /**
+     * Set visibility for declared entities.
+     *
+     * @param visibility The {@link Visibility} that this EntityComposite will have.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration visibleIn( Visibility visibility );
+
+    /**
+     * Declare additional concerns for these entities.
+     *
+     * @param concerns The concerns that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withConcerns( Class<?>... concerns );
+
+    /**
+     * Declare additional side-effects for these entitites.
+     *
+     * @param sideEffects The sideeffects that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withSideEffects( Class<?>... sideEffects );
+
+    /**
+     * Declare additional mixins for these entities.
+     * <p>
+     * This can be useful to override any default mixins from the entity interface.
+     * </p>
+     * @param mixins The mixins that are to be added to the EntityComposite beyond the statically declared ones.
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withMixins( Class<?>... mixins );
+
+    /**
+     * Declare additional interfaces for these declared interfaces.
+     * <p>
+     * This can be useful to add types that the entities should implement, but
+     * which you do not want to include in the entity interface itself.
+     * </p>
+     * @param types list of interfaces to add
+     *
+     * @return This instance for a fluid DSL
+     */
+    EntityDeclaration withTypes( Class<?>... types );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceAssembly.java
new file mode 100644
index 0000000..057c179
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single imported service in a Module.
+ */
+public interface ImportedServiceAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceDeclaration.java
new file mode 100644
index 0000000..8d143e9
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ImportedServiceDeclaration.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.importer.InstanceImporter;
+import org.apache.polygene.api.service.importer.NewObjectImporter;
+import org.apache.polygene.api.service.importer.ServiceInstanceImporter;
+import org.apache.polygene.api.service.importer.ServiceSelectorImporter;
+
+/**
+ * Fluent API for declaring imported services. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#importedServices(Class[])}.
+ */
+public interface ImportedServiceDeclaration
+{
+    // Convenience constants for common service importers
+    public static final Class<? extends ServiceImporter> INSTANCE = InstanceImporter.class;
+    public static final Class<? extends ServiceImporter> NEW_OBJECT = NewObjectImporter.class;
+    public static final Class<? extends ServiceImporter> SERVICE_SELECTOR = ServiceSelectorImporter.class;
+    public static final Class<? extends ServiceImporter> SERVICE_IMPORTER = ServiceInstanceImporter.class;
+
+    ImportedServiceDeclaration visibleIn( Visibility visibility );
+
+    ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass );
+
+    ImportedServiceDeclaration identifiedBy( String identity );
+
+    ImportedServiceDeclaration taggedWith( String... tags );
+
+    ImportedServiceDeclaration setMetaInfo( Object serviceAttribute );
+    
+    ImportedServiceDeclaration importOnStartup();
+
+    /**
+     * Set the imported service activators. Activators are executed in order around
+     * the ServiceReference activation and passivation.
+     *
+     * @param activators the imported service activators
+     * @return the assembly
+     */    
+    @SuppressWarnings( { "unchecked","varargs" } )
+    ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InjectionException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InjectionException.java
new file mode 100644
index 0000000..47d88ca
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InjectionException.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Thrown by the Polygene runtime if a dependency can not be injected.
+ */
+public class InjectionException
+    extends RuntimeException
+{
+    public InjectionException( String s )
+    {
+        super( s );
+    }
+
+    public InjectionException( String s, Throwable throwable )
+    {
+        super( s, throwable );
+    }
+
+    public InjectionException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InvalidInjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InvalidInjectionException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InvalidInjectionException.java
new file mode 100644
index 0000000..4b9c3cb
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/InvalidInjectionException.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Thrown by the Polygene runtime if a dependency injection declaration is invalid.
+ */
+public class InvalidInjectionException
+    extends Exception
+{
+    public InvalidInjectionException( String s )
+    {
+        super( s );
+    }
+
+    public InvalidInjectionException( String s, Throwable throwable )
+    {
+        super( s, throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerAssembly.java
new file mode 100644
index 0000000..6afbf26
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerAssembly.java
@@ -0,0 +1,124 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.structure.Layer;
+
+/**
+ * Fluid API for declaring a layer in an application. This is obtained by calling {@link ApplicationAssembly#layer(String)}.
+ */
+public interface LayerAssembly
+{
+    /**
+     * Get an assembly for a particular Module. If this is called many times with the same name, then the same module
+     * is affected.
+     *
+     * @param name The name of the Module to retrieve or create.
+     *
+     * @return The ModuleAssembly for the Module.
+     */
+    ModuleAssembly module( String name );
+
+    ApplicationAssembly application();
+
+    String name();
+
+    LayerAssembly setName( String name );
+
+    LayerAssembly setMetaInfo( Object info );
+
+    LayerAssembly uses( LayerAssembly... layerAssembly );
+
+    /**
+     * Set the layer activators. Activators are executed in order around the
+     * Layer activation and passivation.
+     *
+     * @param activators the layer activators
+     * @return the assembly
+     */    
+    @SuppressWarnings( { "unchecked","varargs" } )
+    LayerAssembly withActivators( Class<? extends Activator<Layer>>... activators );
+
+    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType;
+
+    /**
+     * Given a Specification for EntityAssembly's, returns a EntityDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the EntityComposite types of interest.
+     *
+     * @return An EntityDeclaration for the specified EntityComposite types.
+     */
+    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
+
+    /**
+     * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the ServiceComposite types of interest.
+     *
+     * @return An ServiceDeclaration for the specified ServiceComposite types.
+     */
+    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
+
+    /**
+     * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the TransientComposite types of interest.
+     *
+     * @return An TransientDeclaration for the specified TransientComposite types.
+     */
+    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
+
+    /**
+     * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the ValueComposite types of interest.
+     *
+     * @return An ValueDeclaration for the specified ValueComposite types.
+     */
+    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
+
+    /**
+     * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the Object types of interest.
+     *
+     * @return An ObjectDeclaration for the specified Object types.
+     */
+    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
+
+    /**
+     * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
+     * be used to work with all of the assemblies in this Layer matched by the specification.
+     *
+     * @param specification The Specification that specifies the Imported Service types of interest.
+     *
+     * @return An ImportedServiceDeclaration for the specified Imported Service types.
+     */
+    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerName.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerName.java
new file mode 100644
index 0000000..36e6435
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/LayerName.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Set the name of the layer
+ */
+public final class LayerName
+    implements Assembler
+{
+    private final String name;
+
+    public LayerName( String name )
+    {
+        this.name = name;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.layer().setName( name );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ManyAssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ManyAssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ManyAssociationDeclarations.java
new file mode 100644
index 0000000..4c39a99
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ManyAssociationDeclarations.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.polygene.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.polygene.api.association.ManyAssociation} information that the runtime can use.
+ */
+public interface ManyAssociationDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
new file mode 100644
index 0000000..2967fe5
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
@@ -0,0 +1,221 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Declaration of a Property or Association.
+ */
+public final class MetaInfoDeclaration
+    implements StateDeclarations, AssociationDeclarations, ManyAssociationDeclarations, NamedAssociationDeclarations
+{
+    Map<Class<?>, InfoHolder<?>> mixinPropertyDeclarations = new HashMap<>();
+
+    public MetaInfoDeclaration()
+    {
+    }
+
+    public <T> MixinDeclaration<T> on( Class<T> mixinType )
+    {
+        @SuppressWarnings( "unchecked" )
+        InfoHolder<T> propertyDeclarationHolder = (InfoHolder<T>) mixinPropertyDeclarations.get( mixinType );
+        if( propertyDeclarationHolder == null )
+        {
+            propertyDeclarationHolder = new InfoHolder<>( mixinType );
+            mixinPropertyDeclarations.put( mixinType, propertyDeclarationHolder );
+        }
+        return propertyDeclarationHolder;
+    }
+
+    @Override
+    public MetaInfo metaInfoFor( AccessibleObject accessor )
+    {
+        for( Map.Entry<Class<?>, InfoHolder<?>> entry : mixinPropertyDeclarations.entrySet() )
+        {
+            InfoHolder<?> holder = entry.getValue();
+            MetaInfo metaInfo = holder.metaInfoFor( accessor );
+            if( metaInfo != null )
+            {
+                Class<?> mixinType = entry.getKey();
+                return metaInfo.withAnnotations( mixinType )
+                    .withAnnotations( accessor )
+                    .withAnnotations( accessor instanceof Method ? ( (Method) accessor ).getReturnType() : ( (Field) accessor )
+                        .getType() );
+            }
+        }
+        // TODO is this code reached at all??
+        Class<?> declaringType = ( (Member) accessor ).getDeclaringClass();
+        return new MetaInfo().withAnnotations( declaringType )
+            .withAnnotations( accessor )
+            .withAnnotations( accessor instanceof Method ? ( (Method) accessor ).getReturnType() : ( (Field) accessor ).getType() );
+    }
+
+    @Override
+    public Object initialValueOf( AccessibleObject accessor )
+    {
+        for( InfoHolder<?> propertyDeclarationHolder : mixinPropertyDeclarations.values() )
+        {
+            final Object initialValue = propertyDeclarationHolder.initialValueOf( accessor );
+            if( initialValue != null )
+            {
+                return initialValue;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public boolean useDefaults( AccessibleObject accessor )
+    {
+        for( InfoHolder<?> propertyDeclarationHolder : mixinPropertyDeclarations.values() )
+        {
+            final boolean useDefaults = propertyDeclarationHolder.useDefaults( accessor );
+            if( useDefaults )
+            {
+                return useDefaults;
+            }
+        }
+        return false;
+    }
+
+    private static class InfoHolder<T>
+        implements InvocationHandler, StateDeclarations, MixinDeclaration<T>
+    {
+        private final static class MethodInfo
+        {
+            Object initialValue;
+            boolean useDefaults;
+            MetaInfo metaInfo;
+
+            private MethodInfo( MetaInfo metaInfo )
+            {
+                this.metaInfo = metaInfo;
+            }
+        }
+
+        private final Class<T> mixinType;
+        private final Map<AccessibleObject, MethodInfo> methodInfos = new HashMap<>();
+        // temporary holder
+        private MetaInfo metaInfo = null;
+
+        private InfoHolder( Class<T> mixinType )
+        {
+            this.mixinType = mixinType;
+        }
+
+        @Override
+        @SuppressWarnings( "raw" )
+        public Object invoke( Object o, Method method, Object[] objects )
+            throws Throwable
+        {
+            final MethodInfo methodInfo = new MethodInfo( metaInfo );
+            methodInfo.useDefaults = true;
+            methodInfos.put( method, methodInfo );
+            metaInfo = null; // reset
+            final Class<?> returnType = method.getReturnType();
+            try
+            {
+                return Proxy.newProxyInstance( returnType.getClassLoader(), new Class[]{ returnType },
+                                               ( o1, method1, objects1 ) -> {
+                                                   if( method1.getName().equals( "set" ) )
+                                                   {
+                                                       methodInfo.initialValue = objects1[ 0 ];
+                                                   }
+                                                   return null;
+                                               } );
+            }
+            catch( IllegalArgumentException e )
+            {
+                throw new IllegalArgumentException(
+                    "Only methods with " + Property.class.getName() + " as return type can have declareDefaults()" );
+            }
+        }
+
+        public MethodInfo matches( AccessibleObject accessor )
+        {
+            return methodInfos.get( accessor );
+        }
+
+        @Override
+        public MetaInfo metaInfoFor( AccessibleObject accessor )
+        {
+            final MethodInfo methodInfo = matches( accessor );
+            if( methodInfo == null )
+            {
+                return null;
+            }
+            return methodInfo.metaInfo;
+        }
+
+        @Override
+        public Object initialValueOf( AccessibleObject accessor )
+        {
+            final MethodInfo methodInfo = matches( accessor );
+            if( methodInfo == null )
+            {
+                return null;
+            }
+            return methodInfo.initialValue;
+        }
+
+        @Override
+        public boolean useDefaults( AccessibleObject accessor )
+        {
+            final MethodInfo methodInfo = matches( accessor );
+            if( methodInfo == null )
+            {
+                return false;
+            }
+            return methodInfo.useDefaults;
+        }
+
+        // DSL Interface
+
+        @Override
+        @SuppressWarnings( "raw" )
+        public T declareDefaults()
+        {
+            return mixinType.cast(
+                Proxy.newProxyInstance( mixinType.getClassLoader(), new Class[]{ mixinType }, this ) );
+        }
+
+        @Override
+        public MixinDeclaration<T> setMetaInfo( Object info )
+        {
+            if( metaInfo == null )
+            {
+                metaInfo = new MetaInfo();
+            }
+            metaInfo.set( info );
+            return this;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
new file mode 100644
index 0000000..90e22f4
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Fluent API for declaring information about properties
+ *
+ * @param <T> Parameterized mixin type
+ */
+public interface MixinDeclaration<T>
+{
+    T declareDefaults();
+
+    MixinDeclaration<T> setMetaInfo( Object info );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
new file mode 100644
index 0000000..47c3729
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
@@ -0,0 +1,242 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * The ModuleAssembly is used to register any information about * what the module should contain, such as composites,
+ * entities and services.
+ * <p>
+ * Use the methods and the fluent API's to declare how the module should be constructed.
+ * </p>
+ */
+public interface ModuleAssembly
+{
+    /**
+     * Access the layer assembly for this module.
+     *
+     * @return The Layer containing this Module.
+     */
+    LayerAssembly layer();
+
+    /**
+     * Get an assembly for a particular Module. If this is called many times with the same names, then the same module
+     * is affected.
+     *
+     * @param layerName  The name of the Layer
+     * @param moduleName The name of the Module to retrieve or create.
+     *
+     * @return The ModuleAssembly for the Module.
+     */
+    ModuleAssembly module( String layerName, String moduleName );
+
+    /**
+     * Set the name of this module.
+     *
+     * @param name The name that this Module should have.
+     *
+     * @return This instance to support the fluid DSL of bootstrap.
+     */
+    ModuleAssembly setName( String name );
+
+    /**
+     * Access the currently set name for this module.
+     *
+     * @return The name of this Module.
+     */
+    String name();
+
+    ModuleAssembly setMetaInfo( Object info );
+
+    /**
+     * Set the module activators. Activators are executed in order around the
+     * Module activation and passivation.
+     *
+     * @param activators the module activators
+     *
+     * @return the assembly
+     */
+    @SuppressWarnings( { "unchecked", "varargs" } )
+    ModuleAssembly withActivators( Class<? extends Activator<Module>>... activators );
+
+    /**
+     * Declare a list of TransientComposites for this Module. Use the TransientDeclaration that is returned to
+     * declare further settings. Note that the TransientDeclaration works on all of the types specified.
+     *
+     * @param transientTypes The types that specifies the Transient types.
+     *
+     * @return An TransientDeclaration for the specified Transient types.
+     */
+    TransientDeclaration transients( Class<?>... transientTypes );
+
+    /**
+     * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the TransientComposite types of interest.
+     *
+     * @return An TransientDeclaration for the specified TransientComposite types.
+     */
+    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
+
+    /**
+     * Declare a list of ValueComposites for this Module. Use the ValueDeclaration that is returned to
+     * declare further settings. Note that the ValueDeclaration works on all of the types specified.
+     *
+     * @param valueTypes The types that specifies the Value types.
+     *
+     * @return An ValueDeclaration for the specified Value types.
+     */
+    ValueDeclaration values( Class<?>... valueTypes );
+
+    /**
+     * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the ValueComposite types of interest.
+     *
+     * @return An ValueDeclaration for the specified ValueComposite types.
+     */
+    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
+
+    /**
+     * Declare a list of EntityComposites for this Module. Use the EntityDeclaration that is returned to
+     * declare further settings. Note that the EntityDeclaration works on all of the types specified.
+     *
+     * @param entityTypes The types that specifies the Entity types.
+     *
+     * @return An EntityDeclaration for the specified Entity types.
+     */
+    EntityDeclaration entities( Class<?>... entityTypes );
+
+    /**
+     * Given a Specification for EntityAssembly's, returns a EntityDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the EntityComposite types of interest.
+     *
+     * @return An EntityDeclaration for the specified EntityComposite types.
+     */
+    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
+
+    /**
+     * Declare a list of Configuration Composites for this Module. Use the ConfigurationDeclaration that is returned to
+     * declare further settings. Note that the ConfigurationDeclaration works on all of the types specified.
+     *
+     * @param configurationTypes The types that specifies the Configuration types.
+     *
+     * @return An ConfigurationDeclaration for the specified Configuration types.
+     */
+    ConfigurationDeclaration configurations( Class<?>... configurationTypes );
+
+    /**
+     * Given a Specification for ConfigurationAssembly's, returns a ConfigurationDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the ConfigurationComposite types of interest.
+     *
+     * @return An ConfigurationDeclaration for the specified EntityComposite types.
+     */
+    ConfigurationDeclaration configurations( Predicate<HasTypes> specification );
+
+    /**
+     * Declare a list of object classes for this Module. Use the ObjectDeclaration that is returned to
+     * declare further settings. Note that the ObjectDeclaration works on all of the types specified.
+     *
+     * @param objectTypes The types that specifies the Object types.
+     *
+     * @return An ObjectDeclaration for the specified Object types.
+     *
+     * @throws AssemblyException on invalid assembly
+     */
+    ObjectDeclaration objects( Class<?>... objectTypes )
+        throws AssemblyException;
+
+    /**
+     * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the Object types of interest.
+     *
+     * @return An ObjectDeclaration for the specified Object types.
+     */
+    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
+
+    /**
+     * Create a list of ServiceComposites for this Module. Use the ServiceDeclaration that is returned to
+     * declare further settings. This will always create new assemblies for the specified types, instead
+     * of potentially working on already declared types like the services(...) method.
+     *
+     * @param serviceTypes The types that specifies the Service types.
+     *
+     * @return An ServiceDeclaration for the specified Service types.
+     */
+    ServiceDeclaration addServices( Class<?>... serviceTypes );
+
+    /**
+     * Declare a list of ServiceComposites for this Module. Use the ServiceDeclaration that is returned to
+     * declare further settings. Note that the ServiceDeclaration works on all of the types specified.
+     *
+     * @param serviceTypes The types that specifies the Service types.
+     *
+     * @return An ServiceDeclaration for the specified Service types.
+     */
+    ServiceDeclaration services( Class<?>... serviceTypes );
+
+    /**
+     * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the ServiceComposite types of interest.
+     *
+     * @return An ServiceDeclaration for the specified ServiceComposite types.
+     */
+    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
+
+    /**
+     * Declare a list of imported services for this Module. Use the ImportedServiceDeclaration that is returned to
+     * declare further settings. Note that the ImportedServiceDeclaration works on all of the types specified.
+     *
+     * @param serviceTypes The types that specifies the Imported Service types.
+     *
+     * @return An ImportedServiceDeclaration for the specified Imported Service types.
+     */
+    ImportedServiceDeclaration importedServices( Class<?>... serviceTypes );
+
+    /**
+     * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
+     * be used to work with all of the assemblies matched by the specification.
+     *
+     * @param specification The Specification that specifies the Imported Service types of interest.
+     *
+     * @return An ImportedServiceDeclaration for the specified Imported Service types.
+     */
+    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
+
+    <T> MixinDeclaration<T> forMixin( Class<T> mixinType );
+
+    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleName.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleName.java
new file mode 100644
index 0000000..72ba9ce
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleName.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Set the name of the module
+ */
+public final class ModuleName
+    implements Assembler
+{
+    private final String name;
+
+    public ModuleName( String name )
+    {
+        this.name = name;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.setName( name );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/NamedAssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/NamedAssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/NamedAssociationDeclarations.java
new file mode 100644
index 0000000..bc8a8ea
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/NamedAssociationDeclarations.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.polygene.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.polygene.api.association.NamedAssociation} information that the runtime can use.
+ */
+public interface NamedAssociationDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectAssembly.java
new file mode 100644
index 0000000..281fd6e
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single object type in a Module.
+ */
+public interface ObjectAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectDeclaration.java
new file mode 100644
index 0000000..3587443
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ObjectDeclaration.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring objects.Instances
+ * of this API are acquired by calling {@link ModuleAssembly#objects(Class[])}.
+ */
+public interface ObjectDeclaration
+{
+    ObjectDeclaration setMetaInfo( Object info );
+
+    ObjectDeclaration visibleIn( Visibility visibility )
+        throws IllegalStateException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/RuntimeFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/RuntimeFactory.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/RuntimeFactory.java
new file mode 100644
index 0000000..f12b999
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/RuntimeFactory.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Polygene runtime factory.
+ */
+public interface RuntimeFactory
+{
+    PolygeneRuntime createRuntime();
+
+    /**
+     * Standalone application Polygene runtime factory.
+     */
+    public final class StandaloneApplicationRuntimeFactory
+        implements RuntimeFactory
+    {
+        @Override
+        public PolygeneRuntime createRuntime()
+        {
+            ClassLoader loader = getClass().getClassLoader();
+            try
+            {
+                Class<? extends PolygeneRuntime> runtimeClass = loadRuntimeClass( loader );
+                return runtimeClass.newInstance();
+            }
+            catch( ClassNotFoundException e )
+            {
+                System.err.println( "Polygene Runtime jar is not present in the classpath." );
+            }
+            catch( InstantiationException | IllegalAccessException e )
+            {
+                System.err.println( "Invalid Polygene Runtime class. If you are providing your own Polygene Runtime, please " +
+                                    "contact dev@polygene.apache.org mailing list for assistance." );
+            }
+            return null;
+        }
+
+        @SuppressWarnings( { "unchecked" } )
+        private Class<? extends PolygeneRuntime> loadRuntimeClass( ClassLoader loader )
+            throws ClassNotFoundException
+        {
+            return (Class<? extends PolygeneRuntime>) loader.loadClass( "org.apache.polygene.runtime.PolygeneRuntimeImpl" );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceAssembly.java
new file mode 100644
index 0000000..5a889de
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.identity.Identifiable;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single ServiceComposite in a Module.
+ */
+public interface ServiceAssembly extends HasTypes, Identifiable
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceDeclaration.java
new file mode 100644
index 0000000..8dad610
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ServiceDeclaration.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring services hosted in Polygene. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#services(Class[])}.
+ */
+public interface ServiceDeclaration
+{
+    ServiceDeclaration setMetaInfo( Object serviceAttribute );
+
+    ServiceDeclaration visibleIn( Visibility visibility );
+
+    ServiceDeclaration withConcerns( Class<?>... concerns );
+
+    ServiceDeclaration withSideEffects( Class<?>... sideEffects );
+
+    ServiceDeclaration withMixins( Class<?>... mixins );
+
+    ServiceDeclaration withTypes( Class<?>... types );
+
+    ServiceDeclaration identifiedBy( String identity );
+
+    ServiceDeclaration taggedWith( String... tags );
+
+    ServiceDeclaration instantiateOnStartup();
+
+    /**
+     * Set the service activators. Activators are executed in order around the
+     * ServiceReference activation and passivation.
+     *
+     * @param activators the service activators
+     * @return the assembly
+     */    
+    @SuppressWarnings( { "unchecked","varargs" } )
+    ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
new file mode 100644
index 0000000..18717dd
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+
+/**
+ * Base class for Assembler that creates an Application
+ * with one Layer and one Module. Create a subclass of this
+ * and implement the {@link Assembler#assemble(ModuleAssembly)} method.
+ * Once the SingletonAssembler is instantiated it will have created and activated
+ * an Application which can be accessed from {@link org.apache.polygene.bootstrap.SingletonAssembler#application()}.
+ * You can also easily access any resources specific for the single Module, such as the TransientBuilderFactory.
+ */
+public abstract class SingletonAssembler
+    implements Assembler
+{
+    private Energy4Java zest;
+    private Application applicationInstance;
+    private final Module moduleInstance;
+
+    /**
+     * Creates a Polygene Runtime instance containing one Layer with one Module.
+     * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add
+     * additional layers and modules via the Assembler interface that must be implemented in the subclass of this
+     * class.
+     *
+     * @throws AssemblyException   Either if the model can not be created from the disk, or some inconsistency in
+     *                             the programming model makes it impossible to create it.
+     * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception..
+     */
+    public SingletonAssembler()
+        throws AssemblyException, ActivationException
+    {
+// START SNIPPET: actual
+        zest = new Energy4Java();
+        applicationInstance = zest.newApplication(
+            applicationFactory -> applicationFactory.newApplicationAssembly( SingletonAssembler.this )
+        );
+
+        try
+        {
+            beforeActivation( applicationInstance );
+            applicationInstance.activate();
+        }
+        catch( Exception e )
+        {
+            if( e instanceof ActivationException )
+            {
+                throw ( (ActivationException) e );
+            }
+            throw new ActivationException( "Could not activate application", e );
+        }
+// START SNIPPET: actual
+
+        moduleInstance = applicationInstance.findModule( "Layer 1", "Module 1" );
+    }
+
+    public final PolygeneAPI runtime()
+    {
+        return zest.spi();
+    }
+
+    public final Application application()
+    {
+        return applicationInstance;
+    }
+
+    public final Module module()
+    {
+        return moduleInstance;
+    }
+
+    protected void beforeActivation( Application application )
+        throws Exception
+    {
+    }
+
+    protected UnitOfWorkFactory unitOfWorkFactory()
+    {
+        return moduleInstance.unitOfWorkFactory();
+    }
+
+    protected ServiceFinder serviceFinder()
+    {
+        return moduleInstance.serviceFinder();
+    }
+
+    protected ValueBuilderFactory valueBuilderFactory()
+    {
+        return moduleInstance.valueBuilderFactory();
+    }
+
+    protected TransientBuilderFactory transientBuilderFactory()
+    {
+        return moduleInstance.transientBuilderFactory();
+    }
+
+    protected ObjectFactory objectFactory()
+    {
+        return moduleInstance.objectFactory();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/StateDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/StateDeclarations.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/StateDeclarations.java
new file mode 100644
index 0000000..79d2834
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/StateDeclarations.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.polygene.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.polygene.api.property.Property} information that the runtime can use.
+ */
+public interface StateDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+
+    Object initialValueOf( AccessibleObject accessor );
+
+    boolean useDefaults( AccessibleObject accessor );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientAssembly.java
new file mode 100644
index 0000000..42aab6d
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single TransientComposite in a Module.
+ */
+public interface TransientAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientDeclaration.java
new file mode 100644
index 0000000..04a1942
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/TransientDeclaration.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring TransientComposites. Instances
+ * of this API are acquired by calling {@link ModuleAssembly#transients(Class[])}.
+ */
+public interface TransientDeclaration
+{
+    TransientDeclaration setMetaInfo( Object info );
+
+    TransientDeclaration visibleIn( Visibility visibility );
+
+    TransientDeclaration withConcerns( Class<?>... concerns );
+
+    TransientDeclaration withSideEffects( Class<?>... sideEffects );
+
+    TransientDeclaration withMixins( Class<?>... mixins );
+
+    TransientDeclaration withTypes( Class<?>... roles );
+}


[45/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/DependencyDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/DependencyDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/DependencyDescriptor.java
new file mode 100644
index 0000000..ec87e2c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/DependencyDescriptor.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+/**
+ * Composite dependency descriptor.
+ */
+public interface DependencyDescriptor
+{
+    Annotation injectionAnnotation();
+
+    Type injectionType();
+
+    Class<?> injectedClass();
+
+    Class<?> rawInjectionType();
+
+    boolean optional();
+
+    Annotation[] annotations();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/InjectedFieldDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InjectedFieldDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedFieldDescriptor.java
new file mode 100644
index 0000000..ce88a68
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedFieldDescriptor.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.Field;
+
+/**
+ * Composite injected field descriptor.
+ */
+public interface InjectedFieldDescriptor
+{
+    Field field();
+
+    DependencyDescriptor dependency();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/InjectedMethodDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InjectedMethodDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedMethodDescriptor.java
new file mode 100644
index 0000000..0ad4f70
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedMethodDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.Method;
+
+/**
+ * Composite injected method descriptor.
+ */
+public interface InjectedMethodDescriptor
+{
+    Method method();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/InjectedParametersDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InjectedParametersDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedParametersDescriptor.java
new file mode 100644
index 0000000..5361575
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InjectedParametersDescriptor.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * Composite constructors and method injected parameters descriptor.
+ */
+public interface InjectedParametersDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
new file mode 100644
index 0000000..d9de0c7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * This exception is thrown if a Composite is invalid.
+ */
+public class InvalidCompositeException
+    extends RuntimeException
+{
+    public InvalidCompositeException( String message )
+    {
+        super( message );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/InvalidValueCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InvalidValueCompositeException.java b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidValueCompositeException.java
new file mode 100644
index 0000000..c857a6e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidValueCompositeException.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * This exception is thrown if a ValueComposite is invalid.
+ */
+public class InvalidValueCompositeException
+    extends RuntimeException
+{
+    public InvalidValueCompositeException( String message )
+    {
+        super( message );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/MethodDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/MethodDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/MethodDescriptor.java
new file mode 100644
index 0000000..f0a991d
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/MethodDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.lang.reflect.Method;
+
+/**
+ * Composite Method Descriptor.
+ */
+public interface MethodDescriptor
+{
+    Method method();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/MissingMethodException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/MissingMethodException.java b/core/api/src/main/java/org/apache/polygene/api/composite/MissingMethodException.java
new file mode 100644
index 0000000..a6e5998
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/MissingMethodException.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * This exception is thrown if client code tries to invoke a non-existing Composite method.
+ */
+public class MissingMethodException
+    extends RuntimeException
+{
+    public MissingMethodException( String message )
+    {
+        super( message );
+    }
+
+    public MissingMethodException( String message, NoSuchMethodException e )
+    {
+        super(message,e);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/ModelDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/ModelDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/ModelDescriptor.java
new file mode 100644
index 0000000..cd7ddcf
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/ModelDescriptor.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * Composite ModelDescriptor.
+ */
+public interface ModelDescriptor extends HasTypes, MetaInfoHolder
+{
+    Visibility visibility();
+
+    /** The Module that the Model is declared in.
+     *
+     * @return The Module that this Model was declared in.
+     */
+    ModuleDescriptor module();
+
+    boolean isAssignableTo( Class<?> type );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchCompositeException.java b/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchCompositeException.java
new file mode 100644
index 0000000..e03eafc
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchCompositeException.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+
+/**
+ * This exception is thrown if client code tries to create a non-existing Composite type.
+ */
+public class NoSuchCompositeException
+    extends InvalidApplicationException
+{
+    private static final long serialVersionUID = 1L;
+
+    private final String compositeType;
+    private final String moduleName;
+    private final String visibleTypes;
+
+    protected NoSuchCompositeException( String metaType, String compositeType, String moduleName, String visibleTypes )
+    {
+        super( "Could not find any visible " + metaType + " of type [" + compositeType + "] in module [" +
+               moduleName + "].\n" + visibleTypes );
+        this.compositeType = compositeType;
+        this.moduleName = moduleName;
+        this.visibleTypes = visibleTypes;
+    }
+
+    public String compositeType()
+    {
+        return compositeType;
+    }
+
+    public String moduleName()
+    {
+        return moduleName;
+    }
+
+    public String visibleTypes()
+    {
+        return visibleTypes;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchTransientException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchTransientException.java b/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchTransientException.java
new file mode 100644
index 0000000..6f6bfd7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/NoSuchTransientException.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.util.stream.Collectors;
+import org.apache.polygene.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, TypeLookup typeLookup )
+    {
+        super( "TransientComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
+    {
+        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/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/PropertyMapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/PropertyMapper.java b/core/api/src/main/java/org/apache/polygene/api/composite/PropertyMapper.java
new file mode 100644
index 0000000..0591bd4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/PropertyMapper.java
@@ -0,0 +1,655 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.Period;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.value.ValueComposite;
+
+/**
+ * Transfer java.util.Properties to Composite properties
+ */
+public final class PropertyMapper
+{
+
+    private final static Map<Type, MappingStrategy> STRATEGY;
+
+    static
+    {
+        STRATEGY = new HashMap<>();
+        STRATEGY.put( Integer.class, new IntegerMapper() );
+        STRATEGY.put( Long.class, new LongMapper() );
+        STRATEGY.put( Short.class, new ShortMapper() );
+        STRATEGY.put( Byte.class, new ByteMapper() );
+        STRATEGY.put( String.class, new StringMapper() );
+        STRATEGY.put( Character.class, new CharMapper() );
+        STRATEGY.put( Float.class, new FloatMapper() );
+        STRATEGY.put( Double.class, new DoubleMapper() );
+        STRATEGY.put( LocalDate.class, new LocalDateMapper() );
+        STRATEGY.put( LocalDateTime.class, new LocalDateTimeMapper() );
+        STRATEGY.put( ZonedDateTime.class, new ZonedDateTimeMapper() );
+        STRATEGY.put( OffsetDateTime.class, new OffsetDateTimeMapper() );
+        STRATEGY.put( Instant.class, new InstantMapper() );
+        STRATEGY.put( Duration.class, new DurationMapper() );
+        STRATEGY.put( Period.class, new PeriodMapper() );
+        STRATEGY.put( Boolean.class, new BooleanMapper() );
+        STRATEGY.put( BigDecimal.class, new BigDecimalMapper() );
+        STRATEGY.put( BigInteger.class, new BigIntegerMapper() );
+        STRATEGY.put( Enum.class, new EnumMapper() );
+        STRATEGY.put( Array.class, new ArrayMapper() );
+        STRATEGY.put( Map.class, new MapMapper() );
+        STRATEGY.put( List.class, new ListMapper() );
+        STRATEGY.put( Set.class, new SetMapper() );
+        STRATEGY.put( ValueComposite.class, new ValueCompositeMapper() );
+    }
+
+    /**
+     * Populate the Composite with properties from the given properties object.
+     *
+     * @param props     properties object
+     * @param composite the composite instance
+     *
+     * @throws IllegalArgumentException if properties could not be transferred to composite
+     */
+    public static void map( Properties props, Composite composite )
+        throws IllegalArgumentException
+    {
+        for( Map.Entry<Object, Object> objectObjectEntry : props.entrySet() )
+        {
+            try
+            {
+                String methodName = objectObjectEntry.getKey().toString();
+                Method propertyMethod = composite.getClass().getInterfaces()[ 0 ].getMethod( methodName );
+                propertyMethod.setAccessible( true );
+                Object value = objectObjectEntry.getValue();
+                Type propertyType = GenericPropertyInfo.propertyTypeOf( propertyMethod );
+
+                value = mapToType( composite, propertyType, value.toString() );
+
+                @SuppressWarnings( "unchecked" )
+                Property<Object> property = (Property<Object>) propertyMethod.invoke( composite );
+                property.set( value );
+            }
+            catch( NoSuchMethodException e )
+            {
+                throw new IllegalArgumentException( "Could not find any property named " + objectObjectEntry.getKey() );
+            }
+            catch( IllegalAccessException e )
+            {
+                //noinspection ThrowableInstanceNeverThrown
+                throw new IllegalArgumentException( "Could not populate property named " + objectObjectEntry.getKey(), e );
+            }
+            catch( InvocationTargetException e )
+            {
+                //noinspection ThrowableInstanceNeverThrown
+                String message = "Could not populate property named " + objectObjectEntry.getKey();
+                throw new IllegalArgumentException( message, e );
+            }
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    private static Object mapToType( Composite composite, Type propertyType, Object value )
+    {
+        final String stringValue = value.toString();
+        MappingStrategy strategy;
+        if( propertyType instanceof Class )
+        {
+            Class type = (Class) propertyType;
+            if( type.isArray() )
+            {
+                strategy = STRATEGY.get( Array.class );
+            }
+            else if( Enum.class.isAssignableFrom( Classes.RAW_CLASS.apply( propertyType ) ) )
+            {
+                strategy = STRATEGY.get( Enum.class );
+            }
+            else
+            {
+                strategy = STRATEGY.get( type );
+            }
+            if( strategy == null ) // If null, try with the ValueComposite Mapper...
+            {
+                strategy = STRATEGY.get( ValueComposite.class );
+            }
+        }
+        else if( propertyType instanceof ParameterizedType )
+        {
+            ParameterizedType type = ( (ParameterizedType) propertyType );
+
+            if( type.getRawType() instanceof Class )
+            {
+                Class clazz = (Class) type.getRawType();
+                if( List.class.isAssignableFrom( clazz ) )
+                {
+                    strategy = STRATEGY.get( List.class );
+                }
+                else if( Set.class.isAssignableFrom( clazz ) )
+                {
+                    strategy = STRATEGY.get( Set.class );
+                }
+                else if( Map.class.isAssignableFrom( clazz ) )
+                {
+                    strategy = STRATEGY.get( Map.class );
+                }
+                else
+                {
+                    throw new IllegalArgumentException( propertyType + " is not supported." );
+                }
+            }
+            else
+            {
+                throw new IllegalArgumentException( propertyType + " is not supported." );
+            }
+        }
+        else
+        {
+            throw new IllegalArgumentException( propertyType + " is not supported." );
+        }
+
+        if( strategy == null )
+        {
+            throw new IllegalArgumentException( propertyType + " is not supported." );
+        }
+
+        return strategy.map( composite, propertyType, stringValue );
+    }
+
+    /**
+     * Load a Properties object from the given stream, close it, and then populate
+     * the Composite with the properties.
+     *
+     * @param propertyInputStream properties input stream
+     * @param composite           the instance
+     *
+     * @throws IOException if the stream could not be read
+     */
+
+    public static void map( InputStream propertyInputStream, Composite composite )
+        throws IOException
+    {
+        if( propertyInputStream != null )
+        {
+            Properties configProps = new Properties();
+            try
+            {
+                configProps.load( propertyInputStream );
+            }
+            finally
+            {
+                propertyInputStream.close();
+            }
+            map( configProps, composite );
+        }
+    }
+
+    /**
+     * Create Properties object which is backed by the given Composite.
+     *
+     * @param composite the instance
+     *
+     * @return properties instance
+     */
+    public static Properties toJavaProperties( final Composite composite )
+    {
+        return new Properties()
+        {
+            private static final long serialVersionUID = 3550125427530538865L;
+
+            @Override
+            public Object get( Object o )
+            {
+                try
+                {
+                    Method propertyMethod = composite.getClass().getMethod( o.toString() );
+                    Property<?> property = (Property<?>) propertyMethod.invoke( composite );
+                    return property.get();
+                }
+                catch( NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
+                {
+                    return null;
+                }
+            }
+
+            @Override
+            public Object put( Object o, Object o1 )
+            {
+                Object oldValue = get( o );
+
+                try
+                {
+                    Method propertyMethod = composite.getClass().getMethod( o.toString(), Object.class );
+                    propertyMethod.invoke( composite, o1 );
+                }
+                catch( NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
+                {
+                    e.printStackTrace();
+                }
+
+                return oldValue;
+            }
+        };
+    }
+
+    private static void tokenize( String valueString, boolean mapSyntax, TokenizerCallback callback )
+    {
+        char[] data = valueString.toCharArray();
+
+        int oldPos = 0;
+        for( int pos = 0; pos < data.length; pos++ )
+        {
+            char ch = data[ pos ];
+            if( ch == '\"' )
+            {
+                pos = resolveQuotes( valueString, callback, data, pos, '\"' );
+                oldPos = pos;
+            }
+            if( ch == '\'' )
+            {
+                pos = resolveQuotes( valueString, callback, data, pos, '\'' );
+                oldPos = pos;
+            }
+            if( ch == ',' || ( mapSyntax && ch == ':' ) )
+            {
+                String token = new String( data, oldPos, pos - oldPos );
+                callback.token( token );
+                oldPos = pos + 1;
+            }
+        }
+        String token = new String( data, oldPos, data.length - oldPos );
+        callback.token( token );
+    }
+
+    private static int resolveQuotes( String valueString,
+                                      TokenizerCallback callback,
+                                      char[] data,
+                                      int pos, char quote
+    )
+    {
+        boolean found = false;
+        for( int j = pos + 1; j < data.length; j++ )
+        {
+            if( !found )
+            {
+                if( data[ j ] == quote )
+                {
+                    String token = new String( data, pos + 1, j - pos - 1 );
+                    callback.token( token );
+                    found = true;
+                }
+            }
+            else
+            {
+                if( data[ j ] == ',' )
+                {
+                    return j + 1;
+                }
+            }
+        }
+        if( !found )
+        {
+            throw new IllegalArgumentException( "String is not quoted correctly: " + valueString );
+        }
+        return data.length;
+    }
+
+    private interface TokenizerCallback
+    {
+        void token( String token );
+    }
+
+    private interface MappingStrategy
+    {
+        Object map( Composite composite, Type type, String value );
+    }
+
+    private static class StringMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return value;
+        }
+    }
+
+    private static class IntegerMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Integer( value.trim() );
+        }
+    }
+
+    private static class FloatMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Float( value.trim() );
+        }
+    }
+
+    private static class DoubleMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Double( value.trim() );
+        }
+    }
+
+    private static class LongMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Long( value.trim() );
+        }
+    }
+
+    private static class ShortMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Short( value.trim() );
+        }
+    }
+
+    private static class ByteMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new Byte( value.trim() );
+        }
+    }
+
+    private static class CharMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return value.trim().charAt( 0 );
+        }
+    }
+
+    private static class BigDecimalMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new BigDecimal( value.trim() );
+        }
+    }
+
+    private static class BigIntegerMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return new BigInteger( value.trim() );
+        }
+    }
+
+    private static class EnumMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public Object map( Composite composite, Type type, String value )
+        {
+            return Enum.valueOf( (Class<Enum>) type, value );
+        }
+    }
+
+    private static class LocalDateMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return LocalDate.parse( value.trim() );
+        }
+    }
+
+    private static class LocalDateTimeMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return LocalDateTime.parse( value.trim() );
+        }
+    }
+
+    private static class ZonedDateTimeMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return ZonedDateTime.parse( value.trim() );
+        }
+    }
+
+    private static class OffsetDateTimeMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return OffsetDateTime.parse( value.trim() );
+        }
+    }
+
+    private static class InstantMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return Instant.parse( value.trim() );
+        }
+    }
+
+    private static class DurationMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return Duration.parse( value.trim() );
+        }
+    }
+
+    private static class PeriodMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( Composite composite, Type type, String value )
+        {
+            return Period.parse( value.trim() );
+        }
+    }
+
+    private static class ValueCompositeMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public Object map( Composite composite, Type type, String value )
+        {
+            return PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite )
+                .module()
+                .instance()
+                .newValueFromSerializedState( (Class<Object>) type, value );
+        }
+    }
+
+    private static class ArrayMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( { "raw", "unchecked" } )
+        public Object map( final Composite composite, Type type, String value )
+        {
+            final Class arrayType = ( (Class) type ).getComponentType();
+            final ArrayList result = new ArrayList();
+            tokenize( value, false, new TokenizerCallback()
+            {
+                @Override
+                public void token( String token )
+                {
+                    result.add( mapToType( composite, arrayType, token ) );
+                }
+            } );
+            return result.toArray( (Object[]) Array.newInstance( arrayType, result.size() ) );
+        }
+    }
+
+    private static class BooleanMapper
+        implements MappingStrategy
+    {
+        @Override
+        public Object map( final Composite composite, Type type, String value )
+        {
+            return Boolean.valueOf( value.trim() );
+        }
+    }
+
+    private static class ListMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( { "raw", "unchecked" } )
+        public Object map( final Composite composite, Type type, String value )
+        {
+            final Type dataType = ( (ParameterizedType) type ).getActualTypeArguments()[ 0 ];
+            final Collection result = new ArrayList();
+            tokenize( value, false, new TokenizerCallback()
+            {
+                @Override
+                public void token( String token )
+                {
+                    result.add( mapToType( composite, dataType, token ) );
+                }
+            } );
+            return result;
+        }
+    }
+
+    private static class SetMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( { "raw", "unchecked" } )
+        public Object map( final Composite composite, Type type, String value )
+        {
+            final Type dataType = ( (ParameterizedType) type ).getActualTypeArguments()[ 0 ];
+            final Collection result = new HashSet();
+            tokenize( value, false, new TokenizerCallback()
+            {
+                @Override
+                public void token( String token )
+                {
+                    result.add( mapToType( composite, dataType, token ) );
+                }
+            } );
+            return result;
+        }
+    }
+
+    private static class MapMapper
+        implements MappingStrategy
+    {
+        @Override
+        @SuppressWarnings( { "raw", "unchecked" } )
+        public Object map( final Composite composite, Type generictype, String value )
+        {
+            ParameterizedType type = (ParameterizedType) generictype;
+            final Type keyType = type.getActualTypeArguments()[ 0 ];
+            final Type valueType = type.getActualTypeArguments()[ 0 ];
+            final Map result = new HashMap();
+            tokenize( value, true, new TokenizerCallback()
+            {
+                boolean keyArrivingNext = true;
+                String key;
+
+                @Override
+                public void token( String token )
+                {
+                    if( keyArrivingNext )
+                    {
+                        key = token;
+                        keyArrivingNext = false;
+                    }
+                    else
+                    {
+                        result.put( mapToType( composite, keyType, key ), mapToType( composite, valueType, token ) );
+                        keyArrivingNext = true;
+                    }
+                }
+            } );
+            return result;
+        }
+    }
+
+    private PropertyMapper()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/StateDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/StateDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/StateDescriptor.java
new file mode 100644
index 0000000..20c07c2
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/StateDescriptor.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.property.PropertyDescriptor;
+
+/**
+ * Composite State Descriptor.
+ */
+public interface StateDescriptor
+{
+    PropertyDescriptor findPropertyModelByName( String name )
+        throws IllegalArgumentException;
+
+    PropertyDescriptor findPropertyModelByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException;
+
+    Stream<? extends PropertyDescriptor> properties();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/StatefulCompositeDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/StatefulCompositeDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/StatefulCompositeDescriptor.java
new file mode 100644
index 0000000..42cdcb3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/StatefulCompositeDescriptor.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * Stateful Composite Descriptor.
+ */
+public interface StatefulCompositeDescriptor
+{
+    StateDescriptor state();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilder.java b/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilder.java
new file mode 100644
index 0000000..e42a904
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilder.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * TransientBuilders are used to instantiate TransientComposites. They can be acquired from
+ * {@link TransientBuilderFactory#newTransientBuilder(Class)} and allows the client
+ * to provide additional settings before instantiating the TransientComposite.
+ */
+public interface TransientBuilder<T>
+{
+    /**
+     * Provide objects that can be injected into mixins that has the @Uses
+     * dependency injection annotation.
+     *
+     * @param usedObjects The objects that can be injected into mixins.
+     *
+     * @return the transient builder instance
+     *
+     * @see org.apache.polygene.api.injection.scope.Uses
+     */
+    TransientBuilder<T> use( Object... usedObjects );
+
+    /**
+     * Get a representation of the state for the new Composite.
+     * It is possible to access and update properties and associations,
+     * even immutable ones since the builder represents the initial state.
+     *
+     * @return a proxy implementing the Composite type
+     */
+    T prototype();
+
+    /**
+     * Get a representation of the state of the given type for the new Composite.
+     * This is primarily used if you want to provide state for a private mixin type.
+     *
+     * @param mixinType the mixin which you want to provide state for
+     *
+     * @return a proxy implementing the given mixin type
+     */
+    <K> K prototypeFor( Class<K> mixinType );
+
+    /**
+     * Create a new Composite instance.
+     *
+     * @return a new Composite instance
+     *
+     * @throws ConstructionException thrown if it was not possible to instantiate the Composite
+     */
+    T newInstance()
+        throws ConstructionException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilderFactory.java b/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilderFactory.java
new file mode 100644
index 0000000..7c6c7a1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/TransientBuilderFactory.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * This factory creates TransientComposites and the TransientBuilders.
+ *
+ * TransientComposite instances are very flexible in what it can reference, but are restricted in where they
+ * can be used. So, TransientComposites are mainly recommended where Values, Entities and Services can not be used,
+ * but they can also not be used to store state, be serialized across a network or have automatic equals/hashCode
+ * calculations.
+ */
+public interface TransientBuilderFactory
+{
+    /**
+     * Create a builder for creating new TransientComposites that implements the given TransientComposite type.
+     *
+     * @param mixinType an interface that describes the TransientComposite to be instantiated
+     *
+     * @return a TransientBuilder for creation of TransientComposites implementing the interface
+     *
+     * @throws NoSuchTransientException if no composite extending the mixinType has been registered
+     */
+    <T> TransientBuilder<T> newTransientBuilder( Class<T> mixinType )
+        throws NoSuchTransientException;
+
+    /**
+     * Instantiate a TransientComposite of the given type.
+     *
+     * @param mixinType the TransientComposite type to instantiate
+     *
+     * @return a new TransientComposite instance
+     *
+     * @throws NoSuchTransientException if no composite extending the mixinType has been registered
+     * @throws org.apache.polygene.api.common.ConstructionException
+     *                                  if the composite could not be instantiated
+     */
+    <T> T newTransient( Class<T> mixinType, Object... uses )
+        throws NoSuchTransientException, ConstructionException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/TransientComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/TransientComposite.java b/core/api/src/main/java/org/apache/polygene/api/composite/TransientComposite.java
new file mode 100644
index 0000000..bcf86fd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/TransientComposite.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * Transient Composite Type.
+ *
+ * TransientComposites have the following criteria;
+ * <ul>
+ * <li>Does not persist its state, and is not serializable</li>
+ * <li>Can not be referenced from Properties, Associations, ValueComposites nor Entities</li>
+ * <li>Can reference all types</li>
+ * <li>No lifecycle</li>
+ * <li>equals/hashCode is delegated to a single Mixin implementing the methods, like any other method</li>
+ * </ul>
+ */
+public interface TransientComposite
+    extends Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/TransientDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/TransientDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/composite/TransientDescriptor.java
new file mode 100644
index 0000000..e4ce21a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/TransientDescriptor.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.composite;
+
+/**
+ * TransientComposite Descriptor.
+ */
+public interface TransientDescriptor
+    extends CompositeDescriptor, StatefulCompositeDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/composite/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/package.html b/core/api/src/main/java/org/apache/polygene/api/composite/package.html
new file mode 100644
index 0000000..4c79ac8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Composite API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/ConcernDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/ConcernDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernDescriptor.java
new file mode 100644
index 0000000..4986bec
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernDescriptor.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+/**
+ * Concern descriptor.
+ */
+public interface ConcernDescriptor
+{
+    Class modifierClass();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/ConcernOf.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/ConcernOf.java b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernOf.java
new file mode 100644
index 0000000..e872308
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernOf.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+import org.apache.polygene.api.concern.internal.ConcernFor;
+
+/**
+ * Base class for Concerns. It introduces a typed "next" pointer
+ * that Concerns can use to invoke the next Concern (or mixin) in
+ * the chain.
+ * <p>
+ * Generic Concerns should subclass {@link GenericConcern} instead.
+ * </p>
+ * <p>
+ * Concerns implementations must be thread-safe in their implementation,
+ * as multiple threads may share instances.
+ * </p>
+ */
+public abstract class ConcernOf<T>
+{
+    /**
+     * The "next" pointer. This points to
+     * the next concern in the chain or the mixin
+     * to be invoked.
+     */
+    final
+    @ConcernFor
+    protected T next = null;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/Concerns.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/Concerns.java b/core/api/src/main/java/org/apache/polygene/api/concern/Concerns.java
new file mode 100644
index 0000000..9c43e0f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/Concerns.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used by composites and mixins to declare what Concerns
+ * should be applied to the type or specific method.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface Concerns
+{
+    Class<?>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/ConcernsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/ConcernsDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernsDescriptor.java
new file mode 100644
index 0000000..7a5ee07
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/ConcernsDescriptor.java
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+/**
+ * Concerns descriptor.
+ */
+public interface ConcernsDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/GenericConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/GenericConcern.java b/core/api/src/main/java/org/apache/polygene/api/concern/GenericConcern.java
new file mode 100644
index 0000000..f96aec0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/GenericConcern.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern;
+
+import java.lang.reflect.InvocationHandler;
+
+/**
+ * Base class for generic Concerns. Subclass
+ * and implement the "invoke" method. Use the
+ * "next" field in {@link ConcernOf} to continue the invocation
+ * chain.
+ */
+public abstract class GenericConcern
+    extends ConcernOf<InvocationHandler>
+    implements InvocationHandler
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/internal/ConcernFor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/internal/ConcernFor.java b/core/api/src/main/java/org/apache/polygene/api/concern/internal/ConcernFor.java
new file mode 100644
index 0000000..1db879c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/internal/ConcernFor.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.concern.internal;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * This annotation is required once in each Concern, to mark the
+ * field where the next element in the call sequence should be
+ * injected.
+ * <p>
+ * The type of the field must be of the same type as the Concern
+ * itself, or an InvocationHandler.
+ * </p>
+ * <p>
+ * Example;
+ * </p>
+ * <pre><code>
+ * public interface MyStuff
+ * {
+ *     void doSomething();
+ * }
+ *
+ * public class MyStuffConcern
+ *     implements MyStuff
+ * {
+ *     &#64;ConcernFor MyStuff next;
+ *
+ *     public void doSomething()
+ *     {
+ *         // HERE DO THE MODIFIER STUFF.
+ *
+ *         // Delegate to the underlying mixin/modifier.
+ *         next.doSomething();
+ *     }
+ * }
+ * </code></pre>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.FIELD, ElementType.PARAMETER } )
+@Documented
+@InjectionScope
+public @interface ConcernFor
+{
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/internal/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/internal/package.html b/core/api/src/main/java/org/apache/polygene/api/concern/internal/package.html
new file mode 100644
index 0000000..7dcd3b6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/internal/package.html
@@ -0,0 +1,28 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h1>Internal/Private package for the Concern API.</h1>
+        <p>
+            This is an internal package, and no classes in this package is part of the API and compatibility
+            with these classes will not be attempted.
+        </p>
+    </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/concern/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/concern/package.html b/core/api/src/main/java/org/apache/polygene/api/concern/package.html
new file mode 100644
index 0000000..f9d5d0c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/concern/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Concern API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/configuration/Configuration.java b/core/api/src/main/java/org/apache/polygene/api/configuration/Configuration.java
new file mode 100644
index 0000000..60da8eb
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/configuration/Configuration.java
@@ -0,0 +1,401 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.PropertyMapper;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.service.qualifier.ServiceTags;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.usecase.Usecase;
+import org.apache.polygene.api.usecase.UsecaseBuilder;
+import org.apache.polygene.api.value.ValueSerialization;
+
+/**
+ * Provide Configurations for Services. A Service that wants to be configurable
+ * should inject a reference to Configuration with the Configuration type:
+ * <pre><code>
+ *  * &#64;This Configuration&#60;MyServiceConfiguration&#62; config;
+ * </code></pre>
+ * <p>
+ * where MyServiceConfiguration extends {@link ConfigurationComposite}, which itself is an ordinary
+ * {@link org.apache.polygene.api.entity.EntityComposite}. The Configuration implementation
+ * will either locate an instance of the given Configuration type in the
+ * persistent store using the reference of the Service, or create a new such instance
+ * if one doesn't already exist.
+ * </p>
+ * <p>
+ * If a new Configuration instance is created then it will be populated with properties
+ * from the properties file whose filesystem name is the same as the reference (e.g. "MyService.properties").
+ * If a service is not given a name via the {@code org.apache.polygene.bootstrap.ServiceDeclaration#identifiedBy(String)}, the
+ * name will default to the FQCN of the ServiceComposite type.
+ * </p>
+ * <p>
+ * The Configuration instance can be modified externally just like any other EntityComposite, but
+ * its values will not be updated in the Service until {@link #refresh()} is called. This allows
+ * safe reloads of Configuration state to ensure that it is not reloaded while the Service is handling
+ * a request.
+ * </p>
+ * <p>
+ * The Configuration will be automatically refreshed when the Service is activated by the Polygene runtime.
+ * Any refreshes at other points will have to be done manually or triggered through some other
+ * mechanism.
+ * </p>
+ * <p>
+ * The user configuration entity is part of a long running {@link UnitOfWork}, and to persist changes to it the
+ * {@link #save()} method must be called. No other actions are required. Example;
+ * </p>
+ * <pre><code>
+ *
+ * public interface MyConfiguration extends ConfigurationComposite
+ * {
+ *     Property&lt;Long&gt; timeout();
+ * }
+ *
+ * :
+ *
+ * &#64;This Configuration&lt;MyConfiguration&gt; config;
+ * :
+ * private void setTimeoutConfiguration( long timeout )
+ * {
+ *     config.get().timeout().set( timeout );
+ *     config.save();
+ * }
+ * </code></pre>
+ * <p>
+ * And even if a separate thread is using the {@code timeout()} configuration when this is happening, the
+ * {@link UnitOfWork} isolation will ensure that the other thread is not affected. That thread, on the other hand
+ * will need to do a {@link #refresh()} at an appropriate time to pick up the timeout change. For instance;
+ * </p>
+ * <pre><code>
+ *
+ * &#64;Service InventoryService remoteInventoryService;
+ *
+ * public void restockInventoryItem( InventoryItemId id, int itemCount )
+ * {
+ *     config.refresh();
+ *     long timeout = config.get().timeout().get();
+ *
+ *     remoteInventoryService.restock( id, itemCount, timeout );
+ *
+ *     :
+ *     :
+ * }
+ * </code></pre>
+ */
+@SuppressWarnings( "JavadocReference" )
+@Mixins( Configuration.ConfigurationMixin.class )
+public interface Configuration<T>
+{
+    /**
+     * Retrieves the user configuration instance managed by this Configuration.
+     * <p>
+     * Even if the user configuration is initialized from properties file, the consistency rules of Polygene composites
+     * still applies. If the the properties file is missing a value, then the initialization will fail with a
+     * RuntimeException. If Constraints has been defined, those will need to be satisfied as well. The user
+     * configuration instance returned will fulfill the constraints and consistency normal to all composites, and
+     * can therefor safely be used with additional checks.
+     * </p>
+     *
+     * @return The fully initialized and ready-to-use user configuration instance.
+     */
+    T get();
+
+    /**
+     * Updates the values of the managed user ConfigurationComposite instance from the underlying
+     * {@code org.apache.polygene.spi.entitystore.EntityStore}.  Any modified values in the current user configuration that
+     * has not been saved, via {@link #save()} method, will be lost.
+     */
+    void refresh();
+
+    /**
+     * Persists the modified values in the user configuration instance to the underlying store.
+     */
+    void save();
+
+    /**
+     * Implementation of Configuration.
+     * <p>
+     * This is effectively an internal class in Polygene and should never be used directly by user code.
+     * </p>
+     *
+     * @param <T>
+     */
+    public class ConfigurationMixin<T>
+        implements Configuration<T>
+    {
+        private T configuration;
+        private UnitOfWork uow;
+
+        @Structure
+        private PolygeneAPI api;
+
+        @This
+        private ServiceComposite me;
+
+        @Structure
+        private UnitOfWorkFactory uowf;
+
+        @Service
+        private Iterable<ServiceReference<ValueSerialization>> valueSerialization;
+
+
+        public ConfigurationMixin()
+        {
+        }
+
+        @Override
+        public synchronized T get()
+        {
+            if( configuration == null )
+            {
+                Usecase usecase = UsecaseBuilder.newUsecase( "Configuration:" + me.identity().get() );
+                uow = uowf.newUnitOfWork( usecase );
+                try
+                {
+                    configuration = this.findConfigurationInstanceFor( me, uow );
+                }
+                catch( InstantiationException e )
+                {
+                    throw new IllegalStateException( e );
+                }
+            }
+
+            return configuration;
+        }
+
+        @Override
+        public synchronized void refresh()
+        {
+            if( configuration != null )
+            {
+                configuration = null;
+                uow.discard();
+                uow = null;
+            }
+        }
+
+        @Override
+        public void save()
+        {
+            if( uow != null )
+            {
+                try
+                {
+                    uow.complete();
+                    uow = null;
+                }
+                catch( UnitOfWorkCompletionException e )
+                {
+                    // Should be impossible
+                    e.printStackTrace();
+                }
+
+                configuration = null; // Force refresh
+            }
+        }
+
+        @SuppressWarnings( "unchecked" )
+        public <V> V findConfigurationInstanceFor( ServiceComposite serviceComposite, UnitOfWork uow )
+            throws InstantiationException
+        {
+            ServiceDescriptor serviceModel = api.serviceDescriptorFor( serviceComposite );
+
+            V configuration;
+            try
+            {
+                configuration = uow.get( serviceModel.<V>configurationType(), serviceComposite.identity().get() );
+                uow.pause();
+            }
+            catch( NoSuchEntityException | NoSuchEntityTypeException e )
+            {
+                return (V) initializeConfigurationInstance( serviceComposite, uow, serviceModel, serviceComposite.identity().get() );
+            }
+            return configuration;
+        }
+
+        @SuppressWarnings( "unchecked" )
+        private <V extends HasIdentity> V initializeConfigurationInstance(ServiceComposite serviceComposite,
+                                                                          UnitOfWork uow,
+                                                                          ServiceDescriptor serviceModel,
+                                                                          Identity identity
+        )
+            throws InstantiationException
+        {
+            Module module = api.moduleOf( serviceComposite ).instance();
+            Usecase usecase = UsecaseBuilder.newUsecase( "Configuration:" + me.identity().get() );
+            UnitOfWork buildUow = module.unitOfWorkFactory().newUnitOfWork( usecase );
+
+            Class<?> type = api.serviceDescriptorFor( serviceComposite ).types().findFirst().orElse( null );
+            Class<V> configType = serviceModel.configurationType();
+
+            // Check for defaults
+            V config = tryLoadPropertiesFile( buildUow, type, configType, identity );
+            if( config == null )
+            {
+                config = tryLoadJsonFile( buildUow, type, configType, identity );
+                if( config == null )
+                {
+                    config = tryLoadYamlFile( buildUow, type, configType, identity );
+                    if( config == null )
+                    {
+                        config = tryLoadXmlFile( buildUow, type, configType, identity );
+                        if( config == null )
+                        {
+                            try
+                            {
+                                EntityBuilder<V> configBuilder = buildUow.newEntityBuilder( serviceModel.<V>configurationType(), identity );
+                                configBuilder.newInstance();
+                            }
+                            catch( ConstraintViolationException e )
+                            {
+                                throw new NoSuchConfigurationException( configType, identity, e );
+                            }
+                        }
+                    }
+                }
+            }
+
+            try
+            {
+                buildUow.complete();
+
+                // Try again
+                return (V) findConfigurationInstanceFor( serviceComposite, uow );
+            }
+            catch( Exception e1 )
+            {
+                InstantiationException ex = new InstantiationException(
+                    "Could not instantiate configuration, and no configuration initialization file was found (" + identity + ")" );
+                ex.initCause( e1 );
+                throw ex;
+            }
+        }
+
+        private <C, V> V tryLoadPropertiesFile( UnitOfWork buildUow,
+                                                Class<C> compositeType,
+                                                Class<V> configType,
+                                                Identity identity
+        )
+            throws InstantiationException
+        {
+            EntityBuilder<V> configBuilder = buildUow.newEntityBuilder( configType, identity );
+            String resourceName = identity + ".properties";
+            InputStream asStream = getResource( compositeType, resourceName );
+            if( asStream != null )
+            {
+                try
+                {
+                    PropertyMapper.map( asStream, (Composite) configBuilder.instance() );
+                    return configBuilder.newInstance();
+                }
+                catch( IOException e1 )
+                {
+                    InstantiationException exception = new InstantiationException(
+                        "Could not read underlying Properties file." );
+                    exception.initCause( e1 );
+                    throw exception;
+                }
+            }
+            return null;
+        }
+
+        private InputStream getResource( Class<?> type, String resourceName )
+        {
+            // Load defaults from classpath root if available
+            if( type.getResource( resourceName ) == null && type.getResource( "/" + resourceName ) != null )
+            {
+                resourceName = "/" + resourceName;
+            }
+            return type.getResourceAsStream( resourceName );
+        }
+
+        private <C, V extends HasIdentity> V tryLoadJsonFile(UnitOfWork uow,
+                                                             Class<C> compositeType,
+                                                             Class<V> configType,
+                                                             Identity identity
+        )
+        {
+            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.JSON, ".json" );
+        }
+
+        private <C, V extends HasIdentity> V tryLoadYamlFile(UnitOfWork uow,
+                                                             Class<C> compositeType,
+                                                             Class<V> configType,
+                                                             Identity identity
+        )
+        {
+            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.YAML, ".yaml" );
+        }
+
+        private <C, V extends HasIdentity> V tryLoadXmlFile(UnitOfWork uow,
+                                                            Class<C> compositeType,
+                                                            Class<V> configType,
+                                                            Identity identity
+        )
+        {
+            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.XML, ".xml" );
+        }
+
+        private <C, V extends HasIdentity> V readConfig(UnitOfWork uow,
+                                                        Class<C> compositeType,
+                                                        Class<V> configType,
+                                                        Identity identity,
+                                                        String format,
+                                                        String extension
+        )
+        {
+            for( ServiceReference<ValueSerialization> serializerRef : valueSerialization )
+            {
+                ServiceTags serviceTags = serializerRef.metaInfo( ServiceTags.class );
+                if( serviceTags.hasTag( format ) )
+                {
+                    String resourceName = identity + extension;
+                    InputStream asStream = getResource( compositeType, resourceName );
+                    if( asStream != null )
+                    {
+                        V configObject = serializerRef.get().deserialize( uow.module(), configType, asStream );
+                        return uow.toEntity( configType, configObject );
+                    }
+                }
+            }
+            return null;
+        }
+    }
+}


[30/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/importer/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/importer/package.html b/core/api/src/main/java/org/apache/zest/api/service/importer/package.html
deleted file mode 100644
index be1d382..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/importer/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Service Importers.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/package.html b/core/api/src/main/java/org/apache/zest/api/service/package.html
deleted file mode 100644
index c217c9c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Service API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/Active.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Active.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/Active.java
deleted file mode 100644
index c8e162a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Active.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Filter services based on whether they are active or not.
- * <p>
- * At an injection point you can do this:
- * </p>
- * <pre><code>
- * &#64;Service &#64;Active MyService service;
- * </code></pre>
- * <p>
- * to get only a service that is currently active.
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Qualifier( Active.ActiveQualifier.class )
-public @interface Active
-{
-    /**
-     * Active Annotation Qualifier.
-     * See {@link Active}.
-     */
-    public final class ActiveQualifier
-        implements AnnotationQualifier<Active>
-    {
-        @Override
-        public <T> Predicate<ServiceReference<?>> qualifier( Active active )
-        {
-            return ServiceQualifier.whereActive();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/AnnotationQualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/AnnotationQualifier.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/AnnotationQualifier.java
deleted file mode 100644
index cc52560..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/AnnotationQualifier.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Annotation;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Constructs a Specification for a given qualifier annotation
- */
-public interface AnnotationQualifier<QUALIFIER extends Annotation>
-{
-    public <T> Predicate<ServiceReference<?>> qualifier( QUALIFIER qualifier );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/Available.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Available.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/Available.java
deleted file mode 100644
index 584088c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Available.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Filter services based on whether they are available or not.
- *
- * At an injection point you can do this:
- *
- * <pre><code>
- * &#64;Service &#64;Available MyService service;
- * </code></pre>
- * to get only a service that is currently available.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Qualifier( Available.AvailableQualifier.class )
-public @interface Available
-{
-    /**
-     * Available Annotation Qualifier.
-     * See {@link Available}.
-     */
-    public final class AvailableQualifier
-        implements AnnotationQualifier<Available>
-    {
-        @Override
-        public <T> Predicate<ServiceReference<?>> qualifier( Available active )
-        {
-            return ServiceQualifier.whereAvailable();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/HasMetaInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/HasMetaInfo.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/HasMetaInfo.java
deleted file mode 100644
index 55219c4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/HasMetaInfo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Filter services based on Meta Info being declared on the Service.
- * <p>
- * Meta Info of any type can be set on the service during assembly, e.g.;
- * </p>
- * <pre><code>
- * module.addService( MyService.class ).setMetaInfo( new MyCustomInfo(someData) );
- * </code></pre>
- * <p>
- * and then at an injection point you can do this:
- * </p>
- * <pre><code>
- * &#64;Service &#64;HasMetaInfo(MyCustomInfo.class) MyService service;
- * </code></pre>
- * <p>
- * to get only a service that has a MyCustomInfo instance set as meta info.
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Qualifier( HasMetaInfo.HasMetaInfoQualifier.class )
-@Documented
-public @interface HasMetaInfo
-{
-    /**
-     * The Class(es) needed to have been defined in the Service meta info for a qualifier to evaluate true.
-     *
-     * @return One or more classes that should be defined in the service's meta info for the service to be considered
-     *         qualified. If more than one class is defined, the {@code anded()} parameter will define if they must be
-     *         AND'ed or OR'ed together.
-     */
-    Class[] value();
-
-    /**
-     * True if the Classes defined in the value() field should be AND'ed instead of OR'ed.
-     *
-     * @return If true, all the Class types defined in {@code value()} must be defined for the service for it to be
-     *         qualified. If false, if any of the Class types defined in {@code value()} is defined for the service
-     *         the service is qualified.
-     */
-    boolean anded() default false;
-
-    /**
-     * HasMetaInfo Annotation Qualifier.
-     * See {@link HasMetaInfo}.
-     */
-    public static class HasMetaInfoQualifier
-        implements AnnotationQualifier<HasMetaInfo>
-    {
-        @Override
-        public <T> Predicate<ServiceReference<?>> qualifier( final HasMetaInfo hasMetaInfo )
-        {
-            return new Predicate<ServiceReference<?>>()
-            {
-                @Override
-                @SuppressWarnings( {"raw", "unchecked"} )
-                public boolean test( ServiceReference<?> service )
-                {
-                    for( Class metaInfoType : hasMetaInfo.value() )
-                    {
-                        Object metaInfo = service.metaInfo( metaInfoType );
-                        if( hasMetaInfo.anded() )
-                        {
-                            if( metaInfo == null )
-                            {
-                                return false;
-                            }
-                        }
-                        else
-                        {
-                            if( metaInfo != null )
-                            {
-                                return true;
-                            }
-                        }
-                    }
-                    return false;
-                }
-            };
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/IdentifiedBy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/IdentifiedBy.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/IdentifiedBy.java
deleted file mode 100644
index 111443c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/IdentifiedBy.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Filter services based on identity. Identity can be set during assembly, like so:
- * <pre><code>
- * module.addService(MyService.class).identifiedBy("myservice1");
- * </code></pre>
- *
- * and then at an injection point you can do this:
- * <pre><code>
- * &#64;Service @IdentifiedBy("myservice1") MyService service;
- * </code></pre>
- * to get only a service identified "myservice1".
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Qualifier( IdentifiedBy.IdentifiedByQualifier.class )
-public @interface IdentifiedBy
-{
-    public abstract String value();
-
-    /**
-     * IdentifiedBy Annotation Qualifier.
-     * See {@link IdentifiedBy}.
-     */
-    public final class IdentifiedByQualifier
-        implements AnnotationQualifier<IdentifiedBy>
-    {
-        @Override
-        public <T> Predicate<ServiceReference<?>> qualifier( IdentifiedBy identifiedBy )
-        {
-            return ServiceQualifier.withId( identifiedBy.value() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/Qualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Qualifier.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/Qualifier.java
deleted file mode 100644
index 3aecc80..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Qualifier.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Annotation used to declare Qualifiers annotations.
- */
-@Retention( RetentionPolicy.RUNTIME )
-public @interface Qualifier
-{
-    public abstract Class<? extends AnnotationQualifier> value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceQualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceQualifier.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceQualifier.java
deleted file mode 100644
index 74f9691..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceQualifier.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * This class helps you select a particular service
- * from a list.
- * <p>
- * Provide a Selector which does the actual
- * selection from the list. A common case is to select
- * based on reference of the service, which you can do this way:
- * </p>
- *
- * <pre><code>
- * new ServiceQualifier&lt;MyService&gt;(services, ServiceQualifier.withId("someId"))
- * </code></pre>
- * <p>
- * Many selectors can be combined by using firstOf. Example:
- * </p>
- * <pre><code>
- * new ServiceQualifier&lt;MyService&gt;(services, firstOf(withTags("sometag"), firstActive(), first()))
- * </code></pre>
- * <p>
- * This will pick a service that has the tag "sometag", or if none is found take the first active one. If no
- * service is active, then the first service will be picked.
- * </p>
- */
-public abstract class ServiceQualifier
-{
-    public static Predicate<ServiceReference<?>> withId( final String anId )
-    {
-        return new Predicate<ServiceReference<?>>()
-        {
-            @Override
-            public boolean test( ServiceReference<?> service )
-            {
-                return service.identity().toString().equals( anId );
-            }
-        };
-    }
-
-    public static Predicate<ServiceReference<?>> whereMetaInfoIs( final Object metaInfo )
-    {
-        return new Predicate<ServiceReference<?>>()
-        {
-            @Override
-            public boolean test( ServiceReference<?> service )
-            {
-                Object metaObject = service.metaInfo( metaInfo.getClass() );
-                return metaObject != null && metaInfo.equals( metaObject );
-            }
-        };
-    }
-
-    public static Predicate<ServiceReference<?>> whereActive()
-    {
-        return new Predicate<ServiceReference<?>>()
-        {
-            @Override
-            public boolean test( ServiceReference<?> service )
-            {
-                return service.isActive();
-            }
-        };
-    }
-
-    public static Predicate<ServiceReference<?>> whereAvailable()
-    {
-        return new Predicate<ServiceReference<?>>()
-        {
-            @Override
-            public boolean test( ServiceReference<?> service )
-            {
-                return service.isAvailable();
-            }
-        };
-    }
-
-    public static Predicate<ServiceReference<?>> withTags( final String... tags )
-    {
-        return new Predicate<ServiceReference<?>>()
-        {
-            @Override
-            public boolean test( ServiceReference<?> service )
-            {
-                ServiceTags serviceTags = service.metaInfo( ServiceTags.class );
-
-                return serviceTags != null && serviceTags.hasTags( tags );
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceTags.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceTags.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceTags.java
deleted file mode 100644
index 71703da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/ServiceTags.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.io.Serializable;
-
-/**
- * Use this as metainfo about a Service to specify tags. Easiest way to set them on a service
- * is to use the <code>ServiceDeclaration.taggedWith(String...)</code> method.
- *
- * These can be used in conjunction with the withTags() Service
- * Selector.
- */
-public final class ServiceTags
-    implements Serializable
-{
-    private String[] tags;
-
-    public ServiceTags( String... tags )
-    {
-        this.tags = tags;
-    }
-
-    public String[] tags()
-    {
-        return tags;
-    }
-
-    public boolean hasTag( String tag )
-    {
-        for( String serviceTag : tags )
-        {
-            if( serviceTag.equals( tag ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    public boolean hasTags( String... aTags )
-    {
-        for( String tag : aTags )
-        {
-            if( !hasTag( tag ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/Tagged.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Tagged.java b/core/api/src/main/java/org/apache/zest/api/service/qualifier/Tagged.java
deleted file mode 100644
index 6b9ec5f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/Tagged.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.qualifier;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.function.Predicate;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Filter services based on tags. Tags can be set using the ServiceTags meta-info, like so:
- * <pre><code>
- * module.addService(MyService.class).taggedWith(new ServiceTags("onetag","twotag"));
- * </code></pre>
- *
- * and then at an injection point you can do this:
- *
- * <pre><code>
- * &#64;Service &#64;Tagged("onetag") MyService service;
- * </code></pre>
- * to get only a service tagged with MyService. If several match only the first match is used.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Qualifier( Tagged.TaggedQualifier.class )
-public @interface Tagged
-{
-    String[] value();
-
-    /**
-     * Tagged Annotation Qualifier.
-     * See {@link Tagged}.
-     */
-    final class TaggedQualifier
-        implements AnnotationQualifier<Tagged>
-    {
-        @Override
-        public Predicate<ServiceReference<?>> qualifier( Tagged tagged )
-        {
-            return ServiceQualifier.withTags( tagged.value() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/qualifier/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/qualifier/package.html b/core/api/src/main/java/org/apache/zest/api/service/qualifier/package.html
deleted file mode 100644
index 0240c65..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/qualifier/package.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Service Qualifiers.</h2>
-        <p>
-            The @Service injection is only able to specify the type of the service to be injected. If any other type of
-            qualification has to be done it has to be done manually but for common cases it's more convenient to use
-            annotations to do this filtering. This package contains annotations to perform this qualification.
-        </p>
-        <p>Example:</p>
-        <blockquote>
-            <pre>@Service @Tagged( "sometag" ) MyService service;</pre>
-        </blockquote>
-        <p>
-            This will only inject instances of MyService that have been tagged with "sometag". If none exist an
-            exception will occur at injection time since it is not optional.
-        </p>
-        <p>It also works with iterables:</p>
-        <blockquote>
-            <pre>@Service @Tagged( "sometag" ) Iterable&lt;MyService&gt; services;</pre>
-        </blockquote>
-        <p>
-            The qualification will be evaluated upon each call to iterator(), and since the qualifier has access to a
-            ServiceReference, which contains the isActive() method, it can even provide some dynamicity.
-        </p>
-        <blockquote>
-            <pre>@Service @Active Iterable&lt;SomeImportedService&gt; importedServices;</pre>
-        </blockquote>
-        <p>
-            Let's say these SomeImportedService are only sometimes available. Then whenever iterator() is called the
-            {@link org.apache.zest.api.service.qualifier.Active} tag can kick in and filter out those whose
-            ServiceReference.isActive() returns false.
-        </p>
-        <p>Standard ones defined in the API are:</p>
-        <ul>
-            <li>{@link org.apache.zest.api.service.qualifier.Active}</li>
-            <li>{@link org.apache.zest.api.service.qualifier.Available}</li>
-            <li>{@link org.apache.zest.api.service.qualifier.HasMetaInfo}</li>
-            <li>{@link org.apache.zest.api.service.qualifier.IdentifiedBy}</li>
-            <li>{@link org.apache.zest.api.service.qualifier.Tagged}</li>
-        </ul>
-        <p>See tests and API for more examples, and how to implement your own qualifiers.</p>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/GenericSideEffect.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/GenericSideEffect.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/GenericSideEffect.java
deleted file mode 100644
index 0fa157a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/GenericSideEffect.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-/**
- * Base class for generic SideEffects.
- */
-public abstract class GenericSideEffect
-    extends SideEffectOf<InvocationHandler>
-    implements InvocationHandler
-{
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Object invoke( final Object proxy, final Method method, final Object[] args )
-        throws Throwable
-    {
-        invoke( method, args );
-        return null;
-    }
-
-    /**
-     * Convenience method to be overridden by subclasses in order to avoid returning null, as returned value from side
-     * effects is not taken in consideration.
-     *
-     * @param method the method that was invoked
-     * @param args   the arguments of the method invocation
-     *
-     * @throws Throwable - the exception to throw from the method invocation on the proxy instance. The exception's type
-     *                   must be assignable either to any of the exception types declared in the throws clause of the
-     *                   interface method or to the unchecked exception types {code}java.lang.RuntimeException{code}
-     *                   or {code}java.lang.Error{code}. If a checked exception is thrown by this method that is not
-     *                   assignable to any of the exception types declared in the throws clause of the interface method,
-     *                   then an UndeclaredThrowableException containing the exception that was thrown by this method
-     *                   will be thrown by the method invocation on the proxy instance.
-     */
-    protected void invoke( final Method method, final Object[] args )
-        throws Throwable
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectDescriptor.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectDescriptor.java
deleted file mode 100644
index 51433b4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectDescriptor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect;
-
-/**
- * SideEffect Descriptor.
- */
-public interface SideEffectDescriptor
-{
-    Class<?> modifierClass();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectOf.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectOf.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectOf.java
deleted file mode 100644
index f198664..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectOf.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect;
-
-import org.apache.zest.api.sideeffect.internal.SideEffectFor;
-
-/**
- * Base class for SideEffects. It introduces a typed "next" pointer
- * that SideEffects can use to get the result of the original invocation.
- * <p>
- * Generic SideEffects should subclass {@link GenericSideEffect} instead.
- * </p>
- * <p>
- * SideEffects implementations must be thread-safe in their implementation,
- * as multiple threads may share instances.
- * </p>
- */
-public abstract class SideEffectOf<T>
-{
-    final
-    @SideEffectFor
-    protected T result = null;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffects.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffects.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffects.java
deleted file mode 100644
index b53ee4a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffects.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used by composites and mixins to declare what SideEffects
- * should apply to the type or specific method.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface SideEffects
-{
-    Class<?>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectsDescriptor.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectsDescriptor.java
deleted file mode 100644
index b08ef0e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/SideEffectsDescriptor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect;
-
-/**
- * SideEffects Descriptor.
- */
-public interface SideEffectsDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/SideEffectFor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/SideEffectFor.java b/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/SideEffectFor.java
deleted file mode 100644
index d46c840..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/SideEffectFor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.sideeffect.internal;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * This annotation is required once in each SideEffect, to mark the
- * field where the element providing the invocation result should be
- * injected.
- * <p>
- * The type of the field must be of the same type as the SideEffect
- * itself, or an InvocationHandler.
- * </p>
- * <p>
- * Example;
- * </p>
- * <pre><code>
- * public interface MyStuff
- * {
- *     SomeResult doSomething();
- * }
- *
- * public class MyStuffSideEffect
- *     implements MyStuff
- * {
- *     &#64;SideEffectFor MyStuff next;
- *
- *     public SomeResult doSomething()
- *     {
- *          SomeResult result = next.doSomething();
- *
- *         // HERE DO THE SIDEEFFECT STUFF.
- *
- *          return result; // Result value is ignored, null would work too.
- *     }
- * }
- * </code></pre>
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ ElementType.FIELD, ElementType.PARAMETER })
-@Documented
-@InjectionScope
-public @interface SideEffectFor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/package.html b/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/package.html
deleted file mode 100644
index 9f70396..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/internal/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h1>Internal/Private package for the API.</h1>
-        <p>
-            This is an internal package, and no classes in this package is part of the API and compatibility
-            with these classes will not be attempted.
-        </p>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/sideeffect/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/sideeffect/package.html b/core/api/src/main/java/org/apache/zest/api/sideeffect/package.html
deleted file mode 100644
index 4f14cc1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/sideeffect/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>SideEffect API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/Application.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/Application.java b/core/api/src/main/java/org/apache/zest/api/structure/Application.java
deleted file mode 100644
index 0018376..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/Application.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activation;
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-
-/**
- * The Application represents a whole Polygene application.
- */
-public interface Application
-    extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
-{
-    /**
-     * Application modes.
-     */
-    public enum Mode
-    {
-        /**
-         * Should be used for unit test runs. Created files etc. should be cleaned up between runs.
-         */
-        test,
-        /**
-         * Should be used during development. Typically create in-memory databases etc.
-         */
-        development,
-        /**
-         * Should be used in QA environments, and other production-like settings where different set of external
-         * resources are utilized.
-         */
-        staging,
-        /**
-         * Should be used in production. All databases are persistent on disk etc.
-         */
-        production
-    }
-
-    /**
-     * @return Application name
-     */
-    String name();
-
-    /**
-     * The version of the application. This can be in any format, but
-     * most likely will follow the Dewey format, i.e. x.y.z.
-     *
-     * @return the version of the application
-     */
-    String version();
-
-    /**
-     * @return Application Mode
-     */
-    Mode mode();
-
-    /**
-     * Find a Layer.
-     *
-     * @param layerName Layer name
-     * @return Found Layer, never returns null
-     * @throws IllegalArgumentException if there's no such Layer
-     */
-    Layer findLayer( String layerName )
-        throws IllegalArgumentException;
-
-    /**
-     * Find a Module.
-     *
-     * @param layerName Layer name
-     * @param moduleName Module name
-     * @return Found Module, never returns null
-     * @throws IllegalArgumentException if there's no such Module
-     */
-    Module findModule( String layerName, String moduleName )
-        throws IllegalArgumentException;
-
-    /**
-     * @return Application Descriptor
-     */
-    ApplicationDescriptor descriptor();
-
-    Stream<? extends Layer> layers();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/ApplicationDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/ApplicationDescriptor.java b/core/api/src/main/java/org/apache/zest/api/structure/ApplicationDescriptor.java
deleted file mode 100644
index 58e73c9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/ApplicationDescriptor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.util.VisitableHierarchy;
-
-/**
- * Application Descriptor.
- */
-public interface ApplicationDescriptor
-    extends VisitableHierarchy<Object, Object>
-{
-    /**
-     * Create a new instance of the Application.
-     * @param runtime Polygene Runtime
-     * @param importedServiceInstances Imported Services instances
-     * @return a new instance of the Application.
-     */
-    Application newInstance( PolygeneAPI runtime, Object... importedServiceInstances );
-
-    /**
-     * @return the Application's name
-     */
-    String name();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/Layer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/Layer.java b/core/api/src/main/java/org/apache/zest/api/structure/Layer.java
deleted file mode 100644
index 2ca74c0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/Layer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activation;
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-
-/**
- * The Layer represents a single layer in a Polygene application.
- */
-public interface Layer
-    extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
-{
-    /**
-     * @return the Layer's name
-     */
-    String name();
-
-    Application application();
-
-    Stream<? extends Module> modules();
-
-    LayerDescriptor descriptor();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/LayerDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/LayerDescriptor.java b/core/api/src/main/java/org/apache/zest/api/structure/LayerDescriptor.java
deleted file mode 100644
index 35ce5f2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/LayerDescriptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.object.ObjectDescriptor;
-import org.apache.zest.api.value.ValueDescriptor;
-
-/**
- * Layer Descriptor.
- */
-public interface LayerDescriptor
-{
-
-    /**
-     * @return the Layer's name
-     */
-    String name();
-
-    Layer instance();
-
-    /**
-     * @return Layers used by this Layer
-     */
-    UsedLayersDescriptor usedLayers();
-
-    Stream<? extends ObjectDescriptor> visibleObjects( Visibility visibility );
-
-    Stream<? extends TransientDescriptor> visibleTransients( Visibility visibility );
-
-    Stream<? extends EntityDescriptor> visibleEntities( Visibility visibility );
-
-    Stream<? extends ValueDescriptor> visibleValues( Visibility visibility );
-
-    Stream<? extends ModelDescriptor> visibleServices( Visibility visibility );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/MetaInfoHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/MetaInfoHolder.java b/core/api/src/main/java/org/apache/zest/api/structure/MetaInfoHolder.java
deleted file mode 100644
index d58f141..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/MetaInfoHolder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-/**
- * MetaInfo holder.
- */
-public interface MetaInfoHolder
-{
-
-    /**
-     * Get metadata that implements the given type.
-     * The info is registered during assembly of the application.
-     *
-     * @param infoType the type of metadata to be returned
-     *
-     * @return the metadata for the given type, or <code>null</code> if
-     *         no such metadata has been registered
-     */
-    <T> T metaInfo( Class<T> infoType );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index 073ffa1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/Module.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.object.ObjectFactory;
-import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.service.ServiceFinder;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilderFactory;
-
-/**
- * API for interacting with a Module. Instances
- * of this can be accessed by using the {@link Structure}
- * injection scope.
- */
-public interface Module
-    extends ActivationEventListenerRegistration,
-            MetaInfoHolder,
-            ObjectFactory,
-            TransientBuilderFactory,
-            ValueBuilderFactory,
-            QueryBuilderFactory,
-            ServiceFinder
-{
-
-    /**
-     * @return the Module's name
-     */
-    String name();
-
-    ModuleDescriptor descriptor();
-
-    /**
-     * @return the Layer that the Module is declared in.
-     */
-    LayerDescriptor layer();
-
-    /** Returns the TypeLookup for the Module.
-     * TypeLookup handles all the types visible from within this Module.
-     *
-     * @return TypeLookup for this Module
-     */
-    TypeLookup typeLookup();
-
-    /** Returns the UnitOfWorkFactory for this Module.
-     *
-     * @return the UnitOfWorkFactory of this Module.
-     */
-    UnitOfWorkFactory unitOfWorkFactory();
-
-    /** Returns the ServiceFinder for this Module.
-     *
-     * @return the ServiceFinder for this Module.
-     */
-    ServiceFinder serviceFinder();
-
-    /** Returns the ValueBuilderFactory for this Module.
-     *
-     * @return the ValueBuilderFactory for this Module.
-     */
-    ValueBuilderFactory valueBuilderFactory();
-
-    /** Returns the TransientBuilderFactory for this Module.
-     *
-     * @return the TransientBuilderFactory for this Module.
-     */
-    TransientBuilderFactory transientBuilderFactory();
-
-    /** Returns the ObjectFactory for this Module.
-     *
-     * @return the ObjectFactory for this Module.
-     */
-    ObjectFactory objectFactory();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/ModuleDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/ModuleDescriptor.java b/core/api/src/main/java/org/apache/zest/api/structure/ModuleDescriptor.java
deleted file mode 100644
index 223d66d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/ModuleDescriptor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.object.ObjectDescriptor;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceDescriptor;
-import org.apache.zest.api.value.ValueDescriptor;
-
-/**
- * Module Descriptor.
- */
-public interface ModuleDescriptor
-{
-    String name();
-
-    LayerDescriptor layer();
-
-    /**
-     * @return the Module's ClassLoader
-     */
-    ClassLoader classLoader();
-
-    /**
-     * @param typeName name of a transient composite type
-     *
-     * @return the descriptor for a transient composite or null if the class could not be found or the transient composite is not visible
-     */
-    TransientDescriptor transientDescriptor( String typeName );
-
-    /**
-     * @param typeName name of an entity composite type
-     *
-     * @return the descriptor for an entity composite or null if the class could not be found or the entity composite is not visible
-     */
-    EntityDescriptor entityDescriptor( String typeName );
-
-    /**
-     * @param typeName name of an object type
-     *
-     * @return the descriptor for an object or null if the class could not be found or the object is not visible
-     */
-    ObjectDescriptor objectDescriptor( String typeName );
-
-    /**
-     * @param typeName name of a value composite type
-     *
-     * @return the descriptor for a value composite or null if the class could not be found or the value composite is not visible
-     */
-    ValueDescriptor valueDescriptor( String typeName );
-
-    Stream<? extends TransientDescriptor> findVisibleTransientTypes();
-
-    Stream<? extends ValueDescriptor> findVisibleValueTypes();
-
-    Stream<? extends EntityDescriptor> findVisibleEntityTypes();
-
-    Stream<? extends ObjectDescriptor> findVisibleObjectTypes();
-
-    Stream<? extends TransientDescriptor> transientComposites();
-
-    Stream<? extends ValueDescriptor> valueComposites();
-
-    Stream<? extends EntityDescriptor> entityComposites();
-
-    Stream<? extends ObjectDescriptor> objects();
-
-    Stream<? extends ImportedServiceDescriptor> importedServices();
-
-    Stream<? extends ServiceDescriptor> serviceComposites();
-
-    Module instance();
-
-    TypeLookup typeLookup();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/TypeLookup.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/TypeLookup.java b/core/api/src/main/java/org/apache/zest/api/structure/TypeLookup.java
deleted file mode 100644
index 332bb31..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/TypeLookup.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.AmbiguousTypeException;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.object.ObjectDescriptor;
-import org.apache.zest.api.value.ValueDescriptor;
-
-public interface TypeLookup
-{
-    /**
-     * Lookup first Object Model matching the given Type.
-     *
-     * <p>First, if Object Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Second, if Object Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return First matching Object Model
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    ObjectDescriptor lookupObjectModel( Class<?> type ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup first Transient Model matching the given Type.
-     *
-     * <p>First, if Transient Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Second, if Transient Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return First matching Transient Model
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    TransientDescriptor lookupTransientModel( Class<?> type ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup first Value Model matching the given Type.
-     *
-     * <p>First, if Value Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Second, if Value Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return First matching Value Model
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    ValueDescriptor lookupValueModel( Class<?> type ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup first Entity Model matching the given Type.
-     *
-     * <p>First, if Entity Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Second, if Entity Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
-     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p><b>Should be used for creational use cases only.</b> For non-creational use cases see
-     * {@link #lookupEntityModels(Class)}.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return First matching Entity Model
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    EntityDescriptor lookupEntityModel( Class<?> type ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup all Entity Models matching the given Type.
-     *
-     * <p>Returned List contains, in order, Entity Models that: </p>
-     *
-     * <ul>
-     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
-     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
-     * </ul>
-     *
-     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
-     * <p>Multiple <b>assignable</b> matches are <b>allowed</b> to enable polymorphic fetches and queries.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p><b>Should be used for non-creational use cases only.</b> For creational use cases see
-     * {@link #lookupEntityModel(Class)}.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return All matching Entity Models
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    List<EntityDescriptor> lookupEntityModels( Class<?> type ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup first ServiceDescriptor/ImportedServiceDescriptor matching the given Type.
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * <p>See {@link #lookupServiceModels(Type)}.</p>
-     *
-     * @param serviceType Looked up Type
-     *
-     * @return First matching Service
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    ModelDescriptor lookupServiceModel( Type serviceType ) throws AmbiguousTypeException;
-
-    /**
-     * Lookup all ServiceDescriptors matching the given Type.
-     *
-     * <p>Returned List contains, in order, ServiceReferences that: </p>
-     *
-     * <ul>
-     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
-     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
-     * </ul>
-     *
-     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>allowed</b> to enable polymorphic lookup/injection.</p>
-     * <p>Multiple <b>assignable</b> matches with the same Visibility are <b>allowed</b> for the very same reason.</p>
-     *
-     * <p>Type lookup is done lazily and cached.</p>
-     *
-     * @param type Looked up Type
-     *
-     * @return All matching ServiceReferences
-     * @throws AmbiguousTypeException when a type ambiguity is found
-     */
-    List<? extends ModelDescriptor> lookupServiceModels( Type type ) throws AmbiguousTypeException;
-
-    /**
-     * @return All visible Objects, in visibility order
-     */
-    Stream<ObjectDescriptor> allObjects();
-
-    /**
-     * @return All visible Transients, in visibility order
-     */
-    Stream<TransientDescriptor> allTransients();
-
-    /**
-     * @return All visible Values, in visibility order
-     */
-    Stream<ValueDescriptor> allValues();
-
-    /**
-     * @return All visible Entities, in visibility order
-     */
-    Stream<EntityDescriptor> allEntities();
-
-    /**
-     * @return All visible Services, in visibility order
-     */
-    Stream<? extends ModelDescriptor> allServices();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/UsedLayersDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/UsedLayersDescriptor.java b/core/api/src/main/java/org/apache/zest/api/structure/UsedLayersDescriptor.java
deleted file mode 100644
index 5b6495f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/UsedLayersDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.structure;
-
-import java.util.stream.Stream;
-
-/**
- * Used Layers Descriptor.
- */
-public interface UsedLayersDescriptor
-{
-    Stream<? extends LayerDescriptor> layers();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/structure/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/structure/package.html b/core/api/src/main/java/org/apache/zest/api/structure/package.html
deleted file mode 100644
index c44c4ad..0000000
--- a/core/api/src/main/java/org/apache/zest/api/structure/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Application Structure API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java b/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
deleted file mode 100644
index 129bb12..0000000
--- a/core/api/src/main/java/org/apache/zest/api/time/SystemTime.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.time;
-
-import java.time.Clock;
-import java.time.Instant;
-
-public class SystemTime
-{
-    private static Clock defaultClock = Clock.systemUTC();
-
-    public static Clock getDefaultClock()
-    {
-        return defaultClock;
-    }
-
-    public static void setDefaultClock(Clock defaultClock)
-    {
-        SystemTime.defaultClock = defaultClock;
-    }
-
-    public static Instant now()
-    {
-        return Instant.now(defaultClock);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/CollectionType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/CollectionType.java b/core/api/src/main/java/org/apache/zest/api/type/CollectionType.java
deleted file mode 100644
index fb5e2fe..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/CollectionType.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import org.apache.zest.api.util.Classes;
-
-/**
- * Collection ValueType.
- * <p>This handles Collection, List and Set types.</p>
- */
-public final class CollectionType
-    extends ValueType
-{
-
-    public static boolean isCollection( Type type )
-    {
-        Class<?> cl = Classes.RAW_CLASS.apply( type );
-        return cl.equals( Collection.class ) || cl.equals( List.class ) || cl.equals( Set.class );
-    }
-
-    public static CollectionType collectionOf( Class<?> collectedType )
-    {
-        return new CollectionType( Collection.class, ValueType.of( collectedType ) );
-    }
-
-    public static CollectionType listOf( Class<?> collectedType )
-    {
-        return new CollectionType( List.class, ValueType.of( collectedType ) );
-    }
-
-    public static CollectionType setOf( Class<?> collectedType )
-    {
-        return new CollectionType( Set.class, ValueType.of( collectedType ) );
-    }
-    private ValueType collectedType;
-
-    public CollectionType( Class<?> type, ValueType collectedType )
-    {
-        super( type );
-        this.collectedType = collectedType;
-        if( !isCollection( type ) )
-        {
-            throw new IllegalArgumentException( type + " is not a Collection, List or Set." );
-        }
-    }
-
-    public ValueType collectedType()
-    {
-        return collectedType;
-    }
-
-    @Override
-    public String toString()
-    {
-        return super.toString() + "<" + collectedType + ">";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/EnumType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/EnumType.java b/core/api/src/main/java/org/apache/zest/api/type/EnumType.java
deleted file mode 100644
index 595cbee..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/EnumType.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.reflect.Type;
-
-/**
- * Enum ValueType.
- */
-public final class EnumType
-    extends ValueType
-{
-
-    public static boolean isEnum( Type type )
-    {
-        if( type instanceof Class )
-        {
-            Class<?> typeClass = (Class) type;
-            return ( typeClass.isEnum() );
-        }
-        return false;
-    }
-
-    public static EnumType of( Class<?> type )
-    {
-        return new EnumType( type );
-    }
-
-    public EnumType( Class<?> type )
-    {
-        super( type );
-        if( !isEnum( type ) )
-        {
-            throw new IllegalArgumentException( type + " is not an Enum." );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/HasTypes.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/HasTypes.java b/core/api/src/main/java/org/apache/zest/api/type/HasTypes.java
deleted file mode 100644
index 070b7c9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/HasTypes.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.reflect.Type;
-import java.util.stream.Stream;
-import org.apache.zest.api.util.Classes;
-
-/**
- * Has types.
- */
-public interface HasTypes
-{
-    Stream<Class<?>> types();
-
-    default boolean hasType( Type type )
-    {
-        Class<?> rawType = Classes.RAW_CLASS.apply( type );
-        return types().map( Classes.RAW_CLASS ).anyMatch( rawType::isAssignableFrom );
-    }
-}


[73/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..4549efe
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,175 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiAnnotationMemberValue;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiJavaCodeReferenceElement;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.*;
+
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ConcernsAnnotationDeclaredCorrectlyInspection extends AbstractInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "concerns.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "ConcernsAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @Override
+    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
+                                                 @NotNull InspectionManager manager,
+                                                 boolean isOnTheFly )
+    {
+        // If class does not have @Concerns, ignore
+        PsiAnnotation concernsAnnotation = getConcernsAnnotation( psiClass );
+        if( concernsAnnotation == null )
+        {
+            return null;
+        }
+
+        // If @Concerns declared in class, suggest remove @Concerns annotation
+        if( !psiClass.isInterface() )
+        {
+            String message = message( "concerns.annotation.declared.correctly.error.annotation.declared.in.class" );
+            RemoveConcernsAnnotationFix fix = new RemoveConcernsAnnotationFix( concernsAnnotation );
+            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( concernsAnnotation, message, fix,
+                                                                                   GENERIC_ERROR_OR_WARNING );
+            return new ProblemDescriptor[]{ problemDescriptor };
+        }
+
+        // If @Concerns annotation is empty, ignore
+        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernsAnnotation );
+        if( concernsAnnotationValue.isEmpty() )
+        {
+            return null;
+        }
+
+        // If ConcernOfClass is not resolved, ignore
+        Project project = psiClass.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( psiClass );
+        PsiClass concernOfClass = getConcernOfClass( project, searchScope );
+        if( concernOfClass == null )
+        {
+            return null;
+        }
+
+        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+        for( PsiAnnotationMemberValue concernClassAnnotationValue : concernsAnnotationValue )
+        {
+            PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernClassAnnotationValue );
+
+            // If it's not a class reference, ignore
+            if( concernClassReference == null )
+            {
+                continue;
+            }
+
+            // If class reference can't be resolved, ignore
+            PsiClass concernClass = (PsiClass) concernClassReference.resolve();
+            if( concernClass == null )
+            {
+                continue;
+            }
+
+            // If concern class does not inherit concern class, suggest remove that reference.
+            if( !concernClass.isInheritor( concernOfClass, true ) )
+            {
+                String message = PolygeneResourceBundle.message(
+                    "concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf",
+                    concernClass.getQualifiedName()
+                );
+
+                RemoveInvalidConcernClassReferenceFix fix = new RemoveInvalidConcernClassReferenceFix(
+                    concernClassAnnotationValue, concernClassReference
+                );
+                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                    concernClassAnnotationValue, message, fix, GENERIC_ERROR_OR_WARNING );
+                problems.add( problemDescriptor );
+            }
+            else
+            {
+                // TODO: Test whether it is a generic concern
+                // TODO: Test whether it is a specific concern
+            }
+        }
+
+        return problems.toArray( new ProblemDescriptor[problems.size()] );
+    }
+
+    private static class RemoveConcernsAnnotationFix extends AbstractFix
+    {
+        private final PsiAnnotation annotationToRemove;
+
+        private RemoveConcernsAnnotationFix( @NotNull PsiAnnotation annotationToRemove )
+        {
+            super( message( "concerns.annotation.declared.correctly.fix.remove.annotation" ) );
+            this.annotationToRemove = annotationToRemove;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            annotationToRemove.delete();
+        }
+    }
+
+    private static class RemoveInvalidConcernClassReferenceFix extends AbstractFix
+    {
+        private final PsiAnnotationMemberValue concernClassAnnotationValue;
+
+        public RemoveInvalidConcernClassReferenceFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
+                                                      @NotNull PsiJavaCodeReferenceElement concernClassReference )
+        {
+            super( message( "concerns.annotation.declared.correctly.fix.remove.concern.class.reference",
+                            concernClassReference.getQualifiedName() ) );
+            this.concernClassAnnotationValue = annotationValueToRemove;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            concernClassAnnotationValue.delete();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
new file mode 100644
index 0000000..5dc21bf
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
@@ -0,0 +1,140 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.intentions.add;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.Processor;
+import com.intellij.util.Query;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.polygene.ide.plugin.idea.common.intentions.AbstractIntention;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static com.intellij.psi.search.searches.ClassInheritorsSearch.search;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.addOrReplaceConcernAnnotation;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.getConcernOfClass;
+
+/**
+ * JAVADOC: This is disabled in PolygeneApplicationComponent.
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class AddConcernOnType
+    extends AbstractIntention
+{
+    protected boolean isIntentionValidFor( PsiElement element )
+    {
+        if( !( element instanceof PsiClass ) )
+        {
+            return false;
+        }
+
+        // If it's not interface, ignore it
+        PsiClass psiClass = (PsiClass) element;
+        if( !psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        // Is @Concerns accesible within module
+        GlobalSearchScope searchScope = determineSearchScope( psiClass );
+        PsiClass concernOfClass = getConcernOfClass( psiClass.getProject(), searchScope );
+        return concernOfClass != null;
+    }
+
+    protected final String resourceBundlePrefixId()
+    {
+        return "add.concern";
+    }
+
+    @Override
+    public boolean isAvailable( @NotNull Project project, Editor editor, @Nullable PsiElement element )
+    {
+        while( element != null )
+        {
+            if( element instanceof PsiFile ||
+                element instanceof PsiMethod )
+            {
+                break;
+            }
+
+            if( isIntentionValidFor( element ) )
+            {
+                return true;
+            }
+
+            element = element.getParent();
+        }
+
+        return false;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected void processIntention( @NotNull Project project, @NotNull Editor editor, @NotNull PsiElement element )
+    {
+        PsiClass psiClass = (PsiClass) element;
+        List<PsiClass> concernCandidates = findConcernsCandidates( psiClass );
+        if( concernCandidates.size() == 1 )
+        {
+            PsiClass concernCandidate = concernCandidates.get( 0 );
+            addOrReplaceConcernAnnotation( psiClass, concernCandidate );
+        }
+    }
+
+    private static List<PsiClass> findConcernsCandidates( final @NotNull PsiClass classToCheck )
+    {
+        GlobalSearchScope searchScope = determineSearchScope( classToCheck );
+        PsiClass concernOfClass = getConcernOfClass( classToCheck.getProject(), searchScope );
+        if( concernOfClass == null )
+        {
+            return emptyList();
+        }
+
+        Query<PsiClass> psiClassQuery = search( concernOfClass, searchScope, true, false );
+        final List<PsiClass> concernCandidates = new ArrayList<PsiClass>();
+        psiClassQuery.forEach( new Processor<PsiClass>()
+        {
+            public boolean process( PsiClass psiClass )
+            {
+                // TODO: Ideally search for all "extends" as well
+                boolean isInheritor = psiClass.isInheritor( classToCheck, true );
+                if( isInheritor )
+                {
+                    concernCandidates.add( psiClass );
+                }
+
+                return true;
+            }
+        } );
+
+        return concernCandidates;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
new file mode 100644
index 0000000..4b4bb9c
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.common.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiParameter;
+import com.intellij.psi.PsiParameterList;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static java.util.Arrays.asList;
+
+/**
+ * {@code AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection} is a helper method to check whether
+ * injection annotation are declared in either constructor or non static field.
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public abstract class AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
+    extends AbstractInjectionAnnotationDeclarationOnFieldInspection
+{
+    @Override
+    public final ProblemDescriptor[] checkMethod( @NotNull PsiMethod method,
+                                                  @NotNull InspectionManager manager,
+                                                  boolean isOnTheFly )
+    {
+        PsiParameterList parameterList = method.getParameterList();
+        PsiParameter[] parameters = parameterList.getParameters();
+        if( method.isConstructor() )
+        {
+            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+            for( PsiParameter parameter : parameters )
+            {
+                PsiAnnotation annotation = getAnnotationToCheck( parameter );
+                if( annotation != null )
+                {
+                    ProblemDescriptor[] descriptors =
+                        verifyAnnotationDeclaredCorrectly( parameter, annotation, manager );
+                    if( descriptors != null )
+                    {
+                        problems.addAll( asList( descriptors ) );
+                    }
+                }
+            }
+
+            return problems.toArray( new ProblemDescriptor[problems.size()] );
+        }
+        else
+        {
+            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+            for( PsiParameter parameter : parameters )
+            {
+                PsiAnnotation annotationToCheck = getAnnotationToCheck( parameter );
+                if( annotationToCheck != null )
+                {
+                    String message = getInjectionAnnotationValidDeclarationMessage();
+                    AbstractFix removeAnnotationFix = createRemoveAnnotationFix( annotationToCheck );
+                    ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                        annotationToCheck, message, removeAnnotationFix, GENERIC_ERROR_OR_WARNING
+                    );
+                    problems.add( problemDescriptor );
+                }
+            }
+
+            return problems.toArray( new ProblemDescriptor[problems.size()] );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
new file mode 100644
index 0000000..f93f396
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
@@ -0,0 +1,141 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.common.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiModifierList;
+import com.intellij.psi.PsiVariable;
+import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public abstract class AbstractInjectionAnnotationDeclarationOnFieldInspection extends AbstractInspection
+{
+    /**
+     * @return Remove annotation message fix.
+     * @since 0.1
+     */
+    @NotNull
+    protected abstract String getRemoveAnnotationMessageFix();
+
+    /**
+     * @return Annotation to check qualified name.
+     * @since 0.1
+     */
+    @NotNull
+    protected abstract String getAnnotationToCheckQualifiedName();
+
+    /**
+     * Verified that {@link #getAnnotationToCheck(com.intellij.psi.PsiVariable)} is declared correctly.
+     *
+     * @param psiVariable       Variable to check. This could be class field member or constructor parameter.
+     * @param annotationToCheck annotation declared at variable to check.
+     * @param manager           Inspection manager to use to create problem descriptor.
+     * @return {@code null} if annotation is declared correctly, otherwise an array of problem descriptor.
+     * @since 0.1
+     */
+    @Nullable
+    protected abstract ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
+                                                                              @NotNull PsiAnnotation annotationToCheck,
+                                                                              @NotNull InspectionManager manager );
+
+    @Override
+    public final ProblemDescriptor[] checkField( @NotNull PsiField field,
+                                                 @NotNull InspectionManager manager,
+                                                 boolean isOnTheFly )
+    {
+        PsiAnnotation annotationToCheck = getAnnotationToCheck( field );
+        if( annotationToCheck == null )
+        {
+            return null;
+        }
+
+        PsiModifierList modifierList = field.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( com.intellij.psi.PsiModifier.STATIC ) )
+            {
+                String message = getInjectionAnnotationValidDeclarationMessage();
+                AbstractFix removeAnnotationFix = createRemoveAnnotationFix( annotationToCheck );
+                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                    annotationToCheck, message, removeAnnotationFix, com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING
+                );
+
+                return new ProblemDescriptor[]{ problemDescriptor };
+            }
+        }
+
+        return verifyAnnotationDeclaredCorrectly( field, annotationToCheck, manager );
+    }
+
+    /**
+     * @param variable variable to check.
+     * @return Annotation to check.
+     * @see #getAnnotationToCheckQualifiedName()
+     * @since 0.1
+     */
+    @Nullable
+    protected final PsiAnnotation getAnnotationToCheck( @NotNull PsiVariable variable )
+    {
+        String annotationQualifiedName = getAnnotationToCheckQualifiedName();
+        return findAnnotation( variable, annotationQualifiedName );
+    }
+
+    @NotNull protected String getInjectionAnnotationValidDeclarationMessage()
+    {
+        String annotationQualifiedName = getAnnotationToCheckQualifiedName();
+        return PolygeneResourceBundle.message( "abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly",
+                                           annotationQualifiedName );
+    }
+
+    @NotNull
+    protected final AbstractFix createRemoveAnnotationFix( @NotNull PsiAnnotation annotationToRemove )
+    {
+        String fixMessage = getRemoveAnnotationMessageFix();
+        return new RemoveAnnotationFix( fixMessage, annotationToRemove );
+    }
+
+    private static class RemoveAnnotationFix extends AbstractFix
+    {
+        private final PsiAnnotation annotationToRemove;
+
+        public RemoveAnnotationFix( @NotNull String fixMessage, @NotNull PsiAnnotation annotationToRemove )
+        {
+            super( fixMessage );
+            this.annotationToRemove = annotationToRemove;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            annotationToRemove.delete();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
new file mode 100644
index 0000000..25c1267
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneInvocationAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_INVOCATION_ANNOTATION = "org.apache.polygene.api.injection.scope.Invocation";
+
+    private PolygeneInvocationAnnotationConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
new file mode 100644
index 0000000..334918d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
+
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult.*;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneInvocationAnnotationUtil
+{
+    /**
+     * Returns {@code @Invocation} annotation if exists.
+     *
+     * @param modifierListOwner modifier list owner to process.
+     * @return {@code @Invocation} annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getInvocationAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_INVOCATION_ANNOTATION );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if the specified psiClass is injectable by invocation annotation, {@code false} otherwise.
+     */
+    public static boolean isInjectableByInvocationAnnotation( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isAnnotationType() )
+        {
+            return true;
+        }
+
+        String classQualifiedName = psiClass.getQualifiedName();
+        return "java.lang.reflect.Method".equals( classQualifiedName ) ||
+               "java.lang.reflect.AnnotatedElement".equals( classQualifiedName );
+    }
+
+    /**
+     * Validates whether the variable has {@code @Invocation} annotation declared correctly.
+     *
+     * @param variable variable to check.
+     * @return Look at {@link InvocationAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static InvocationAnnotationDeclarationValidationResult isValidInvocationAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation invocationAnnotation = getInvocationAnnotation( variable );
+        if( invocationAnnotation == null )
+        {
+            return invalidInvocationAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        // TODO: Check whether variable is either an instance of java.lang.reflect.Method or
+        // java.lang.reflect.AnnotatedElement or Annotation
+        PsiTypeElement typeElement = variable.getTypeElement();
+        if( typeElement != null )
+        {
+            PsiClass psiClass = getPSIClass( typeElement );
+            if( psiClass != null )
+            {
+                if( !isInjectableByInvocationAnnotation( psiClass ) )
+                {
+                    // Can't be type that is injected by @Structure
+                    if( isInjecteableByStructureAnnotation( variable ) )
+                    {
+                        return invalidTypeIsInjectedViaStructureAnnotation;
+                    }
+
+                    return invalidType;
+                }
+            }
+        }
+
+        return valid;
+    }
+
+    public enum InvocationAnnotationDeclarationValidationResult
+    {
+        invalidInvocationAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidTypeIsInjectedViaStructureAnnotation,
+        invalidType,
+        valid,
+    }
+
+    private PolygeneInvocationAnnotationUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..e8dc1d4
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,121 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.invocation.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
+import org.apache.polygene.ide.plugin.idea.injections.structure.common.ReplaceWithStructureAnnotation;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.isValidInvocationAnnotationDeclaration;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.getStructureAnnotation;
+
+/**
+ * {@code InvocationAnnotationDeclaredCorrectlyInspection} validates {@code @Invocation} injection annotation
+ * declaration.
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class InvocationAnnotationDeclaredCorrectlyInspection
+    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "injections.invocation.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "InvocationAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @NotNull
+    protected final String getRemoveAnnotationMessageFix()
+    {
+        return message( "injections.invocation.annotation.declared.correctly.fix.remove.annotation" );
+    }
+
+    @NotNull
+    protected final String getAnnotationToCheckQualifiedName()
+    {
+        return QUALIFIED_NAME_INVOCATION_ANNOTATION;
+    }
+
+    @Nullable
+    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
+                                                                           @NotNull PsiAnnotation invocationAnnotation,
+                                                                           @NotNull InspectionManager manager )
+    {
+        LocalQuickFix fix = null;
+        String message = null;
+
+        String variableTypeQualifiedName = psiVariable.getType().getCanonicalText();
+
+        InvocationAnnotationDeclarationValidationResult validationResult =
+            isValidInvocationAnnotationDeclaration( psiVariable );
+        switch( validationResult )
+        {
+        case invalidTypeIsInjectedViaStructureAnnotation:
+            if( getStructureAnnotation( psiVariable ) == null )
+            {
+                fix = new ReplaceWithStructureAnnotation(
+                    message( "injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation" ),
+                    invocationAnnotation );
+            }
+            message = message(
+                "injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure",
+                variableTypeQualifiedName
+            );
+            break;
+
+        case invalidType:
+            message = message( "injections.invocation.annotation.declared.correctly.error.type.is.not.injectable",
+                               variableTypeQualifiedName );
+            break;
+        }
+
+        // If it's not an error, return null
+        if( message == null )
+        {
+            return null;
+        }
+
+        // If Fix not defined, by default we remove it.
+        if( fix == null )
+        {
+            fix = createRemoveAnnotationFix( invocationAnnotation );
+        }
+
+        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+            invocationAnnotation, message, fix, GENERIC_ERROR_OR_WARNING );
+        return new ProblemDescriptor[]{ problemDescriptor };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
new file mode 100644
index 0000000..5a95513
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.service.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneServiceAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_SERVICE_ANNOTATION = "org.apache.polygene.api.injection.scope.Service";
+
+    private PolygeneServiceAnnotationConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
new file mode 100644
index 0000000..962c1bb
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.service.common;
+
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiModifierList;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneServiceAnnotationUtil
+{
+    /**
+     * Returns {@code @Service} annotation if exists.
+     *
+     * @param modifierListOwner modifier list owner to process.
+     * @return {@code @Service} annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION );
+    }
+
+    /**
+     * Validates whether the variable has {@code @Service} annotation declared correctly.
+     *
+     * @param variable variable to check.
+     * @return Look at {@link ServiceAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation serviceAnnotation = getServiceAnnotation( variable );
+        if( serviceAnnotation == null )
+        {
+            return invalidServiceAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        // Can't be type that is injected by @Structure
+        if( isInjecteableByStructureAnnotation( variable ) )
+        {
+            return invalidTypeIsInjectedViaStructureAnnotation;
+        }
+
+        return valid;
+    }
+
+    public enum ServiceAnnotationDeclarationValidationResult
+    {
+        invalidServiceAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidTypeIsInjectedViaStructureAnnotation,
+        valid,
+    }
+
+    private PolygeneServiceAnnotationUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..afc43f1
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.service.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.LocalQuickFix;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
+import org.apache.polygene.ide.plugin.idea.injections.structure.common.ReplaceWithStructureAnnotation;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.isValidServiceAnnotationDeclaration;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.getStructureAnnotation;
+
+/**
+ * {@code ServiceAnnotationDeclaredCorrectly} validates {@code @Service} injection annotation declaration.
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class ServiceAnnotationDeclaredCorrectlyInspection
+    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "injections.service.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "ServiceAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @NotNull
+    protected final String getRemoveAnnotationMessageFix()
+    {
+        return message( "injections.service.annotation.declared.correctly.fix.remove.annotation" );
+    }
+
+    @NotNull
+    protected final String getAnnotationToCheckQualifiedName()
+    {
+        return QUALIFIED_NAME_SERVICE_ANNOTATION;
+    }
+
+    @Nullable
+    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
+                                                                           @NotNull PsiAnnotation serviceAnnotation,
+                                                                           @NotNull InspectionManager manager )
+    {
+        ServiceAnnotationDeclarationValidationResult annotationCheck =
+            isValidServiceAnnotationDeclaration( psiVariable );
+        String message = null;
+        LocalQuickFix fix = null;
+        switch( annotationCheck )
+        {
+        case invalidTypeIsInjectedViaStructureAnnotation:
+            if( getStructureAnnotation( psiVariable ) == null )
+            {
+                fix = new ReplaceWithStructureAnnotation(
+                    message( "injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation" ),
+                    serviceAnnotation );
+            }
+            message = message(
+                "injections.service.annotation.declared.correctly.error.type.is.injected.by.structure",
+                psiVariable.getType().getCanonicalText()
+            );
+            break;
+        }
+
+        // If it's not an error, return null
+        if( message == null )
+        {
+            return null;
+        }
+
+        // Default behavior to remove @Service annotation
+        if( fix == null )
+        {
+            fix = createRemoveAnnotationFix( serviceAnnotation );
+        }
+
+        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+            serviceAnnotation, message, fix, GENERIC_ERROR_OR_WARNING );
+        return new ProblemDescriptor[]{ problemDescriptor };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
new file mode 100644
index 0000000..2a5d3bf
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
+
+import static java.util.Arrays.sort;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneStructureAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure";
+
+    public static final String[] VALID_STRUCTURE_INJECTION_TYPE;
+
+    static
+    {
+        VALID_STRUCTURE_INJECTION_TYPE = new String[]
+            {
+                "org.apache.polygene.composite.CompositeBuilderFactory",
+                "org.apache.polygene.object.ObjectBuilderFactory",
+                "org.apache.polygene.entity.UnitOfWorkFactory",
+                "org.apache.polygene.service.ServiceFinder",
+                "org.apache.polygene.structure.Module",
+                "org.apache.polygene.structure.Layer",
+                "org.apache.polygene.structure.Application",
+                "org.apache.polygene.api.PolygeneAPI",
+                "org.apache.polygene.spi.PolygeneSPI"
+            };
+        sort( VALID_STRUCTURE_INJECTION_TYPE );
+    }
+
+    private PolygeneStructureAnnotationConstants()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
new file mode 100644
index 0000000..c334276
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
@@ -0,0 +1,124 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneStructureAnnotationUtil
+{
+    /**
+     * Returns {@code Structure} annotation if exists.
+     *
+     * @param modifierListOwner Modifier list owner.
+     * @return @Structure annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION );
+    }
+
+    /**
+     * Create structure annotation.
+     *
+     * @param project project to create structure annotation.
+     * @param context the context to create structure annotation.
+     * @return @Structure annotation.
+     */
+    @NotNull
+    public static PsiAnnotation createStructureAnnotation( @NotNull Project project,
+                                                           @NotNull PsiElement context )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context );
+    }
+
+    /**
+     * @param variable variable to check.
+     * @return Look at {@link StructureAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation structureAnnotation = getStructureAnnotation( variable );
+        if( structureAnnotation == null )
+        {
+            return invalidStructureAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        if( !isInjecteableByStructureAnnotation( variable ) )
+        {
+            return invalidInjectionType;
+        }
+
+        return valid;
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation.
+     *
+     * @param variable variable to check.
+     * @return {@code true} if variable type is injecteable by @Structure annotation.
+     * @since 0.1
+     */
+    public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable )
+    {
+        PsiType type = variable.getType();
+        String fieldClassQualifiedName = type.getCanonicalText();
+        return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1;
+    }
+
+    private PolygeneStructureAnnotationUtil()
+    {
+    }
+
+    public enum StructureAnnotationDeclarationValidationResult
+    {
+        invalidStructureAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidInjectionType,
+        valid,
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
new file mode 100644
index 0000000..3659db3
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
+
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotation;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.createStructureAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class ReplaceWithStructureAnnotation extends AbstractFix
+{
+    private final PsiAnnotation annotation;
+
+    public ReplaceWithStructureAnnotation( @NotNull String fixMessage,
+                                           @NotNull PsiAnnotation annotationToReplace )
+    {
+        super( fixMessage );
+        this.annotation = annotationToReplace;
+    }
+
+    public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+    {
+        PsiAnnotation structureAnnotation = createStructureAnnotation( project, annotation );
+        annotation.replace( structureAnnotation );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..a972acd
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.validateStructureAnnotationDeclaration;
+
+/**
+ * {@code StructureAnnotationUsedCorrectly} validates {@code @Structure} injection annotation declaration.
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class StructureAnnotationDeclaredCorrectlyInspection
+    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "injections.structure.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "StructureAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @NotNull
+    protected final String getRemoveAnnotationMessageFix()
+    {
+        return message( "injections.structure.annotation.declared.correctly.fix.remove.annotation" );
+    }
+
+    @NotNull
+    protected final String getAnnotationToCheckQualifiedName()
+    {
+        return QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+    }
+
+    @Nullable
+    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
+                                                                           @NotNull PsiAnnotation structureAnnotation,
+                                                                           @NotNull InspectionManager manager )
+    {
+        StructureAnnotationDeclarationValidationResult annotationCheck =
+            validateStructureAnnotationDeclaration( psiVariable );
+        switch( annotationCheck )
+        {
+        case invalidInjectionType:
+            String message = message(
+                "injections.structure.annotation.declared.correctly.error.invalid.injection.type",
+                psiVariable.getType().getCanonicalText()
+            );
+            AbstractFix removeStructureAnnotationFix = createRemoveAnnotationFix( structureAnnotation );
+            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                structureAnnotation, message, removeStructureAnnotationFix, GENERIC_ERROR_OR_WARNING
+            );
+            return new ProblemDescriptor[]{ problemDescriptor };
+        }
+
+        return null;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
new file mode 100644
index 0000000..c871b3d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneMixinConstants
+{
+    public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins";
+
+    private PolygeneMixinConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
new file mode 100644
index 0000000..729ff58
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
@@ -0,0 +1,196 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Set;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptySet;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
+import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneMixinUtil
+{
+    /**
+     * Get all valid mixin types of given the {@code psiClass} argument.
+     *
+     * @param psiClass The psi class to check.
+     * @return all vlaid mixin types of the given {@code psiClass} argument.
+     * @since 0.1
+     */
+    @NotNull
+    public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
+    {
+        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
+        if( mixinsAnnotation == null )
+        {
+            return emptySet();
+        }
+
+        Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
+        validMixinsType.add( psiClass );
+        return validMixinsType;
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
+    {
+        return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
+    {
+        if( mixinsAnnotation == null )
+        {
+            return emptyList();
+        }
+
+        String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
+        if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( mixinsAnnotation );
+    }
+
+    @Nullable
+    public static PsiAnnotation getMixinsAnnotation( PsiElement element )
+    {
+        PsiClass psiClass = getPSIClass( element );
+        if( psiClass == null )
+        {
+            return null;
+        }
+
+        return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
+    }
+
+    @NotNull
+    public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
+                                                             @NotNull PsiClass mixinClassToAdd )
+    {
+        Project project = modifierListOwner.getProject();
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
+
+        boolean isReplace = false;
+        PsiAnnotation newMixinsAnnotation;
+        if( existingMixinsAnnotation != null )
+        {
+            // Check duplicate
+            List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
+            for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+            {
+                PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
+                if( mixinClassReference == null )
+                {
+                    continue;
+                }
+
+                PsiElement mixinClass = mixinClassReference.resolve();
+                if( mixinClassToAdd.equals( mixinClass ) )
+                {
+                    return existingMixinsAnnotation;
+                }
+            }
+
+            isReplace = true;
+        }
+
+        String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
+        newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
+
+        if( isReplace )
+        {
+            // Replace @Mixins instead
+            existingMixinsAnnotation.replace( newMixinsAnnotation );
+        }
+        else
+        {
+            // @Mixins doesn't exists, add it as first child
+            PsiModifierList modifierList = modifierListOwner.getModifierList();
+            modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
+        }
+
+        // Shorten all class references if possible
+        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
+        codeStyleManager.shortenClassReferences( newMixinsAnnotation );
+
+        return newMixinsAnnotation;
+    }
+
+    @NotNull
+    private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
+                                                      @NotNull PsiClass mixinClassToAdd )
+    {
+        StringBuilder annotationTextBuilder = new StringBuilder();
+        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
+        List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
+        for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+        {
+            annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
+        }
+        annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
+        annotationTextBuilder.append( "} )" );
+
+        return annotationTextBuilder.toString();
+    }
+
+
+    @Nullable
+    public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Validate whether psiClass is a mixin.
+     *
+     * @param psiClass psi class to check.
+     * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
+     */
+    public static boolean isAMixin( @NotNull PsiClass psiClass )
+    {
+        return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
+    }
+
+    private PolygeneMixinUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
new file mode 100644
index 0000000..c74725b
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
@@ -0,0 +1,190 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotationMemberValue;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiJavaCodeReferenceElement;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
+import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinUtil.*;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class MixinImplementsMixinType extends AbstractInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "mixin.implements.mixin.type";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "MixinImplementsMixinType";
+    }
+
+    @Override
+    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
+                                                 @NotNull InspectionManager manager,
+                                                 boolean isOnTheFly )
+    {
+        // If psiClass is not an interface, ignore
+        if( !psiClass.isInterface() )
+        {
+            return null;
+        }
+
+        // If @Mixins annotation is empty, ignore
+        List<PsiAnnotationMemberValue> mixinAnnotationValues = getMixinsAnnotationValue( psiClass );
+        if( mixinAnnotationValues.isEmpty() )
+        {
+            return null;
+        }
+
+        // Get all valid mixin type
+        Set<PsiClass> validMixinsType = getAllValidMixinTypes( psiClass );
+        if( validMixinsType.isEmpty() )
+        {
+            return null;
+        }
+
+        // For each mixin
+        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+        for( PsiAnnotationMemberValue mixinAnnotationValue : mixinAnnotationValues )
+        {
+            PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinAnnotationValue );
+
+            // If it's not a class reference, ignore
+            if( mixinClassReference == null )
+            {
+                continue;
+            }
+
+            // If class reference can't be resolved, ignore
+            PsiClass mixinClass = (PsiClass) mixinClassReference.resolve();
+            if( mixinClass == null )
+            {
+                continue;
+            }
+
+            String mixinQualifiedName = mixinClass.getQualifiedName();
+
+            boolean isMixinsDeclarationValid = false;
+            String message = "";
+            if( mixinClass.isInterface() )
+            {
+                // Mixin can't be an interface
+                message = message( "mixin.implements.mixin.type.error.mixin.is.an.interface", mixinQualifiedName );
+            }
+            else if( isAConcern( mixinClass ) )
+            {
+                // Mixin can't be a concern
+                message = message( "mixin.implements.mixin.type.error.mixin.is.a.concern", mixinQualifiedName );
+            }
+            else if( isASideEffect( mixinClass ) )
+            {
+                // Mixin can't be a side effect
+                message = message( "mixin.implements.mixin.type.error.mixin.is.a.side.effect", mixinQualifiedName );
+            }
+            else
+            {
+                // If doesn't implement any mixin type, it's a problem
+                if( !isImplementValidMixinType( mixinClass, validMixinsType ) )
+                {
+                    message = message(
+                        "mixin.implements.mixin.type.error.does.not.implement.any.mixin.type",
+                        mixinQualifiedName,
+                        psiClass.getQualifiedName()
+                    );
+                }
+                else
+                {
+                    isMixinsDeclarationValid = true;
+                }
+            }
+
+            if( !isMixinsDeclarationValid )
+            {
+                ProblemDescriptor problemDescriptor = createProblemDescriptor(
+                    manager, mixinAnnotationValue, mixinClassReference, message );
+                problems.add( problemDescriptor );
+            }
+        }
+
+        return problems.toArray( new ProblemDescriptor[problems.size()] );
+    }
+
+    private boolean isImplementValidMixinType( PsiClass mixinClass, Set<PsiClass> validMixinsType )
+    {
+        for( PsiClass validMixinTypeClass : validMixinsType )
+        {
+            if( mixinClass.isInheritor( validMixinTypeClass, true ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private ProblemDescriptor createProblemDescriptor( @NotNull InspectionManager manager,
+                                                       @NotNull PsiAnnotationMemberValue mixinAnnotationValue,
+                                                       @NotNull PsiJavaCodeReferenceElement mixinClassReference,
+                                                       @NotNull String message )
+    {
+        RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix(
+            mixinAnnotationValue, mixinClassReference
+        );
+        return manager.createProblemDescriptor( mixinAnnotationValue, message, fix, GENERIC_ERROR_OR_WARNING );
+    }
+
+    private static class RemoveInvalidMixinClassReferenceFix extends AbstractFix
+    {
+        private final PsiAnnotationMemberValue mixinClassAnnotationValue;
+
+        public RemoveInvalidMixinClassReferenceFix( @NotNull PsiAnnotationMemberValue mixinClassAnnotationValue,
+                                                    @NotNull PsiJavaCodeReferenceElement mixinClassReference )
+        {
+            super( message( "mixin.implements.mixin.type.fix.remove.class.reference", mixinClassReference.getQualifiedName() ) );
+            this.mixinClassAnnotationValue = mixinClassAnnotationValue;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            mixinClassAnnotationValue.delete();
+        }
+    }
+}


[78/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
deleted file mode 100644
index a8e54ee..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.indexing.rdf;
-
-import java.io.File;
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.polygene.api.query.QueryBuilderFactory;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.query.Query;
-import org.apache.polygene.api.query.QueryBuilder;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
-import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
-import org.apache.polygene.index.rdf.indexing.RdfIndexingService;
-import org.apache.polygene.index.rdf.query.SesameExpressions;
-import org.apache.polygene.library.rdf.repository.NativeConfiguration;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-import static org.apache.polygene.api.query.QueryExpressions.eq;
-import static org.apache.polygene.api.query.QueryExpressions.templateFor;
-
-@SuppressWarnings( "ResultOfMethodCallIgnored" )
-public class QueryPerformanceTest
-    implements ApplicationAssembler
-{
-    private static final int NUMBER_OF_ENTITIES = 100000;
-    private static final String LAYER_INFRASTRUCTURE = "LAYER_INFRASTRUCTURE";
-    private static final String MODULE_PERSISTENCE = "MODULE_PERSISTENCE";
-    private static final String LAYER_CONFIGURATION = "CONFIGURATION";
-    private static final String LAYER_DOMAIN = "LAYER_DOMAIN";
-    private static final String MODULE_DOMAIN = "MODULE_DOMAIN";
-    private static final String MODULE_CONFIG = "MODULE_CONFIG";
-
-    private Application application;
-    private Module module;
-    private UnitOfWorkFactory uowf;
-    private static final String QUERY1 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
-                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
-                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
-                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
-                                         + "SELECT ?entityType ?reference\n"
-                                         + "WHERE {\n"
-                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
-                                         + "?entity rdf:type ?entityType. \n"
-                                         + "?entity ns0:reference ?reference. \n"
-                                         + "?entity ns1:name \"Lead64532\". \n"
-                                         + "}";
-    private static final String QUERY2 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
-                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
-                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
-                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
-                                         + "SELECT ?entityType ?reference\n"
-                                         + "WHERE {\n"
-                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
-                                         + "?entity rdf:type ?entityType. \n"
-                                         + "?entity ns0:reference ?reference. \n"
-                                         + "?entity ns1:name \"Lead98276\". \n"
-                                         + "}";
-    private static final String QUERY3 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
-                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
-                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
-                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
-                                         + "SELECT ?entityType ?reference\n"
-                                         + "WHERE {\n"
-                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
-                                         + "?entity rdf:type ?entityType. \n"
-                                         + "?entity ns0:reference ?reference. \n"
-                                         + "?entity ns1:name \"Lead2\". \n"
-                                         + "}";
-    private static final String QUERY4 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
-                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
-                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
-                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
-                                         + "SELECT ?entityType ?reference\n"
-                                         + "WHERE {\n"
-                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
-                                         + "?entity rdf:type ?entityType. \n"
-                                         + "?entity ns0:reference ?reference. \n"
-                                         + "?entity ns1:name \"Lead14332\". \n"
-                                         + "}";
-    private static final String QUERY5 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
-                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
-                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
-                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
-                                         + "SELECT ?entityType ?reference\n"
-                                         + "WHERE {\n"
-                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
-                                         + "?entity rdf:type ?entityType. \n"
-                                         + "?entity ns0:reference ?reference. \n"
-                                         + "?entity ns1:name \"Lead632\". \n"
-                                         + "}";
-    private File indexingDataDir;
-
-    @Before
-    public void setup()
-        throws Exception
-    {
-        Energy4Java polygene = new Energy4Java();
-        application = polygene.newApplication( this );
-        module = application.findModule( LAYER_DOMAIN, MODULE_DOMAIN );
-        application.activate();
-        indexingDataDir = module.findService( RdfIndexingService.class ).get().dataDir();
-        uowf = module.unitOfWorkFactory();
-    }
-
-    @After
-    public void tearDown()
-        throws Exception
-    {
-        try
-        {
-            if( application != null )
-            {
-                System.out.println( "Shutting Down test." );
-                application.passivate();
-            }
-        }
-        finally
-        {
-            FileUtil.removeDirectory( indexingDataDir );
-        }
-    }
-
-    @Override
-    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-        throws AssemblyException
-    {
-        ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
-        LayerAssembly infra = createInfrastructureLayer( applicationAssembly );
-        LayerAssembly domain = createDomainLayer( applicationAssembly );
-        LayerAssembly config = createConfigurationLayer( applicationAssembly );
-        infra.uses( config );
-        domain.uses( infra );
-        return applicationAssembly;
-    }
-
-    @Test
-    public void testIndexingFluentQueries()
-        throws Exception
-    {
-        LeadRepository leadRepo = populateEntityStore();
-        measureFluentQuery( leadRepo, "Lead64531" );
-        measureFluentQuery( leadRepo, "Lead98275" );
-        measureFluentQuery( leadRepo, "Lead3" );
-        measureFluentQuery( leadRepo, "Lead14331" );
-        measureFluentQuery( leadRepo, "Lead631" );
-    }
-
-    @Test
-    public void testIndexingNamedQueries()
-        throws Exception
-    {
-        LeadRepository leadRepo = populateEntityStore();
-        measureNamedQuery( leadRepo, QUERY1 );
-        measureNamedQuery( leadRepo, QUERY2 );
-        measureNamedQuery( leadRepo, QUERY3 );
-        measureNamedQuery( leadRepo, QUERY4 );
-        measureNamedQuery( leadRepo, QUERY5 );
-    }
-
-    private LeadRepository populateEntityStore()
-        throws UnitOfWorkCompletionException
-    {
-        UnitOfWork uow = uowf.newUnitOfWork();
-        try
-        {
-            LeadRepository leadRepo = module.findService( LeadRepositoryService.class ).get();
-            if( leadRepo.findByName( "Lead99999" ) == null )
-            {
-                ServiceReference<LeadEntityFactoryService> leadFactoryRef = module.findService( LeadEntityFactoryService.class );
-                LeadEntityFactory leadFactory = leadFactoryRef.get();
-                long start, end;
-                start = System.currentTimeMillis();
-                for( int i = 1; i < NUMBER_OF_ENTITIES; i++ )
-                {
-                    if( ( i % 10000 ) == 0 )
-                    {
-                        System.out.print( "\r" + i );
-                        uow.complete();
-                        uow = uowf.newUnitOfWork();
-                    }
-                    leadFactory.create( "Lead" + i );
-                }
-                System.out.println();
-                uow.complete();
-                end = System.currentTimeMillis();
-                System.out.println( "Population time: " + ( end - start ) );
-            }
-            return leadRepo;
-        }
-        finally
-        {
-            if( uow != null && uow.isOpen() )
-            {
-                uow.discard();
-            }
-        }
-    }
-
-    private void measureFluentQuery( LeadRepository leadRepo, String nameOfEntity )
-        throws Exception
-    {
-        long start;
-        long end;
-        try( UnitOfWork uow = uowf.newUnitOfWork() )
-        {
-            start = System.currentTimeMillis();
-            Lead lead = leadRepo.findByName( nameOfEntity );
-            end = System.currentTimeMillis();
-            if( lead == null )
-            {
-                Assert.fail( "Entity was not found or more than one entity was found." );
-                return;
-            }
-            System.out.println( "Lead: " + lead );
-            System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
-            uow.complete();
-        }
-    }
-
-    private void measureNamedQuery( LeadRepository leadRepo, String queryName )
-        throws Exception
-    {
-        long start;
-        long end;
-        try( UnitOfWork uow = uowf.newUnitOfWork() )
-        {
-            start = System.currentTimeMillis();
-            Lead lead = leadRepo.findByFixedQuery( queryName );
-            end = System.currentTimeMillis();
-            if( lead == null )
-            {
-                Assert.fail( "Entity was not found or more than one entity was found." );
-                return;
-            }
-            System.out.println( "Lead: " + lead );
-            System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
-            uow.complete();
-        }
-    }
-
-    private LayerAssembly createDomainLayer( ApplicationAssembly applicationAssembly )
-        throws AssemblyException
-    {
-        LayerAssembly domainLayer = applicationAssembly.layer( LAYER_DOMAIN );
-        ModuleAssembly domainModule = domainLayer.module( MODULE_DOMAIN );
-        domainModule.addServices( LeadRepositoryService.class );
-        domainModule.addServices( LeadEntityFactoryService.class );
-        domainModule.entities( LeadEntity.class );
-        return domainLayer;
-    }
-
-    private LayerAssembly createInfrastructureLayer( ApplicationAssembly applicationAssembly )
-        throws AssemblyException
-    {
-        LayerAssembly infrastructureLayer = applicationAssembly.layer( LAYER_INFRASTRUCTURE );
-
-        // Persistence module
-        ModuleAssembly persistenceModule = infrastructureLayer.module( MODULE_PERSISTENCE );
-
-        // Indexing
-        new RdfNativeSesameStoreAssembler().assemble( persistenceModule );
-
-        // Entity store
-        new OrgJsonValueSerializationAssembler().assemble( persistenceModule );
-        new MemoryEntityStoreAssembler().visibleIn( Visibility.application ).assemble( persistenceModule );
-
-        return infrastructureLayer;
-    }
-
-    private LayerAssembly createConfigurationLayer( ApplicationAssembly applicationAssembly )
-        throws AssemblyException
-    {
-        LayerAssembly layer = applicationAssembly.layer( LAYER_CONFIGURATION );
-        ModuleAssembly configModule = layer.module( MODULE_CONFIG );
-        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
-        new EntityTestAssembler().assemble( configModule );
-        return layer;
-    }
-
-    public interface Lead
-    {
-        Property<String> name();
-    }
-
-    public interface LeadEntity
-        extends Lead, EntityComposite
-    {
-    }
-
-    @Mixins( LeadEntityFactoryMixin.class )
-    public interface LeadEntityFactoryService
-        extends LeadEntityFactory, ServiceComposite
-    {
-    }
-
-    public interface LeadEntityFactory
-    {
-        Lead create( String name );
-    }
-
-    public static class LeadEntityFactoryMixin
-        implements LeadEntityFactory
-    {
-        @Structure
-        private UnitOfWorkFactory uowf;
-
-        @Override
-        public Lead create( String name )
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            EntityBuilder<LeadEntity> builder = uow.newEntityBuilder( LeadEntity.class );
-            Lead prototype = builder.instanceFor( LeadEntity.class );
-            prototype.name().set( name );
-            return builder.newInstance();
-        }
-    }
-
-    public interface LeadRepository
-    {
-        Lead findByFixedQuery( String name );
-
-        Lead findByName( String name );
-    }
-
-    @Mixins( LeadRepositoryMixin.class )
-    public interface LeadRepositoryService
-        extends LeadRepository, ServiceComposite
-    {
-    }
-
-    public static class LeadRepositoryMixin
-        implements LeadRepository
-    {
-        @Structure
-        private QueryBuilderFactory qbf;
-
-        @Structure
-        private UnitOfWorkFactory uowf;
-
-        @Override
-        public Lead findByFixedQuery( String queryString )
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            Query<Lead> query = uow.newQuery( qbf.newQueryBuilder( Lead.class ).where( SesameExpressions.sparql( queryString ) ) );
-            return query.find();
-        }
-
-        @Override
-        public Lead findByName( String name )
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            QueryBuilder<Lead> builder = qbf.newQueryBuilder( Lead.class );
-            Lead template = templateFor( Lead.class );
-
-            Query<Lead> query = uow.newQuery( builder.where( eq( template.name(), name ) ) );
-            return query.find();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
deleted file mode 100644
index 449ecf4..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.runtime.composite;
-
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.composite.TransientBuilderFactory;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.api.value.ValueBuilderFactory;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-import org.junit.Test;
-
-/**
- * Tests performance of new composite creation.
- */
-public class CompositeCreationPerformanceTest
-{
-    @Test
-    public void newInstanceForRegisteredCompositePerformance()
-        throws ActivationException, AssemblyException, InterruptedException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( AnyComposite.class );
-                module.objects( AnyObject.class );
-                module.values( AnyValue.class );
-            }
-        };
-        int warmups = 10;
-        int runs = 20;
-        long waitBeforeRun = 1000;
-        long waitBetweenRuns = 500;
-        long timeForJavaObject = 0;
-        {
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testJavaObjectCreationPerformance( false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForJavaObject += testJavaObjectCreationPerformance( true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForJavaObject = timeForJavaObject / runs;
-        }
-        long timeForTransientComposite = 0;
-        {
-            TransientBuilderFactory module = assembler.module();
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testCompositeCreationPerformance( module, false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForTransientComposite += testCompositeCreationPerformance( module, true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForTransientComposite = timeForTransientComposite / runs;
-        }
-        long timeForManagedObject = 0;
-        {
-            ObjectFactory objectFactory = assembler.module();
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testObjectCreationPerformance( objectFactory, false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForManagedObject += testObjectCreationPerformance( objectFactory, true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForManagedObject = timeForManagedObject / runs;
-        }
-        long timeForValueComposite = 0;
-        {
-            ValueBuilderFactory valueBuilderFactory = assembler.module();
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testValueCreationPerformance( valueBuilderFactory, false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForValueComposite += testValueCreationPerformance( valueBuilderFactory, true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForValueComposite = timeForValueComposite / runs;
-        }
-
-        long timeForTransientCompositeBuilder = 0;
-        {
-            TransientBuilderFactory module = assembler.module();
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testCompositeCreationWithBuilderPerformance( module, false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForTransientCompositeBuilder += testCompositeCreationWithBuilderPerformance( module, true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForTransientCompositeBuilder = timeForTransientCompositeBuilder / runs;
-        }
-        long timeForValueCompositeBuilder = 0;
-        {
-            ValueBuilderFactory valueBuilderFactory = assembler.module();
-            // Warmup
-            for( int i = 0; i < warmups; i++ )
-            {
-                testValueCreationWithBuilderPerformance( valueBuilderFactory, false );
-            }
-            Thread.sleep( waitBeforeRun );
-            // Run
-            for( int i = 0; i < runs; i++ )
-            {
-                timeForValueCompositeBuilder += testValueCreationWithBuilderPerformance( valueBuilderFactory, true );
-                Thread.sleep( waitBetweenRuns );
-            }
-            timeForValueCompositeBuilder = timeForValueCompositeBuilder / runs;
-        }
-
-        System.out.println( "----" );
-        System.out.println( "Transient: " + ( timeForTransientComposite / timeForJavaObject ) + "x" );
-        System.out.println( "TransientBuilder: " + ( timeForTransientCompositeBuilder / timeForJavaObject ) + "x" );
-        System.out.println( "Value: " + ( timeForValueComposite / timeForJavaObject ) + "x" );
-        System.out.println( "ValueBuilder: " + ( timeForValueCompositeBuilder / timeForJavaObject ) + "x" );
-        System.out.println( "Object: " + ( timeForManagedObject / timeForJavaObject ) + "x" );
-    }
-
-    private long testCompositeCreationPerformance( TransientBuilderFactory module, boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            module.newTransient( AnyComposite.class );
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Composite Creation Time:" + time + " nanoseconds per composite" );
-        }
-        return time;
-    }
-
-    private long testCompositeCreationWithBuilderPerformance( TransientBuilderFactory module, boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            module.newTransientBuilder( AnyComposite.class ).newInstance();
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Composite (builder) Creation Time:" + time + " nanoseconds per composite" );
-        }
-        return time;
-    }
-
-    private long testValueCreationPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            valueBuilderFactory.newValue( AnyValue.class );
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Value Creation Time:" + time + " nanoseconds per composite" );
-        }
-        return time;
-    }
-
-    private long testValueCreationWithBuilderPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            valueBuilderFactory.newValueBuilder( AnyValue.class ).newInstance();
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Value (builder) Creation Time:" + time + " nanoseconds per composite" );
-        }
-        return time;
-    }
-
-    private long testObjectCreationPerformance( ObjectFactory objectFactory, boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            objectFactory.newObject( AnyObject.class );
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Polygene Object Creation Time:" + time + " nanoseconds per object" );
-        }
-        return time;
-    }
-
-    private long testJavaObjectCreationPerformance( boolean run )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            new AnyObject();
-        }
-
-        long end = System.currentTimeMillis();
-        long time = 1000000L * ( end - start ) / iter;
-        if( run )
-        {
-            System.out.println( "Java Object Creation Time:" + time + " nanoseconds per object" );
-        }
-        return time;
-    }
-
-    public interface AnyComposite
-        extends TransientComposite
-    {
-    }
-
-    public interface AnyValue
-        extends ValueComposite
-    {
-    }
-
-    public static class AnyObject
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
deleted file mode 100644
index c63e33a..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/InvocationPerformanceTest.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.runtime.composite;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.text.NumberFormat;
-import org.junit.Test;
-import org.apache.polygene.api.composite.TransientBuilder;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.concern.ConcernOf;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-
-/**
- * Invocation performance test.
- * <p>
- * Don't forget to add VM value "-server" before running this test!
- * </p>
- * <p>
- * These tests are very sensitive to warmup of JVM, hence the duplication. Often the first round
- * is only for getting the code jitted, and the second round is what you want to look at.
- * </p>
- */
-public class InvocationPerformanceTest
-    extends AbstractPolygeneTest
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.transients( SimpleComposite.class );
-        module.transients( SimpleWithTypedConcernComposite.class );
-        module.transients( SimpleWithGenericConcernComposite.class );
-    }
-
-    @Test
-    public void testInvokeMixin()
-    {
-        // Create instance
-        TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
-        Simple simple = builder.newInstance();
-
-        for( int i = 0; i < 60000; i++ )
-        {
-            simple.test();
-        }
-
-        int rounds = 10;
-        for( int i = 0; i < rounds; i++ )
-        {
-            System.gc();
-            performanceCheck( simple );
-        }
-    }
-
-    @Test
-    public void testInvokeMixinWithTypedConcern()
-    {
-        // Create instance
-        Simple simple = transientBuilderFactory.newTransient( SimpleWithTypedConcernComposite.class );
-
-        for( int i = 0; i < 60000; i++ )
-        {
-            simple.test();
-        }
-
-        int rounds = 3;
-        for( int i = 0; i < rounds; i++ )
-        {
-            performanceCheck( simple );
-        }
-    }
-
-    @Test
-    public void testInvokeMixinWithGenericConcern()
-    {
-        // Create instance
-        Simple simple = transientBuilderFactory.newTransient( SimpleWithGenericConcernComposite.class );
-
-        for( int i = 0; i < 60000; i++ )
-        {
-            simple.test();
-        }
-
-        int rounds = 3;
-        for( int i = 0; i < rounds; i++ )
-        {
-            performanceCheck( simple );
-        }
-    }
-
-    @Test
-    public void testInvokeMixin2()
-    {
-        testInvokeMixin();
-    }
-
-    @Test
-    public void testInvokeMixinWithTypedConcern2()
-    {
-        testInvokeMixinWithTypedConcern();
-    }
-
-    @Test
-    public void testInvokeMixinWithGenericConcern2()
-    {
-        testInvokeMixinWithGenericConcern();
-    }
-
-    private void performanceCheck( Simple simple )
-    {
-        long count = 10000000L;
-
-        long start = System.currentTimeMillis();
-        for( long i = 0; i < count; i++ )
-        {
-            simple.test();
-        }
-        long end = System.currentTimeMillis();
-        long time = end - start;
-        long callsPerSecond = ( count / time ) * 1000;
-        System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
-    }
-
-    @Mixins( SimpleMixin.class )
-    @Concerns( SimpleTypedConcern.class )
-    public interface SimpleWithTypedConcernComposite
-        extends Simple, TransientComposite
-    {
-    }
-
-    @Mixins( SimpleMixin.class )
-    @Concerns( SimpleGenericConcern.class )
-    public interface SimpleWithGenericConcernComposite
-        extends Simple, TransientComposite
-    {
-    }
-
-    @Mixins( SimpleMixin.class )
-    public interface SimpleComposite
-        extends Simple, TransientComposite
-    {
-    }
-
-    public interface Simple
-    {
-        public void test();
-    }
-
-    public static class SimpleMixin
-        implements Simple
-    {
-        long count = 0;
-
-        @Override
-        public void test()
-        {
-            count++; // Do nothing
-        }
-    }
-
-    public static class SimpleTypedConcern
-        extends ConcernOf<Simple>
-        implements Simple
-    {
-        @Override
-        public void test()
-        {
-            next.test();
-        }
-    }
-
-    public static class SimpleGenericConcern
-        extends ConcernOf<InvocationHandler>
-        implements InvocationHandler
-    {
-        @Override
-        public Object invoke( Object o, Method method, Object[] objects )
-            throws Throwable
-        {
-            return next.invoke( o, method, objects );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
deleted file mode 100644
index 7508fe2..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.runtime.composite;
-
-import java.text.NumberFormat;
-import java.util.Locale;
-import org.junit.Test;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.composite.TransientBuilder;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.injection.scope.State;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-
-/**
- * PropertyMixin invocation performance test.
- * <p>
- * Don't forget to add VM value "-server" before running this test!
- * </p>
- */
-public class PropertyMixinInvocationPerformanceTest
-    extends AbstractPolygeneTest
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.transients( SimpleComposite.class );
-        module.transients( SimpleComposite2.class );
-    }
-
-    @Test
-    public void testNewInstance()
-    {
-        {
-            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
-            SimpleComposite simple = builder.newInstance();
-
-            int rounds = 1;
-            for( int i = 0; i < rounds; i++ )
-            {
-                performanceCheck( simple );
-            }
-        }
-
-        {
-            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
-            SimpleComposite simple = builder.newInstance();
-
-            int rounds = 1;
-            for( int i = 0; i < rounds; i++ )
-            {
-                performanceCheck( simple );
-            }
-        }
-    }
-
-    private void performanceCheck( SimpleComposite simple )
-    {
-        long count = 10000000L;
-
-        {
-            long start = System.currentTimeMillis();
-            for( long i = 0; i < count; i++ )
-            {
-                simple.test();
-            }
-            long end = System.currentTimeMillis();
-            long time = end - start;
-            long callsPerSecond = ( count / time ) * 1000;
-            System.out.println( "Accesses per second: "
-                                + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
-        }
-
-        {
-            long start = System.currentTimeMillis();
-            for( long i = 0; i < count; i++ )
-            {
-                simple.test().get();
-            }
-            long end = System.currentTimeMillis();
-            long time = end - start;
-            long callsPerSecond = ( count / time ) * 1000;
-            System.out.println( "Gets per second: "
-                                + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
-        }
-    }
-
-    public interface SimpleComposite
-        extends TransientComposite
-    {
-        @Optional
-        Property<String> test();
-    }
-
-    @Mixins( SimpleMixin.class )
-    public interface SimpleComposite2
-        extends SimpleComposite
-    {
-    }
-
-    public abstract static class SimpleMixin
-        implements SimpleComposite2
-    {
-        @State
-        Property<String> test;
-
-        @Override
-        public Property<String> test()
-        {
-            return test;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java
deleted file mode 100644
index b995770..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/object/ObjectCreationPerformanceTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.runtime.object;
-
-import org.junit.Test;
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-
-/**
- * Tests performance of new object creation.
- */
-public class ObjectCreationPerformanceTest
-{
-
-    @Test
-    public void newInstanceForRegisteredObjectPerformance()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( AnyObject.class );
-            }
-        };
-        ObjectFactory objectFactory = assembler.module();
-        for( int i = 0; i < 10; i++ )
-        {
-            testPerformance( objectFactory );
-        }
-    }
-
-    private void testPerformance( ObjectFactory objectFactory )
-    {
-        long start = System.currentTimeMillis();
-        int iter = 1000000;
-        for( int i = 0; i < iter; i++ )
-        {
-            objectFactory.newObject( AnyObject.class );
-        }
-
-        long end = System.currentTimeMillis();
-        System.out.println( end - start );
-    }
-
-    public static final class AnyObject
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
deleted file mode 100644
index c599f6e..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.runtime.service;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.text.NumberFormat;
-import junit.framework.TestCase;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-
-public class ServiceInvocationPerformanceTest
-    extends TestCase
-{
-    @Service
-    ServiceInvocationPerformanceTest.MyService service;
-
-    public void testInjectService()
-        throws Exception
-    {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( ServiceInvocationPerformanceTest.MyServiceComposite.class );
-                module.objects( ServiceInvocationPerformanceTest.class );
-            }
-        };
-
-        assembly.module().injectTo( this );
-
-        // Warmup
-        for( int i = 0; i < 60000; i++ )
-        {
-            service.test();
-        }
-
-        int rounds = 5;
-        for( int i = 0; i < rounds; i++ )
-        {
-            performanceCheck( service );
-        }
-    }
-
-    private void performanceCheck( MyService simple )
-    {
-        long count = 10000000L;
-
-        long start = System.currentTimeMillis();
-        for( long i = 0; i < count; i++ )
-        {
-            simple.test();
-        }
-        long end = System.currentTimeMillis();
-        long time = end - start;
-        long callsPerSecond = ( count / time ) * 1000;
-        System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
-    }
-
-    @Mixins( NoopMixin.class )
-    public static interface MyServiceComposite
-        extends ServiceInvocationPerformanceTest.MyService, ServiceComposite
-    {
-    }
-
-    public static interface MyService
-    {
-        void test();
-    }
-
-    public static class MyServiceMixin
-        implements ServiceInvocationPerformanceTest.MyService
-    {
-        @Override
-        public void test()
-        {
-        }
-    }
-
-    public final static class NoopMixin
-        implements InvocationHandler
-    {
-        @Override
-        public Object invoke( Object object, Method method, Object[] objects )
-            throws Throwable
-        {
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties b/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties
new file mode 100644
index 0000000..8527b21
--- /dev/null
+++ b/tests/performance/src/perf/resources/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreService.properties
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+#
+#
+#
+
+
+# The file that will contain the JDBM data.
+file=build/tmp/jdbm/jdbmstore.data
+
+disableTransactions=false

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties b/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
new file mode 100644
index 0000000..2cb86eb
--- /dev/null
+++ b/tests/performance/src/perf/resources/org/apache/polygene/library/rdf/repository/rdf-indexing.properties
@@ -0,0 +1,22 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+#
+#
+#
+
+tripleIndexes=spoc,ospc
+dataDirectory=build/tmp/rdf
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties b/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties
deleted file mode 100644
index 8527b21..0000000
--- a/tests/performance/src/perf/resources/org/apache/zest/entitystore/jdbm/JdbmEntityStoreService.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you 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.
-#
-#
-#
-
-
-# The file that will contain the JDBM data.
-file=build/tmp/jdbm/jdbmstore.data
-
-disableTransactions=false

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties b/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
deleted file mode 100644
index 2cb86eb..0000000
--- a/tests/performance/src/perf/resources/org/apache/zest/library/rdf/repository/rdf-indexing.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you 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.
-#
-#
-#
-
-tripleIndexes=spoc,ospc
-dataDirectory=build/tmp/rdf
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js
new file mode 100644
index 0000000..73f44e6
--- /dev/null
+++ b/tools/generator-polygene/app/index.js
@@ -0,0 +1,317 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+ */
+
+var generators = require( 'yeoman-generator' );
+
+var polygene = {};
+
+module.exports = generators.Base.extend(
+    {
+        // The name `constructor` is important here
+        constructor: function ()
+        {
+            // Calling the super constructor is important so our generator is correctly set up
+            generators.Base.apply( this, arguments );
+
+            // this.option( 'coffee' ); // This method adds support for a `--coffee` flag
+        },
+
+        method1: function ()
+        {
+            console.log( 'method 1 just ran' );
+        },
+        method2: function ()
+        {
+            console.log( 'method 2 just ran' );
+        },
+        prompting: function ()
+        {
+            return this.prompt(
+                [
+                    {
+                        type: 'input',
+                        name: 'name',
+                        message: 'Your project name',
+                        default: firstUpper( this.appname )
+                    },
+                    {
+                        type: 'input',
+                        name: 'packagename',
+                        message: 'Java package name',
+                        default: this.appname // Default to current folder name
+                    },
+                    {
+                        type: 'list',
+                        name: 'entitystore',
+                        choices: [
+                            'File',
+                            'Geode',
+                            'Hazelcast',
+                            'JClouds',
+                            'Jdbm',
+                            'LevelDB',
+                            'Memory',
+                            'MongoDB',
+                            'Preferences',
+                            'Redis',
+                            'Riak',
+                            'MySQL',
+                            'PostgresSQL',
+                            'SQLite',
+                            'H2SQL',
+                            'DerbySQL'
+                        ],
+                        message: 'Which entity store do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'indexing',
+                        choices: [
+                            'Rdf',
+                            'ElasticSearch',
+                            'Solr',
+                            'SQL'
+                        ],
+                        message: 'Which caching system do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'caching',
+                        choices: [
+                            'none',
+                            'memcache',
+                            'ehcache'
+                        ],
+                        message: 'Which serialization system do you want to use?'
+                    },
+                    {
+                        type: 'list',
+                        name: 'serialization',
+                        choices: [
+                            'Jackson',
+                            'Stax',
+                            'OrgJson'
+                        ],
+                        message: 'Which indexing system do you want to use?'
+                    },
+                    {
+                        type: 'checkbox',
+                        name: 'features',
+                        choices: [
+                            'rest api',
+                            // 'reindexer',
+                            // 'metrics',
+                            // 'jmx',
+                            // 'version migration',
+                            'sample (heroes) web application'
+                        ],
+                        message: 'Other features?'
+                    }
+                ]
+            ).then( function ( answers )
+                    {
+                        this.log( 'app name', answers.name );
+                        this.log( 'Entity Stores:', answers.entitystore );
+                        this.log( 'Indexing:', answers.indexing );
+                        this.log( 'Caching:', answers.caching );
+                        this.log( 'Serialization:', answers.serialization );
+                        this.log( 'Features:', answers.features );
+                        polygene = answers;
+                        polygene.javaPackageDir = polygene.packagename.replace( '.', '/' );
+                        polygene.singletonApp = false;
+                        if( hasFeature( 'sample (heroes) web application' ) )
+                        {
+                            polygene.features.push( 'rest api' );
+                        }
+                    }.bind( this )
+            );
+        },
+
+        writing: function ()
+        {
+            copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "domain", "DomainLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp );
+
+            copyPolygeneBootstrap( this, "config", "ConfigModule", true );
+
+            copyPolygeneBootstrap( this, "infrastructure", "FileConfigurationModule", true );
+
+            copyEntityStore( this, polygene.entitystore );
+
+            copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
+
+            copyPolygeneBootstrap( this, "infrastructure", "NoCachingModule", hasCaching( 'none' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "MemcacheCachingModule", hasCaching( 'Memcache' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "EhCacheCachingModule", hasCaching( 'Ehcache' ) );
+
+            copyPolygeneBootstrap( this, "infrastructure", "JacksonSerializationModule", hasSerialization( 'Jackson' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "StaxSerializationModule", hasSerialization( 'Stax' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "OrgJsonSerializationModule", hasSerialization( 'Orgjson' ) );
+
+            copyPolygeneBootstrap( this, "connectivity", "RestApiModule", hasFeature( 'rest api' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "ReindexerModule", hasFeature( 'reindexer' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "MetricsModule", hasFeature( 'metrics' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "JmxModule", hasFeature( 'jmx' ) );
+            copyPolygeneBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
+
+            copyPolygeneBootstrap( this, "domain", "CrudModule", true );
+            copyHeroesSampleApp( this );
+            copyPolygeneDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
+
+            copyRestFeature( this, hasFeature( 'rest api' ) );
+
+            copyTemplate( this, 'buildtool/gradle-app.tmpl', 'app/build.gradle' );
+            copyTemplate( this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle' );
+            copyTemplate( this, 'buildtool/gradle-model.tmpl', 'model/build.gradle' );
+            copyTemplate( this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle' );
+            copyTemplate( this, 'buildtool/gradle-root.tmpl', 'build.gradle' );
+            copyTemplate( this, 'buildtool/settings.tmpl', 'settings.gradle' );
+            copyTemplate( this, 'buildtool/gradlew.tmpl', 'gradlew' );
+            copyTemplate( this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat' );
+            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) );
+            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) );
+        }
+    }
+);
+
+function copyPolygeneBootstrap( ctx, layer, moduleName, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      moduleName + '/bootstrap.tmpl',
+                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
+    }
+}
+
+function copyEntityStore( ctx, entityStoreName )
+{
+    copyTemplate( ctx,
+                  'StorageModule/bootstrap.tmpl',
+                  'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
+}
+
+function copyPolygeneApp( ctx, name, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      name + '/bootstrap.tmpl',
+                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
+
+        copyTemplate( ctx,
+                      name + '/app.tmpl',
+                      'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java' );
+
+        copyTemplate( ctx,
+                      name + '/webapp/',
+                      'app/src/main/webapp/' );
+    }
+}
+
+function copyPolygeneDomain( ctx, model, module, clazz, condition )
+{
+    if( condition )
+    {
+        copyTemplate( ctx,
+                      module + '/' + clazz + '.tmpl',
+                      'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
+    }
+}
+
+function copyRestFeature( ctx, condition )
+{
+    if( condition )
+    {
+        copyPolygeneBootstrap( ctx, "domain", "SecurityModule", true );
+
+        copyTemplate( ctx,
+                      'RestApiModule/SimpleEnroler.tmpl',
+                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java' );
+
+        copyTemplate( ctx,
+                      'RestApiModule/SimpleVerifier.tmpl',
+                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java' );
+
+        copyTemplate( ctx,
+                      'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
+                      'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
+    }
+}
+
+function copyHeroesSampleApp( ctx )
+{
+    copyPolygeneDomain( ctx, "heroes", "Heroes", "Hero", hasFeature( 'sample (heroes) web application' ) );
+    copyPolygeneApp( ctx, "Heroes", hasFeature( 'sample (heroes) web application' ) );
+    copyTemplate( ctx,
+                  'Heroes/web.tmpl',
+                  'app/src/main/webapp/WEB-INF/web.xml' );
+}
+
+function copyTemplate( ctx, from, to )
+{
+    ctx.fs.copyTpl(
+        ctx.templatePath( from ),
+        ctx.destinationPath( to ),
+        {
+            packageName: polygene.packagename,
+            hasFeature: hasFeature,
+            hasEntityStore: hasEntityStore,
+            hasIndexing: hasIndexing,
+            hasCaching: hasCaching,
+            polygene: polygene
+        }
+    );
+}
+
+function hasEntityStore( esType )
+{
+    return polygene.entitystore === esType;
+}
+
+function hasIndexing( indexingType )
+{
+    return polygene.indexing === indexingType;
+}
+
+function hasCaching( cachingType )
+{
+    return polygene.caching === cachingType;
+}
+
+function hasSerialization( serializer )
+{
+    return polygene.serialization === serializer;
+}
+
+function hasFeature( feature )
+{
+    return polygene.features.indexOf( feature ) >= 0;
+}
+
+function firstUpper( text )
+{
+    return text.charAt( 0 ).toUpperCase() + text.substring( 1 );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
new file mode 100644
index 0000000..b152d3a
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConfigModule/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.config;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+
+public class ConfigModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
+        new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
new file mode 100644
index 0000000..bb81a83
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.config;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConfigurationLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static String NAME;
+    private ModuleAssembly configModule;
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        configModule = createModule( layer, ConfigModule.class );
+        return layer;
+    }
+
+    public ModuleAssembly configModule()
+    {
+        return configModule;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
new file mode 100644
index 0000000..941e77e
--- /dev/null
+++ b/tools/generator-polygene/app/templates/ConnectivityLayer/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.connectivity;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class ConnectivityLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static String NAME;
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+<% if( hasFeature('rest api') ) { %>
+        createModule( layer, RestApiModule.class );
+<% } -%>
+        return layer;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
new file mode 100644
index 0000000..0877723
--- /dev/null
+++ b/tools/generator-polygene/app/templates/CrudModule/bootstrap.tmpl
@@ -0,0 +1,38 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.domain;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler;
+
+public class CrudModule
+    implements ModuleAssembler
+{
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new CrudServiceAssembler().assemble( module );
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
new file mode 100644
index 0000000..6285025
--- /dev/null
+++ b/tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.domain;
+
+import java.util.function.Function;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class DomainLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    @Override
+    public LayerAssembly assemble(LayerAssembly layer)
+        throws AssemblyException
+    {
+        createModule( layer, CrudModule.class );
+        createModule( layer, SecurityModule.class );
+        return layer;
+    }
+
+    public static Function<Application, Module> typeFinder()
+    {
+        return application -> application.findModule( "Domain Layer", "Assets Module" );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
new file mode 100644
index 0000000..ab2ad2c
--- /dev/null
+++ b/tools/generator-polygene/app/templates/FileConfigurationModule/bootstrap.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
+
+public class FileConfigurationModule
+    implements ModuleAssembler
+{
+    public static String NAME;
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/Hero.tmpl b/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
new file mode 100644
index 0000000..c3c7ec9
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/Hero.tmpl
@@ -0,0 +1,28 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.model.heroes;
+
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.property.Property;
+
+public interface Hero extends HasIdentity
+{
+    Property<String> name();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/app.tmpl b/tools/generator-polygene/app/templates/Heroes/app.tmpl
new file mode 100644
index 0000000..4878f81
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/app.tmpl
@@ -0,0 +1,103 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.app;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
+import org.apache.polygene.library.restlet.ZrestApplication;
+import org.restlet.Context;
+import org.restlet.routing.Filter;
+import org.restlet.routing.Router;
+import org.restlet.security.Enroler;
+import org.restlet.security.Verifier;
+
+import <%= packageName %>.bootstrap.HeroesApplicationAssembler;
+import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
+import <%= packageName %>.bootstrap.connectivity.RestApiModule;
+import <%= packageName %>.model.heroes.Hero;
+import <%= packageName %>.rest.security.SimpleEnroler;
+import <%= packageName %>.rest.security.SimpleVerifier;
+
+public class Heroes extends ZrestApplication
+{
+
+    public Heroes( Context context )
+        throws AssemblyException
+    {
+        super( context );
+    }
+
+    @Override
+    protected void addRoutes( Router router )
+    {
+        addResourcePath( "heroes", Hero.class, "/" );
+    }
+
+    @Override
+    protected LayeredApplicationAssembler createApplicationAssembler( String mode )
+        throws AssemblyException
+    {
+        if( mode != null )
+        {
+            return new HeroesApplicationAssembler( Application.Mode.valueOf( mode ) );
+        }
+        return new HeroesApplicationAssembler( Application.Mode.production );
+    }
+
+    @Override
+    protected Verifier createVerifier()
+    {
+        return newObject( SimpleVerifier.class );
+    }
+
+    @Override
+    protected Enroler createEnroler()
+    {
+        return newObject( SimpleEnroler.class, this );
+    }
+
+    @Override
+    protected String getConnectivityLayer()
+    {
+        return ConnectivityLayer.NAME;
+    }
+
+    @Override
+    protected String getConnectivityModule()
+    {
+        return RestApiModule.NAME;
+    }
+
+    private <T> T newObject( Class<T> type, Object... uses )
+    {
+        try
+        {
+            T instamce = type.newInstance();
+            objectFactory.injectTo( instamce, uses );
+            return instamce;
+        }
+        catch( Exception e )
+        {
+            throw new UndeclaredThrowableException( e );
+        }
+    }
+}
\ No newline at end of file


[61/81] [abbrv] zest-java git commit: ZEST-195 ; Clean up the mistakes in the rename.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
deleted file mode 100644
index 18e1c24..0000000
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestBaseTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test;
-
-import org.apache.polygene.test.util.NotYetImplemented;
-import org.junit.After;
-import org.junit.Before;
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.spi.PolygeneSPI;
-import org.junit.Rule;
-
-public abstract class AbstractPolygeneBaseTest
-{
-    @Rule public NotYetImplemented.Rule notYetImplementedRule = new NotYetImplemented.Rule();
-
-    protected PolygeneAPI api;
-    protected PolygeneSPI spi;
-
-    protected Energy4Java polygene;
-    protected ApplicationDescriptor applicationModel;
-    protected Application application;
-
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        polygene = new Energy4Java();
-        applicationModel = newApplication();
-        if( applicationModel == null )
-        {
-            // An AssemblyException has occurred that the Test wants to check for.
-            return;
-        }
-        application = newApplicationInstance( applicationModel );
-        initApplication( application );
-        api = spi = polygene.spi();
-        application.activate();
-    }
-
-    /** Called by the superclass for the test to define the entire application, every layer, every module and all
-     * the contents of each module.
-     *
-     * @param applicationAssembly the {@link org.apache.polygene.bootstrap.ApplicationAssembly} to be populated.
-     *
-     * @throws AssemblyException on invalid assembly
-     */
-    protected abstract void defineApplication( ApplicationAssembly applicationAssembly )
-        throws AssemblyException;
-
-    protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
-    {
-        return applicationModel.newInstance( polygene.api() );
-    }
-
-    protected ApplicationDescriptor newApplication()
-        throws AssemblyException
-    {
-        ApplicationAssembler assembler = new ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
-                applicationAssembly.setMode( Application.Mode.test );
-                defineApplication( applicationAssembly );
-                return applicationAssembly;
-            }
-        };
-
-        try
-        {
-            return polygene.newApplicationModel( assembler );
-        }
-        catch( AssemblyException e )
-        {
-            assemblyException( e );
-            return null;
-        }
-    }
-
-    /**
-     * This method is called when there was an AssemblyException in the creation of the Polygene application model.
-     * <p>
-     * Override this method to catch valid failures to place into satisfiedBy suites.
-     * </p>
-     * @param exception the exception thrown.
-     *
-     * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception.
-     */
-    protected void assemblyException( AssemblyException exception )
-        throws AssemblyException
-    {
-        throw exception;
-    }
-
-    protected void initApplication( Application app )
-        throws Exception
-    {
-    }
-
-    @After
-    public void tearDown()
-        throws Exception
-    {
-        if( application != null )
-        {
-            application.passivate();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
deleted file mode 100644
index 4f85962..0000000
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestScenarioTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test;
-
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.spi.PolygeneSPI;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-/**
- * Base class for Polygene scenario tests. This will create one Polygene application per class instead of per test.
- */
-public abstract class AbstractPolygeneScenarioTest
-    implements Assembler
-{
-    static protected PolygeneAPI api;
-    static protected PolygeneSPI spi;
-
-    static protected Energy4Java polygene;
-    static protected ApplicationDescriptor applicationModel;
-    static protected Application application;
-
-    static protected Module module;
-
-    static protected Assembler assembler; // Initialize this in static block of subclass
-    private static UnitOfWorkFactory uowf;
-
-    @BeforeClass
-    public static void setUp()
-        throws Exception
-    {
-        polygene = new Energy4Java();
-        applicationModel = newApplication();
-        if( applicationModel == null )
-        {
-            // An AssemblyException has occurred that the Test wants to check for.
-            return;
-        }
-        application = applicationModel.newInstance( polygene.spi() );
-        initApplication( application );
-        api = spi = polygene.spi();
-        application.activate();
-
-        // Assume only one module
-        module = application.findModule( "Layer 1", "Module 1" );
-        uowf = module.unitOfWorkFactory();
-    }
-
-    static protected ApplicationDescriptor newApplication()
-        throws AssemblyException
-    {
-        final Assembler asm = assembler;
-
-        ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm );
-        try
-        {
-            return polygene.newApplicationModel( assembler );
-        }
-        catch( AssemblyException e )
-        {
-            assemblyException( e );
-            return null;
-        }
-    }
-
-    /**
-     * This method is called when there was an AssemblyException in the creation of the Polygene application model.
-     * <p>
-     * Override this method to catch valid failures to place into satisfiedBy suites.
-     * </p>
-     *
-     * @param exception the exception thrown.
-     *
-     * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception.
-     */
-    static protected void assemblyException( AssemblyException exception )
-        throws AssemblyException
-    {
-        throw exception;
-    }
-
-    static protected void initApplication( Application app )
-        throws Exception
-    {
-    }
-
-    @AfterClass
-    public void tearDown()
-        throws Exception
-    {
-        if( uowf != null && uowf.isUnitOfWorkActive() )
-        {
-            while( uowf.isUnitOfWorkActive() )
-            {
-                UnitOfWork uow = uowf.currentUnitOfWork();
-                if( uow.isOpen() )
-                {
-                    uow.discard();
-                }
-                else
-                {
-                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is" + uow
-                        .usecase()
-                        .name() );
-                }
-            }
-            new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace();
-        }
-
-        if( application != null )
-        {
-            application.passivate();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestTest.java
deleted file mode 100644
index db3c8d8..0000000
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractZestTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test;
-
-import org.apache.polygene.api.composite.TransientBuilderFactory;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.api.query.QueryBuilderFactory;
-import org.apache.polygene.api.service.ServiceFinder;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.structure.ModuleDescriptor;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.api.value.ValueBuilderFactory;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.junit.After;
-import org.junit.Before;
-
-/**
- * Base class for Composite tests.
- */
-public abstract class AbstractPolygeneTest extends AbstractPolygeneBaseTest
-    implements Assembler
-{
-    @Structure
-    protected UnitOfWorkFactory unitOfWorkFactory;
-
-    @Structure
-    protected TransientBuilderFactory transientBuilderFactory;
-
-    @Structure
-    protected ValueBuilderFactory valueBuilderFactory;
-
-    @Structure
-    protected ServiceFinder serviceFinder;
-
-    @Structure
-    protected ObjectFactory objectFactory;
-
-    @Structure
-    protected QueryBuilderFactory queryBuilderFactory;
-
-    @Structure
-    protected ModuleDescriptor module;
-
-    @Before
-    @Override
-    public void setUp()
-        throws Exception
-    {
-        super.setUp();
-        if( application == null )
-        {
-            return; // failure in Assembly.
-        }
-        Module module = application.findModule( "Layer 1", "Module 1" );
-        module.injectTo( this );
-    }
-
-    @Override
-    protected void defineApplication( ApplicationAssembly applicationAssembly )
-        throws AssemblyException
-    {
-        LayerAssembly layer = applicationAssembly.layer( "Layer 1" );
-        ModuleAssembly module = layer.module( "Module 1" );
-        new DefaultUnitOfWorkAssembler().assemble( module );
-        module.objects( AbstractPolygeneTest.this.getClass() );
-        assemble( module );
-    }
-
-    @After
-    @Override
-    public void tearDown()
-        throws Exception
-    {
-        if( unitOfWorkFactory != null && unitOfWorkFactory.isUnitOfWorkActive() )
-        {
-            while( unitOfWorkFactory.isUnitOfWorkActive() )
-            {
-                UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
-                if( uow.isOpen() )
-                {
-                    System.err.println( "UnitOfWork not cleaned up:" + uow.usecase().name() );
-                    uow.discard();
-                }
-                else
-                {
-                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is: " + uow
-                        .usecase()
-                        .name() );
-                }
-            }
-            new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace();
-        }
-        super.tearDown();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
index 008fb26..6e236fd 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/cache/AbstractCachePoolTest.java
@@ -21,13 +21,13 @@ package org.apache.polygene.test.cache;
 
 import java.util.Collection;
 import java.util.Random;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolation;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.util.NullArgumentException;
 import org.apache.polygene.spi.cache.Cache;
 import org.apache.polygene.spi.cache.CachePool;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
index 72cc069..44ab1f4 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/value/AbstractValueCompositeSerializationTest.java
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -53,7 +54,6 @@ import org.apache.polygene.api.value.ValueComposite;
 import org.apache.polygene.api.value.ValueSerialization;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/doap.rdf
----------------------------------------------------------------------
diff --git a/doap.rdf b/doap.rdf
index 9fbc5de..6ffbfa0 100644
--- a/doap.rdf
+++ b/doap.rdf
@@ -37,7 +37,7 @@
     <asfext:pmc rdf:resource="https://polygene.apache.org" />
     <shortdesc>Apache Polygene is a community based effort exploring Composite Oriented Programming for domain centric application development.</shortdesc>
     <description>Apache Polygene is a community based effort exploring Composite Oriented Programming for domain centric application development. This includes evolved concepts from Aspect Oriented Programming, Dependency Injection and Domain Driven Design. Composite Oriented Programming allows developers to work with 'fragments', smaller than classes, and 'compose' fragments into larger 'composites' which acts like the regular objects. Polygene also tackles the enforcement of application composition, i.e. composites are declared in modules, modules are contained in layers and access between layers are controlled/enforced. Apache Polygene\u2122 (Java Edition), first Apache Polygene sub-project, is an implementation of Composite Oriented Programming, using the standard Java platform, without the use of any pre-processors or new language elements. Everything you know from Java still applies and you can leverage both your experience and toolkits to become more productive with Composite Or
 iented Programming today.</description>
-    <bug-database rdf:resource="https://issues.apache.org/jira/browse/ZEST" />
+    <bug-database rdf:resource="https://issues.apache.org/jira/browse/POLYGENE" />
     <mailing-list rdf:resource="https://www.apache.org/foundation/mailinglists.html" />
     <download-page rdf:resource="https://polygene.apache.org/download.html" />
     <programming-language>Java</programming-language>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
index f4cb13b..7715f9e 100644
--- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
+++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
@@ -25,7 +25,7 @@ import org.apache.polygene.entitystore.prefs.assembly.PreferenceEntityStoreAssem
 import org.apache.polygene.test.AbstractPolygeneTest;
 
 public class DocumentationSupport
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     // START SNIPPET: assembly

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLDBIntegrityTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLDBIntegrityTest.java b/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLDBIntegrityTest.java
index f1c1b49..54d6570 100644
--- a/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLDBIntegrityTest.java
+++ b/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLDBIntegrityTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.index.sql.postgresql;
 
 import java.sql.Connection;
 import javax.sql.DataSource;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -37,7 +38,6 @@ import org.apache.polygene.index.sql.support.common.GenericDatabaseExplorer.Data
 import org.apache.polygene.index.sql.support.postgresql.PostgreSQLAppStartup;
 import org.apache.polygene.library.sql.common.SQLConfiguration;
 import org.apache.polygene.library.sql.common.SQLUtil;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.sql.generation.api.vendor.PostgreSQLVendor;
 import org.sql.generation.api.vendor.SQLVendorProvider;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmHistoryImplTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmHistoryImplTest.java b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmHistoryImplTest.java
index 8e69504..5bf2ac8 100644
--- a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmHistoryImplTest.java
+++ b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmHistoryImplTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.library.alarm;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceComposite;
@@ -28,7 +29,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import java.util.Map;
 import org.apache.polygene.test.EntityTestAssembler;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmPointImplTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmPointImplTest.java b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmPointImplTest.java
index 84b6715..2281e34 100644
--- a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmPointImplTest.java
+++ b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/AlarmPointImplTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.library.alarm;
 
 import java.util.List;
 import java.util.Locale;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.mixin.Mixins;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/SimpleAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/SimpleAlarmModelTest.java b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/SimpleAlarmModelTest.java
index 9bb7013..dd97c15 100644
--- a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/SimpleAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/SimpleAlarmModelTest.java
@@ -23,6 +23,7 @@ import java.time.Instant;
 import java.util.List;
 import java.util.Locale;
 import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityBuilder;
 import org.apache.polygene.api.mixin.Mixins;
@@ -31,7 +32,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/StandardAlarmModelTest.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/StandardAlarmModelTest.java b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/StandardAlarmModelTest.java
index 74e9df0..aa247cd 100644
--- a/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/StandardAlarmModelTest.java
+++ b/libraries/alarm/src/test/java/org/apache/polygene/library/alarm/StandardAlarmModelTest.java
@@ -24,6 +24,7 @@ import java.time.Instant;
 import java.util.List;
 import java.util.Locale;
 import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityBuilder;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
----------------------------------------------------------------------
diff --git a/libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java b/libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
index 967f32b..d186597 100644
--- a/libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
+++ b/libraries/circuitbreaker/src/test/java/org/apache/polygene/library/circuitbreaker/BreaksCircuitOnThrowableTest.java
@@ -35,7 +35,7 @@ import org.apache.polygene.test.AbstractPolygeneTest;
  * Test @BreaksCircuitOnThrowable annotation
  */
 public class BreaksCircuitOnThrowableTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     // START SNIPPET: service

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
----------------------------------------------------------------------
diff --git a/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java b/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
index c16d4f1..a0d6346 100644
--- a/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
+++ b/libraries/constraints/src/test/java/org/apache/polygene/library/constraints/ConstraintTest.java
@@ -22,12 +22,12 @@ package org.apache.polygene.library.constraints;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.fail;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/http/src/test/java/org/apache/polygene/library/http/AbstractJettyTest.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/java/org/apache/polygene/library/http/AbstractJettyTest.java b/libraries/http/src/test/java/org/apache/polygene/library/http/AbstractJettyTest.java
index 282382a..bfa1c53 100644
--- a/libraries/http/src/test/java/org/apache/polygene/library/http/AbstractJettyTest.java
+++ b/libraries/http/src/test/java/org/apache/polygene/library/http/AbstractJettyTest.java
@@ -29,12 +29,11 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.util.EntityUtils;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
 
-import org.apache.polygene.test.AbstractPolygeneTest;
-
 public abstract class AbstractJettyTest
     extends AbstractPolygeneTest
 {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java b/libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java
index 436d9b4..c8ba055 100644
--- a/libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java
+++ b/libraries/http/src/test/java/org/apache/polygene/library/http/JettyJMXStatisticsTest.java
@@ -19,13 +19,13 @@
  */
 package org.apache.polygene.library.http;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.util.FreePortFinder;
 import org.junit.Test;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.jmx.JMXAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.apache.polygene.library.http.Servlets.addServlets;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/http/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/logback.xml b/libraries/http/src/test/resources/logback.xml
index ae07ef3..cacadbd 100644
--- a/libraries/http/src/test/resources/logback.xml
+++ b/libraries/http/src/test/resources/logback.xml
@@ -22,7 +22,7 @@
 
     <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
-            <pattern>[ZEST] @%-20thread %-5level %logger{36} - %msg%n</pattern>
+            <pattern>[POLYGENE] @%-20thread %-5level %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/http/src/vhost-test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/libraries/http/src/vhost-test/resources/logback.xml b/libraries/http/src/vhost-test/resources/logback.xml
index ae07ef3..cacadbd 100644
--- a/libraries/http/src/vhost-test/resources/logback.xml
+++ b/libraries/http/src/vhost-test/resources/logback.xml
@@ -22,7 +22,7 @@
 
     <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
         <encoder>
-            <pattern>[ZEST] @%-20thread %-5level %logger{36} - %msg%n</pattern>
+            <pattern>[POLYGENE] @%-20thread %-5level %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/PolygeneMBeans.java
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/PolygeneMBeans.java b/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/PolygeneMBeans.java
new file mode 100644
index 0000000..d7d5bd6
--- /dev/null
+++ b/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/PolygeneMBeans.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.jmx;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+/**
+ * Helper for working with Polygene MBeans.
+ */
+public class PolygeneMBeans
+{
+    public static ObjectName findServiceName( MBeanServer server, String applicationName, String serviceId )
+        throws MalformedObjectNameException
+    {
+        ObjectName objectName = new ObjectName( "Polygene:application=" + applicationName + ",*,service=" + serviceId );
+        return server.queryNames( objectName, null ).stream()
+                     .filter( item -> item.getKeyPropertyList().size() == 5 )
+                     .findFirst().orElse( null );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ZestMBeans.java
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ZestMBeans.java b/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ZestMBeans.java
deleted file mode 100644
index d7d5bd6..0000000
--- a/libraries/jmx/src/main/java/org/apache/polygene/library/jmx/ZestMBeans.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.jmx;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * Helper for working with Polygene MBeans.
- */
-public class PolygeneMBeans
-{
-    public static ObjectName findServiceName( MBeanServer server, String applicationName, String serviceId )
-        throws MalformedObjectNameException
-    {
-        ObjectName objectName = new ObjectName( "Polygene:application=" + applicationName + ",*,service=" + serviceId );
-        return server.queryNames( objectName, null ).stream()
-                     .filter( item -> item.getKeyPropertyList().size() == 5 )
-                     .findFirst().orElse( null );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/GroovyMixinTest.java
----------------------------------------------------------------------
diff --git a/libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/GroovyMixinTest.java b/libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/GroovyMixinTest.java
index eb58986..7691fb6 100644
--- a/libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/GroovyMixinTest.java
+++ b/libraries/lang-groovy/src/test/groovy/org/apache/polygene/library/groovy/GroovyMixinTest.java
@@ -19,11 +19,11 @@
  */
 package org.apache.polygene.library.groovy;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 public class GroovyMixinTest extends AbstractPolygeneTest
 {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
----------------------------------------------------------------------
diff --git a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
index ee3c22e..8e28370 100644
--- a/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
+++ b/libraries/metrics/src/test/java/org/apache/polygene/library/metrics/AbstractTimingCaptureTest.java
@@ -34,7 +34,8 @@ import org.junit.Test;
 import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
 
-abstract class AbstractTimingCaptureTest extends AbstractPolygeneTest {
+abstract class AbstractTimingCaptureTest extends AbstractPolygeneTest
+{
 
     @Override
     public void assemble( ModuleAssembly module )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntity.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntity.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntity.java
new file mode 100644
index 0000000..3e97ae8
--- /dev/null
+++ b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntity.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rdf;
+
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.URIImpl;
+
+
+/**
+ * This is the RDF vocabulary for Polygene Entity data.
+ */
+public interface PolygeneEntity
+{
+    // Model
+    String NAMESPACE = "http://polygene.apache.org/rdf/entity/1.0/";
+
+    // Types
+    URI ENTITY = new URIImpl( NAMESPACE + "entity" );
+    URI ENTITYTYPEREFERENCE = new URIImpl( NAMESPACE + "entitytypereference" );
+    URI QUALIFIER = new URIImpl( NAMESPACE + "qualifier" );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntityType.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntityType.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntityType.java
new file mode 100644
index 0000000..2d63daa
--- /dev/null
+++ b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneEntityType.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rdf;
+
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.URIImpl;
+
+
+/**
+ * This is the RDF vocabulary for Polygene EntityType data.
+ */
+public interface PolygeneEntityType
+{
+    // Namespace
+    String NAMESPACE = "http://polygene.apache.org/rdf/entitytype/1.0/";
+
+    // Predicates
+    URI QUERYABLE = new URIImpl( NAMESPACE + "queryable" );
+    URI VERSION = new URIImpl( NAMESPACE + "version" );
+    URI TYPE = new URIImpl( NAMESPACE + "type" );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneRdf.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneRdf.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneRdf.java
new file mode 100644
index 0000000..8afd4f8
--- /dev/null
+++ b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/PolygeneRdf.java
@@ -0,0 +1,87 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rdf;
+
+import org.openrdf.model.URI;
+import org.openrdf.model.impl.URIImpl;
+
+
+/**
+ * This is the RDF vocabulary for Polygene.
+ */
+public interface PolygeneRdf
+{
+
+    // MODEL
+    // Namespace TODO: Need to figure out what these should really be!
+    String POLYGENE_MODEL = "http://polygene.apache.org/rdf/model/1.0/";
+
+    String POLYGENE_MODEL_TYPES = "http://polygene.apache.org/rdf/model/1.0/type#";
+    String POLYGENE_MODEL_RELATIONSHIPS = "http://polygene.apache.org/rdf/module/1.0/";
+    String POLYGENE_MODEL_PROPERTIES = "http://polygene.apache.org/rdf/model/1.0/property#";
+
+    // Types
+    URI TYPE_APPLICATION = new URIImpl( POLYGENE_MODEL_TYPES + "application" );
+    URI TYPE_LAYER = new URIImpl( POLYGENE_MODEL_TYPES + "layer" );
+    URI TYPE_MODULE = new URIImpl( POLYGENE_MODEL_TYPES + "module" );
+    URI TYPE_ENTITY = new URIImpl( POLYGENE_MODEL_TYPES + "entity" );
+    URI TYPE_QUALIFIER = new URIImpl( POLYGENE_MODEL_TYPES + "qualifier" );
+    URI TYPE_COMPOSITE = new URIImpl( POLYGENE_MODEL_TYPES + "composite" );
+    URI TYPE_SERVICE = new URIImpl( POLYGENE_MODEL_TYPES + "service" );
+    URI TYPE_METHOD = new URIImpl( POLYGENE_MODEL_TYPES + "method" );
+    URI TYPE_CONSTRAINT = new URIImpl( POLYGENE_MODEL_TYPES + "constraint" );
+    URI TYPE_CONCERN = new URIImpl( POLYGENE_MODEL_TYPES + "concern" );
+    URI TYPE_CONSTRUCTOR = new URIImpl( POLYGENE_MODEL_TYPES + "constructor" );
+    URI TYPE_SIDEEFFECT = new URIImpl( POLYGENE_MODEL_TYPES + "sideeffect" );
+    URI TYPE_MIXIN = new URIImpl( POLYGENE_MODEL_TYPES + "mixin" );
+    URI TYPE_FIELD = new URIImpl( POLYGENE_MODEL_TYPES + "field" );
+    URI TYPE_CLASS = new URIImpl( POLYGENE_MODEL_TYPES + "class" );
+    URI TYPE_OBJECT = new URIImpl( POLYGENE_MODEL_TYPES + "object" );
+    URI TYPE_PARAMETER = new URIImpl( POLYGENE_MODEL_TYPES + "parameter" );
+    URI TYPE_INJECTION = new URIImpl( POLYGENE_MODEL_TYPES + "injection" );
+    URI TYPE_INFO = new URIImpl( POLYGENE_MODEL_TYPES + "info" );
+
+    // Properties
+    URI HAS_INJECTIONS = new URIImpl( POLYGENE_MODEL_PROPERTIES + "hasinjections" );
+
+    // Relationship
+    URI RELATIONSHIP_COMPOSITE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "composite" );
+    URI RELATIONSHIP_ENTITY = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "entity" );
+    URI RELATIONSHIP_SERVICE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "service" );
+    URI RELATIONSHIP_OBJECT = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "object" );
+    URI RELATIONSHIP_PRIVATE_METHOD = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "private/method" );
+    URI RELATIONSHIP_INJECTION = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "injection" );
+    URI RELATIONSHIP_CONSTRUCTOR = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "constructor" );
+    URI RELATIONSHIP_FIELD = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "field" );
+    URI RELATIONSHIP_APPLIESTO = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "appliesto" );
+    URI RELATIONSHIP_METHOD = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "method" );
+    URI RELATIONSHIP_CONSTRAINT = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "constraint" );
+    URI RELATIONSHIP_CONCERN = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "concern" );
+    URI RELATIONSHIP_SIDEEFFECT = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "sideeffect" );
+    URI RELATIONSHIP_PUBLIC_SERVICE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "public/service" );
+    URI RELATIONSHIP_PRIVATE_SERVICE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "private/service" );
+    URI RELATIONSHIP_PROVIDEDBY = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "providedby" );
+    URI RELATIONSHIP_SERVICEINFO = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "info/service" );
+    URI RELATIONSHIP_INFOVALUE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "info/value" );
+    URI RELATIONSHIP_MIXIN = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "mixin" );
+    URI RELATIONSHIP_LAYER = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "layer" );
+    URI RELATIONSHIP_MODULE = new URIImpl( POLYGENE_MODEL_RELATIONSHIPS + "module" );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntity.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntity.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntity.java
deleted file mode 100644
index 3e97ae8..0000000
--- a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntity.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rdf;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.URIImpl;
-
-
-/**
- * This is the RDF vocabulary for Polygene Entity data.
- */
-public interface PolygeneEntity
-{
-    // Model
-    String NAMESPACE = "http://polygene.apache.org/rdf/entity/1.0/";
-
-    // Types
-    URI ENTITY = new URIImpl( NAMESPACE + "entity" );
-    URI ENTITYTYPEREFERENCE = new URIImpl( NAMESPACE + "entitytypereference" );
-    URI QUALIFIER = new URIImpl( NAMESPACE + "qualifier" );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntityType.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntityType.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntityType.java
deleted file mode 100644
index 2d63daa..0000000
--- a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestEntityType.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rdf;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.URIImpl;
-
-
-/**
- * This is the RDF vocabulary for Polygene EntityType data.
- */
-public interface PolygeneEntityType
-{
-    // Namespace
-    String NAMESPACE = "http://polygene.apache.org/rdf/entitytype/1.0/";
-
-    // Predicates
-    URI QUERYABLE = new URIImpl( NAMESPACE + "queryable" );
-    URI VERSION = new URIImpl( NAMESPACE + "version" );
-    URI TYPE = new URIImpl( NAMESPACE + "type" );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestRdf.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestRdf.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestRdf.java
deleted file mode 100644
index 1a8a624..0000000
--- a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/ZestRdf.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rdf;
-
-import org.openrdf.model.URI;
-import org.openrdf.model.impl.URIImpl;
-
-
-/**
- * This is the RDF vocabulary for Polygene.
- */
-public interface PolygeneRdf
-{
-
-    // MODEL
-    // Namespace TODO: Need to figure out what these should really be!
-    String ZEST_MODEL = "http://polygene.apache.org/rdf/model/1.0/";
-
-    String ZEST_MODEL_TYPES = "http://polygene.apache.org/rdf/model/1.0/type#";
-    String ZEST_MODEL_RELATIONSHIPS = "http://polygene.apache.org/rdf/module/1.0/";
-    String ZEST_MODEL_PROPERTIES = "http://polygene.apache.org/rdf/model/1.0/property#";
-
-    // Types
-    URI TYPE_APPLICATION = new URIImpl( ZEST_MODEL_TYPES + "application" );
-    URI TYPE_LAYER = new URIImpl( ZEST_MODEL_TYPES + "layer" );
-    URI TYPE_MODULE = new URIImpl( ZEST_MODEL_TYPES + "module" );
-    URI TYPE_ENTITY = new URIImpl( ZEST_MODEL_TYPES + "entity" );
-    URI TYPE_QUALIFIER = new URIImpl( ZEST_MODEL_TYPES + "qualifier" );
-    URI TYPE_COMPOSITE = new URIImpl( ZEST_MODEL_TYPES + "composite" );
-    URI TYPE_SERVICE = new URIImpl( ZEST_MODEL_TYPES + "service" );
-    URI TYPE_METHOD = new URIImpl( ZEST_MODEL_TYPES + "method" );
-    URI TYPE_CONSTRAINT = new URIImpl( ZEST_MODEL_TYPES + "constraint" );
-    URI TYPE_CONCERN = new URIImpl( ZEST_MODEL_TYPES + "concern" );
-    URI TYPE_CONSTRUCTOR = new URIImpl( ZEST_MODEL_TYPES + "constructor" );
-    URI TYPE_SIDEEFFECT = new URIImpl( ZEST_MODEL_TYPES + "sideeffect" );
-    URI TYPE_MIXIN = new URIImpl( ZEST_MODEL_TYPES + "mixin" );
-    URI TYPE_FIELD = new URIImpl( ZEST_MODEL_TYPES + "field" );
-    URI TYPE_CLASS = new URIImpl( ZEST_MODEL_TYPES + "class" );
-    URI TYPE_OBJECT = new URIImpl( ZEST_MODEL_TYPES + "object" );
-    URI TYPE_PARAMETER = new URIImpl( ZEST_MODEL_TYPES + "parameter" );
-    URI TYPE_INJECTION = new URIImpl( ZEST_MODEL_TYPES + "injection" );
-    URI TYPE_INFO = new URIImpl( ZEST_MODEL_TYPES + "info" );
-
-    // Properties
-    URI HAS_INJECTIONS = new URIImpl( ZEST_MODEL_PROPERTIES + "hasinjections" );
-
-    // Relationship
-    URI RELATIONSHIP_COMPOSITE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "composite" );
-    URI RELATIONSHIP_ENTITY = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "entity" );
-    URI RELATIONSHIP_SERVICE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "service" );
-    URI RELATIONSHIP_OBJECT = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "object" );
-    URI RELATIONSHIP_PRIVATE_METHOD = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "private/method" );
-    URI RELATIONSHIP_INJECTION = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "injection" );
-    URI RELATIONSHIP_CONSTRUCTOR = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "constructor" );
-    URI RELATIONSHIP_FIELD = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "field" );
-    URI RELATIONSHIP_APPLIESTO = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "appliesto" );
-    URI RELATIONSHIP_METHOD = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "method" );
-    URI RELATIONSHIP_CONSTRAINT = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "constraint" );
-    URI RELATIONSHIP_CONCERN = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "concern" );
-    URI RELATIONSHIP_SIDEEFFECT = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "sideeffect" );
-    URI RELATIONSHIP_PUBLIC_SERVICE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "public/service" );
-    URI RELATIONSHIP_PRIVATE_SERVICE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "private/service" );
-    URI RELATIONSHIP_PROVIDEDBY = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "providedby" );
-    URI RELATIONSHIP_SERVICEINFO = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "info/service" );
-    URI RELATIONSHIP_INFOVALUE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "info/value" );
-    URI RELATIONSHIP_MIXIN = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "mixin" );
-    URI RELATIONSHIP_LAYER = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "layer" );
-    URI RELATIONSHIP_MODULE = new URIImpl( ZEST_MODEL_RELATIONSHIPS + "module" );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/serializer/AbstractSerializer.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/serializer/AbstractSerializer.java b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/serializer/AbstractSerializer.java
index e0d94bd..bca0d6e 100644
--- a/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/serializer/AbstractSerializer.java
+++ b/libraries/rdf/src/main/java/org/apache/polygene/library/rdf/serializer/AbstractSerializer.java
@@ -42,7 +42,7 @@ abstract class AbstractSerializer
     public void serialize( Iterable<Statement> graph, Writer out ) throws RDFHandlerException
     {
         String[] prefixes = { "polygene", "rdf", "rdfs" };
-        String[] namespaces = { PolygeneRdf.ZEST_MODEL, Rdfs.RDF, Rdfs.RDFS };
+        String[] namespaces = { PolygeneRdf.POLYGENE_MODEL, Rdfs.RDF, Rdfs.RDFS };
         serialize( graph, out, prefixes, namespaces );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/ApplicationXmlTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/ApplicationXmlTest.java b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/ApplicationXmlTest.java
index e0aad0c..e953c9b 100644
--- a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/ApplicationXmlTest.java
+++ b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/ApplicationXmlTest.java
@@ -87,7 +87,7 @@ public class ApplicationXmlTest extends AbstractPolygeneTest
         throws RDFHandlerException
     {
         writer.startRDF();
-        writer.handleNamespace( "polygene", PolygeneRdf.ZEST_MODEL );
+        writer.handleNamespace( "polygene", PolygeneRdf.POLYGENE_MODEL );
         writer.handleNamespace( "rdf", Rdfs.RDF );
         writer.handleNamespace( "rdfs", Rdfs.RDFS );
         for( Statement st : graph )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntitySerializerTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntitySerializerTest.java b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntitySerializerTest.java
index 6e3e394..0ef8475 100644
--- a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntitySerializerTest.java
+++ b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntitySerializerTest.java
@@ -24,6 +24,7 @@ import java.io.PrintWriter;
 import java.time.Instant;
 import org.apache.polygene.api.identity.StringIdentity;
 import org.apache.polygene.api.time.SystemTime;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.openrdf.model.Statement;
@@ -45,7 +46,6 @@ import org.apache.polygene.library.rdf.serializer.RdfXmlSerializer;
 import org.apache.polygene.spi.entity.EntityState;
 import org.apache.polygene.spi.entitystore.EntityStore;
 import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializerTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializerTest.java b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializerTest.java
index 9fb27e8..6c1d279 100644
--- a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializerTest.java
+++ b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/EntityTypeSerializerTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.library.rdf.entity;
 
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.openrdf.model.Statement;
@@ -39,7 +40,6 @@ import org.apache.polygene.library.rdf.PolygeneEntityType;
 import org.apache.polygene.library.rdf.Rdfs;
 import org.apache.polygene.library.rdf.serializer.RdfXmlSerializer;
 import org.apache.polygene.spi.entitystore.EntityStore;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import java.io.PrintWriter;
 import org.apache.polygene.test.EntityTestAssembler;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/repository/MemoryRepositoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/repository/MemoryRepositoryTest.java b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/repository/MemoryRepositoryTest.java
index 2b26c85..bce71ed 100644
--- a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/repository/MemoryRepositoryTest.java
+++ b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/repository/MemoryRepositoryTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.library.rdf.repository;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Test;
@@ -29,7 +30,6 @@ import org.openrdf.repository.RepositoryException;
 import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
index 3da87d1..69d460e 100644
--- a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.rest.client;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.util.FreePortFinder;
 import org.hamcrest.CoreMatchers;
 import org.junit.After;
@@ -52,7 +53,6 @@ import org.apache.polygene.library.rest.server.api.ContextRestlet;
 import org.apache.polygene.library.rest.server.assembler.RestServerAssembler;
 import org.apache.polygene.library.rest.server.restlet.NullCommandResult;
 import org.apache.polygene.library.rest.server.spi.CommandResult;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
 import org.restlet.Client;
 import org.restlet.Request;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneFinder.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneFinder.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneFinder.java
new file mode 100644
index 0000000..b261ed3
--- /dev/null
+++ b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneFinder.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rest.admin;
+
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.resource.Finder;
+import org.restlet.resource.ServerResource;
+
+public class PolygeneFinder
+    extends Finder
+{
+    @Structure
+    private ObjectFactory factory;
+
+    public PolygeneFinder()
+    {
+    }
+
+    @Override
+    public ServerResource create( Class<? extends ServerResource> targetClass, Request request, Response response )
+    {
+        return factory.newObject( targetClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServlet.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServlet.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServlet.java
new file mode 100644
index 0000000..f9e2490
--- /dev/null
+++ b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServlet.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rest.admin;
+
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.structure.Module;
+import org.restlet.Application;
+import org.restlet.Context;
+import org.restlet.ext.servlet.ServerServlet;
+
+/**
+ * Integration with Polygene. Register an object extending Application to use.
+ */
+public class PolygeneServerServlet
+    extends ServerServlet
+{
+    @Structure
+    Module module;
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    protected Application createApplication( Context context )
+    {
+        return module.newObject( Application.class, context.createChildContext(), getServletConfig(), getServletContext() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServletService.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServletService.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServletService.java
new file mode 100644
index 0000000..16cf511
--- /dev/null
+++ b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/PolygeneServerServletService.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.rest.admin;
+
+import javax.servlet.Servlet;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceComposite;
+
+/**
+ * JAVADOC
+ */
+@Mixins( PolygeneServerServlet.class )
+public interface PolygeneServerServletService
+    extends Servlet, ServiceComposite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestFinder.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestFinder.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestFinder.java
deleted file mode 100644
index b261ed3..0000000
--- a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestFinder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rest.admin;
-
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.restlet.Request;
-import org.restlet.Response;
-import org.restlet.resource.Finder;
-import org.restlet.resource.ServerResource;
-
-public class PolygeneFinder
-    extends Finder
-{
-    @Structure
-    private ObjectFactory factory;
-
-    public PolygeneFinder()
-    {
-    }
-
-    @Override
-    public ServerResource create( Class<? extends ServerResource> targetClass, Request request, Response response )
-    {
-        return factory.newObject( targetClass );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServlet.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServlet.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServlet.java
deleted file mode 100644
index f9e2490..0000000
--- a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServlet.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rest.admin;
-
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.structure.Module;
-import org.restlet.Application;
-import org.restlet.Context;
-import org.restlet.ext.servlet.ServerServlet;
-
-/**
- * Integration with Polygene. Register an object extending Application to use.
- */
-public class PolygeneServerServlet
-    extends ServerServlet
-{
-    @Structure
-    Module module;
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    protected Application createApplication( Context context )
-    {
-        return module.newObject( Application.class, context.createChildContext(), getServletConfig(), getServletContext() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServletService.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServletService.java b/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServletService.java
deleted file mode 100644
index 16cf511..0000000
--- a/libraries/rest/src/main/java/org/apache/polygene/library/rest/admin/ZestServerServletService.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.rest.admin;
-
-import javax.servlet.Servlet;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ServiceComposite;
-
-/**
- * JAVADOC
- */
-@Mixins( PolygeneServerServlet.class )
-public interface PolygeneServerServletService
-    extends Servlet, ServiceComposite
-{
-}


[76/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
new file mode 100644
index 0000000..3261944
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-bootstrap.tmpl
@@ -0,0 +1,36 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+dependencies {
+  compile project( ":model" )
+  compile project( ":rest" )
+
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+
+
+  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
+<% if( hasFeature( 'rest api' ) ) { %>
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+<% } %>
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion"
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
new file mode 100644
index 0000000..7f75b20
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-model.tmpl
@@ -0,0 +1,23 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+
+// dependencies {
+//   compile "org.restlet.jee:org.restlet:2.3.4"
+// }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
new file mode 100644
index 0000000..5c389c2
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-rest.tmpl
@@ -0,0 +1,27 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+
+dependencies {
+  compile project( ":model" )
+
+  compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
new file mode 100644
index 0000000..c1960ba
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-root.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+
+version = 1.0
+
+rootProject.ext {
+  polygeneVersion = 0
+}
+
+allprojects() {
+  apply plugin: 'java'
+  apply plugin: 'maven'
+
+  defaultTasks 'assemble'
+
+  repositories {
+    mavenLocal()
+    mavenCentral()
+    maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
+<% if( polygene.entitystore == 'Jdbm' ) { -%>
+    maven { name 'clojure-repo'; url 'http://clojars.org/repo/' }
+<% } -%>
+  }
+
+  dependencies {
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.jar_ b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.jar_
new file mode 100644
index 0000000..0087cd3
Binary files /dev/null and b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.jar_ differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_ b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
new file mode 100644
index 0000000..731cb78
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-wrapper.properties_
@@ -0,0 +1,24 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradlew-bat.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradlew-bat.tmpl b/tools/generator-polygene/app/templates/buildtool/gradlew-bat.tmpl
new file mode 100644
index 0000000..3d06f18
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradlew-bat.tmpl
@@ -0,0 +1,109 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradlew.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradlew.tmpl b/tools/generator-polygene/app/templates/buildtool/gradlew.tmpl
new file mode 100755
index 0000000..11c35cc
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradlew.tmpl
@@ -0,0 +1,183 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/settings.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/settings.tmpl b/tools/generator-polygene/app/templates/buildtool/settings.tmpl
new file mode 100644
index 0000000..3016193
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/settings.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+include 'app',
+        'bootstrap',
+        'model',
+        'rest'
+
+rootProject.name = '<%= polygene.entitystore %>'
+
+validateProject(rootProject, "")
+
+def validateProject(project, parentName)
+{
+  assert project.projectDir.isDirectory()
+  if( new File("$project.projectDir/src/main/java").exists() )
+  {
+    assert project.buildFile.isFile()
+  }
+  if( parentName.length() > 0 )
+  println "Project: " + project.name
+  project.children.each { child ->
+    validateProject(child, project.name)
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/package.json
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/package.json b/tools/generator-polygene/package.json
new file mode 100644
index 0000000..25e2d02
--- /dev/null
+++ b/tools/generator-polygene/package.json
@@ -0,0 +1,14 @@
+{
+  "name": "generator-polygene",
+  "version": "0.1.0",
+  "description": "",
+  "files": [
+    "app"
+  ],
+  "keywords": [
+    "yeoman-generator"
+  ],
+  "dependencies": {
+    "yeoman-generator": "^0.24.1"
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js
deleted file mode 100644
index 73f44e6..0000000
--- a/tools/generator-zest/app/index.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
- */
-
-var generators = require( 'yeoman-generator' );
-
-var polygene = {};
-
-module.exports = generators.Base.extend(
-    {
-        // The name `constructor` is important here
-        constructor: function ()
-        {
-            // Calling the super constructor is important so our generator is correctly set up
-            generators.Base.apply( this, arguments );
-
-            // this.option( 'coffee' ); // This method adds support for a `--coffee` flag
-        },
-
-        method1: function ()
-        {
-            console.log( 'method 1 just ran' );
-        },
-        method2: function ()
-        {
-            console.log( 'method 2 just ran' );
-        },
-        prompting: function ()
-        {
-            return this.prompt(
-                [
-                    {
-                        type: 'input',
-                        name: 'name',
-                        message: 'Your project name',
-                        default: firstUpper( this.appname )
-                    },
-                    {
-                        type: 'input',
-                        name: 'packagename',
-                        message: 'Java package name',
-                        default: this.appname // Default to current folder name
-                    },
-                    {
-                        type: 'list',
-                        name: 'entitystore',
-                        choices: [
-                            'File',
-                            'Geode',
-                            'Hazelcast',
-                            'JClouds',
-                            'Jdbm',
-                            'LevelDB',
-                            'Memory',
-                            'MongoDB',
-                            'Preferences',
-                            'Redis',
-                            'Riak',
-                            'MySQL',
-                            'PostgresSQL',
-                            'SQLite',
-                            'H2SQL',
-                            'DerbySQL'
-                        ],
-                        message: 'Which entity store do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'indexing',
-                        choices: [
-                            'Rdf',
-                            'ElasticSearch',
-                            'Solr',
-                            'SQL'
-                        ],
-                        message: 'Which caching system do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'caching',
-                        choices: [
-                            'none',
-                            'memcache',
-                            'ehcache'
-                        ],
-                        message: 'Which serialization system do you want to use?'
-                    },
-                    {
-                        type: 'list',
-                        name: 'serialization',
-                        choices: [
-                            'Jackson',
-                            'Stax',
-                            'OrgJson'
-                        ],
-                        message: 'Which indexing system do you want to use?'
-                    },
-                    {
-                        type: 'checkbox',
-                        name: 'features',
-                        choices: [
-                            'rest api',
-                            // 'reindexer',
-                            // 'metrics',
-                            // 'jmx',
-                            // 'version migration',
-                            'sample (heroes) web application'
-                        ],
-                        message: 'Other features?'
-                    }
-                ]
-            ).then( function ( answers )
-                    {
-                        this.log( 'app name', answers.name );
-                        this.log( 'Entity Stores:', answers.entitystore );
-                        this.log( 'Indexing:', answers.indexing );
-                        this.log( 'Caching:', answers.caching );
-                        this.log( 'Serialization:', answers.serialization );
-                        this.log( 'Features:', answers.features );
-                        polygene = answers;
-                        polygene.javaPackageDir = polygene.packagename.replace( '.', '/' );
-                        polygene.singletonApp = false;
-                        if( hasFeature( 'sample (heroes) web application' ) )
-                        {
-                            polygene.features.push( 'rest api' );
-                        }
-                    }.bind( this )
-            );
-        },
-
-        writing: function ()
-        {
-            copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "domain", "DomainLayer", !polygene.singeltonApp );
-            copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp );
-
-            copyPolygeneBootstrap( this, "config", "ConfigModule", true );
-
-            copyPolygeneBootstrap( this, "infrastructure", "FileConfigurationModule", true );
-
-            copyEntityStore( this, polygene.entitystore );
-
-            copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "SolrIndexingModule", hasIndexing( 'Solr' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "SqlIndexingModule", hasIndexing( 'Sql' ) );
-
-            copyPolygeneBootstrap( this, "infrastructure", "NoCachingModule", hasCaching( 'none' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MemcacheCachingModule", hasCaching( 'Memcache' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "EhCacheCachingModule", hasCaching( 'Ehcache' ) );
-
-            copyPolygeneBootstrap( this, "infrastructure", "JacksonSerializationModule", hasSerialization( 'Jackson' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "StaxSerializationModule", hasSerialization( 'Stax' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "OrgJsonSerializationModule", hasSerialization( 'Orgjson' ) );
-
-            copyPolygeneBootstrap( this, "connectivity", "RestApiModule", hasFeature( 'rest api' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "ReindexerModule", hasFeature( 'reindexer' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MetricsModule", hasFeature( 'metrics' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "JmxModule", hasFeature( 'jmx' ) );
-            copyPolygeneBootstrap( this, "infrastructure", "MigrationModule", hasFeature( 'version migration' ) );
-
-            copyPolygeneBootstrap( this, "domain", "CrudModule", true );
-            copyHeroesSampleApp( this );
-            copyPolygeneDomain( this, "security", "RestApiModule", "SecurityRepository", hasFeature( 'rest api' ) );
-
-            copyRestFeature( this, hasFeature( 'rest api' ) );
-
-            copyTemplate( this, 'buildtool/gradle-app.tmpl', 'app/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-bootstrap.tmpl', 'bootstrap/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-model.tmpl', 'model/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-rest.tmpl', 'rest/build.gradle' );
-            copyTemplate( this, 'buildtool/gradle-root.tmpl', 'build.gradle' );
-            copyTemplate( this, 'buildtool/settings.tmpl', 'settings.gradle' );
-            copyTemplate( this, 'buildtool/gradlew.tmpl', 'gradlew' );
-            copyTemplate( this, 'buildtool/gradlew-bat.tmpl', 'gradlew.bat' );
-            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.jar_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.jar' ) );
-            this.fs.copy( this.templatePath( 'buildtool/gradle-wrapper.properties_' ), this.destinationPath( 'gradle/wrapper/gradle-wrapper.properties' ) );
-        }
-    }
-);
-
-function copyPolygeneBootstrap( ctx, layer, moduleName, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      moduleName + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
-    }
-}
-
-function copyEntityStore( ctx, entityStoreName )
-{
-    copyTemplate( ctx,
-                  'StorageModule/bootstrap.tmpl',
-                  'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
-}
-
-function copyPolygeneApp( ctx, name, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      name + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
-
-        copyTemplate( ctx,
-                      name + '/app.tmpl',
-                      'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java' );
-
-        copyTemplate( ctx,
-                      name + '/webapp/',
-                      'app/src/main/webapp/' );
-    }
-}
-
-function copyPolygeneDomain( ctx, model, module, clazz, condition )
-{
-    if( condition )
-    {
-        copyTemplate( ctx,
-                      module + '/' + clazz + '.tmpl',
-                      'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
-    }
-}
-
-function copyRestFeature( ctx, condition )
-{
-    if( condition )
-    {
-        copyPolygeneBootstrap( ctx, "domain", "SecurityModule", true );
-
-        copyTemplate( ctx,
-                      'RestApiModule/SimpleEnroler.tmpl',
-                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java' );
-
-        copyTemplate( ctx,
-                      'RestApiModule/SimpleVerifier.tmpl',
-                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java' );
-
-        copyTemplate( ctx,
-                      'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
-                      'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
-    }
-}
-
-function copyHeroesSampleApp( ctx )
-{
-    copyPolygeneDomain( ctx, "heroes", "Heroes", "Hero", hasFeature( 'sample (heroes) web application' ) );
-    copyPolygeneApp( ctx, "Heroes", hasFeature( 'sample (heroes) web application' ) );
-    copyTemplate( ctx,
-                  'Heroes/web.tmpl',
-                  'app/src/main/webapp/WEB-INF/web.xml' );
-}
-
-function copyTemplate( ctx, from, to )
-{
-    ctx.fs.copyTpl(
-        ctx.templatePath( from ),
-        ctx.destinationPath( to ),
-        {
-            packageName: polygene.packagename,
-            hasFeature: hasFeature,
-            hasEntityStore: hasEntityStore,
-            hasIndexing: hasIndexing,
-            hasCaching: hasCaching,
-            polygene: polygene
-        }
-    );
-}
-
-function hasEntityStore( esType )
-{
-    return polygene.entitystore === esType;
-}
-
-function hasIndexing( indexingType )
-{
-    return polygene.indexing === indexingType;
-}
-
-function hasCaching( cachingType )
-{
-    return polygene.caching === cachingType;
-}
-
-function hasSerialization( serializer )
-{
-    return polygene.serialization === serializer;
-}
-
-function hasFeature( feature )
-{
-    return polygene.features.indexOf( feature ) >= 0;
-}
-
-function firstUpper( text )
-{
-    return text.charAt( 0 ).toUpperCase() + text.substring( 1 );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl b/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
deleted file mode 100644
index b152d3a..0000000
--- a/tools/generator-zest/app/templates/ConfigModule/bootstrap.tmpl
+++ /dev/null
@@ -1,41 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.config;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
-
-public class ConfigModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.layer );
-        new JacksonValueSerializationAssembler().visibleIn( Visibility.layer ).assemble( module );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
deleted file mode 100644
index bb81a83..0000000
--- a/tools/generator-zest/app/templates/ConfigurationLayer/bootstrap.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.config;
-
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class ConfigurationLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static String NAME;
-    private ModuleAssembly configModule;
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        configModule = createModule( layer, ConfigModule.class );
-        return layer;
-    }
-
-    public ModuleAssembly configModule()
-    {
-        return configModule;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl
deleted file mode 100644
index 941e77e..0000000
--- a/tools/generator-zest/app/templates/ConnectivityLayer/bootstrap.tmpl
+++ /dev/null
@@ -1,41 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.connectivity;
-
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class ConnectivityLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static String NAME;
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-<% if( hasFeature('rest api') ) { %>
-        createModule( layer, RestApiModule.class );
-<% } -%>
-        return layer;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl b/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl
deleted file mode 100644
index 0877723..0000000
--- a/tools/generator-zest/app/templates/CrudModule/bootstrap.tmpl
+++ /dev/null
@@ -1,38 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.domain;
-
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.library.restlet.assembly.CrudServiceAssembler;
-
-public class CrudModule
-    implements ModuleAssembler
-{
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        new CrudServiceAssembler().assemble( module );
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl
deleted file mode 100644
index 6285025..0000000
--- a/tools/generator-zest/app/templates/DomainLayer/bootstrap.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.domain;
-
-import java.util.function.Function;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class DomainLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    @Override
-    public LayerAssembly assemble(LayerAssembly layer)
-        throws AssemblyException
-    {
-        createModule( layer, CrudModule.class );
-        createModule( layer, SecurityModule.class );
-        return layer;
-    }
-
-    public static Function<Application, Module> typeFinder()
-    {
-        return application -> application.findModule( "Domain Layer", "Assets Module" );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl b/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl
deleted file mode 100644
index ab2ad2c..0000000
--- a/tools/generator-zest/app/templates/FileConfigurationModule/bootstrap.tmpl
+++ /dev/null
@@ -1,41 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
-
-public class FileConfigurationModule
-    implements ModuleAssembler
-{
-    public static String NAME;
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        new FileConfigurationAssembler().visibleIn( Visibility.layer ).assemble( module );
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/Hero.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/Hero.tmpl b/tools/generator-zest/app/templates/Heroes/Hero.tmpl
deleted file mode 100644
index c3c7ec9..0000000
--- a/tools/generator-zest/app/templates/Heroes/Hero.tmpl
+++ /dev/null
@@ -1,28 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.model.heroes;
-
-import org.apache.polygene.api.identity.HasIdentity;
-import org.apache.polygene.api.property.Property;
-
-public interface Hero extends HasIdentity
-{
-    Property<String> name();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/app.tmpl b/tools/generator-zest/app/templates/Heroes/app.tmpl
deleted file mode 100644
index 4878f81..0000000
--- a/tools/generator-zest/app/templates/Heroes/app.tmpl
+++ /dev/null
@@ -1,103 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.app;
-
-import java.lang.reflect.UndeclaredThrowableException;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
-import org.apache.polygene.library.restlet.ZrestApplication;
-import org.restlet.Context;
-import org.restlet.routing.Filter;
-import org.restlet.routing.Router;
-import org.restlet.security.Enroler;
-import org.restlet.security.Verifier;
-
-import <%= packageName %>.bootstrap.HeroesApplicationAssembler;
-import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
-import <%= packageName %>.bootstrap.connectivity.RestApiModule;
-import <%= packageName %>.model.heroes.Hero;
-import <%= packageName %>.rest.security.SimpleEnroler;
-import <%= packageName %>.rest.security.SimpleVerifier;
-
-public class Heroes extends ZrestApplication
-{
-
-    public Heroes( Context context )
-        throws AssemblyException
-    {
-        super( context );
-    }
-
-    @Override
-    protected void addRoutes( Router router )
-    {
-        addResourcePath( "heroes", Hero.class, "/" );
-    }
-
-    @Override
-    protected LayeredApplicationAssembler createApplicationAssembler( String mode )
-        throws AssemblyException
-    {
-        if( mode != null )
-        {
-            return new HeroesApplicationAssembler( Application.Mode.valueOf( mode ) );
-        }
-        return new HeroesApplicationAssembler( Application.Mode.production );
-    }
-
-    @Override
-    protected Verifier createVerifier()
-    {
-        return newObject( SimpleVerifier.class );
-    }
-
-    @Override
-    protected Enroler createEnroler()
-    {
-        return newObject( SimpleEnroler.class, this );
-    }
-
-    @Override
-    protected String getConnectivityLayer()
-    {
-        return ConnectivityLayer.NAME;
-    }
-
-    @Override
-    protected String getConnectivityModule()
-    {
-        return RestApiModule.NAME;
-    }
-
-    private <T> T newObject( Class<T> type, Object... uses )
-    {
-        try
-        {
-            T instamce = type.newInstance();
-            objectFactory.injectTo( instamce, uses );
-            return instamce;
-        }
-        catch( Exception e )
-        {
-            throw new UndeclaredThrowableException( e );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl b/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
deleted file mode 100644
index e3a9d06..0000000
--- a/tools/generator-zest/app/templates/Heroes/bootstrap.tmpl
+++ /dev/null
@@ -1,68 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.function.Function;
-
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
-
-import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
-import <%= packageName %>.bootstrap.domain.DomainLayer;
-import <%= packageName %>.bootstrap.config.ConfigurationLayer;
-import <%= packageName %>.bootstrap.infrastructure.InfrastructureLayer;
-
-public class HeroesApplicationAssembler extends LayeredApplicationAssembler
-{
-    private static final String NAME = "Heroes";
-    private static final String VERSION = "1.0.alpha";
-
-    public HeroesApplicationAssembler( Application.Mode mode )
-    throws AssemblyException
-    {
-        super( NAME, VERSION, mode );
-    }
-
-    @Override
-    protected void assembleLayers( ApplicationAssembly assembly )
-        throws AssemblyException
-    {
-        LayerAssembly configLayer = createLayer( ConfigurationLayer.class );
-        ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();
-        LayerAssembly domainLayer = createLayer( DomainLayer.class );
-        Function<Application, Module> typeFinder = DomainLayer.typeFinder();
-        LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );
-        LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );
-        connectivityLayer.uses( domainLayer );
-        domainLayer.uses( infraLayer );
-        infraLayer.uses( configLayer );
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/web.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/web.tmpl b/tools/generator-zest/app/templates/Heroes/web.tmpl
deleted file mode 100644
index dda4f37..0000000
--- a/tools/generator-zest/app/templates/Heroes/web.tmpl
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<%#
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-%>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
-         version="2.5">
-
-  <display-name><%= polygene.name %></display-name>
-
-
-  <servlet>
-    <servlet-name>Restlet</servlet-name>
-    <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
-    <init-param>
-      <param-name>org.apache.polygene.runtime.mode</param-name>
-      <param-value>development</param-value>
-    </init-param>
-    <init-param>
-      <!-- Application class name -->
-      <param-name>org.restlet.application</param-name>
-      <param-value><%= packageName %>.app.Heroes</param-value>
-    </init-param>
-    <init-param>
-      <!-- Protocols to be bound to-->
-      <param-name>org.restlet.clients</param-name>
-      <param-value>HTTP HTTPS</param-value>
-    </init-param>
-    <load-on-startup>1</load-on-startup>
-  </servlet>
-
-  <servlet-mapping>
-    <servlet-name>Restlet</servlet-name>
-    <url-pattern>/api/1/*</url-pattern>
-  </servlet-mapping>
-
-</web-app>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
deleted file mode 100644
index cb651f5..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.css
+++ /dev/null
@@ -1,34 +0,0 @@
-nav a {
-  padding: 5px 10px;
-  text-decoration: none;
-  margin-top: 10px;
-  display: inline-block;
-  background-color: #eee;
-  border-radius: 4px;
-}
-nav a:visited, a:link {
-  color: #607D8B;
-}
-nav a:hover {
-  color: #039be5;
-  background-color: #CFD8DC;
-}
-nav a.router-link-active {
-  color: #039be5;
-}
-h1 {
-  font-size: 1.2em;
-  color: #999;
-  margin-bottom: 0;
-}
-h2 {
-  font-size: 2em;
-  margin-top: 0;
-  padding-top: 0;
-}
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js
deleted file mode 100644
index 18aeea4..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js
+++ /dev/null
@@ -1,41 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var core_1 = require('angular2/core');
-var router_1 = require('angular2/router');
-var heroes_component_1 = require('./heroes.component');
-var hero_detail_component_1 = require('./hero-detail.component');
-var dashboard_component_1 = require('./dashboard.component');
-var hero_service_1 = require('./hero.service');
-var AppComponent = (function () {
-    function AppComponent() {
-        this.title = 'Tour of Heroes';
-    }
-    AppComponent = __decorate([
-        core_1.Component({
-            selector: 'my-app',
-            template: "\n    <h1>{{title}}</h1>\n    <nav>\n      <a [routerLink]=\"['Dashboard']\">Dashboard</a>\n      <a [routerLink]=\"['Heroes']\">Heroes</a>\n    </nav>\n    <router-outlet></router-outlet>\n  ",
-            styleUrls: ['app/app.component.css'],
-            directives: [router_1.ROUTER_DIRECTIVES],
-            providers: [hero_service_1.HeroService]
-        }),
-        router_1.RouteConfig([
-            // {path: '/', redirectTo: ['Dashboard'] },
-            { path: '/dashboard', name: 'Dashboard', component: dashboard_component_1.DashboardComponent, useAsDefault: true },
-            { path: '/heroes', name: 'Heroes', component: heroes_component_1.HeroesComponent },
-            { path: '/detail/:id', name: 'HeroDetail', component: hero_detail_component_1.HeroDetailComponent }
-        ])
-    ], AppComponent);
-    return AppComponent;
-}());
-exports.AppComponent = AppComponent;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=app.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js.map
deleted file mode 100644
index bade57d..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAwB,eAAe,CAAC,CAAA;AACxC,uBAA6C,iBAAiB,CAAC,CAAA;AAC/D,iCAA8B,oBAAoB,CAAC,CAAA;AACnD,sCAAkC,yBAAyB,CAAC,CAAA;AAC5D,oCAAiC,uBAAuB,CAAC,CAAA;AACzD,6BAA0B,gBAAgB,CAAC,CAAA;AAsB3C;IAAA;QACE,UAAK,GAAG,gBAAgB,CAAC;IAC3B,CAAC;IAtBD;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,kMAOT;YACD,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,UAAU,EAAE,CAAC,0BAAiB,CAAC;YAC/B,SAAS,EAAE,CAAC,0BAAW,CAAC;SACzB,CAAC;QACD,oBAAW,CAAC;YACX,2CAA2C;YAC3C,EAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,wCAAkB,EAAE,YAAY,EAAE,IAAI,EAAC;YAC1F,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kCAAe,EAAC;YAC7D,EAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,2CAAmB,EAAC;SAC1E,CAAC;oBAAA;IAGF,mBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,oBAAY,eAExB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
deleted file mode 100644
index 222874b..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/app.component.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import {Component} from 'angular2/core';
-import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
-import {HeroesComponent} from './heroes.component';
-import {HeroDetailComponent} from './hero-detail.component';
-import {DashboardComponent} from './dashboard.component';
-import {HeroService} from './hero.service';
-
-@Component({
-  selector: 'my-app',
-  template: `
-    <h1>{{title}}</h1>
-    <nav>
-      <a [routerLink]="['Dashboard']">Dashboard</a>
-      <a [routerLink]="['Heroes']">Heroes</a>
-    </nav>
-    <router-outlet></router-outlet>
-  `,
-  styleUrls: ['app/app.component.css'],
-  directives: [ROUTER_DIRECTIVES],
-  providers: [HeroService]
-})
-@RouteConfig([
-  // {path: '/', redirectTo: ['Dashboard'] },
-  {path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true},
-  {path: '/heroes', name: 'Heroes', component: HeroesComponent},
-  {path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent}
-])
-export class AppComponent {
-  title = 'Tour of Heroes';
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
deleted file mode 100644
index b9d3215..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.css
+++ /dev/null
@@ -1,67 +0,0 @@
-[class*='col-'] {
-  float: left;
-}
-*, *:after, *:before {
-	-webkit-box-sizing: border-box;
-	-moz-box-sizing: border-box;
-	box-sizing: border-box;
-}
-h3 {
-  text-align: center; margin-bottom: 0;
-}
-[class*='col-'] {
-  padding-right: 20px;
-  padding-bottom: 20px;
-}
-[class*='col-']:last-of-type {
-  padding-right: 0;
-}
-.grid {
-  margin: 0;
-}
-.col-1-4 {
-  width: 25%;
-}
-.module {
-	padding: 20px;
-	text-align: center;
-	color: #eee;
-	max-height: 120px;
-	min-width: 120px;
-	background-color: #607D8B;
-	border-radius: 2px;
-}
-h4 {
-  position: relative;
-}
-.module:hover {
-  background-color: #EEE;
-  cursor: pointer;
-  color: #607d8b;
-}
-.grid-pad {
-  padding: 10px 0;
-}
-.grid-pad > [class*='col-']:last-of-type {
-  padding-right: 20px;
-}
-@media (max-width: 600px) {
-	.module {
-	  font-size: 10px;
-	  max-height: 75px; }
-}
-@media (max-width: 1024px) {
-	.grid {
-	  margin: 0;
-	}
-	.module {
-	  min-width: 60px;
-	}
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
deleted file mode 100644
index 3fc7517..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<h3>Top Heroes</h3>
-<div class="grid grid-pad">
-  <div *ngFor="#hero of heroes" class="col-1-4" (click)="gotoDetail(hero)">
-    <div class="module hero">
-      <h4>{{hero.name}}</h4>
-    </div>
-  </div>
-</div>
-
-
-<!-- 
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js
deleted file mode 100644
index 9c69780..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js
+++ /dev/null
@@ -1,38 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var core_1 = require('angular2/core');
-var DashboardComponent = (function () {
-    function DashboardComponent(_heroService, _router) {
-        this._heroService = _heroService;
-        this._router = _router;
-        this.heroes = [];
-    }
-    DashboardComponent.prototype.ngOnInit = function () {
-        var _this = this;
-        this._heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes.slice(1, 5); });
-    };
-    DashboardComponent.prototype.gotoDetail = function (hero) {
-        var link = ['HeroDetail', { id: hero.id }];
-        this._router.navigate(link);
-    };
-    DashboardComponent = __decorate([
-        core_1.Component({
-            selector: 'my-dashboard',
-            templateUrl: 'app/dashboard.component.html',
-            styleUrls: ['app/dashboard.component.css']
-        })
-    ], DashboardComponent);
-    return DashboardComponent;
-}());
-exports.DashboardComponent = DashboardComponent;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=dashboard.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js.map
deleted file mode 100644
index 5bc16f0..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"dashboard.component.js","sourceRoot":"","sources":["dashboard.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAUhD;IAGE,4BAAoB,YAAyB,EAAU,OAAe;QAAlD,iBAAY,GAAZ,YAAY,CAAa;QAAU,YAAO,GAAP,OAAO,CAAQ;QAFtE,WAAM,GAAW,EAAE,CAAC;IAEsD,CAAC;IAE3E,qCAAQ,GAAR;QAAA,iBAEC;QADC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAC,CAAC,CAAC,EAA/B,CAA+B,CAAC,CAAC;IAChF,CAAC;IAED,uCAAU,GAAV,UAAW,IAAU;QACnB,IAAI,IAAI,GAAG,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAjBH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE,8BAA8B;YAC3C,SAAS,EAAE,CAAC,6BAA6B,CAAC;SAC3C,CAAC;0BAAA;IAcF,yBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,0BAAkB,qBAa9B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
deleted file mode 100644
index c8160d1..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/dashboard.component.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import {Component, OnInit} from 'angular2/core';
-import {Router} from 'angular2/router';
-import {Hero} from './hero';
-import {HeroService} from './hero.service';
-
-@Component({
-  selector: 'my-dashboard',
-  templateUrl: 'app/dashboard.component.html',
-  styleUrls: ['app/dashboard.component.css']
-})
-export class DashboardComponent implements OnInit {
-  heroes: Hero[] = [];
-
-  constructor(private _heroService: HeroService, private _router: Router) { }
-
-  ngOnInit() {
-    this._heroService.getHeroes().then(heroes => this.heroes = heroes.slice(1,5));
-  }
-
-  gotoDetail(hero: Hero) {
-    let link = ['HeroDetail', { id: hero.id }];
-    this._router.navigate(link);
-  }
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
deleted file mode 100644
index 2a0e285..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.css
+++ /dev/null
@@ -1,36 +0,0 @@
-label {
-  display: inline-block;
-  width: 3em;
-  margin: .5em 0;
-  color: #607D8B;
-  font-weight: bold;
-}
-input {
-  height: 2em;
-  font-size: 1em;
-  padding-left: .4em;
-}
-button {
-  margin-top: 20px;
-  font-family: Arial;
-  background-color: #eee;
-  border: none;
-  padding: 5px 10px;
-  border-radius: 4px;
-  cursor: pointer; cursor: hand;
-}
-button:hover {
-  background-color: #cfd8dc;
-}
-button:disabled {
-  background-color: #eee;
-  color: #ccc; 
-  cursor: auto;
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
deleted file mode 100644
index 1e85e75..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<div *ngIf="hero">
-	<h2>{{hero.name}} details!</h2>
-	<div>
-		<label>id: </label>{{hero.id}}</div>
-	<div>
-		<label>name: </label>
-		<input [(ngModel)]="hero.name" placeholder="name"/>
-	</div>
-	<button (click)="goBack()">Back</button>
-</div>
-
-<!-- 
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js
deleted file mode 100644
index 56d5fa5..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js
+++ /dev/null
@@ -1,37 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var core_1 = require('angular2/core');
-var HeroDetailComponent = (function () {
-    function HeroDetailComponent(_heroService, _routeParams) {
-        this._heroService = _heroService;
-        this._routeParams = _routeParams;
-    }
-    HeroDetailComponent.prototype.ngOnInit = function () {
-        var _this = this;
-        var id = +this._routeParams.get('id');
-        this._heroService.getHero(id).then(function (hero) { return _this.hero = hero; });
-    };
-    HeroDetailComponent.prototype.goBack = function () {
-        window.history.back();
-    };
-    HeroDetailComponent = __decorate([
-        core_1.Component({
-            selector: 'my-hero-detail',
-            templateUrl: 'app/hero-detail.component.html',
-            styleUrls: ['app/hero-detail.component.css']
-        })
-    ], HeroDetailComponent);
-    return HeroDetailComponent;
-}());
-exports.HeroDetailComponent = HeroDetailComponent;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=hero-detail.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js.map
deleted file mode 100644
index 3928563..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAWhD;IAGE,6BAAoB,YAAyB,EACnC,YAAyB;QADf,iBAAY,GAAZ,YAAY,CAAa;QACnC,iBAAY,GAAZ,YAAY,CAAa;IACnC,CAAC;IAED,sCAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IAC/D,CAAC;IAED,oCAAM,GAAN;QACE,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;IAnBH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,gCAAgC;YAC7C,SAAS,EAAE,CAAC,+BAA+B,CAAC;SAC7C,CAAC;2BAAA;IAgBF,0BAAC;AAAD,CAAC,AAfD,IAeC;AAfY,2BAAmB,sBAe/B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
deleted file mode 100644
index 0181847..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero-detail.component.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import {Component, OnInit} from 'angular2/core';
-import {RouteParams} from 'angular2/router';
-
-import {Hero} from './hero';
-import {HeroService} from './hero.service';
-
-@Component({
-  selector: 'my-hero-detail',
-  templateUrl: 'app/hero-detail.component.html',
-  styleUrls: ['app/hero-detail.component.css']
-})
-export class HeroDetailComponent implements OnInit {
-  hero: Hero;
-
-  constructor(private _heroService: HeroService,
-    private _routeParams: RouteParams) {
-  }
-
-  ngOnInit() {
-    let id = +this._routeParams.get('id');
-    this._heroService.getHero(id).then(hero => this.hero = hero);
-  }
-
-  goBack() {
-    window.history.back();
-  }
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js
deleted file mode 100644
index 0c6fe2e..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js
+++ /dev/null
@@ -1,13 +0,0 @@
-"use strict";
-var Hero = (function () {
-    function Hero() {
-    }
-    return Hero;
-}());
-exports.Hero = Hero;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=hero.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js.map
deleted file mode 100644
index 4a29533..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"hero.js","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":";AAAA;IAAA;IAGA,CAAC;IAAD,WAAC;AAAD,CAAC,AAHD,IAGC;AAHY,YAAI,OAGhB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js
deleted file mode 100644
index 3f92669..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var core_1 = require('angular2/core');
-var mock_heroes_1 = require('./mock-heroes');
-var HeroService = (function () {
-    function HeroService() {
-    }
-    HeroService.prototype.getHeroes = function () {
-        return Promise.resolve(mock_heroes_1.HEROES);
-    };
-    HeroService.prototype.getHero = function (id) {
-        return Promise.resolve(mock_heroes_1.HEROES).then(function (heroes) { return heroes.filter(function (hero) { return hero.id === id; })[0]; });
-    };
-    HeroService = __decorate([
-        core_1.Injectable()
-    ], HeroService);
-    return HeroService;
-}());
-exports.HeroService = HeroService;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=hero.service.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js.map
deleted file mode 100644
index 2485ba7..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"hero.service.js","sourceRoot":"","sources":["hero.service.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAyB,eAAe,CAAC,CAAA;AACzC,4BAAyB,eAAe,CAAC,CAAA;AAGzC;IAAA;IAUA,CAAC;IATC,+BAAS,GAAT;QACE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAM,CAAC,CAAC;IACjC,CAAC;IAEF,6BAAO,GAAP,UAAQ,EAAU;QACf,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAM,CAAC,CAAC,IAAI,CACjC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,MAAM,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC,CAAC,CAAC,EAAxC,CAAwC,CACnD,CAAC;IACJ,CAAC;IAVH;QAAC,iBAAU,EAAE;mBAAA;IAWb,kBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,mBAAW,cAUvB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
deleted file mode 100644
index aee78a1..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.service.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import {Injectable} from 'angular2/core';
-import {HEROES}     from './mock-heroes';
-
-@Injectable()
-export class HeroService {
-  getHeroes() {
-    return Promise.resolve(HEROES);
-  }
-
-	getHero(id: number) {
-    return Promise.resolve(HEROES).then(
-      heroes => heroes.filter(hero => hero.id === id)[0]
-    );
-  }
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
deleted file mode 100644
index 812726c..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/hero.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-export class Hero {
-	id: number;
-	name: string;
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file


[41/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/GePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/GePredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/GePredicate.java
new file mode 100644
index 0000000..a9e7923
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/GePredicate.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Greater or equals Specification.
+ */
+public class GePredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public GePredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    protected boolean compare( T value )
+    {
+        return ( (Comparable) value ).compareTo( this.value ) >= 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + ">=" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/GtPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/GtPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/GtPredicate.java
new file mode 100644
index 0000000..7558c8b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/GtPredicate.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Greater than Specification.
+ */
+public class GtPredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public GtPredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    protected boolean compare( T value )
+    {
+        return ( (Comparable) value ).compareTo( this.value ) > 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + ">" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/LePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/LePredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/LePredicate.java
new file mode 100644
index 0000000..a2ff287
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/LePredicate.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Less or equals Specification.
+ */
+public class LePredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public LePredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    protected boolean compare( T value )
+    {
+        return ( (Comparable) value ).compareTo( this.value ) <= 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "<=" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/LtPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/LtPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/LtPredicate.java
new file mode 100644
index 0000000..da2fb04
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/LtPredicate.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Lesser than Specification.
+ */
+public class LtPredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public LtPredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    protected boolean compare( T value )
+    {
+        return ( (Comparable) value ).compareTo( this.value ) < 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "<" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationContainsPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationContainsPredicate.java
new file mode 100644
index 0000000..34c3161
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationContainsPredicate.java
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * ManyAssociation Contains Specification.
+ */
+public class ManyAssociationContainsPredicate<T>
+    extends ExpressionPredicate
+{
+    private final ManyAssociationFunction<T> manyAssociationFunction;
+    private final T value;
+
+    public ManyAssociationContainsPredicate( ManyAssociationFunction<T> manyAssociationFunction, T value )
+    {
+        this.manyAssociationFunction = manyAssociationFunction;
+        this.value = value;
+    }
+
+    public ManyAssociationFunction<T> manyAssociation()
+    {
+        return manyAssociationFunction;
+    }
+
+    public T value()
+    {
+        return value;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        ManyAssociation<T> collection = manyAssociationFunction.apply( item );
+        if( collection == null )
+        {
+            return false;
+        }
+        return collection.contains( value );
+    }
+
+    @Override
+    public String toString()
+    {
+        return manyAssociationFunction + " contains:" + value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationFunction.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationFunction.java
new file mode 100644
index 0000000..4d91a24
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ManyAssociationFunction.java
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.lang.reflect.Proxy;
+import java.util.function.Function;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+
+/**
+ * Function to get Entity ManyAssociations.
+ */
+public class ManyAssociationFunction<T>
+    implements Function<Composite, ManyAssociation<T>>
+{
+    private final AssociationFunction<?> traversedAssociation;
+    private final ManyAssociationFunction<?> traversedManyAssociation;
+    private final NamedAssociationFunction<?> traversedNamedAssociation;
+    private final AccessibleObject accessor;
+
+    public ManyAssociationFunction( AssociationFunction<?> traversedAssociation,
+                                    ManyAssociationFunction<?> traversedManyAssociation,
+                                    NamedAssociationFunction<?> traversedNamedAssociation,
+                                    AccessibleObject accessor
+    )
+    {
+        this.traversedAssociation = traversedAssociation;
+        this.traversedManyAssociation = traversedManyAssociation;
+        this.traversedNamedAssociation = traversedNamedAssociation;
+        this.accessor = accessor;
+    }
+
+    public AssociationFunction<?> traversedAssociation()
+    {
+        return traversedAssociation;
+    }
+
+    public ManyAssociationFunction<?> traversedManyAssociation()
+    {
+        return traversedManyAssociation;
+    }
+
+    public NamedAssociationFunction<?> traversedNamedAssociation()
+    {
+        return traversedNamedAssociation;
+    }
+
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public ManyAssociation<T> apply( Composite entity )
+    {
+        try
+        {
+            Object target = entity;
+            if( traversedAssociation != null )
+            {
+                target = traversedAssociation.apply( entity ).get();
+            }
+            if( traversedManyAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot traverse ManyAssociations" );
+            }
+            if( traversedNamedAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot traverse NamedAssociations" );
+            }
+
+            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
+            return ( (AssociationStateHolder) handler.state() ).manyAssociationFor( accessor );
+        }
+        catch( IllegalArgumentException e )
+        {
+            throw e;
+        }
+        catch( Throwable e )
+        {
+            throw new IllegalArgumentException( e );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        if( traversedAssociation != null )
+        {
+            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
+        }
+        else
+        {
+            return ( (Member) accessor ).getName();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/MatchesPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/MatchesPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/MatchesPredicate.java
new file mode 100644
index 0000000..bf050c0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/MatchesPredicate.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Regular expression match Specification.
+ */
+public class MatchesPredicate
+    extends ExpressionPredicate
+{
+    private PropertyFunction<String> property;
+    private Object value;
+
+    public MatchesPredicate( PropertyFunction<String> property, String regexp )
+    {
+        this.property = property;
+        this.value = regexp;
+    }
+
+    public MatchesPredicate( PropertyFunction<String> property, Variable variable )
+    {
+        this.property = property;
+        this.value = variable;
+    }
+
+    public PropertyFunction<String> property()
+    {
+        return property;
+    }
+
+    public Object value()
+    {
+        return value;
+    }
+
+    public String regexp()
+    {
+        return ( String ) value;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Property<String> prop = property.apply( item );
+
+        if( prop == null )
+        {
+            return false;
+        }
+
+        String val = prop.get();
+
+        if( val == null )
+        {
+            return false;
+        }
+
+        return val.matches( ( String ) value );
+    }
+
+    @Override
+    public String toString()
+    {
+        return "( " + property + " matches " + "\"" + value + "\"" + " )";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsNamePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsNamePredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsNamePredicate.java
new file mode 100644
index 0000000..b5d2f64
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsNamePredicate.java
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * NamedAssociation Contains Specification.
+ */
+public class NamedAssociationContainsNamePredicate<T>
+    extends ExpressionPredicate
+{
+    private final NamedAssociationFunction<T> namedAssociationFunction;
+    private final String name;
+
+    public NamedAssociationContainsNamePredicate( NamedAssociationFunction<T> namedAssociationFunction, String name )
+    {
+        this.namedAssociationFunction = namedAssociationFunction;
+        this.name = name;
+    }
+
+    public NamedAssociationFunction<T> namedAssociation()
+    {
+        return namedAssociationFunction;
+    }
+
+    public String name()
+    {
+        return name;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        NamedAssociation<T> collection = namedAssociationFunction.apply( item );
+        if( collection == null )
+        {
+            return false;
+        }
+        return collection.containsName( name );
+    }
+
+    @Override
+    public String toString()
+    {
+        return namedAssociationFunction + " contains name:" + name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsPredicate.java
new file mode 100644
index 0000000..6d13fb6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationContainsPredicate.java
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * NamedAssociation Contains Specification.
+ */
+public class NamedAssociationContainsPredicate<T>
+    extends ExpressionPredicate
+{
+    private final NamedAssociationFunction<T> namedAssociationFunction;
+    private final T value;
+
+    public NamedAssociationContainsPredicate( NamedAssociationFunction<T> namedAssociationFunction, T value )
+    {
+        this.namedAssociationFunction = namedAssociationFunction;
+        this.value = value;
+    }
+
+    public NamedAssociationFunction<T> namedAssociation()
+    {
+        return namedAssociationFunction;
+    }
+
+    public T value()
+    {
+        return value;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        NamedAssociation<T> collection = namedAssociationFunction.apply( item );
+        if( collection == null )
+        {
+            return false;
+        }
+        return collection.nameOf( value ) != null;
+    }
+
+    @Override
+    public String toString()
+    {
+        return namedAssociationFunction + " contains:" + value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationFunction.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationFunction.java
new file mode 100644
index 0000000..9631612
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NamedAssociationFunction.java
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.lang.reflect.Proxy;
+import java.util.function.Function;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+
+/**
+ * Function to get Entity NamedAssociations.
+ */
+public class NamedAssociationFunction<T>
+    implements Function<Composite, NamedAssociation<T>>
+{
+    private final AssociationFunction<?> traversedAssociation;
+    private final ManyAssociationFunction<?> traversedManyAssociation;
+    private final NamedAssociationFunction<?> traversedNamedAssociation;
+    private final AccessibleObject accessor;
+
+    public NamedAssociationFunction( AssociationFunction<?> traversedAssociation,
+                                     ManyAssociationFunction<?> traversedManyAssociation,
+                                     NamedAssociationFunction<?> traversedNamedAssociation,
+                                     AccessibleObject accessor
+    )
+    {
+        this.traversedAssociation = traversedAssociation;
+        this.traversedManyAssociation = traversedManyAssociation;
+        this.traversedNamedAssociation = traversedNamedAssociation;
+        this.accessor = accessor;
+    }
+
+    public AssociationFunction<?> traversedAssociation()
+    {
+        return traversedAssociation;
+    }
+
+    public ManyAssociationFunction<?> traversedManyAssociation()
+    {
+        return traversedManyAssociation;
+    }
+
+    public NamedAssociationFunction<?> traversedNamedAssociation()
+    {
+        return traversedNamedAssociation;
+    }
+
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public NamedAssociation<T> apply( Composite entity )
+    {
+        try
+        {
+            Object target = entity;
+            if( traversedAssociation != null )
+            {
+                target = traversedAssociation.apply( entity ).get();
+            }
+            if( traversedManyAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot traverse ManyAssociations" );
+            }
+            if( traversedNamedAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot traverse NamedAssociations" );
+            }
+
+            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
+            return ( (AssociationStateHolder) handler.state() ).namedAssociationFor( accessor );
+        }
+        catch( IllegalArgumentException e )
+        {
+            throw e;
+        }
+        catch( Throwable e )
+        {
+            throw new IllegalArgumentException( e );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        if( traversedAssociation != null )
+        {
+            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
+        }
+        else
+        {
+            return ( (Member) accessor ).getName();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/NePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/NePredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NePredicate.java
new file mode 100644
index 0000000..eb6fd41
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/NePredicate.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Not equals Specification.
+ */
+public class NePredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public NePredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    protected boolean compare( T value )
+    {
+        return !value.equals( this.value );
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "!=" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/Notpredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/Notpredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/Notpredicate.java
new file mode 100644
index 0000000..59b3fcc
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/Notpredicate.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * NOT Specification.
+ */
+public class Notpredicate implements Predicate<Composite>
+{
+    private Predicate<Composite> operand;
+
+    public Notpredicate( Predicate<Composite> operand )
+    {
+        this.operand = operand;
+    }
+
+    public Predicate<Composite> operand()
+    {
+        return operand;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        return operand.negate().test( item );
+    }
+
+    @Override
+    public String toString()
+    {
+        return "!" + operand.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrPredicate.java
new file mode 100644
index 0000000..400d415
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrPredicate.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.Collection;
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * OR Specification.
+ */
+public class OrPredicate
+    extends BinaryPredicate
+{
+
+    public OrPredicate( Collection<Predicate<Composite>> operands )
+    {
+        super( operands );
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Predicate<Composite> master = t -> false;
+        for( Predicate<Composite> p : operands )
+        {
+            master = master.or( p );
+        }
+        return master.test( item );
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "(" );
+        String or = "";
+        for( Predicate<Composite> operand : operands )
+        {
+            sb.append( or ).append( operand );
+            or = " or ";
+        }
+        return sb.append( ")" ).toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrderBy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrderBy.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrderBy.java
new file mode 100644
index 0000000..7c1e4e1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/OrderBy.java
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Query sorting segment.
+ */
+public class OrderBy
+{
+    /**
+     * Order direction.
+     */
+    public enum Order
+    {
+        ASCENDING, DESCENDING
+    }
+
+    /**
+     * Order.
+     */
+    private final PropertyFunction<?> propertyReference;
+    /**
+     * Direction.
+     */
+    private final Order order;
+
+    /**
+     * Constructor.
+     *
+     * @param propertyReference property that determines the order; cannot be null
+     * @param order             direction
+     *
+     * @throws IllegalArgumentException - If property is null
+     */
+    public OrderBy( final PropertyFunction<?> propertyReference,
+                    final Order order
+    )
+    {
+        if( propertyReference == null )
+        {
+            throw new IllegalArgumentException( "Ordering property cannot be null" );
+        }
+        this.propertyReference = propertyReference;
+        this.order = order;
+    }
+
+    /**
+     * Getter.
+     *
+     * @return property; cannot be null
+     */
+    public PropertyFunction<?> property()
+    {
+        return propertyReference;
+    }
+
+    /**
+     * Getter.
+     *
+     * @return direction; cannot be null
+     */
+    public Order order()
+    {
+        return order;
+    }
+
+    @Override
+    public String toString()
+    {
+        return new StringBuilder()
+            .append( propertyReference )
+            .append( " " )
+            .append( order )
+            .toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyFunction.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyFunction.java
new file mode 100644
index 0000000..f37e2c1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyFunction.java
@@ -0,0 +1,180 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.function.Function;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.NotQueryableException;
+import org.apache.polygene.api.query.QueryExpressionException;
+import org.apache.polygene.api.util.Classes;
+
+import static org.apache.polygene.api.util.Classes.typeOf;
+
+/**
+ * Function to get Entity Properties.
+ */
+public class PropertyFunction<T>
+    implements Function<Composite, Property<T>>
+{
+    private final PropertyFunction<?> traversedProperty;
+    private final AssociationFunction<?> traversedAssociation;
+    private final ManyAssociationFunction<?> traversedManyAssociation;
+    private final NamedAssociationFunction<?> traversedNamedAssociation;
+    private final AccessibleObject accessor;
+
+    public PropertyFunction( PropertyFunction<?> traversedProperty,
+                             AssociationFunction<?> traversedAssociation,
+                             ManyAssociationFunction<?> traversedManyAssociation,
+                             NamedAssociationFunction<?> traversedNamedAssociation,
+                             AccessibleObject accessor
+    )
+    {
+        this.traversedProperty = traversedProperty;
+        this.traversedAssociation = traversedAssociation;
+        this.traversedManyAssociation = traversedManyAssociation;
+        this.traversedNamedAssociation = traversedNamedAssociation;
+        this.accessor = accessor;
+
+        // Verify that the property accessor is not marked as non queryable
+        NotQueryableException.throwIfNotQueryable( accessor );
+        // Verify that the property type itself (value composites) is not marked as non queryable
+
+        Type returnType = typeOf( accessor );
+        if( !Property.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) ) )
+        {
+            throw new QueryExpressionException( "Not a property type:" + returnType );
+        }
+        Type propertyTypeAsType = GenericPropertyInfo.toPropertyType( returnType );
+        if( propertyTypeAsType instanceof ParameterizedType )
+        {
+            propertyTypeAsType = ( (ParameterizedType) propertyTypeAsType ).getRawType();
+        }
+
+        if( !( propertyTypeAsType instanceof Class ) )
+        {
+            throw new QueryExpressionException( "Unsupported property type:" + propertyTypeAsType );
+        }
+        @SuppressWarnings( "unchecked" )
+        Class<T> type = (Class<T>) propertyTypeAsType;
+        NotQueryableException.throwIfNotQueryable( type );
+    }
+
+    public PropertyFunction<?> traversedProperty()
+    {
+        return traversedProperty;
+    }
+
+    public AssociationFunction<?> traversedAssociation()
+    {
+        return traversedAssociation;
+    }
+
+    public ManyAssociationFunction<?> traversedManyAssociation()
+    {
+        return traversedManyAssociation;
+    }
+
+    public NamedAssociationFunction<?> traversedNamedAssociation()
+    {
+        return traversedNamedAssociation;
+    }
+
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public Property<T> apply( Composite entity )
+    {
+        try
+        {
+            Object target = entity;
+            if( traversedProperty != null )
+            {
+                Property<?> property = traversedProperty.apply( entity );
+                if( property == null )
+                {
+                    return null;
+                }
+                target = property.get();
+            }
+            else if( traversedAssociation != null )
+            {
+                Association<?> association = traversedAssociation.apply( entity );
+                if( association == null )
+                {
+                    return null;
+                }
+                target = association.get();
+            }
+            else if( traversedManyAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot evaluate a ManyAssociation" );
+            }
+            else if( traversedNamedAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot evaluate a NamedAssociation" );
+            }
+
+            if( target == null )
+            {
+                return null;
+            }
+
+            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
+            return handler.state().propertyFor( accessor );
+        }
+        catch( IllegalArgumentException e )
+        {
+            throw e;
+        }
+        catch( Throwable e )
+        {
+            throw new IllegalArgumentException( e );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        if( traversedProperty != null )
+        {
+            return traversedProperty.toString() + "." + ( (Member) accessor ).getName();
+        }
+        else if( traversedAssociation != null )
+        {
+            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
+        }
+        else
+        {
+            return ( (Member) accessor ).getName();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNotNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNotNullPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNotNullPredicate.java
new file mode 100644
index 0000000..b029a5b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNotNullPredicate.java
@@ -0,0 +1,61 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Property not null Specification.
+ */
+public class PropertyNotNullPredicate<T>
+    extends ExpressionPredicate
+{
+    private PropertyFunction<T> property;
+
+    public PropertyNotNullPredicate( PropertyFunction<T> property )
+    {
+        this.property = property;
+    }
+
+    public PropertyFunction<T> property()
+    {
+        return property;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Property<T> prop = property.apply( item );
+
+        if( prop == null )
+        {
+            return false;
+        }
+
+        return prop.get() != null;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "is not null";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNullPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNullPredicate.java
new file mode 100644
index 0000000..8de2630
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyNullPredicate.java
@@ -0,0 +1,61 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Property null Specification.
+ */
+public class PropertyNullPredicate<T>
+    extends ExpressionPredicate
+{
+    private PropertyFunction<T> property;
+
+    public PropertyNullPredicate( PropertyFunction<T> property )
+    {
+        this.property = property;
+    }
+
+    public PropertyFunction<T> property()
+    {
+        return property;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Property<T> prop = property.apply( item );
+
+        if( prop == null )
+        {
+            return true;
+        }
+
+        return prop.get() == null;
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "is null";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyReference.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyReference.java
new file mode 100644
index 0000000..45a9476
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/PropertyReference.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.function.Function;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Property Reference.
+ */
+public interface PropertyReference
+{
+    <T> Function<Composite, Property<T>> reference();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/QuerySpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/QuerySpecification.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/QuerySpecification.java
new file mode 100644
index 0000000..6e30aea
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/QuerySpecification.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * This should be used when doing native queries, such as SQL, SPARQL or similar. EntityFinders can choose
+ * what type of query languages they can understand by checking the language property of a QuerySpecification
+ */
+public class QuerySpecification
+    implements Predicate<Composite>
+{
+    public static boolean isQueryLanguage( String language, Predicate<Composite> specification )
+    {
+        if( !( specification instanceof QuerySpecification ) )
+        {
+            return false;
+        }
+
+        return ( (QuerySpecification) specification ).language().equals( language );
+    }
+
+    private String language;
+    private String query;
+
+    public QuerySpecification( String language, String query )
+    {
+        this.language = language;
+        this.query = query;
+    }
+
+    public String language()
+    {
+        return language;
+    }
+
+    public String query()
+    {
+        return query;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        return false;
+    }
+
+    @Override
+    public String toString()
+    {
+        return language + ":" + query;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/Variable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/Variable.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/Variable.java
new file mode 100644
index 0000000..a5cfe78
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/Variable.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Query Variable name.
+ */
+public class Variable
+{
+    private String name;
+
+    public Variable( String name )
+    {
+        this.name = name;
+    }
+
+    public String variableName()
+    {
+        return name;
+    }
+
+    @Override
+    public String toString()
+    {
+        return name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/package.html b/core/api/src/main/java/org/apache/polygene/api/query/grammar/package.html
new file mode 100644
index 0000000..4a3e2f1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Query Grammar.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/package.html b/core/api/src/main/java/org/apache/polygene/api/query/package.html
new file mode 100644
index 0000000..c3ee7ad
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Query API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/Availability.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/Availability.java b/core/api/src/main/java/org/apache/polygene/api/service/Availability.java
new file mode 100644
index 0000000..974a32e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/Availability.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+/**
+ * Services can implement this interface in order to allow Polygene to ask
+ * it whether it is currently available for use or not. This is accessed
+ * by clients through the ServiceReference of the service. Services that do not
+ * implement this are always considered to be available.
+ */
+public interface Availability
+{
+    /**
+     * Implementations should return true if the underlying service is currently available for use.
+     *
+     * Reasons why a service might not be available is either if it has been configured not to be (see
+     * the Enabled interface), or if an underlying resource is currently unavailable.
+     *
+     * @return true if the service is available, false otherwise.
+     */
+    boolean isAvailable();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/DuplicateServiceIdentityException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/DuplicateServiceIdentityException.java b/core/api/src/main/java/org/apache/polygene/api/service/DuplicateServiceIdentityException.java
new file mode 100644
index 0000000..e404666
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/DuplicateServiceIdentityException.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+
+/**
+ * Thrown when a duplicate service reference is detected.
+ */
+public class DuplicateServiceIdentityException
+    extends InvalidApplicationException
+{
+    public DuplicateServiceIdentityException( String string )
+    {
+        super( string );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ImportedServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ImportedServiceDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/service/ImportedServiceDescriptor.java
new file mode 100644
index 0000000..558b7ed
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ImportedServiceDescriptor.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.identity.Identifiable;
+
+/**
+ * {@code ServiceDescriptor} provides meta information of a service.
+ */
+public interface ImportedServiceDescriptor
+    extends ModelDescriptor, Identifiable
+{
+    Class<? extends ServiceImporter> serviceImporter();
+
+    Class<?> type();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/NoSuchServiceException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/NoSuchServiceException.java b/core/api/src/main/java/org/apache/polygene/api/service/NoSuchServiceException.java
new file mode 100644
index 0000000..31523b5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/NoSuchServiceException.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import java.util.stream.Collectors;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.NoSuchCompositeException;
+import org.apache.polygene.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, TypeLookup typeLookup )
+    {
+        super( "ServiceComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
+    }
+
+    private static String formatVisibleTypes( TypeLookup typeLookup )
+    {
+        return typeLookup.allServices()
+            .map( NoSuchServiceException::typeOf )
+            .collect( Collectors.joining( "\n", "Visible service types are:\n", "" ) );
+    }
+
+    private static String typeOf( ModelDescriptor descriptor )
+    {
+        if( descriptor instanceof CompositeDescriptor )
+        {
+            return ( (CompositeDescriptor) descriptor ).primaryType().getName();
+        }
+        return descriptor.types().map( Class::getName ).collect( Collectors.joining( ",", "[", "]") );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivation.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivation.java
new file mode 100644
index 0000000..38c4020
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivation.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.activation.Activators;
+
+/**
+ * Convenience interface for simple Service Activation.
+ *
+ * Let your ServiceComposite extends ServiceActivation and implement it in one of its Mixins.
+ * A corresponding Activator is automatically registered.
+ */
+@Activators( ServiceActivation.ServiceActivator.class )
+public interface ServiceActivation
+{
+
+    /**
+     * Called after ServiceComposite Activation.
+     */
+    void activateService()
+        throws Exception;
+
+    /**
+     * Called before ServiceComposite Passivation.
+     */
+    void passivateService()
+        throws Exception;
+
+    /**
+     * Service Activator.
+     */
+    class ServiceActivator
+        extends ServiceActivatorAdapter<ServiceActivation>
+    {
+
+        @Override
+        public void afterActivation( ServiceReference<ServiceActivation> activated )
+            throws Exception
+        {
+            activated.get().activateService();
+        }
+
+        @Override
+        public void beforePassivation( ServiceReference<ServiceActivation> passivating )
+            throws Exception
+        {
+            passivating.get().passivateService();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivatorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivatorAdapter.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivatorAdapter.java
new file mode 100644
index 0000000..032064a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceActivatorAdapter.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.activation.Activator;
+
+/**
+ * Adapter for Service Activator.
+ *
+ * @param <ServiceType> Type of the service.
+ */
+public class ServiceActivatorAdapter<ServiceType>
+    implements Activator<ServiceReference<ServiceType>>
+{
+    /**
+     * Called before Service activation.
+     * @param activating Activating Service
+     */
+    @Override
+    public void beforeActivation( ServiceReference<ServiceType> activating )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called after Service activation.
+     * @param activated Activated Service
+     */
+    @Override
+    public void afterActivation( ServiceReference<ServiceType> activated )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called before Service passivation.
+     * @param passivating Passivating Service
+     */
+    @Override
+    public void beforePassivation( ServiceReference<ServiceType> passivating )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called after Service passivation.
+     * @param passivated Passivated Service
+     */
+    @Override
+    public void afterPassivation( ServiceReference<ServiceType> passivated )
+        throws Exception
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceComposite.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceComposite.java
new file mode 100644
index 0000000..f6e2b6e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceComposite.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.identity.HasIdentity;
+
+/**
+ * All Composites being used to implement Services
+ * must extend this interface.
+ */
+public interface ServiceComposite
+    extends HasIdentity, Composite
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceDescriptor.java
new file mode 100644
index 0000000..7bfafc9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceDescriptor.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.StatefulCompositeDescriptor;
+import org.apache.polygene.api.identity.Identifiable;
+
+/**
+ * {@code ServiceDescriptor} provides meta informations of a service.
+ */
+public interface ServiceDescriptor
+    extends CompositeDescriptor, StatefulCompositeDescriptor, Identifiable
+{
+    boolean isInstantiateOnStartup();
+
+    <T> Class<T> configurationType();
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceFinder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceFinder.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceFinder.java
new file mode 100644
index 0000000..038d8a3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceFinder.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import java.lang.reflect.Type;
+import java.util.stream.Stream;
+
+/**
+ * Interface used to query for ServiceReferences.
+ * <p>
+ * Each ServiceFinder is
+ * obtained from a specific Module, and the lookup rules are the following:
+ * </p>
+ * <ol>
+ * <li>First look in the same Module as the ServiceFinder</li>
+ * <li>Then look in the same Layer as the ServiceFinder. Any Services declared
+ * with Visibility Layer and Application should be included</li>
+ * <li>Then look in the used Layers. Any Services declared with Visibility Application
+ * should be included</li>
+ * </ol>
+ * <p>
+ * Both native Polygene services and imported services are considered, with preference to native services.
+ * </p>
+ */
+public interface ServiceFinder
+{
+    /**
+     * Find a ServiceReference that implements the given type.
+     *
+     * @param serviceType the type that the Service must implement
+     *
+     * @return a ServiceReference if one is found
+     *
+     * @throws NoSuchServiceException if no service of serviceType is found
+     */
+    <T> ServiceReference<T> findService( Class<T> serviceType )
+        throws NoSuchServiceException;
+
+    /**
+     * Find a ServiceReference that implements the given type.
+     *
+     * @param serviceType the type that the Service must implement
+     *
+     * @return a ServiceReference if one is found
+     *
+     * @throws NoSuchServiceException if no service of serviceType is found
+     */
+    <T> ServiceReference<T> findService( Type serviceType )
+        throws NoSuchServiceException;
+
+    /**
+     * Find ServiceReferences that implements the given type.
+     * <p>
+     * The order of the references is such that Services more local to the querying
+     * Module is earlier in the list.
+     * </p>
+     *
+     * @param serviceType the type that the Services must implement
+     *
+     * @return a stream of ServiceReferences for the given type. It is empty if none exist
+     */
+    <T> Stream<ServiceReference<T>> findServices( Class<T> serviceType );
+
+    /**
+     * Find ServiceReferences that implements the given type.
+     * <p>
+     * The order of the references is such that Services more local to the querying
+     * Module is earlier in the list.
+     * </p>
+     *
+     * @param serviceType the type that the Services must implement
+     *
+     * @return a stream of ServiceReferences for the given type. It is empty if none exist
+     */
+    <T> Stream<ServiceReference<T>> findServices( Type serviceType );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporter.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporter.java
new file mode 100644
index 0000000..2cbc6cf
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporter.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+/**
+ * Import a service from some external source.
+ */
+public interface ServiceImporter<T>
+{
+    /**
+     * Imports an instance of the service type described in the service descriptor.
+     *
+     * @param serviceDescriptor The service descriptor.
+     *
+     * @return The imported service instance.
+     *
+     * @throws ServiceImporterException if import failed.
+     */
+    T importService( ImportedServiceDescriptor serviceDescriptor )
+        throws ServiceImporterException;
+
+    /**
+     * Ask if the service is available or not.
+     *
+     * @param instance the instance to be checked
+     *
+     * @return true if the service is available, false if not
+     */
+    boolean isAvailable( T instance );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporterException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporterException.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporterException.java
new file mode 100644
index 0000000..db02796
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceImporterException.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+/**
+ * If a ServiceImporter could not import a service
+ * instance it must throw this exception.
+ */
+public class ServiceImporterException
+    extends RuntimeException
+{
+    public ServiceImporterException()
+    {
+    }
+
+    public ServiceImporterException( String string )
+    {
+        super( string );
+    }
+
+    public ServiceImporterException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+
+    public ServiceImporterException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceReference.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceReference.java
new file mode 100644
index 0000000..6b01b69
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceReference.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.identity.Identifiable;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * From a ServiceReference you can access and modify metadata about a service.
+ * You can also access the actual service through get(), that can then be invoked.
+ */
+public interface ServiceReference<T>
+    extends HasTypes, ActivationEventListenerRegistration, MetaInfoHolder, Identifiable
+{
+    /**
+     * @return the actual service
+     */
+    T get();
+
+    /**
+     * @return TRUE if the service is active, otherwise return FALSE
+     */
+    boolean isActive();
+
+    /**
+     * @return TRUE if the service is available, otherwise return FALSE
+     */
+    boolean isAvailable();
+
+    /**
+     * @return the ServiceModel of the service referenced by this ServiceReference.
+     */
+     ModelDescriptor model();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/ServiceUnavailableException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/ServiceUnavailableException.java b/core/api/src/main/java/org/apache/polygene/api/service/ServiceUnavailableException.java
new file mode 100644
index 0000000..a479e6f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/ServiceUnavailableException.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+/**
+ * Thrown when no available service is found.
+ */
+public class ServiceUnavailableException
+    extends RuntimeException
+{
+    public ServiceUnavailableException( String message )
+    {
+        super( message );
+    }
+
+    public ServiceUnavailableException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}


[52/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/main/java/org/apache/polygene/tools/shell/FileUtils.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/FileUtils.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/FileUtils.java
index 6a8bd73..add4b1b 100644
--- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/FileUtils.java
+++ b/tools/shell/src/main/java/org/apache/polygene/tools/shell/FileUtils.java
@@ -74,7 +74,7 @@ public class FileUtils
 
     public static Map<String, String> readTemplateProperties( String templateName )
     {
-        File propertiesFile = new File( zestHome(), "etc/templates/" + templateName + "/template.properties" );
+        File propertiesFile = new File( polygeneHome(), "etc/templates/" + templateName + "/template.properties" );
         try( InputStream in = new BufferedInputStream( new FileInputStream( propertiesFile ) ) )
         {
             Properties properties = readProperties( in );
@@ -112,7 +112,7 @@ public class FileUtils
         Files.copy( srcFile.toPath(), dest.toPath() );
     }
 
-    public static File zestHome()
+    public static File polygeneHome()
     {
         String home = System.getProperty( "polygene.home" );
         return new File( home ).getAbsoluteFile();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java
index ff92787..66f7c40 100644
--- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java
+++ b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/AbstractProjectCreator.java
@@ -39,7 +39,7 @@ abstract class AbstractProjectCreator
     )
         throws IOException
     {
-        File templateDir = new File( FileUtils.zestHome(), properties.get( "template.dir" ) );
+        File templateDir = new File( FileUtils.polygeneHome(), properties.get( "template.dir" ) );
         copyFiles( templateDir, projectDir, properties.get( "root.package" ) );
         File gradlewFile = new File( projectDir, "gradlew" );
         Path gradlewPath = gradlewFile.toPath();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/restapp/WebXmlWriter.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/restapp/WebXmlWriter.java b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/restapp/WebXmlWriter.java
index ed30693..5a181ec 100644
--- a/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/restapp/WebXmlWriter.java
+++ b/tools/shell/src/main/java/org/apache/polygene/tools/shell/create/project/restapp/WebXmlWriter.java
@@ -46,7 +46,7 @@ public class WebXmlWriter
                     "         version=\"3.0\">\n" +
                     "\n" +
                     "  <servlet>\n" +
-                    "    <servlet-name>zestrest</servlet-name>\n" +
+                    "    <servlet-name>polygenerest</servlet-name>\n" +
                     "    <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>\n" +
                     "    <init-param>\n" +
                     "      <param-name>org.apache.polygene.runtime.mode</param-name>\n" +
@@ -66,7 +66,7 @@ public class WebXmlWriter
                     "  </servlet>\n" +
                     "\n" +
                     "  <servlet-mapping>\n" +
-                    "    <servlet-name>zestrest</servlet-name>\n" +
+                    "    <servlet-name>polygenerest</servlet-name>\n" +
                     "    <url-pattern>/api/*</url-pattern>\n" +
                     "  </servlet-mapping>\n" +
                     "\n" +

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/test/java/org/apache/polygene/tools/shell/TestHelper.java
----------------------------------------------------------------------
diff --git a/tools/shell/src/test/java/org/apache/polygene/tools/shell/TestHelper.java b/tools/shell/src/test/java/org/apache/polygene/tools/shell/TestHelper.java
index af8585f..c512820 100644
--- a/tools/shell/src/test/java/org/apache/polygene/tools/shell/TestHelper.java
+++ b/tools/shell/src/test/java/org/apache/polygene/tools/shell/TestHelper.java
@@ -29,18 +29,18 @@ public class TestHelper
         String cwd = new File( ".").getAbsolutePath();
         if( cwd.endsWith( "/java/." )) // IDEA default runner
         {
-            String zestHome = new File( new File(".").getAbsoluteFile(), "tools/shell/src/dist" ).getAbsolutePath();
-            System.setProperty( "polygene.home", zestHome );
+            String polygeneHome = new File( new File(".").getAbsoluteFile(), "tools/shell/src/dist" ).getAbsolutePath();
+            System.setProperty( "polygene.home", polygeneHome );
         }
         if( cwd.endsWith( "tools/shell/." )) // Gradle build
         {
-            String zestHome = new File( new File(".").getAbsoluteFile(), "src/dist" ).getAbsolutePath();
-            System.setProperty( "polygene.home", zestHome );
+            String polygeneHome = new File( new File(".").getAbsoluteFile(), "src/dist" ).getAbsolutePath();
+            System.setProperty( "polygene.home", polygeneHome );
         }
         if( cwd.endsWith( "test/work/." ) ) // Parallel Gradle build
         {
-            String zestHome = new File( cwd + "./../../../../src/dist" ).getAbsolutePath();
-            System.setProperty( "polygene.home", zestHome );
+            String polygeneHome = new File( cwd + "./../../../../src/dist" ).getAbsolutePath();
+            System.setProperty( "polygene.home", polygeneHome );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/cargo/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/cargo/build.gradle b/tutorials/cargo/build.gradle
index 8765a74..ca2479f 100644
--- a/tutorials/cargo/build.gradle
+++ b/tutorials/cargo/build.gradle
@@ -23,11 +23,11 @@ description = "Tutorial on how to convert existing application into a Apache Pol
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - Cargo" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.easymock
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/composites/build.gradle b/tutorials/composites/build.gradle
index 65db15b..55b7a4f 100644
--- a/tutorials/composites/build.gradle
+++ b/tutorials/composites/build.gradle
@@ -23,12 +23,12 @@ description = "Basic tutorial on how to covert a simple 'Hello World' applicatio
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - Composites" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'constraints' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step1.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step1.txt b/tutorials/composites/src/docs/step1.txt
index fb4b933..251e9c1 100644
--- a/tutorials/composites/src/docs/step1.txt
+++ b/tutorials/composites/src/docs/step1.txt
@@ -27,7 +27,7 @@ Composite Oriented application. Here is the initial code of HelloWorld.
 
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial1/HelloWorld.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial1/HelloWorld.java
 tag=initial
 ----
 
@@ -57,28 +57,28 @@ If you have successfully completed the task, you should end up with the followin
 *HelloWorld.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/HelloWorld.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/HelloWorld.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/HelloWorldState.java
 tag=solution
 ----
 
 *HelloWorldBehaviour.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/HelloWorldBehaviour.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/HelloWorldBehaviour.java
 tag=solution
 ----
 
 *HelloWorldMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/HelloWorldMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/HelloWorldMixin.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step2.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step2.txt b/tutorials/composites/src/docs/step2.txt
index 8064089..b649b0b 100644
--- a/tutorials/composites/src/docs/step2.txt
+++ b/tutorials/composites/src/docs/step2.txt
@@ -48,14 +48,14 @@ These ones remain unchanged:
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial3/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldComposite.java
 tag=solution
 ----
 
 *HelloWorldMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial2/HelloWorldMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/HelloWorldMixin.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step3.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step3.txt b/tutorials/composites/src/docs/step3.txt
index e87014e..61540b0 100644
--- a/tutorials/composites/src/docs/step3.txt
+++ b/tutorials/composites/src/docs/step3.txt
@@ -40,35 +40,35 @@ Only *HelloWorld.java* remains unchanged.
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial4/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldComposite.java
 tag=solution
 ----
 
 *HelloWorldBehaviour.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial4/HelloWorldBehaviour.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldBehaviour.java
 tag=solution
 ----
 
 *HelloWorldBehaviourMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial4/HelloWorldBehaviourMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldBehaviourMixin.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial4/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldState.java
 tag=solution
 ----
 
 *HelloWorldStateMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial4/HelloWorldStateMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldStateMixin.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step4.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step4.txt b/tutorials/composites/src/docs/step4.txt
index ed77e6a..c5d3333 100644
--- a/tutorials/composites/src/docs/step4.txt
+++ b/tutorials/composites/src/docs/step4.txt
@@ -63,14 +63,14 @@ These ones remain unchanged:
 *HelloWorldBehaviourMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/HelloWorldBehaviourMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldBehaviourMixin.java
 tag=solution
 ----
 
 *HelloWorldBehaviourConcern.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial5/HelloWorldBehaviourConcern.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldBehaviourConcern.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step5.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step5.txt b/tutorials/composites/src/docs/step5.txt
index 7a8078b..022cc50 100644
--- a/tutorials/composites/src/docs/step5.txt
+++ b/tutorials/composites/src/docs/step5.txt
@@ -66,28 +66,28 @@ These ones remain unchanged:
 *HelloWorldBehaviour.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial6/HelloWorldBehaviour.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldBehaviour.java
 tag=solution
 ----
 
 *HelloWorldBehaviourMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial6/HelloWorldBehaviourMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldBehaviourMixin.java
 tag=solution
 ----
 
 *HelloWorldBehaviourConcern.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial6/HelloWorldBehaviourConcern.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldBehaviourConcern.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial6/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldState.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step6.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step6.txt b/tutorials/composites/src/docs/step6.txt
index 136f36a..675dd36 100644
--- a/tutorials/composites/src/docs/step6.txt
+++ b/tutorials/composites/src/docs/step6.txt
@@ -62,28 +62,28 @@ These ones remain unchanged:
 *HelloWorldBehaviour.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial7/HelloWorldBehaviour.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldBehaviour.java
 tag=solution
 ----
 
 *HelloWorldBehaviourSideEffect.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial7/HelloWorldBehaviourSideEffect.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldBehaviourSideEffect.java
 tag=solution
 ----
 
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial7/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldComposite.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial7/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldState.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step7.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step7.txt b/tutorials/composites/src/docs/step7.txt
index e3f6d99..4c5a5d2 100644
--- a/tutorials/composites/src/docs/step7.txt
+++ b/tutorials/composites/src/docs/step7.txt
@@ -80,28 +80,28 @@ Theses ones are deleted:
 *HelloWorldBehaviourMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial8/HelloWorldBehaviourMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldBehaviourMixin.java
 tag=solution
 ----
 
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial8/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldComposite.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial8/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldState.java
 tag=solution
 ----
 
 *HelloWorldStateMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial8/HelloWorldStateMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial8/HelloWorldStateMixin.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step8.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step8.txt b/tutorials/composites/src/docs/step8.txt
index 2e302b2..ac26edd 100644
--- a/tutorials/composites/src/docs/step8.txt
+++ b/tutorials/composites/src/docs/step8.txt
@@ -60,21 +60,21 @@ These ones remain unchanged:
 *GenericPropertyMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial9/GenericPropertyMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial9/GenericPropertyMixin.java
 tag=solution
 ----
 
 *HelloWorldBehaviourMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial9/HelloWorldBehaviourMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldBehaviourMixin.java
 tag=solution
 ----
 
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial9/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial9/HelloWorldComposite.java
 tag=solution
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/step9.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/step9.txt b/tutorials/composites/src/docs/step9.txt
index 9d40974..ce9268b 100644
--- a/tutorials/composites/src/docs/step9.txt
+++ b/tutorials/composites/src/docs/step9.txt
@@ -65,20 +65,20 @@ If you have successfully completed the task, you should end up with the followin
 *HelloWorldComposite.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial10/HelloWorldComposite.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldComposite.java
 tag=solution
 ----
 
 *HelloWorldMixin.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial10/HelloWorldMixin.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldMixin.java
 tag=solution
 ----
 
 *HelloWorldState.java*
 [snippet,java]
 ----
-source=tutorials/composites/src/main/java/org/apache/zest/tutorials/composites/tutorial10/HelloWorldState.java
+source=tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldState.java
 tag=solution
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/docs/tut-composites.txt
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/docs/tut-composites.txt b/tutorials/composites/src/docs/tut-composites.txt
index dfea921..eb8e3bb 100644
--- a/tutorials/composites/src/docs/tut-composites.txt
+++ b/tutorials/composites/src/docs/tut-composites.txt
@@ -21,7 +21,7 @@
 = Transient Composites Tutorial =
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-https://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+https://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 Throughout this set of tutorials it will be shown how to create and work with Composites, which
@@ -52,7 +52,7 @@ on Core API, Core SPI, Core Bootstrap and Core Functional & I/O APIs:
 
 include::../../../../core/runtime/build/docs/buildinfo/artifact.txt[]
 
-See the <<howto-depend-on-zest>> tutorial for details.
+See the <<howto-depend-on-polygene>> tutorial for details.
 
 :leveloffset: 3
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/package.html
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/package.html b/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/package.html
index 81a1527..7d12bef 100644
--- a/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/package.html
+++ b/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial2/package.html
@@ -37,7 +37,7 @@ Steps for this tutorial:
 </p>
 <ol>
     <li>Create an interface that extends the domain interface HelloWorld and
-        org.apache.zest.api.composite.TransientComposite.
+        org.apache.polygene.api.composite.TransientComposite.
     </li>
     <li>Add a @Mixins annotation to it with the name of the Mixin as argument.</li>
 </ol>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/package.html
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/package.html b/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/package.html
index 499e2f7..c0ca4c9 100644
--- a/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/package.html
+++ b/tutorials/composites/src/main/java/org/apache/polygene/tutorials/composites/tutorial5/package.html
@@ -55,8 +55,8 @@ Steps for this tutorial:
 </ol>
 <p><em>Note:</em></p>
 <p>
-    The previous steps had a dependency to the <code>org.apache.zest.core.api</code> only. The constraints
-    you've used in this step, introduce a new dependency to the <code>org.apache.zest.library.constraints</code>
+    The previous steps had a dependency to the <code>org.apache.polygene.core.api</code> only. The constraints
+    you've used in this step, introduce a new dependency to the <code>org.apache.polygene.library.constraints</code>
     library, where all the constraint related classes reside. So update your classpath settings
     accordingly.
 </p>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/composites/src/main/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/main/javadoc/overview.html b/tutorials/composites/src/main/javadoc/overview.html
index e559da4..8eb2213 100644
--- a/tutorials/composites/src/main/javadoc/overview.html
+++ b/tutorials/composites/src/main/javadoc/overview.html
@@ -42,7 +42,7 @@ always look at the next tutorial step for guidance on what to do.
 </p>
 <h2>Related Documentation</h2>
 <p>
-For more information on Polygene\u2122 see <a target="_blank" href="http://zest.apache.org">the website</a>.
+For more information on Polygene\u2122 see <a target="_blank" href="http://polygene.apache.org">the website</a>.
 </p>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/hello/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/hello/build.gradle b/tutorials/hello/build.gradle
index cd07ef9..ef714da 100644
--- a/tutorials/hello/build.gradle
+++ b/tutorials/hello/build.gradle
@@ -23,12 +23,12 @@ description = "Basic tutorial on how to covert a simple 'Hello World' applicatio
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - Composites" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'constraints' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/introduction/build.gradle b/tutorials/introduction/build.gradle
index 4e13391..35e231e 100644
--- a/tutorials/introduction/build.gradle
+++ b/tutorials/introduction/build.gradle
@@ -23,11 +23,11 @@ description = "An Introduction to Apache Polygene\u2122 in its simplest form."
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - Introduction" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/src/docs/state-modeling.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/src/docs/state-modeling.txt b/tutorials/introduction/src/docs/state-modeling.txt
index 5ea2668..c573863 100644
--- a/tutorials/introduction/src/docs/state-modeling.txt
+++ b/tutorials/introduction/src/docs/state-modeling.txt
@@ -48,7 +48,7 @@ Here's an example of how you could define an EntityComposite:
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/StateModelingDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/StateModelingDocs.java
 tag=intro1
 -----------
 
@@ -72,7 +72,7 @@ context instead of classes you would probably do something like this instead:
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/StateModelingDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/StateModelingDocs.java
 tag=roles
 -----------
 
@@ -108,7 +108,7 @@ checks when they are updated. What you want are ValueComposites:
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/StateModelingDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/StateModelingDocs.java
 tag=values
 -----------
 
@@ -142,7 +142,7 @@ you write role mixins which map domain methods to that internal state. Here's an
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/StateModelingDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/StateModelingDocs.java
 tag=private
 -----------
 
@@ -171,7 +171,7 @@ To end with, here's a sample of how some other state modeling concepts can be ex
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/StateModelingDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/StateModelingDocs.java
 tag=more
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/src/docs/whats-an-object.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/src/docs/whats-an-object.txt b/tutorials/introduction/src/docs/whats-an-object.txt
index 6273901..470e400 100644
--- a/tutorials/introduction/src/docs/whats-an-object.txt
+++ b/tutorials/introduction/src/docs/whats-an-object.txt
@@ -90,7 +90,7 @@ This leads us to this typical implementation of an Entity
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/WhatsAnObjectDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/WhatsAnObjectDocs.java
 tag=wo1
 -----------
 
@@ -102,7 +102,7 @@ in the mixins.
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/WhatsAnObjectDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/WhatsAnObjectDocs.java
 tag=wo2
 -----------
 
@@ -114,7 +114,7 @@ interface:
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/WhatsAnObjectDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/WhatsAnObjectDocs.java
 tag=wo3
 -----------
 
@@ -122,7 +122,7 @@ This lets us see the totality of all the state that the Entity has, and can be u
 
 [snippet,java]
 -----------
-source=tutorials/introduction/src/main/java/org/apache/zest/demo/intro/WhatsAnObjectDocs.java
+source=tutorials/introduction/src/main/java/org/apache/polygene/demo/intro/WhatsAnObjectDocs.java
 tag=wo4
 -----------
 
@@ -199,5 +199,5 @@ on this page.
 
 That's it. Well done if you've read this far :-)
 
-Comments and thoughts to dev@zest.apache.org mailing list on this are highly appreciated. This is very very important
+Comments and thoughts to dev@polygene.apache.org mailing list on this are highly appreciated. This is very very important
 topics, and crucial to understanding/explaining why COP/Polygene\u2122 is so great! :-)

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/src/docs/zest-cop.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/src/docs/zest-cop.txt b/tutorials/introduction/src/docs/zest-cop.txt
index 7b870ae..2de1ed9 100644
--- a/tutorials/introduction/src/docs/zest-cop.txt
+++ b/tutorials/introduction/src/docs/zest-cop.txt
@@ -17,6 +17,6 @@
  * under the License.
 ///////////////////////////////////////////////////////////////
 
-[[zest-cop,COP with Java and Polygene\u2122]]
+[[polygene-cop,COP with Java and Polygene\u2122]]
 = COP with Java and Polygene\u2122 =
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/tenminutes/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/introduction/tenminutes/build.gradle b/tutorials/introduction/tenminutes/build.gradle
index 03efaa4..3cf3389 100644
--- a/tutorials/introduction/tenminutes/build.gradle
+++ b/tutorials/introduction/tenminutes/build.gradle
@@ -23,11 +23,11 @@ description = "A 10-minute Introduction Tutorial to Apache Polygene\u2122 in its si
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - 10 minute Introduction" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/tenminutes/src/docs/ten-minutes.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/tenminutes/src/docs/ten-minutes.txt b/tutorials/introduction/tenminutes/src/docs/ten-minutes.txt
index b2eb228..1bf8fa9 100644
--- a/tutorials/introduction/tenminutes/src/docs/ten-minutes.txt
+++ b/tutorials/introduction/tenminutes/src/docs/ten-minutes.txt
@@ -21,7 +21,7 @@
 = Polygene\u2122 in 10 minutes =
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-https://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+https://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 
@@ -41,12 +41,12 @@ include::../../../../../core/runtime/build/docs/buildinfo/artifact.txt[]
 Moreover, you'll need an EntityStore for persistence and an Indexing engine for querying. Choose among the available
 implementations listed in the <<extensions>> section.
 
-See the <<howto-depend-on-zest>> tutorial for details.
+See the <<howto-depend-on-polygene>> tutorial for details.
 
 Composition is done with Java interfaces and Annotations. Example;
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/OrderEntity.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/OrderEntity.java
 tag=mainClass
 -----------
 
@@ -56,7 +56,7 @@ methods that they declare, for instance;
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/InventoryConcern.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/InventoryConcern.java
 tag=allClass
 -----------
 
@@ -80,7 +80,7 @@ will execute after the Constraints, Concerns and Mixins. We add the SideEffect t
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/OrderEntity.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/OrderEntity.java
 tag=sideEffect
 -----------
 
@@ -88,7 +88,7 @@ The SideEffect implementation is fairly simple.
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/MailNotifySideEffect.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/MailNotifySideEffect.java
 tag=allClass
 -----------
 The MailService is dependency injected, as we have seen before.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/thirtyminutes/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/introduction/thirtyminutes/build.gradle b/tutorials/introduction/thirtyminutes/build.gradle
index 4f78a90..d313fb6 100644
--- a/tutorials/introduction/thirtyminutes/build.gradle
+++ b/tutorials/introduction/thirtyminutes/build.gradle
@@ -23,12 +23,12 @@ description = "A 30-minute Introduction Tutorial to Apache Polygene\u2122 in its si
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - 30 minute Introduction" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile project( ':org.apache.polygene.tutorials:org.apache.polygene.tutorial.introduction:org.apache.polygene.tutorial.introduction.tenminutes' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/thirtyminutes/src/docs/thirty-minutes.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/thirtyminutes/src/docs/thirty-minutes.txt b/tutorials/introduction/thirtyminutes/src/docs/thirty-minutes.txt
index fb451dd..1ea0414 100644
--- a/tutorials/introduction/thirtyminutes/src/docs/thirty-minutes.txt
+++ b/tutorials/introduction/thirtyminutes/src/docs/thirty-minutes.txt
@@ -21,7 +21,7 @@
 = Polygene\u2122 in 30 minutes =
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-https://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+https://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 
@@ -36,12 +36,12 @@ include::../../../../../core/runtime/build/docs/buildinfo/artifact.txt[]
 Moreover, you'll need an EntityStore for persistence and an Indexing engine for querying. Choose among the available
 implementations listed in the <<extensions>> section.
 
-See the <<howto-depend-on-zest>> tutorial for details.
+See the <<howto-depend-on-polygene>> tutorial for details.
 
 We will go back to the OrderEntity example;
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/OrderEntity.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/OrderEntity.java
 tag=mainClass
 -----------
 
@@ -52,7 +52,7 @@ First we need to create (or also find in a library) the mechanics of the audit t
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=2
 -----------
 
@@ -66,7 +66,7 @@ We also need a Concern to hang into the methods of the Order interface.
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=3
 -----------
 
@@ -81,7 +81,7 @@ the re-use value. It could look like this;
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=4
 -----------
 
@@ -93,7 +93,7 @@ Finally, we need to declare the Concern in the OrderEntity;
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=5
 -----------
 
@@ -115,7 +115,7 @@ Let's say that we want to find a particular Order from its SequenceNumber.
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=6
 -----------
 
@@ -132,7 +132,7 @@ Another example,
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=7
 -----------
 
@@ -144,7 +144,7 @@ that has made an Order in the last 30 days;
 
 [snippet,java]
 -----------
-source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/zest/demo/thirtyminutes/ThirtyMinutesDocs.java
+source=tutorials/introduction/thirtyminutes/src/main/java/org/apache/polygene/demo/thirtyminutes/ThirtyMinutesDocs.java
 tag=8
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/twominutes/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/introduction/twominutes/build.gradle b/tutorials/introduction/twominutes/build.gradle
index e82c728..f953cd0 100644
--- a/tutorials/introduction/twominutes/build.gradle
+++ b/tutorials/introduction/twominutes/build.gradle
@@ -23,11 +23,11 @@ description = "A 2-minute Introduction Tutorial to Apache Polygene\u2122 in its sim
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - 2 minute Introduction" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/introduction/twominutes/src/docs/two-minutes.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/twominutes/src/docs/two-minutes.txt b/tutorials/introduction/twominutes/src/docs/two-minutes.txt
index 6e378a1..9bd0847 100644
--- a/tutorials/introduction/twominutes/src/docs/two-minutes.txt
+++ b/tutorials/introduction/twominutes/src/docs/two-minutes.txt
@@ -21,7 +21,7 @@
 = Polygene\u2122 in 2 minutes =
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-https://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+https://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 To show that Polygene\u2122 is not necessarily complex, not hard to get going with and easy to deploy, we are first showing the
@@ -32,7 +32,7 @@ on Core API, Core SPI, Core Bootstrap and Core Functional & I/O APIs:
 
 include::../../../../../core/runtime/build/docs/buildinfo/artifact.txt[]
 
-See the <<howto-depend-on-zest>> tutorial for details.
+See the <<howto-depend-on-polygene>> tutorial for details.
 
 Ready, Set, Go!
 
@@ -43,7 +43,7 @@ But we also need an implementation for Speaker, which we declare here via the `@
 
 [snippet,java]
 -----------
-source=tutorials/introduction/twominutes/src/main/java/org/apache/zest/demo/twominute/Speaker.java
+source=tutorials/introduction/twominutes/src/main/java/org/apache/polygene/demo/twominute/Speaker.java
 tag=documentation
 -----------
 
@@ -52,7 +52,7 @@ In this case, return a String with the content "Hello, World!".
 
 [snippet,java]
 -----------
-source=tutorials/introduction/twominutes/src/main/java/org/apache/zest/demo/twominute/SpeakerMixin.java
+source=tutorials/introduction/twominutes/src/main/java/org/apache/polygene/demo/twominute/SpeakerMixin.java
 tag=documentation
 -----------
 
@@ -60,7 +60,7 @@ So far so good. We now need to make this into something that can run. This can b
 
 [snippet,java]
 -----------
-source=tutorials/introduction/twominutes/src/main/java/org/apache/zest/demo/twominute/Main.java
+source=tutorials/introduction/twominutes/src/main/java/org/apache/polygene/demo/twominute/Main.java
 tag=documentation
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/services/build.gradle
----------------------------------------------------------------------
diff --git a/tutorials/services/build.gradle b/tutorials/services/build.gradle
index ca7d832..116af6f 100644
--- a/tutorials/services/build.gradle
+++ b/tutorials/services/build.gradle
@@ -23,11 +23,11 @@ description = "Tutorial on how to use Apache Polygene\u2122 service concept."
 jar { manifest { name = "Apache Polygene\u2122 Tutorial - Services" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/services/src/docs/step3.txt
----------------------------------------------------------------------
diff --git a/tutorials/services/src/docs/step3.txt b/tutorials/services/src/docs/step3.txt
index 6c8ce92..8516054 100644
--- a/tutorials/services/src/docs/step3.txt
+++ b/tutorials/services/src/docs/step3.txt
@@ -41,7 +41,7 @@ Steps to do.
 - Delete the LibraryActivator and remove the @Activators annotation from the LibraryService and the corresponding createInitialData method.
 - In the LibraryMixin remove the member injection of the ValueBuilderFactory, and instead inject the ValueBuilderFactory in the constructor.
 - Inject the LibraryConfiguration via the constructor. The injection scope is @This.
-- Create a resource called LibraryService.properties and place it in the directory +org/apache/zest/tutorials/services/step4+ in the classpath (for instance, src/main/resources ). Put something like this in:
+- Create a resource called LibraryService.properties and place it in the directory +org/apache/polygene/tutorials/services/step4+ in the classpath (for instance, src/main/resources ). Put something like this in:
     titles=Domain Driven Design, Pragmatic Programmer, Extreme Programming Explained
     authors=Eric Evans, Andy Hunt, Kent Beck
     #Number of copies of each book.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/services/src/docs/tut-services.txt
----------------------------------------------------------------------
diff --git a/tutorials/services/src/docs/tut-services.txt b/tutorials/services/src/docs/tut-services.txt
index df96a78..dd45540 100644
--- a/tutorials/services/src/docs/tut-services.txt
+++ b/tutorials/services/src/docs/tut-services.txt
@@ -21,7 +21,7 @@
 = Services Composites Tutorial =
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-http://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+http://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 
@@ -45,7 +45,7 @@ on Core API, Core SPI, Core Bootstrap and Core Functional & I/O APIs:
 
 include::../../../../core/runtime/build/docs/buildinfo/artifact.txt[]
 
-See the <<howto-depend-on-zest>> tutorial for details.
+See the <<howto-depend-on-polygene>> tutorial for details.
 
 :leveloffset: 3
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tutorials/services/src/main/java/org/apache/polygene/tutorials/services/step3/package.html
----------------------------------------------------------------------
diff --git a/tutorials/services/src/main/java/org/apache/polygene/tutorials/services/step3/package.html b/tutorials/services/src/main/java/org/apache/polygene/tutorials/services/step3/package.html
index a82f20a..288d2ae 100644
--- a/tutorials/services/src/main/java/org/apache/polygene/tutorials/services/step3/package.html
+++ b/tutorials/services/src/main/java/org/apache/polygene/tutorials/services/step3/package.html
@@ -58,7 +58,7 @@
         </li>
         <li>
             Create a resource called <code>LibraryService.properties</code> and place it in the directory
-            <code>org/apache/zest/tutorials/services/step4</code> in the classpath (for instance, <code>src/main/resources</code>
+            <code>org/apache/polygene/tutorials/services/step4</code> in the classpath (for instance, <code>src/main/resources</code>
             ).
             Put something like;
             <span class="javaxcode"><pre>titles=Domain Driven Design, Pragmatic Programmer, Extreme Programming Explained


[26/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java b/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
new file mode 100644
index 0000000..13c6e60
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
@@ -0,0 +1,149 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+/**
+ * Define a field to be a Property
+ */
+public class StateFieldTest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        new EntityTestAssembler().assemble( module );
+        module.entities( PersonEntity.class );
+    }
+
+    @Test
+    public void givenEntityWithFieldPropertiesWhenUpdatedThenReturnCorrect()
+        throws Exception
+    {
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        try
+        {
+            PersonEntity charles = unitOfWork.newEntity( PersonEntity.class );
+            charles.changeName( "Charles" );
+            Assert.assertEquals( charles.getName(), "Charles" );
+
+            PersonEntity daniel = unitOfWork.newEntity( PersonEntity.class );
+            daniel.changeName( "Daniel" );
+            Assert.assertEquals( daniel.getName(), "Daniel" );
+
+            PersonEntity lisa = unitOfWork.newEntity( PersonEntity.class );
+            lisa.changeName( "Lisa" );
+            Assert.assertEquals( lisa.getName(), "Lisa" );
+
+            charles.befriend( daniel );
+            charles.befriend( lisa );
+            charles.marry( lisa );
+
+            unitOfWork.complete();
+
+            unitOfWork = unitOfWorkFactory.newUnitOfWork();
+
+            charles = unitOfWork.get( charles );
+            daniel = unitOfWork.get( daniel );
+            Assert.assertTrue( charles.isFriend( daniel ) );
+
+            unitOfWork.complete();
+        }
+        finally
+        {
+            unitOfWork.discard();
+        }
+    }
+
+    @Mixins( PersonEntity.Mixin.class )
+    public interface PersonEntity
+        extends EntityComposite
+    {
+        void changeName( String newName );
+
+        void marry( PersonEntity entity );
+
+        void befriend( PersonEntity entity );
+
+        boolean isFriend( PersonEntity entity );
+
+        String getName();
+
+        abstract class Mixin
+            implements PersonEntity
+        {
+            @State
+            @UseDefaults
+            public Property<String> name;
+
+            @State
+            @Optional
+            public Association<PersonEntity> spouse;
+
+            @State
+            public ManyAssociation<PersonEntity> friends;
+
+            @Override
+            public void changeName( String newName )
+            {
+                name.set( newName );
+            }
+
+            @Override
+            public void marry( PersonEntity entity )
+            {
+                spouse.set( entity );
+            }
+
+            @Override
+            public void befriend( PersonEntity entity )
+            {
+                friends.add( entity );
+            }
+
+            @Override
+            public String getName()
+            {
+                return name.get();
+            }
+
+            @Override
+            public boolean isFriend( PersonEntity entity )
+            {
+                return friends.contains( entity );
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/injection/scope/ThisTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/injection/scope/ThisTest.java b/core/api/src/test/java/org/apache/polygene/api/injection/scope/ThisTest.java
new file mode 100644
index 0000000..a26d434
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/injection/scope/ThisTest.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.injection.scope;
+
+import java.lang.annotation.Annotation;
+import org.junit.Test;
+import org.apache.polygene.api.common.Optional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Tests public api exposed by This annotation.
+ * This will ensure that the public api does not get changed by mistake.
+ */
+public class ThisTest
+{
+
+    @Test
+    public void retention()
+        throws NoSuchFieldException
+    {
+        Annotation[] annotations = Annotated.class.getDeclaredField( "uses" ).getDeclaredAnnotations();
+        assertNotNull( "annotations should not be null", annotations );
+        assertEquals( "number of annotations", 1, annotations.length );
+        assertEquals( "annotation type", This.class, annotations[ 0 ].annotationType() );
+    }
+
+    private static class Annotated
+    {
+        @This
+        String uses;
+        @Optional
+        @This
+        String usesOptional;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java b/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
new file mode 100644
index 0000000..654bd5d
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import org.apache.polygene.api.injection.scope.Service;
+
+public class DocumentationSupport
+{
+    // START SNIPPET: common
+    @Service
+    private MetricsProvider provider;
+    // END SNIPPET: common
+
+    public void forDocumentationOnly()
+    {
+        // START SNIPPET: gauge
+        final BlockingQueue queue = new LinkedBlockingQueue( 20 );
+        // END SNIPPET: gauge
+        // START SNIPPET: gauge
+        MetricsGaugeFactory gaugeFactory = provider.createFactory( MetricsGaugeFactory.class );
+        MetricsGauge<Integer> gauge = gaugeFactory.registerGauge( "Sample Gauge", new MetricsGauge<Integer>()
+        {
+            @Override
+            public Integer value()
+            {
+                return queue.size();
+            }
+        } );
+        // END SNIPPET: gauge
+
+        // START SNIPPET: counter
+        MetricsCounterFactory counterFactory = provider.createFactory( MetricsCounterFactory.class );
+        MetricsCounter counter = counterFactory.createCounter( "Sample Counter" );
+        // END SNIPPET: counter
+
+        // START SNIPPET: histogram
+        MetricsHistogramFactory histoFactory = provider.createFactory( MetricsHistogramFactory.class );
+        MetricsHistogram histogram = histoFactory.createHistogram( "Sample Histogram" );
+        // END SNIPPET: histogram
+
+        // START SNIPPET: meter
+        MetricsMeterFactory meterFactory = provider.createFactory( MetricsMeterFactory.class );
+        MetricsMeter meter = meterFactory.createMeter( "Sample Meter" );
+        // END SNIPPET: meter
+
+        // START SNIPPET: timer
+        MetricsTimerFactory timerFactory = provider.createFactory( MetricsTimerFactory.class );
+        MetricsTimer timer = timerFactory.createTimer( "Sample Timer" );
+        // END SNIPPET: timer
+
+        // START SNIPPET: healthcheck
+        MetricsHealthCheckFactory healthFactory = provider.createFactory( MetricsHealthCheckFactory.class );
+        MetricsHealthCheck healthCheck = healthFactory.registerHealthCheck(
+            "Sample Healthcheck",
+            new MetricsHealthCheck()
+            {
+                @Override
+                public Result check()
+                    throws Exception
+                {
+                    ServiceStatus status = pingMyService();
+                    return new Result( status.isOk(), status.getErrorMessage(), status.getException() );
+                }
+            } );
+        // END SNIPPET: healthcheck
+
+    }
+
+    private ServiceStatus pingMyService()
+    {
+        return new ServiceStatus();
+    }
+
+    private static class ServiceStatus
+    {
+        String errorMessage;
+        Exception exception;
+
+        public String getErrorMessage()
+        {
+            return errorMessage;
+        }
+
+        public Exception getException()
+        {
+            return exception;
+        }
+
+        public boolean isOk()
+        {
+            return errorMessage.equals( "OK" );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/BankAccount.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/BankAccount.java b/core/api/src/test/java/org/apache/polygene/api/mixin/BankAccount.java
new file mode 100644
index 0000000..c0f6d6e
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/BankAccount.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+
+// START SNIPPET: mixinType
+public interface BankAccount
+{
+    Money checkBalance();
+}
+// END SNIPPET: mixinType
+
+class Money {}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/Car.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/Car.java b/core/api/src/test/java/org/apache/polygene/api/mixin/Car.java
new file mode 100644
index 0000000..eb927a8
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/Car.java
@@ -0,0 +1,26 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+// START SNIPPET: mixin
+@Mixins( { StartMixin.class, VehicleMixin.class } )
+public interface Car extends Startable, Vehicle
+{}
+// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/Something.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/Something.java b/core/api/src/test/java/org/apache/polygene/api/mixin/Something.java
new file mode 100644
index 0000000..df65eb1
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/Something.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+// START SNIPPET: something
+@Mixins( SomethingMixin.class )
+public interface Something
+{}
+// END SNIPPET: something
+
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/SomethingMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/SomethingMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/SomethingMixin.java
new file mode 100644
index 0000000..e5aa474
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/SomethingMixin.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+// START SNIPPET: something
+public class SomethingMixin
+        implements Something
+{
+    // State is allowed.
+
+    public void doSomething()
+    {
+        // do stuff...
+    }
+}
+// END SNIPPET: something

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/StartMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/StartMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/StartMixin.java
new file mode 100644
index 0000000..2f6fbeb
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/StartMixin.java
@@ -0,0 +1,23 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+public abstract class StartMixin implements Startable
+{}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/Startable.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/Startable.java b/core/api/src/test/java/org/apache/polygene/api/mixin/Startable.java
new file mode 100644
index 0000000..7230742
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/Startable.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+// START SNIPPET: mixin
+public interface Startable
+{
+    boolean start();
+    void stop();
+}
+
+// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/Vehicle.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/Vehicle.java b/core/api/src/test/java/org/apache/polygene/api/mixin/Vehicle.java
new file mode 100644
index 0000000..7545687
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/Vehicle.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+// START SNIPPET: mixin
+public interface Vehicle
+{
+    void turn(float angle);
+
+    void accelerate(float acceleration);
+
+    // more methods
+}
+
+// END SNIPPET: mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/VehicleMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/VehicleMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/VehicleMixin.java
new file mode 100644
index 0000000..16d4cfd
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/VehicleMixin.java
@@ -0,0 +1,23 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+public abstract class VehicleMixin
+{}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
new file mode 100644
index 0000000..4b658e5
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import org.junit.Test;
+import org.apache.polygene.api.composite.TransientBuilder;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class DecoratorMixinTest extends AbstractPolygeneTest
+{
+    // START SNIPPET: assembly
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.transients( View1.class );
+        module.transients( View2.class );
+        module.transients( FooModel.class );
+    }
+// END SNIPPET: assembly
+
+// START SNIPPET: test
+
+    @Test
+    public void testDecoration()
+    {
+        FooModelImpl model = new FooModelImpl( "Init" );
+        View1 view1 = createView1( model );
+        View2 view2 = createView2( model );
+        assertThat( view1.bar(), equalTo( "Init" ) );
+        assertThat( view2.bar(), equalTo( "Init" ) );
+        model.setBar( "New Value" );
+        assertThat( view1.bar(), equalTo( "New Value" ) );
+        assertThat( view2.bar(), equalTo( "New Value" ) );
+    }
+// END SNIPPET: test
+
+    @Test
+    public void testDecorationWithGenericMixin()
+    {
+        InvocationHandler handler = new FooModelInvocationHandler("Init");
+        ClassLoader cl = getClass().getClassLoader();
+        FooModel model = (FooModel) Proxy.newProxyInstance( cl, new Class[]{ FooModel.class }, handler );
+        View1 view1 = createView1( model );
+        View2 view2 = createView2( model );
+        assertThat( view1.bar(), equalTo( "Init" ) );
+        assertThat( view2.bar(), equalTo( "Init" ) );
+        model.setBar( "New Value" );
+        assertThat( view1.bar(), equalTo( "New Value" ) );
+        assertThat( view2.bar(), equalTo( "New Value" ) );
+    }
+
+    // START SNIPPET: create
+    public View1 createView1( FooModel model )
+    {
+        TransientBuilder<View1> builder = transientBuilderFactory.newTransientBuilder( View1.class );
+        builder.use( model );
+        return builder.newInstance();
+    }
+// END SNIPPET: create
+
+    public View2 createView2( FooModel model )
+    {
+        TransientBuilder<View2> builder = transientBuilderFactory.newTransientBuilder( View2.class );
+        builder.use( model );
+        return builder.newInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java
new file mode 100644
index 0000000..f777279
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+import org.apache.polygene.api.composite.DecoratorMixin;
+import org.apache.polygene.api.mixin.Mixins;
+
+// START SNIPPET: decorator
+@Mixins(DecoratorMixin.class)
+// START SNIPPET: plain
+public interface FooModel
+// END SNIPPET: decorator
+{
+    String getBar();
+    void setBar(String value);
+// END SNIPPET: plain
+
+// START SNIPPET: plain
+}
+// END SNIPPET: plain

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelImpl.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelImpl.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelImpl.java
new file mode 100644
index 0000000..5da835e
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelImpl.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+public class FooModelImpl
+    implements FooModel
+{
+    private String bar;
+
+    public FooModelImpl( String bar )
+    {
+        this.bar = bar;
+    }
+
+    @Override
+    public String getBar()
+    {
+        return bar;
+    }
+
+    public void setBar( String bar )
+    {
+        this.bar = bar;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelInvocationHandler.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelInvocationHandler.java
new file mode 100644
index 0000000..856799b
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModelInvocationHandler.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+public class FooModelInvocationHandler
+    implements InvocationHandler
+{
+    private String value;
+
+    public FooModelInvocationHandler( String value )
+    {
+        this.value = value;
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        if(method.getName().equals( "hashCode" ))
+            return hashCode();
+        if(method.getName().equals( "equals" ))
+            return equals(args[0]);
+        if(args==null || args.length==0)
+            return value;
+        value = (String) args[0];
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View1.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View1.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View1.java
new file mode 100644
index 0000000..5cb9293
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View1.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+
+// START SNIPPET: decorator
+@Mixins(View1.Mixin.class)
+public interface View1
+{
+    String bar();
+
+    public class Mixin
+        implements View1
+    {
+        @This
+        FooModel model;
+
+        @Override
+        public String bar()
+        {
+            return model.getBar();
+        }
+    }
+}
+// END SNIPPET: decorator

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View2.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View2.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View2.java
new file mode 100644
index 0000000..517940f
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View2.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.decoratorMixin;
+
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.mixin.Mixins;
+
+@Mixins(View2.Mixin.class)
+public interface View2
+{
+    String bar();
+    public class Mixin
+        implements View2
+    {
+        @This
+        FooModel model;
+
+        @Override
+        public String bar()
+        {
+            return model.getBar();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Car.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Car.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Car.java
new file mode 100644
index 0000000..ea1198e
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Car.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.mixin.StartMixin;
+import org.apache.polygene.api.mixin.Startable;
+
+// START SNIPPET: partial
+@Mixins( { StartMixin.class, SpeedMixin.class, CrashResultMixin.class } )
+public interface Car extends Startable, Vehicle
+{}
+
+// END SNIPPET: partial

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/CrashResultMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/CrashResultMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/CrashResultMixin.java
new file mode 100644
index 0000000..9dbb130
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/CrashResultMixin.java
@@ -0,0 +1,24 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+public class CrashResultMixin implements Crashable
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Crashable.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Crashable.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Crashable.java
new file mode 100644
index 0000000..e83c78a
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Crashable.java
@@ -0,0 +1,24 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+public interface Crashable
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedLocation.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedLocation.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedLocation.java
new file mode 100644
index 0000000..21f3620
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedLocation.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+// START SNIPPET: partial
+public interface SpeedLocation
+{
+    void turn(float angle);
+
+    void accelerate(float acceleration);
+}
+// END SNIPPET: partial

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedMixin.java
new file mode 100644
index 0000000..7273441
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedMixin.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+// START SNIPPET: partial
+public abstract class SpeedMixin
+        implements SpeedLocation
+{
+    // state for speed
+
+    public void accelerate( float acceleration )
+    {
+        // logic
+    }
+}
+
+// END SNIPPET: partial
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Vehicle.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Vehicle.java b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Vehicle.java
new file mode 100644
index 0000000..4372398
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/partial/Vehicle.java
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.partial;
+
+// START SNIPPET: partial
+public interface Vehicle extends SpeedLocation, Crashable
+{
+}
+
+// END SNIPPET: partial
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/Cargo.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/Cargo.java b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/Cargo.java
new file mode 100644
index 0000000..6c61ac2
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/Cargo.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.privateMixin;
+
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.mixin.Mixins;
+
+// START SNIPPET: private
+@Mixins( CargoMixin.class )
+public interface Cargo extends EntityComposite
+{
+    String origin();
+
+    String destination();
+
+    void changeDestination( String newDestination );
+
+}
+
+// END SNIPPET: private

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoMixin.java b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoMixin.java
new file mode 100644
index 0000000..9629161
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoMixin.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.privateMixin;
+
+import org.apache.polygene.api.injection.scope.This;
+
+// START SNIPPET: private
+public abstract class CargoMixin
+        implements Cargo
+{
+    @This
+    private CargoState state;
+
+    public String origin()
+    {
+        return state.origin().get();
+    }
+
+    public String destination()
+    {
+        return state.destination().get();
+    }
+
+    public void changeDestination( String newDestination )
+    {
+        state.destination().set( newDestination );
+    }
+}
+
+// END SNIPPET: private
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoState.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoState.java b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoState.java
new file mode 100644
index 0000000..e93b561
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoState.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin.privateMixin;
+
+import org.apache.polygene.api.property.Property;
+
+// START SNIPPET: private
+public interface CargoState
+{
+    Property<String> origin();
+    Property<String> destination();
+}
+
+// END SNIPPET: private
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/object/ObjectBuilderTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/object/ObjectBuilderTest.java b/core/api/src/test/java/org/apache/polygene/api/object/ObjectBuilderTest.java
new file mode 100644
index 0000000..265d086
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/object/ObjectBuilderTest.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.object;
+
+import org.junit.Test;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * JAVADOC
+ */
+public class ObjectBuilderTest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.objects( A.class, B.class, C.class, D.class );
+    }
+
+    @Test
+    public void testNotProvidedUses()
+    {
+        A a = objectFactory.newObject( A.class );
+        assertNotNull( a );
+        assertNotNull( a.b );
+        assertNotNull( a.b.c );
+        assertNotNull( a.b.c.d );
+    }
+
+    public static class A
+    {
+        @Uses
+        B b;
+    }
+
+    public static class B
+    {
+        @Uses
+        C c;
+    }
+
+    public static class C
+    {
+        @Uses
+        D d;
+    }
+
+    public static class D
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java b/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
new file mode 100644
index 0000000..f0fe7a1
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import org.junit.Test;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+/**
+ * Error messages for Properties
+ */
+public class PropertyErrorTest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        new EntityTestAssembler().assemble( module );
+        module.entities( PersonEntity.class );
+    }
+
+    @Test( expected = ConstraintViolationException.class )
+    public void givenEntityWithNonOptionPropertyWhenInstantiatedThenException()
+        throws Exception
+    {
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        try
+        {
+            PersonEntity person = unitOfWork.newEntity( PersonEntity.class );
+
+            unitOfWork.complete();
+        }
+        finally
+        {
+            unitOfWork.discard();
+        }
+    }
+
+    interface PersonEntity
+        extends EntityComposite
+    {
+        Property<String> foo();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java b/core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
new file mode 100644
index 0000000..c612d0b
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
@@ -0,0 +1,139 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service;
+
+import java.util.List;
+import org.apache.polygene.api.activation.Activators;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.qualifier.ServiceTags;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+
+public class DocumentationSupport
+    implements Assembler
+{
+    // START SNIPPET: tag
+    // START SNIPPET: instantiateOnStartup
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        ServiceDeclaration service = module.addServices( MyDemoService.class );
+        // END SNIPPET: tag
+        service.instantiateOnStartup();
+        // END SNIPPET: instantiateOnStartup
+        // START SNIPPET: tag
+        service.taggedWith( "Important", "Drain" );
+        // END SNIPPET: tag
+    }
+
+    private static class MyDemoService
+    {
+    }
+
+    private static class MyOtherDemoService
+    {
+        // START SNIPPET: UseTag
+        @Service
+        private List<ServiceReference<MyDemoService>> services;
+
+        public MyDemoService locateImportantService()
+        {
+            for( ServiceReference<MyDemoService> ref : services )
+            {
+                ServiceTags serviceTags = ref.metaInfo( ServiceTags.class );
+                if( serviceTags.hasTag( "Important" ) )
+                {
+                    return ref.get();
+                }
+            }
+            return null;
+        }
+        // END SNIPPET: UseTag
+    }
+
+    // START SNIPPET: activation1
+    @Mixins( MyActivationMixin.class )
+    public static interface MyActivationDemoService
+        extends ServiceComposite, ServiceActivation
+    {
+    }
+
+    public static class MyActivationMixin
+        implements ServiceActivation
+    {
+        @Override
+        public void activateService()
+            throws Exception
+        {
+            // Activation code
+        }
+
+        @Override
+        public void passivateService()
+            throws Exception
+        {
+            // Passivation code
+        }
+    }
+    // END SNIPPET: activation1
+
+    // START SNIPPET: activation2
+    @Activators( MyActivator.class )
+    public static interface MyOtherActivationDemoService
+        extends ServiceComposite
+    {
+    }
+
+    public static class MyActivator
+        extends ServiceActivatorAdapter<MyOtherActivationDemoService>
+    {
+        @Override
+        public void afterActivation( ServiceReference<MyOtherActivationDemoService> activated )
+            throws Exception
+        {
+            // Activation code
+        }
+
+        @Override
+        public void beforePassivation( ServiceReference<MyOtherActivationDemoService> passivating )
+            throws Exception
+        {
+            // Passivation code
+        }
+    }
+    // END SNIPPET: activation2
+
+    static class Activation3
+        implements Assembler
+    {
+        // START SNIPPET: activation3
+        @Override
+        public void assemble( ModuleAssembly module )
+        {
+            module.services( MyDemoService.class ).withActivators( MyActivator.class );
+        }
+        // END SNIPPET: activation3
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java
new file mode 100644
index 0000000..87d609c
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/RemovalTest.java
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import org.apache.polygene.api.identity.StringIdentity;
+import org.junit.Test;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+public class RemovalTest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.entities( TestEntity.class );
+        module.entities( PidRegulator.class );
+        new EntityTestAssembler().assemble( module );
+    }
+
+    @Test
+    public void givenEntityIsCreatedAndUnitOfWorkIsNotCompletedWhenEntityIsRemoveThenSuccessfulRemoval()
+        throws Exception
+    {
+        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
+        try
+        {
+            EntityBuilder<TestEntity> builder = uow.newEntityBuilder( TestEntity.class, new StringIdentity( "123" ) );
+            builder.instance().test().set( "habba" );
+            TestEntity test = builder.newInstance();
+            uow.remove( test );
+            uow.complete();
+        }
+        finally
+        {
+            uow.discard();
+        }
+    }
+
+    @Test
+    public void givenStandardPidRegulatorWhenNoChangeInInputExpectOutputToGoTowardsMinimum()
+        throws Exception
+    {
+        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
+        PidRegulator regulator = null;
+        try
+        {
+            regulator = createPidRegulator( uow );
+        }
+        finally
+        {
+            if( regulator != null )
+            {
+                uow.remove( regulator );
+            }
+            // TODO: This problem is related to that uow.remove() has a bug.
+            // If the Entity is both created and removed in the same session, then the remove() should simply remove
+            // the entity from the internal UoW holding area, and not set the REMOVED status.
+
+            // Probably that UnitOfWorkInstance.remove() should also call instanceCache.remove(), but the question is
+            // then what is an InstanceKey vs EntityReference
+            uow.complete();
+        }
+    }
+
+    public interface TestEntity
+        extends EntityComposite
+    {
+        @Optional
+        Property<String> test();
+    }
+
+    private PidRegulator createPidRegulator( UnitOfWork uow )
+        throws UnitOfWorkCompletionException
+    {
+        EntityBuilder<PidRegulator> builder = uow.newEntityBuilder( PidRegulator.class );
+        PidRegulator prototype = builder.instance();
+        prototype.p().set( 1.0f );
+        prototype.i().set( 10f );
+        prototype.d().set( 0.1f );
+        prototype.maxD().set( 10f );
+        prototype.maximum().set( 100f );
+        prototype.minimum().set( 0f );
+        PidRegulator regulator = builder.newInstance();
+
+        return regulator;
+    }
+
+    //    @Mixins( { PidRegulatorAlgorithmMixin.class } )
+    public interface PidRegulator
+        extends PidParameters, EntityComposite
+    {
+    }
+
+    public interface PidParameters
+    {
+        Property<Float> p();
+
+        Property<Float> i();
+
+        Property<Float> d();
+
+        Property<Float> maxD();
+
+        Property<Float> minimum();
+
+        Property<Float> maximum();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
new file mode 100644
index 0000000..5f4b2ae
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import org.junit.Test;
+import org.apache.polygene.api.entity.EntityBuilderTemplate;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+/**
+ * TODO
+ */
+public class UnitOfWorkTemplateTest
+    extends AbstractPolygeneTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        new EntityTestAssembler().assemble( module );
+        module.entities( TestEntity.class );
+    }
+
+    @Test
+    public void testTemplate()
+        throws UnitOfWorkCompletionException
+    {
+        new UnitOfWorkTemplate<Void, RuntimeException>()
+        {
+            @Override
+            protected Void withUnitOfWork( UnitOfWork uow )
+                throws RuntimeException
+            {
+                new EntityBuilderTemplate<TestEntity>( TestEntity.class )
+                {
+                    @Override
+                    protected void build( TestEntity prototype )
+                    {
+                        prototype.name().set( "Rickard" );
+                    }
+                }.newInstance( module.instance() );
+
+                return null;
+            }
+        }.withModule( module.instance() );
+    }
+
+    interface TestEntity
+        extends EntityComposite
+    {
+        Property<String> name();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/util/ClassesTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/util/ClassesTest.java b/core/api/src/test/java/org/apache/polygene/api/util/ClassesTest.java
new file mode 100644
index 0000000..24acbb5
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/util/ClassesTest.java
@@ -0,0 +1,211 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.HashSet;
+import java.util.Set;
+import org.junit.Test;
+
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+import static org.apache.polygene.api.util.Classes.interfacesWithMethods;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Tests for Classes
+ */
+public class ClassesTest
+{
+
+    @Test
+    public void givenClassWithInterfacesWhenInterfacesOfThenGetCorrectSet()
+    {
+        assertThat( "one interface returned", interfacesOf( A.class ).count(), equalTo( 1L ) );
+        assertThat( "two interface returned", interfacesOf( B.class ).count(), equalTo( 2L ) );
+        assertThat( "tree interface returned", interfacesOf( C.class ).count(), equalTo( 4L ) );
+    }
+
+    @Test
+    public void givenClassWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet()
+    {
+        HashSet<Class<?>> interfaces = new HashSet<Class<?>>();
+        interfaces.add( B.class );
+        Set<Class<?>> types = interfacesWithMethods( interfaces );
+        assertThat( "one interface returned", types.size(), equalTo( 1 ) );
+        assertThat( "correct interface returned", types.contains( B.class ), is( true ) );
+    }
+
+    @Test
+    public void givenClassesWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet()
+    {
+        assertThat( "one interface returned", interfacesOf( C.class ).filter( Methods.HAS_METHODS )
+            .count(), equalTo( 1L ) );
+        boolean isIn = interfacesOf( C.class ).filter( Methods.HAS_METHODS )
+            .anyMatch( B.class::equals );
+        assertThat( "correct interface returned", isIn, is( true ) );
+    }
+
+    @Test
+    public void givenClassNameWhenToUriThenUriIsReturned()
+    {
+        assertThat( "URI is correct", Classes.toURI( A.class ), equalTo( "urn:polygene:type:org.apache.polygene.api.util.ClassesTest-A" ) );
+    }
+
+    @Test
+    public void givenUriWhenToClassNameThenClassNameIsReturned()
+    {
+        assertThat( "Class name is correct", Classes.toClassName( "urn:polygene:type:org.apache.polygene.api.util.ClassesTest-A" ), equalTo( "org.apache.polygene.api.util.ClassesTest$A" ) );
+    }
+
+    @Test
+    public void givenGenericTypeWithWildCardWhenGetRawClassThenCorrectTypeIsReturned()
+        throws NoSuchMethodException
+    {
+        Type returnType = Generics.class.getMethod( "wildcard" ).getGenericReturnType();
+        Type wildcardType = ( (ParameterizedType) returnType ).getActualTypeArguments()[ 0 ];
+        assertThat( "Return type is A", Classes.RAW_CLASS.apply( wildcardType ), equalTo( (Class) A.class ) );
+    }
+
+    @Test
+    public void givenTypeVariableWhenResolveThenResolved()
+    {
+        for( Method method : Type1.class.getMethods() )
+        {
+            Type type = method.getGenericReturnType();
+            TypeVariable typeVariable = (TypeVariable) type;
+            Type resolvedType = Classes.resolveTypeVariable( typeVariable, method.getDeclaringClass(), Type1.class );
+            System.out.println( type + "=" + resolvedType );
+            switch( method.getName() )
+            {
+            case "type":
+                assertThat( resolvedType, equalTo( (Type) String.class ) );
+                break;
+            case "type1":
+                assertThat( resolvedType, equalTo( (Type) String.class ) );
+                break;
+            case "type2":
+                assertThat( resolvedType, equalTo( (Type) Long.class ) );
+                break;
+            }
+        }
+    }
+
+    @Test
+    public void givenGenericTypeWhenGetSimpleGenericNameThenCorrectStringIsReturned()
+        throws NoSuchMethodException
+    {
+        assertThat( "Simple Generic Name is 'A'",
+                    Classes.simpleGenericNameOf( A.class ),
+                    equalTo( "A" ) );
+        assertThat( "Simple Generic Name is 'B'",
+                    Classes.simpleGenericNameOf( B.class ),
+                    equalTo( "B" ) );
+        assertThat( "Simple Generic Name is 'C'",
+                    Classes.simpleGenericNameOf( C.class ),
+                    equalTo( "C" ) );
+
+        assertThat( "Simple Generic Name is 'Generics'",
+                    Classes.simpleGenericNameOf( Generics.class ),
+                    equalTo( "Generics" ) );
+        assertThat( "Simple Generic Name is 'Iterable<? extends A>'",
+                    Classes.simpleGenericNameOf( Generics.class.getMethod( "wildcard" ).getGenericReturnType() ),
+                    equalTo( "Iterable<? extends A>" ) );
+
+        assertThat( "Simple Generic Name is 'Type1'",
+                    Classes.simpleGenericNameOf( Type1.class ),
+                    equalTo( "Type1" ) );
+        assertThat( "Simple Generic Name is 'TYPE'",
+                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type" ).getGenericReturnType() ),
+                    equalTo( "TYPE" ) );
+        assertThat( "Simple Generic Name is 'TYPE1'",
+                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type1" ).getGenericReturnType() ),
+                    equalTo( "TYPE1" ) );
+        assertThat( "Simple Generic Name is 'TYPE2'",
+                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type2" ).getGenericReturnType() ),
+                    equalTo( "TYPE2" ) );
+
+        assertThat( "Simple Generic Name is 'Type2'",
+                    Classes.simpleGenericNameOf( Type2.class ),
+                    equalTo( "Type2" ) );
+        assertThat( "Simple Generic Name is 'TYPE'",
+                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type" ).getGenericReturnType() ),
+                    equalTo( "TYPE" ) );
+        assertThat( "Simple Generic Name is 'TYPE1'",
+                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type1" ).getGenericReturnType() ),
+                    equalTo( "TYPE1" ) );
+        assertThat( "Simple Generic Name is 'TYPE2'",
+                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type2" ).getGenericReturnType() ),
+                    equalTo( "TYPE2" ) );
+
+        assertThat( "Simple Generic Name is 'Type3'",
+                    Classes.simpleGenericNameOf( Type3.class ),
+                    equalTo( "Type3" ) );
+        assertThat( "Simple Generic Name is 'TYPE'",
+                    Classes.simpleGenericNameOf( Type3.class.getMethod( "type" ).getGenericReturnType() ),
+                    equalTo( "TYPE" ) );
+    }
+
+    interface A
+    {
+    }
+
+    interface B
+        extends A
+    {
+
+        public void doStuff();
+    }
+
+    interface C
+        extends A, B
+    {
+    }
+
+    interface Generics
+    {
+
+        Iterable<? extends A> wildcard();
+    }
+
+    interface Type1
+        extends Type2<String, Long>
+    {
+    }
+
+    interface Type2<TYPE1, TYPE2>
+        extends Type3<TYPE1>
+    {
+
+        TYPE1 type1();
+
+        TYPE2 type2();
+    }
+
+    interface Type3<TYPE>
+    {
+
+        TYPE type();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/util/CollectorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/util/CollectorsTest.java b/core/api/src/test/java/org/apache/polygene/api/util/CollectorsTest.java
new file mode 100644
index 0000000..5521b93
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/util/CollectorsTest.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.util;
+
+import java.util.Optional;
+import java.util.stream.Stream;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+public class CollectorsTest
+{
+    @Test
+    public void single()
+    {
+        assertThat( Stream.of( 1L ).collect( Collectors.single() ), is( 1L ) );
+
+        try
+        {
+            Stream.of().collect( Collectors.single() );
+            fail( "Should have failed" );
+        }
+        catch( IllegalArgumentException ex ) {}
+        try
+        {
+            Stream.of( 1, 1 ).collect( Collectors.single() );
+            fail( "Should have failed" );
+        }
+        catch( IllegalArgumentException ex ) {}
+        try
+        {
+            Stream.of( 1, 1, 1 ).collect( Collectors.single() );
+            fail( "Should have failed" );
+        }
+        catch( IllegalArgumentException ex ) {}
+    }
+
+    @Test
+    public void singleOrEmpty()
+    {
+        assertEquals( Optional.empty(), Stream.of().collect( Collectors.singleOrEmpty() ) );
+        assertEquals( Optional.of( 1 ), Stream.of( 1 ).collect( Collectors.singleOrEmpty() ) );
+
+        try
+        {
+            Stream.of( 1, 1 ).collect( Collectors.singleOrEmpty() );
+            fail( "Should have failed" );
+        }
+        catch( IllegalArgumentException ex ) {}
+        try
+        {
+            Stream.of( 1, 1, 1 ).collect( Collectors.singleOrEmpty() );
+            fail( "Should have failed" );
+        }
+        catch( IllegalArgumentException ex ) {}
+    }
+}


[54/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-configure-service.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-configure-service.txt b/manual/src/docs/tutorials/howto-configure-service.txt
index 4bfe228..02dc0a6 100644
--- a/manual/src/docs/tutorials/howto-configure-service.txt
+++ b/manual/src/docs/tutorials/howto-configure-service.txt
@@ -28,7 +28,7 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == We need a Service ==
 
@@ -37,7 +37,7 @@ Destinations. For the sake of simplicity, we are leaving out the domain details.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlan.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlan.java
 tag=service
 -----------
 
@@ -45,7 +45,7 @@ So, then there is the ServiceComposite...
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlanService.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlanService.java
 tag=serviceComposite
 -----------
 
@@ -55,7 +55,7 @@ configuration interface.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlanConfiguration.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlanConfiguration.java
 tag=configuration
 -----------
 
@@ -66,7 +66,7 @@ Now we can access this configuration in the TravelPlanMixin like this;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlanMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlanMixin.java
 tag=mixin
 -----------
 
@@ -77,7 +77,7 @@ with the refresh() method in the Configuration interface;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlanMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlanMixin.java
 tag=refresh
 -----------
 
@@ -98,7 +98,7 @@ So, we create a properties file, where the keys are the names of the properties
 
 [snippet,bash]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/TravelPlanService.properties
+source=manual/src/main/java/org/apache/polygene/manual/travel/TravelPlanService.properties
 tag=params
 -----------
 File: org/hedhman/niclas/travel/TravelPlanService.properties
@@ -109,7 +109,7 @@ And this would work with the standard assembly.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/Main.java
 tag=simple
 -----------
 
@@ -120,7 +120,7 @@ the same package as the ServiceComposite sub type, the TravelPlanService in the
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/travel/Main.java
 tag=assemble
 -----------
 
@@ -128,18 +128,18 @@ And the two files for configuration,
 
 [snippet,bash]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/ExpediaService.properties
+source=manual/src/main/java/org/apache/polygene/manual/travel/ExpediaService.properties
 tag=params
 -----------
-File: org/apache/zest/manual/travel/ExpediaService.properties
+File: org/apache/polygene/manual/travel/ExpediaService.properties
 
 
 [snippet,bash]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/travel/OrbitzService.properties
+source=manual/src/main/java/org/apache/polygene/manual/travel/OrbitzService.properties
 tag=params
 -----------
-File: org/apache/zest/manual/travel/OrbitzService.properties
+File: org/apache/polygene/manual/travel/OrbitzService.properties
 
 == Changing Configuration in runtime ==
 Unlike most frameworks, the Configuration in Polygene\u2122 is an active Entity, and once the properties file has been read once

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-contextual-fragments.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-contextual-fragments.txt b/manual/src/docs/tutorials/howto-contextual-fragments.txt
index aee1ae8..d42152a 100644
--- a/manual/src/docs/tutorials/howto-contextual-fragments.txt
+++ b/manual/src/docs/tutorials/howto-contextual-fragments.txt
@@ -32,13 +32,13 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 The mixins, sideeffects and concerns are added during the bootstrap phase. It is very straight-forward;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/contextualFragments/TraceAll.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/contextualFragments/TraceAll.java
 tag=assemble
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-create-concern.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-create-concern.txt b/manual/src/docs/tutorials/howto-create-concern.txt
index ade015d..d76ae1f 100644
--- a/manual/src/docs/tutorials/howto-create-concern.txt
+++ b/manual/src/docs/tutorials/howto-create-concern.txt
@@ -26,7 +26,7 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == Typed Concern ==
 
@@ -34,7 +34,7 @@ A typed Concern is a Java class that implements the MixinType it can be used on:
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/InventoryConcern.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/InventoryConcern.java
 tag=allClass
 -----------
 
@@ -49,7 +49,7 @@ It can be used as follows;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/Order.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/Order.java
 tag=class
 -----------
 
@@ -63,7 +63,7 @@ arbitrary MixinType.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/MyGenericConcern.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/MyGenericConcern.java
 tag=class
 -----------
 
@@ -71,7 +71,7 @@ It can be used as follows;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/AnyMixinType.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/AnyMixinType.java
 tag=class
 -----------
 
@@ -90,7 +90,7 @@ Here is how the declaration goes ;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/MyGenericConcern.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/MyGenericConcern.java
 tag=appliesTo
 -----------
 
@@ -98,7 +98,7 @@ And how to use the annotation ;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/AnyMixinType.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/AnyMixinType.java
 tag=annotationUse
 -----------
 
@@ -108,6 +108,6 @@ Finally here is how to implement an AppliesToFilter:
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/concern/MyAppliesToFilter.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/concern/MyAppliesToFilter.java
 tag=filter
 -----------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-create-constraint.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-create-constraint.txt b/manual/src/docs/tutorials/howto-create-constraint.txt
index 5d0630c..9efd38e 100644
--- a/manual/src/docs/tutorials/howto-create-constraint.txt
+++ b/manual/src/docs/tutorials/howto-create-constraint.txt
@@ -26,7 +26,7 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == Method Constraint ==
 
@@ -34,7 +34,7 @@ Method Constraints are declared with annotations on the method argument. The ann
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/Dialer.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/Dialer.java
 tag=dialer
 -----------
 
@@ -42,7 +42,7 @@ In the code above we say that we want the argument to the callPhoneNumber() meth
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/PhoneNumber.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumber.java
 tag=annotation
 -----------
 
@@ -50,7 +50,7 @@ We then need to provide the Constraint implementation.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/PhoneNumberConstraint.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberConstraint.java
 tag=constraint
 -----------
 
@@ -58,7 +58,7 @@ We also need to include the Constraint on the Composites we want to have them pr
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/DialerComposite.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/DialerComposite.java
 tag=composite
 -----------
 
@@ -67,7 +67,7 @@ in the method invocation. Concerns can be used to catch and report these violati
 
 [snippet,java]
 ----
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/ParameterViolationConcern.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/ParameterViolationConcern.java
 tag=report
 ----
 
@@ -77,7 +77,7 @@ Property Constraints are declared on the Property method.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/HasPhoneNumber.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/HasPhoneNumber.java
 tag=property
 -----------
 
@@ -89,6 +89,6 @@ which can be done like this;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createConstraint/PhoneNumberParameterViolationConcern.java
 tag=property
 -----------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-create-entity.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-create-entity.txt b/manual/src/docs/tutorials/howto-create-entity.txt
index 0fb0044..2a20ce6 100644
--- a/manual/src/docs/tutorials/howto-create-entity.txt
+++ b/manual/src/docs/tutorials/howto-create-entity.txt
@@ -29,7 +29,7 @@ include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 Moreover, you'll need an EntityStore for persistence and an Indexing engine for querying. Choose among the available
 implementations listed in the <<extensions>> section.
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == Basics First ==
 
@@ -68,17 +68,17 @@ Entity management.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/Car.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Car.java
 tag=entity
 -----------
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/Manufacturer.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Manufacturer.java
 tag=entity
 -----------
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/Accident.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Accident.java
 tag=entity
 -----------
 
@@ -93,17 +93,17 @@ We will also need to define the composites for the above domain structure;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntity.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntity.java
 tag=composite
 -----------
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/ManufacturerEntity.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/ManufacturerEntity.java
 tag=composite
 -----------
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/AccidentValue.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/AccidentValue.java
 tag=composite
 -----------
 
@@ -117,7 +117,7 @@ We must also assemble an EntityStore for the entire application, but that is out
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/MyAssembler.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/MyAssembler.java
 tag=assembler1
 -----------
 
@@ -133,7 +133,7 @@ fairly small implementation. So how is that done?
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactory.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactory.java
 tag=carFactory
 -----------
 
@@ -142,7 +142,7 @@ make it possible for the service injection later.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactoryService.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactoryService.java
 tag=carFactoryService
 -----------
 
@@ -150,7 +150,7 @@ Then we need an implementation of the mixin.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactoryMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactoryMixin.java
 tag=carFactoryMixin1
 -----------
 
@@ -162,7 +162,7 @@ to obtain a Module is simply to;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactoryMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactoryMixin.java
 tag=carFactoryMixin2
 -----------
 
@@ -171,7 +171,7 @@ during the construction, we can also request it in the same manner as constructo
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactoryMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactoryMixin.java
 tag=carFactoryMixin3
 -----------
 
@@ -182,7 +182,7 @@ We then need to provide the implementation for the create() method.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/CarEntityFactoryMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/CarEntityFactoryMixin.java
 tag=create
 -----------
 
@@ -194,7 +194,7 @@ re-usable. So let's create one for the Manufacturer type.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/ManufacturerRepository.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/ManufacturerRepository.java
 tag=repo
 -----------
 
@@ -202,7 +202,7 @@ And then we repeat the process for creating a Service...
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/ManufacturerRepositoryService.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/ManufacturerRepositoryService.java
 tag=manufacturerRepositoryService
 -----------
 
@@ -210,7 +210,7 @@ and a Mixin that implements it...
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/ManufacturerRepositoryMixin.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/ManufacturerRepositoryMixin.java
 tag=repo
 -----------
 
@@ -219,7 +219,7 @@ Services to be available to the application layer above, and not restricted to w
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/createEntity/MyAssembler.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/MyAssembler.java
 tag=assembler2
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-create-sideeffect.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-create-sideeffect.txt b/manual/src/docs/tutorials/howto-create-sideeffect.txt
index 4506a51..d9b5680 100644
--- a/manual/src/docs/tutorials/howto-create-sideeffect.txt
+++ b/manual/src/docs/tutorials/howto-create-sideeffect.txt
@@ -26,7 +26,7 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == Typed SideEffect ==
 
@@ -34,7 +34,7 @@ A typed SideEffect is a Java class that implements the MixinType it can be used
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/MailNotifySideEffect.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/MailNotifySideEffect.java
 tag=allClass
 -----------
 
@@ -49,7 +49,7 @@ It can be used as follows;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/OrderEntity.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/OrderEntity.java
 tag=body
 -----------
 
@@ -62,7 +62,7 @@ arbitrary MixinType.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/MyGenericSideEffect.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/MyGenericSideEffect.java
 tag=body
 -----------
 
@@ -70,7 +70,7 @@ It can be used as follows;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/AnyMixinType.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/AnyMixinType.java
 tag=body
 -----------
 
@@ -90,7 +90,7 @@ Here is how the declaration goes ;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/MyGenericSideEffect.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/MyGenericSideEffect.java
 tag=appliesTo
 -----------
 
@@ -98,7 +98,7 @@ And how to use the annotation ;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/AnyMixinType.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/AnyMixinType.java
 tag=annotation
 -----------
 
@@ -108,7 +108,7 @@ Finally here is how to implement an AppliesToFilter:
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/sideeffects/MyAppliesToFilter.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/sideeffects/MyAppliesToFilter.java
 tag=filter
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-depend-on-zest.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-depend-on-zest.txt b/manual/src/docs/tutorials/howto-depend-on-zest.txt
index 76fe286..8b3901b 100644
--- a/manual/src/docs/tutorials/howto-depend-on-zest.txt
+++ b/manual/src/docs/tutorials/howto-depend-on-zest.txt
@@ -17,7 +17,7 @@
  * under the License.
 ///////////////////////////////////////////////////////////////
 
-[[howto-depend-on-zest,Depend on Polygene\u2122 in your build]]
+[[howto-depend-on-polygene,Depend on Polygene\u2122 in your build]]
 = Depend on Polygene\u2122 in your build =
 
 NOTE: Some of the <<libraries>> and <<extensions>> depend on artifacts that are not deployed in central, you'll need to
@@ -37,7 +37,7 @@ http://repository.apache.org/snapshots/
 == Manually ==
 
 If you don't rely on your build scripts dependency resolution mechanism you should
-https://zest.apache.org/download.html[download] the SDK distribution.
+https://polygene.apache.org/download.html[download] the SDK distribution.
 
 
 == Using Maven ==

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-invocation-annotation.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-invocation-annotation.txt b/manual/src/docs/tutorials/howto-invocation-annotation.txt
index a712093..8c87fe3 100644
--- a/manual/src/docs/tutorials/howto-invocation-annotation.txt
+++ b/manual/src/docs/tutorials/howto-invocation-annotation.txt
@@ -53,7 +53,7 @@ First create an annotation of your own liking, it must have +java.lang.annotatio
 
 [snippet,java]
 -----------
-source=core/runtime/src/test/java/org/apache/zest/runtime/injection/InvocationInjectionTest.java
+source=core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
 tag=annotation
 -----------
 
@@ -61,7 +61,7 @@ After that it is possible to have this annotation placed on composite type metho
 
 [snippet,java]
 -----------
-source=core/runtime/src/test/java/org/apache/zest/runtime/injection/InvocationInjectionTest.java
+source=core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
 tag=declaration
 -----------
 
@@ -69,7 +69,7 @@ and then the annotation can simply be injected into your Concerns or Mixins, lik
 
 [snippet,java]
 -----------
-source=core/runtime/src/test/java/org/apache/zest/runtime/injection/InvocationInjectionTest.java
+source=core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
 tag=use1
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-leverage-properties.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-leverage-properties.txt b/manual/src/docs/tutorials/howto-leverage-properties.txt
index f12482b..c3fda1e 100644
--- a/manual/src/docs/tutorials/howto-leverage-properties.txt
+++ b/manual/src/docs/tutorials/howto-leverage-properties.txt
@@ -27,19 +27,19 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/api/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 So in Polygene, instead of writing;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/pojo/Book.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/pojo/Book.java
 tag=book
 -----------
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/pojo/MutableBook.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/pojo/MutableBook.java
 tag=mutableBook
 -----------
 
@@ -54,7 +54,7 @@ like this;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/Book.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/Book.java
 tag=book
 -----------
 
@@ -67,7 +67,7 @@ There is more to this than meets the eye.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/BookFactory.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/BookFactory.java
 tag=create
 -----------
 
@@ -90,7 +90,7 @@ actual domain model. Such Swing client will utilize a SwingInfo property info if
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/SwingInfo.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/SwingInfo.java
 tag=info
 -----------
 
@@ -98,6 +98,6 @@ Our generic Swing UI will be mainly reflective in nature, but when it gets hold
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/properties/SwingPanel.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/properties/SwingPanel.java
 tag=info-use
 -----------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-releasing-apache.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-releasing-apache.txt b/manual/src/docs/tutorials/howto-releasing-apache.txt
index e37a6eb..2854c88 100644
--- a/manual/src/docs/tutorials/howto-releasing-apache.txt
+++ b/manual/src/docs/tutorials/howto-releasing-apache.txt
@@ -49,16 +49,16 @@ Clone/checkout all needed repositories, next to each other:
 
 [source,shell]
 ----
-mkdir zest-repos
-cd zest-repos
-git clone https://git-wip-us.apache.org/repos/asf/zest-java.git zest-java
-svn checkout https://svn.apache.org/repos/asf/zest/ zest-web
-svn checkout --depth empty https://dist.apache.org/repos/dist/ zest-dist
-cd zest-dist
+mkdir polygene-repos
+cd polygene-repos
+git clone https://git-wip-us.apache.org/repos/asf/polygene-java.git polygene-java
+svn checkout https://svn.apache.org/repos/asf/polygene/ polygene-web
+svn checkout --depth empty https://dist.apache.org/repos/dist/ polygene-dist
+cd polygene-dist
 svn update --set-depth immediates dev
 svn update --set-depth immediates release
-svn update --set-depth infinity dev/zest
-svn update --set-depth infinity release/zest
+svn update --set-depth infinity dev/polygene
+svn update --set-depth infinity release/polygene
 ----
 
 You should then get the following directory tree:
@@ -66,20 +66,20 @@ You should then get the following directory tree:
 [source,text]
 ----
 .
-\u2514\u2500\u2500 zest-repos
-    \u251c\u2500\u2500 zest-java           # Apache Polygene\u2122 (Java Edition) source
-    \u251c\u2500\u2500 zest-web            # https://zest.apache.org/ website
-    \u2514\u2500\u2500 zest-dist
+\u2514\u2500\u2500 polygene-repos
+    \u251c\u2500\u2500 polygene-java           # Apache Polygene\u2122 (Java Edition) source
+    \u251c\u2500\u2500 polygene-web            # https://polygene.apache.org/ website
+    \u2514\u2500\u2500 polygene-dist
         \u251c\u2500\u2500 dev
-        |   \u2514\u2500\u2500 zest        # Releases candidate distributions
+        |   \u2514\u2500\u2500 polygene        # Releases candidate distributions
         \u2514\u2500\u2500 release
-            \u2514\u2500\u2500 zest        # Releases distributions
+            \u2514\u2500\u2500 polygene        # Releases distributions
 ----
 
 
 [TIP]
 ====
-From now on, all command line snippets start from the `zest-repos` directory.
+From now on, all command line snippets start from the `polygene-repos` directory.
 ====
 
 
@@ -91,7 +91,7 @@ Here is what should pass before going further:
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 ./gradlew -Dversion="<RELEASE-VERSION>" website signArchives
 ----
 
@@ -100,7 +100,7 @@ See the <<build-system, Build System>> tutorial for details.
 
 === Install Jekyll
 
-Moreover, you will need to have a valid http://jekyllrb.com/[Jekyll] installation as the Apache Polygene\u2122 https://zest.apache.org/[website] is generated using it.
+Moreover, you will need to have a valid http://jekyllrb.com/[Jekyll] installation as the Apache Polygene\u2122 https://polygene.apache.org/[website] is generated using it.
 
 
 === Setup git flow
@@ -128,26 +128,26 @@ See the Apache https://www.apache.org/dev/publishing-maven-artifacts.html[Publis
 
 === Update the `KEYS` files if needed.
 
-The reference `KEYS` file can be found at the `zest-java` repository's root, that is `zest-java/KEYS`.
+The reference `KEYS` file can be found at the `polygene-java` repository's root, that is `polygene-java/KEYS`.
 Ensure that it contains your public key.
 
 Next, diff it against the ones present in the `dev` and `release` distribution areas:
 
 [source,shell]
 ----
-diff zest-java/KEYS zest-dist/dev/zest/KEYS
-diff zest-java/KEYS zest-dist/release/zest/KEYS
+diff polygene-java/KEYS polygene-dist/dev/polygene/KEYS
+diff polygene-java/KEYS polygene-dist/release/polygene/KEYS
 ----
 
 And update them if needed:
 
 [source,shell]
 ----
-cp zest-java/KEYS zest-dist/dev/zest/KEYS
-cp zest-java/KEYS zest-dist/release/zest/KEYS
-cd zest-dist/dev/zest
-svn add dev/zest/KEYS release/zest/KEYS
-svn commit -m "zest: updating Polygene KEYS"
+cp polygene-java/KEYS polygene-dist/dev/polygene/KEYS
+cp polygene-java/KEYS polygene-dist/release/polygene/KEYS
+cd polygene-dist/dev/polygene
+svn add dev/polygene/KEYS release/polygene/KEYS
+svn commit -m "polygene: updating Polygene KEYS"
 ----
 
 
@@ -179,27 +179,27 @@ Set it up to generate plain-text release-notes.
 We will need these in several formats.
 Starting from the plain-text one we will generate the others.
 
-First save the text-plain release-notes in a file named `apache-zest-java-<RELEASE-VERSION>-release-notes.txt`.
-A good place for this file would be in the `zest-repos` directory created earlier, alongside all repositories.
+First save the text-plain release-notes in a file named `apache-polygene-java-<RELEASE-VERSION>-release-notes.txt`.
+A good place for this file would be in the `polygene-repos` directory created earlier, alongside all repositories.
 
 Convert to Asciidoc:
 
 [source,shell]
 ----
-cat "apache-zest-java-<RELEASE-VERSION>-release-notes.txt" | \
+cat "apache-polygene-java-<RELEASE-VERSION>-release-notes.txt" | \
   sed -e "s/\[ZEST-\([0-9]\)*\]/https:\/\/issues.apache.org\/jira\/browse\/ZEST-\1[ZEST-\1]/" | \
   sed -e "s/    \* /- /" |�sed -e "s/^\*\*/====/" \
-  > "apache-zest-java-<RELEASE-VERSION>-release-notes.adoc"
+  > "apache-polygene-java-<RELEASE-VERSION>-release-notes.adoc"
 ----
 
 Convert to Markdown:
 
 [source,shell]
 ----
-cat "apache-zest-java-<RELEASE-VERSION>-release-notes.txt" | \
+cat "apache-polygene-java-<RELEASE-VERSION>-release-notes.txt" | \
   sed -e "s/\[ZEST-\([0-9]*\)\]/[ZEST-\1](https:\/\/issues.apache.org\/jira\/browse\/ZEST-\1)/" | \
   sed -e "s/    \* /- /" |�sed -e "s/^\*\*/####/" \
-  > "apache-zest-java-<RELEASE-VERSION>-release-notes.md"
+  > "apache-polygene-java-<RELEASE-VERSION>-release-notes.md"
 ----
 
 You should then have the following files:
@@ -207,9 +207,9 @@ You should then have the following files:
 [source,shell]
 ----
 .
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-release-notes.txt
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-release-notes.adoc
-\u2514\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-release-notes.md
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-release-notes.txt
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-release-notes.adoc
+\u2514\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-release-notes.md
 ----
 
 We will use them later.
@@ -221,7 +221,7 @@ We use `<RELEASE-VERSION>-RC#` where `RELEASE-VERSION` is the target release ver
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git flow release start "<RELEASE-VERSION>-RC#"
 ----
 
@@ -234,34 +234,34 @@ Make a complete build, deploying maven artifacts locally:
 
 [source,shell]
 ----
-cd zest-java
-./gradlew -Dversion="<RELEASE-VERSION>" -PuploadRepository="file://$(pwd)/build/repositories/zest-java" \
+cd polygene-java
+./gradlew -Dversion="<RELEASE-VERSION>" -PuploadRepository="file://$(pwd)/build/repositories/polygene-java" \
     clean assemble checkDists uploadArchives
 ----
 
-Review maven artifacts in `build/repositories/zest-java`.
+Review maven artifacts in `build/repositories/polygene-java`.
 
 Also review the release distributions in `build/distributions` where you should find the following files:
 
 [source,shell]
 ----
 .
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.tgz
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.tgz.MD5
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.tgz.SHA-512
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.tgz.asc
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.zip
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.zip.MD5
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.zip.SHA-512
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-bin.zip.asc
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.tgz
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.tgz.MD5
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.tgz.SHA-512
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.tgz.asc
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.zip
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.zip.MD5
-\u251c\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.zip.SHA-512
-\u2514\u2500\u2500 apache-zest-java-<RELEASE-VERSION>-src.zip.asc
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.tgz
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.tgz.MD5
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.tgz.SHA-512
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.tgz.asc
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.zip
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.zip.MD5
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.zip.SHA-512
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-bin.zip.asc
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.tgz
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.tgz.MD5
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.tgz.SHA-512
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.tgz.asc
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.zip
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.zip.MD5
+\u251c\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.zip.SHA-512
+\u2514\u2500\u2500 apache-polygene-java-<RELEASE-VERSION>-src.zip.asc
 ----
 
 If any, make the required changes, commit them and iterate.
@@ -273,7 +273,7 @@ Once you are satisfied with the produced artifacts, close the release candidate
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git flow release finish "<RELEASE-VERSION>-RC#"
 ----
 
@@ -284,7 +284,7 @@ To build the release candidate bits, we need to checkout the release candidate t
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git checkout "<RELEASE-VERSION>-RC#"
 ----
 
@@ -293,7 +293,7 @@ git checkout "<RELEASE-VERSION>-RC#"
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 ./gradlew -Dversion="<RELEASE-VERSION>" clean assemble
 ----
 
@@ -304,7 +304,7 @@ Stage artifacts to https://repository.apache.org/[repository.apache.org] :
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 ./gradlew -Dversion="<RELEASE-VERSION>" uploadArchives
 ----
 
@@ -313,63 +313,63 @@ Close the staging Nexus repository by following the https://www.apache.org/dev/p
 
 === Upload RC distributions
 
-Source and binary distributions, checksums and signatures must be uploaded to https://dist.apache.org/repos/dist/dev/zest/[dist.apache.org/repos/dist/dev/zest].
-This build created these in the `buid/distributions` directory, named `apache-zest-java-<RELEASE-VERSION>-[src|bin]*.*`.
+Source and binary distributions, checksums and signatures must be uploaded to https://dist.apache.org/repos/dist/dev/polygene/[dist.apache.org/repos/dist/dev/polygene].
+This build created these in the `buid/distributions` directory, named `apache-polygene-java-<RELEASE-VERSION>-[src|bin]*.*`.
 As this release still is a simple candidate, we'll rename them before upload to advertise this in their names.
 
 [source,shell]
 ----
 # Source ZIP
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.zip" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.zip.MD5" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.MD5"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.zip.SHA-512" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.zip.asc" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.asc"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.zip" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.zip.MD5" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.MD5"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.zip.SHA-512" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.zip.asc" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.asc"
 # Source TAR.GZ
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.tgz" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.tgz.MD5" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.MD5"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.tgz.SHA-512" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-src.tgz.asc" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.asc"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.tgz" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.tgz.MD5" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.MD5"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.tgz.SHA-512" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-src.tgz.asc" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.asc"
 # Binary ZIP
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.zip" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.zip.MD5" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.MD5"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.zip.SHA-512" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.zip.asc" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.asc"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.zip" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.zip.MD5" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.MD5"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.zip.SHA-512" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.zip.asc" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.asc"
 # Binary TAR.GZ
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.tgz" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.tgz.MD5" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.tgz.SHA-512" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512"
-cp "zest-java/build/distributions/apache-zest-java-<RELEASE-VERSION>-bin.tgz.asc" \
-   "zest-dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.asc"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.tgz" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.MD5" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.SHA-512" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512"
+cp "polygene-java/build/distributions/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.asc" \
+   "polygene-dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.asc"
 ----
 
 And then upload them:
 
 [source,shell]
 ----
-cd zest-dist/dev/zest
+cd polygene-dist/dev/polygene
 svn add * --force
-svn commit -m "zest: upload <RELEASE-VERSION> to dist/dev/zest"
+svn commit -m "polygene: upload <RELEASE-VERSION> to dist/dev/polygene"
 ----
 
 
 == Run the vote
 
-Send a "VOTE" to the mailto:dev@zest.apache.org[developer mailing list] including links to release artifacts. A VOTE always contains two parts. Send an email to the developer mailing list with the subject line:
+Send a "VOTE" to the mailto:dev@polygene.apache.org[developer mailing list] including links to release artifacts. A VOTE always contains two parts. Send an email to the developer mailing list with the subject line:
 
 [source,text]
 ----
@@ -386,13 +386,13 @@ I am happy to start the VOTE thread for Apache Polygene (Java Edition) <RELEASE-
 
 The changelog for this release can be found here: https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=12316820&version=12332997
 
-Tag: https://git-wip-us.apache.org/repos/asf?p=zest-java.git;a=tag;h=refs/tags/<RELEASE-VERSION>-RC#
+Tag: https://git-wip-us.apache.org/repos/asf?p=polygene-java.git;a=tag;h=refs/tags/<RELEASE-VERSION>-RC#
 
-The distributions to be voted on are located here: https://dist.apache.org/repos/dist/dev/zest/
+The distributions to be voted on are located here: https://dist.apache.org/repos/dist/dev/polygene/
 
-Convenience artifacts in a maven repository are staged here: https://repository.apache.org/content/groups/staging/org/apache/zest/
+Convenience artifacts in a maven repository are staged here: https://repository.apache.org/content/groups/staging/org/apache/polygene/
 
-Release distributions and convenience artifacts are signed with the following key: https://dist.apache.org/repos/dist/dev/zest/KEYS
+Release distributions and convenience artifacts are signed with the following key: https://dist.apache.org/repos/dist/dev/polygene/KEYS
 
 Please vote on releasing this package as Apache Polygene (Java Edition) <RELEASE-VERSION>.
 
@@ -420,8 +420,8 @@ Here is a sample template:
 
 [source,text]
 ----
-To: "Polygene Developers List" <de...@zest.apache.org>
-CC: "Polygene Project Management Committee List" <pr...@zest.apache.org>
+To: "Polygene Developers List" <de...@polygene.apache.org>
+CC: "Polygene Project Management Committee List" <pr...@polygene.apache.org>
 Subject: [RESULT][VOTE] Release Polygene (Java Edition) version <RELEASE-VERSION>
 
 Hi,
@@ -448,29 +448,29 @@ A single check is better than none.
 
 === Download RC
 
-First go downloading the release candidate distributions from https://dist.apache.org/repos/dist/dev/zest/[dist.a.o/repos/dist/dev/zest].
+First go downloading the release candidate distributions from https://dist.apache.org/repos/dist/dev/polygene/[dist.a.o/repos/dist/dev/polygene].
 Including `*.MD5`, `*.SHA-512` and `*.asc` files.
 Put them in a directory:
 
 [source,shell]
 ----
-cd zest-check-rc
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.asc
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.MD5
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.asc
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.MD5
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.asc
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.MD5
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512
-wget https://dist.apache.org/repos/dist/dev/zest/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.asc
+cd polygene-check-rc
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.asc
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.MD5
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.asc
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.MD5
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.asc
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.MD5
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512
+wget https://dist.apache.org/repos/dist/dev/polygene/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.asc
 ----
 
 
@@ -480,11 +480,11 @@ Verify PGP signatures:
 
 [source,shell]
 ----
-cd zest-check-rc
-gpg apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.asc
-gpg apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.asc
-gpg apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.asc
-gpg apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.asc
+cd polygene-check-rc
+gpg apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.asc
+gpg apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.asc
+gpg apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.asc
+gpg apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.asc
 ----
 
 This must output `gpg: Good signature from "Signer Name <si...@ema.il>"` for each distribution.
@@ -494,11 +494,11 @@ Verify MD5 checksum:
 
 [source,shell]
 ----
-cd zest-check-rc
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5) apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz" | md5sum -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.MD5) apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip" | md5sum -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.MD5) apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz" | md5sum -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.MD5) apache-zest-java-<RELEASE-VERSION>-RC#-src.zip" | md5sum -c -
+cd polygene-check-rc
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5) apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz" | md5sum -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.MD5) apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip" | md5sum -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.MD5) apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz" | md5sum -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.MD5) apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip" | md5sum -c -
 ----
 
 This must output `some-filename: OK` for each distribution.
@@ -508,11 +508,11 @@ Verify SHA-512 checksum:
 
 [source,shell]
 ----
-cd zest-check-rc
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5)  apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz" | shasum -a 512 -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.MD5)  apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip" | shasum -a 512 -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.MD5)  apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz" | shasum -a 512 -c -
-echo "$(cat apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.MD5)  apache-zest-java-<RELEASE-VERSION>-RC#-src.zip" | shasum -a 512 -c -
+cd polygene-check-rc
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5)  apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz" | shasum -a 512 -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.MD5)  apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip" | shasum -a 512 -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.MD5)  apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz" | shasum -a 512 -c -
+echo "$(cat apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.MD5)  apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip" | shasum -a 512 -c -
 ----
 
 This also must output `some-filename: OK` for each distribution.
@@ -524,9 +524,9 @@ Unpack the source distributions, we will use the `zip` distribution here, both s
 
 [source,shell]
 ----
-cd zest-check-rc
-unzip apache-zest-java-<RELEASE-VERSION>-RC#-src.zip
-cd apache-zest-java-<RELEASE-VERSION>-RC#-src
+cd polygene-check-rc
+unzip apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip
+cd apache-polygene-java-<RELEASE-VERSION>-RC#-src
 ----
 
 
@@ -543,7 +543,7 @@ You can also `grep` the whole source tree.
 
 [source,shell]
 ----
-cd zest-check-rc/apache-zest-java-<RELEASE-VERSION>-RC#-src
+cd polygene-check-rc/apache-polygene-java-<RELEASE-VERSION>-RC#-src
 ./gradlew check assemble
 ----
 
@@ -557,7 +557,7 @@ Create and sign the release git tag from the unsigned release candidate tag:
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git tag -s "<RELEASE-VERSION>" "<RELEASE-VERSION>-RC#"
 ----
 
@@ -565,7 +565,7 @@ Push all git changes:
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git checkout master
 git push origin master
 git checkout develop
@@ -578,65 +578,65 @@ git push origin --tags
 
 Promote the staged Nexus repository so it gets synched to Maven Central by following the https://www.apache.org/dev/publishing-maven-artifacts.html#promote[Promoting a repo] guide.
 
-Move the release distributions, checksums and signatures from https://dist.apache.org/repos/dist/dev/zest/[zest-dist/dev/zest] to https://dist.apache.org/repos/dist/release/zest/[zest-dist/release/zest]:
+Move the release distributions, checksums and signatures from https://dist.apache.org/repos/dist/dev/polygene/[polygene-dist/dev/polygene] to https://dist.apache.org/repos/dist/release/polygene/[polygene-dist/release/polygene]:
 
 [source,shell]
 ----
-cd zest-dist
+cd polygene-dist
 # Source ZIP
-export DIST_DEV_URL="https://dist.apache.org/repos/dist/dev/zest"
-export DIST_RELEASE_URL="https://dist.apache.org/repos/dist/release/zest"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.zip" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.MD5" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.zip.MD5" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.zip.SHA-512" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.zip.asc" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.zip.asc" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
+export DIST_DEV_URL="https://dist.apache.org/repos/dist/dev/polygene"
+export DIST_RELEASE_URL="https://dist.apache.org/repos/dist/release/polygene"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.zip" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.MD5" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.zip.MD5" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.SHA-512" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.zip.SHA-512" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.zip.asc" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.zip.asc" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
 # Source TAR.GZ
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.tgz" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.MD5" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.tgz.MD5" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.tgz.SHA-512" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-src.tgz.asc" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-src.tgz.asc" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.tgz" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.MD5" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.tgz.MD5" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.SHA-512" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.tgz.SHA-512" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-src.tgz.asc" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-src.tgz.asc" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
 # Binary ZIP
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.zip" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.MD5" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.zip.MD5" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.zip.SHA-512" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.zip.asc" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.zip.asc" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.zip" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.MD5" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.zip.MD5" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.SHA-512" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.zip.SHA-512" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.zip.asc" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.zip.asc" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
 # Binary TAR.GZ
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.tgz" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.tgz.MD5" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.tgz.SHA-512" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
-svn move "$DIST_DEV_URL/apache-zest-java-<RELEASE-VERSION>-RC#-bin.tgz.asc" \
-     "$DIST_RELEASE_URL/apache-zest-java-<RELEASE-VERSION>-bin.tgz.asc" \
-     -m "zest: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.tgz" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.MD5" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.MD5" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.SHA-512" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.SHA-512" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
+svn move "$DIST_DEV_URL/apache-polygene-java-<RELEASE-VERSION>-RC#-bin.tgz.asc" \
+     "$DIST_RELEASE_URL/apache-polygene-java-<RELEASE-VERSION>-bin.tgz.asc" \
+     -m "polygene: promoting release <RELEASE-VERSION> distributions"
 ----
 
 This produces one commit per file but keep svn history and runs fast, without re-uploading the distributions.
@@ -665,24 +665,24 @@ Generate the documentation and javadoc minisite:
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 ./gradlew -Dversion="<RELEASE-VERSION>" archiveJavadocs manuals
 ----
 
-This will automatically put all files into the `zest-web` website repository.
+This will automatically put all files into the `polygene-web` website repository.
 
 Create a new post on the Polygene\u2122 website by creating a new Markdown file:
 
 [source,shell]
 ----
-cd zest-web
-touch "site/src/_posts/YYYY-MM-DD-apache-zest-java-<RELEASE-VERSION>.md"
+cd polygene-web
+touch "site/src/_posts/YYYY-MM-DD-apache-polygene-java-<RELEASE-VERSION>.md"
 open !$
 ----
 
 You can reuse the Markdown formatted announcement content.
 
-Add the new released version in `zest-web/site/content/java/versions.json` below the `latest` entry:
+Add the new released version in `polygene-web/site/content/java/versions.json` below the `latest` entry:
 
 [source,js]
 ----
@@ -695,13 +695,13 @@ Add the new released version in `zest-web/site/content/java/versions.json` below
 }
 ----
 
-Finally, edit `zest-web/site/src/_data/releases.yml` with the new release data.
+Finally, edit `polygene-web/site/src/_data/releases.yml` with the new release data.
 Upmost is the latest:
 
 [source,text]
 ----
 - version: <RELEASE-VERSION>
-  announcement: YYYY/MM/DD/apache-zest-java-<RELEASE-VERSION>
+  announcement: YYYY/MM/DD/apache-polygene-java-<RELEASE-VERSION>
   signer: John Doe
   pgpId: FB751943
 ----
@@ -710,7 +710,7 @@ You can run the Polygene\u2122 website locally:
 
 [source,shell]
 ----
-cd zest-web
+cd polygene-web
 jekyll serve
 ----
 
@@ -720,7 +720,7 @@ Once you are satisfied with the changes, build the production website:
 
 [source,shell]
 ----
-cd zest-web
+cd polygene-web
 jekyll build
 ----
 
@@ -729,7 +729,7 @@ And publish it:
 [source,shell]
 ----
 svn add * --force
-svn commit -m "zest: update website"
+svn commit -m "polygene: update website"
 ----
 
 
@@ -740,14 +740,14 @@ Register the new release at https://reporter.apache.org/[reporter.apache.org]
 
 === Announce
 
-Finally, send an announcement to mailto:dev@zest.apache.org[dev@] and mailto:users@zest.apache.org[users@] mailing lists. Email announcements should have the subject line:
+Finally, send an announcement to mailto:dev@polygene.apache.org[dev@] and mailto:users@polygene.apache.org[users@] mailing lists. Email announcements should have the subject line:
 
 [source,text]
 ----
 [ANNOUNCE] Released Polygene (Java Edition) version <RELEASE-VERSION>
 ----
 
-The announcement email should contains the release-notes as text, remember they are in the `apache-zest-java-<RELEASE-VERSION>-release-notes.txt` file you created earlier.
+The announcement email should contains the release-notes as text, remember they are in the `apache-polygene-java-<RELEASE-VERSION>-release-notes.txt` file you created earlier.
 
 
 
@@ -762,7 +762,7 @@ Remember, we created a release candidate branch and tags, no signed release tag.
 
 [source,shell]
 ----
-cd zest-java
+cd polygene-java
 git checkout master
 git push origin master
 git checkout develop
@@ -775,14 +775,14 @@ git push origin --tags
 
 Drop the Nexus staging repository by following the https://www.apache.org/dev/publishing-maven-artifacts.html#drop[Dropping a repo] guide.
 
-Drop distributions, checksums and signatures from https://dist.apache.org/repos/dist/dev/zest/[zest-dist/dev/zest]
+Drop distributions, checksums and signatures from https://dist.apache.org/repos/dist/dev/polygene/[polygene-dist/dev/polygene]
 
 [source,shell]
 ----
-cd zest-dist/dev/zest/
+cd polygene-dist/dev/polygene/
 rm "*<RELEASE-VERSION>-RC#*.*"
 svn add * --force
-svn commit -m "zest: dropping <RELEASE-VERSION>-RC# from dist/dev/zest as the vote failed"
+svn commit -m "polygene: dropping <RELEASE-VERSION>-RC# from dist/dev/polygene as the vote failed"
 ----
 
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-writing-docs.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-writing-docs.txt b/manual/src/docs/tutorials/howto-writing-docs.txt
index 438b936..35f7deb 100644
--- a/manual/src/docs/tutorials/howto-writing-docs.txt
+++ b/manual/src/docs/tutorials/howto-writing-docs.txt
@@ -127,28 +127,28 @@ External links are added like this:
 
 [source]
 ----
-https://zest.apache.org/[Link text here]
+https://polygene.apache.org/[Link text here]
 ----
 
-Which renders like: https://zest.apache.org/[Link text here]
+Which renders like: https://polygene.apache.org/[Link text here]
 
 For short links it may be better not to add a link text, just do:
 
 [source]
 ----
-https://zest.apache.org/
+https://polygene.apache.org/
 ----
 
-Which renders like: https://zest.apache.org/
+Which renders like: https://polygene.apache.org/
 
 It's ok to have a dot right after the URL, it won't be part of the link.
 
 [source]
 ----
-https://zest.apache.org/.
+https://polygene.apache.org/.
 ----
 
-Which renders like: https://zest.apache.org/.
+Which renders like: https://polygene.apache.org/.
 
 == Text Formatting ==
 
@@ -226,7 +226,7 @@ Most source code that is included in the documentation should be extract via +SN
 ----
  [snippet,java]
  -----------
- source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/OrderEntity.java
+ source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/OrderEntity.java
  tag=mainClass
  -----------
 ----
@@ -259,7 +259,7 @@ which will be rendered as;
 
 [snippet,java]
 -----------
-source=tutorials/introduction/tenminutes/src/main/java/org/apache/zest/demo/tenminute/OrderEntity.java
+source=tutorials/introduction/tenminutes/src/main/java/org/apache/polygene/demo/tenminute/OrderEntity.java
 tag=mainClass
 -----------
 
@@ -322,8 +322,8 @@ For other highlighters we could add see http://alexgorbatchev.com/SyntaxHighligh
 
 Common attributes you can use in documents:
 
-* \{zest-revnumber} - rendered as "{zest-revnumber}"
-* \{zest-importdir} - rendered as "{zest-importdir}"
+* \{polygene-revnumber} - rendered as "{polygene-revnumber}"
+* \{polygene-importdir} - rendered as "{polygene-importdir}"
 
 These can substitute part of URLs that point to for example APIdocs or source code.
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/userguide/core.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/core.txt b/manual/src/docs/userguide/core.txt
index 7c962a5..4c3da23 100644
--- a/manual/src/docs/userguide/core.txt
+++ b/manual/src/docs/userguide/core.txt
@@ -78,7 +78,7 @@ applications during the bootstrap phase.
 === Core Runtime ===
 //____
 Your code should *never*, *ever*, have a dependency on Polygene\u2122 Core Runtime. If you think you need this, you should
-probably contact dev@zest.apache.org and see if your usecase can either be solved in a existing way or
+probably contact dev@polygene.apache.org and see if your usecase can either be solved in a existing way or
 perhaps that a new Core Extension SPI is needed.
 
 <<core-runtime,Learn more>>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/userguide/index.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/index.txt b/manual/src/docs/userguide/index.txt
index c8190ef..a2fda6a 100644
--- a/manual/src/docs/userguide/index.txt
+++ b/manual/src/docs/userguide/index.txt
@@ -19,9 +19,9 @@
 
 = Polygene\u2122 v{revnumber} User Guide =
 
-:zest-version: {revnumber}
-:zest-buildnumber: {revnumber}
-:zest-git-tag: {gitversion}
+:polygene-version: {revnumber}
+:polygene-buildnumber: {revnumber}
+:polygene-git-tag: {gitversion}
 
 
 :leveloffset: {level2}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/userguide/preface.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/preface.txt b/manual/src/docs/userguide/preface.txt
index f8836ea..5831837 100644
--- a/manual/src/docs/userguide/preface.txt
+++ b/manual/src/docs/userguide/preface.txt
@@ -20,7 +20,7 @@
 [[preface, Preface]]
 = Preface =
 
-This is the reference manual for Polygene\u2122 version {zest-version}, written by members of the Polygene\u2122 Community.
+This is the reference manual for Polygene\u2122 version {polygene-version}, written by members of the Polygene\u2122 Community.
 
 The main parts of the manual are:
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/website/intro.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/intro.txt b/manual/src/docs/website/intro.txt
index 66142b2..c5524f2 100644
--- a/manual/src/docs/website/intro.txt
+++ b/manual/src/docs/website/intro.txt
@@ -40,7 +40,7 @@ include::../../../../tutorials/introduction/src/docs/what-is-composite-oriented-
 
 :leveloffset: 2
 
-// include::../../../../tutorials/introduction/src/docs/zest-cop.txt[]
+// include::../../../../tutorials/introduction/src/docs/polygene-cop.txt[]
 //
 // :leveloffset: 2
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/website/javadocs.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/javadocs.txt b/manual/src/docs/website/javadocs.txt
index ecf1889..5da195e 100644
--- a/manual/src/docs/website/javadocs.txt
+++ b/manual/src/docs/website/javadocs.txt
@@ -37,24 +37,24 @@ In this section you will find links to JavaDocs corresponding to this Apache Pol
 
 Links to _"alias versions"_ JavaDocs:
 
-* https://zest.apache.org/java/latest/javadocs/[Latest Release (`master` branch)]
-* https://zest.apache.org/java/develop/javadocs/[Development (`develop` branch)]
+* https://polygene.apache.org/java/latest/javadocs/[Latest Release (`master` branch)]
+* https://polygene.apache.org/java/develop/javadocs/[Development (`develop` branch)]
 
 
 === Previous Releases ===
 
 Archived JavaDocs of previous releases:
 
-* https://zest.apache.org/java/2.0/javadocs/[Release 2.0]
-* https://zest.apache.org/java/1.4.1/javadocs/[Release 1.4.1]
-* https://zest.apache.org/java/1.4/javadocs/[Release 1.4]
-* https://zest.apache.org/java/1.3/javadocs/[Release 1.3]
+* https://polygene.apache.org/java/2.0/javadocs/[Release 2.0]
+* https://polygene.apache.org/java/1.4.1/javadocs/[Release 1.4.1]
+* https://polygene.apache.org/java/1.4/javadocs/[Release 1.4]
+* https://polygene.apache.org/java/1.3/javadocs/[Release 1.3]
 * Release 1.2
-** https://zest.apache.org/java/1.2/javadocs/api[Core API]
-** https://zest.apache.org/java/1.2/javadocs/bootstrap[Core Bootstrap]
-** https://zest.apache.org/java/1.2/javadocs/spi[Core SPI]
+** https://polygene.apache.org/java/1.2/javadocs/api[Core API]
+** https://polygene.apache.org/java/1.2/javadocs/bootstrap[Core Bootstrap]
+** https://polygene.apache.org/java/1.2/javadocs/spi[Core SPI]
 * Release 1.0
-** https://zest.apache.org/java/1.0/javadocs/api[Core API]
-** https://zest.apache.org/java/1.0/javadocs/bootstrap[Core Bootstrap]
-** https://zest.apache.org/java/1.0/javadocs/spi[Core SPI]
+** https://polygene.apache.org/java/1.0/javadocs/api[Core API]
+** https://polygene.apache.org/java/1.0/javadocs/bootstrap[Core Bootstrap]
+** https://polygene.apache.org/java/1.0/javadocs/spi[Core SPI]
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/website/samples.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/samples.txt b/manual/src/docs/website/samples.txt
index 749c73e..3c0d3ec 100644
--- a/manual/src/docs/website/samples.txt
+++ b/manual/src/docs/website/samples.txt
@@ -35,7 +35,7 @@ The samples are available in the +samples/+ directory of the Polygene\u2122 SDK.
 Sample of how DCI (Data, Context & Interaction) pattern is implemented using
 Polygene\u2122 core only.
 
-https://github.com/apache/zest-java/tree/develop/samples/dci[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/dci[Browse Source]
 
 [[sample-dci-cargo,DCI Cargo Sample]]
 == DCI Cargo Sample ==
@@ -46,7 +46,7 @@ Polygene\u2122, for Eric Evans DDD sample.
 This sample, contributed by Marc Grue, is described in details on his
 website: http://marcgrue.com/
 
-https://github.com/apache/zest-java/tree/develop/samples/dci-cargo[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/dci-cargo[Browse Source]
 
 [[sample-forum,Forum Sample]]
 == Forum Sample ==
@@ -54,7 +54,7 @@ https://github.com/apache/zest-java/tree/develop/samples/dci-cargo[Browse Source
 Sample of how to build a web forum using <<library-rest-server>>,
 <<extension-es-file>> and <<library-fileconfig>>.
 
-https://github.com/apache/zest-java/tree/develop/samples/forum[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/forum[Browse Source]
 
 [[sample-car-rental,Car Rental Sample]]
 == Car Rental Sample ==
@@ -62,14 +62,14 @@ https://github.com/apache/zest-java/tree/develop/samples/forum[Browse Source]
 Sample of implementation of a Car Rental application implemented as a Servlet
 based Webapp packaged as a WAR.
 
-https://github.com/apache/zest-java/tree/develop/samples/rental[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/rental[Browse Source]
 
 // [[sample-scala,Scala Sample]]
 // == Scala Sample ==
 //
 // Sample of how to use Scala with Polygene\u2122.
 //
-// https://github.com/apache/zest-java/tree/develop/samples/scala[Browse Source]
+// https://github.com/apache/polygene-java/tree/develop/samples/scala[Browse Source]
 
 [[sample-sql-support,SQL Support Sample]]
 == SQL Support Sample ==
@@ -78,7 +78,7 @@ NOTE: This sample use PostgreSQL and drop all of its data once run in order to b
 
 Sample of how to fully use Polygene\u2122 SQL support : <<library-sql>>, <<extension-es-sql>> and <<extension-indexing-sql>>.
 
-https://github.com/apache/zest-java/tree/develop/samples/sql-support[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/sql-support[Browse Source]
 
 Here are the steps needed to setup the database using the `psql` utility command:
 
@@ -107,4 +107,4 @@ See <<build-system>> if you need some guidance.
 
 Sample of how to write custom binders.
 
-https://github.com/apache/zest-java/tree/develop/samples/swing[Browse Source]
+https://github.com/apache/polygene-java/tree/develop/samples/swing[Browse Source]

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/website/tutorials.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/tutorials.txt b/manual/src/docs/website/tutorials.txt
index 99b60ea..111090b 100644
--- a/manual/src/docs/website/tutorials.txt
+++ b/manual/src/docs/website/tutorials.txt
@@ -25,7 +25,7 @@
 == Overview ==
 
 TIP: Theses tutorials are based on actual code found in the `tutorials/` directory of the
-https://zest.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
+https://polygene.apache.org/download.html[Polygene\u2122 SDK sources]. You should start your favorite editor and find the code related to
 this tutorial, run it and play with it.
 
 In this section you will find a comprehensive set of tutorials about Composite Oriented Programming using Polygene\u2122.
@@ -48,7 +48,7 @@ Throughout this set of tutorials it will be shown how to depend on Polygene\u2122 i
 application, how to create and work with Composites and Services, how to use contextual fragments and leverage
 properties.
 
-- <<howto-depend-on-zest>>
+- <<howto-depend-on-polygene>>
 - <<howto-assemble-application>>
 - <<tut-composites>>
 - <<tut-services>>
@@ -94,7 +94,7 @@ include::../../../../tutorials/introduction/twohours/src/docs/two-hours.txt[]
 
 :leveloffset: 2
 
-include::../tutorials/howto-depend-on-zest.txt[]
+include::../tutorials/howto-depend-on-polygene.txt[]
 
 :leveloffset: 2
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/website/xsl/head.xsl
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/xsl/head.xsl b/manual/src/docs/website/xsl/head.xsl
index f91c23d..85780d1 100644
--- a/manual/src/docs/website/xsl/head.xsl
+++ b/manual/src/docs/website/xsl/head.xsl
@@ -25,15 +25,15 @@
 
 <!-- favicon -->
 
-<link rel="shortcut icon" href="http://zest.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
-<link rel="icon" href="http://zest.apache.org/favicon.ico" type="image/x-icon" />
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
 
 <!-- style -->
 
 <link href="css/shCore.css" rel="stylesheet" type="text/css" />
 <link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
 <link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
-<link href="css/zest.css" rel="stylesheet" type="text/css" />
+<link href="css/polygene.css" rel="stylesheet" type="text/css" />
 
 <!-- Syntax Highlighter -->
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
----------------------------------------------------------------------
diff --git a/manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java b/manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
index 4a7270c..a1c87e2 100644
--- a/manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
+++ b/manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
@@ -28,7 +28,7 @@ import org.apache.polygene.bootstrap.*;
 // START SNIPPET: main
 public class Main
 {
-    private static Energy4Java zest;
+    private static Energy4Java polygene;
     private static Application application;
 
     public static void main( String[] args )
@@ -36,10 +36,10 @@ public class Main
     {
         // Bootstrap Polygene Runtime
         // Create a Polygene Runtime
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         // Instantiate the Application Model.
-        application = zest.newApplication( new ApplicationAssembler()
+        application = polygene.newApplication( new ApplicationAssembler()
         {
             public ApplicationAssembly assemble(
                     ApplicationAssemblyFactory factory )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Main.java
----------------------------------------------------------------------
diff --git a/manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Main.java b/manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Main.java
index 13fcbac..21370bc 100644
--- a/manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Main.java
+++ b/manual/src/main/java/org/apache/polygene/manual/recipes/createEntity/Main.java
@@ -27,10 +27,10 @@ public class Main
     public static void main(String[] args) throws Exception
     {
 
-        Energy4Java zest = new Energy4Java();
+        Energy4Java polygene = new Energy4Java();
 
         // Instantiate the Application Model.
-        Application application = zest.newApplication( new ApplicationAssembler()
+        Application application = polygene.newApplication( new ApplicationAssembler()
         {
             @Override
             public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory) throws AssemblyException

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/resources/css/progressive-enhancement.css
----------------------------------------------------------------------
diff --git a/manual/src/resources/css/progressive-enhancement.css b/manual/src/resources/css/progressive-enhancement.css
index 06b53f3..a6a551b 100644
--- a/manual/src/resources/css/progressive-enhancement.css
+++ b/manual/src/resources/css/progressive-enhancement.css
@@ -118,7 +118,7 @@ li.jenkins-job div.links > a {
 /**
  * Google Groups forum
 */
-#zest-dev-iframe {
+#polygene-dev-iframe {
     -moz-transform: scale(0.85, 0.85); 
     -webkit-transform: scale(0.85, 0.85); 
     -o-transform: scale(0.85, 0.85);

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/resources/js/progressive-enhancement.js
----------------------------------------------------------------------
diff --git a/manual/src/resources/js/progressive-enhancement.js b/manual/src/resources/js/progressive-enhancement.js
index 359a835..75722b0 100644
--- a/manual/src/resources/js/progressive-enhancement.js
+++ b/manual/src/resources/js/progressive-enhancement.js
@@ -24,7 +24,7 @@
  */
 $( document ).ready( function($){
 
-    var atHome = window.location.hostname == "zest.apache.org"
+    var atHome = window.location.hostname == "polygene.apache.org"
 
     /**
      * Glossary.
@@ -95,7 +95,7 @@ $( document ).ready( function($){
                 }
                 else
                 {
-                    return "https://zest.apache.org/java/" + versions[ displayName ];
+                    return "https://polygene.apache.org/java/" + versions[ displayName ];
                 }
             }
             $( "div.logo select" ).change( function()

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/resources/schemas/2008/dev-status/1/dev-status.xsd
----------------------------------------------------------------------
diff --git a/manual/src/resources/schemas/2008/dev-status/1/dev-status.xsd b/manual/src/resources/schemas/2008/dev-status/1/dev-status.xsd
index 37a8f8f..47831aa 100644
--- a/manual/src/resources/schemas/2008/dev-status/1/dev-status.xsd
+++ b/manual/src/resources/schemas/2008/dev-status/1/dev-status.xsd
@@ -20,9 +20,9 @@
   -->
 <xs:schema attributeFormDefault="unqualified"
            elementFormDefault="qualified"
-           targetNamespace="http://zest.apache.org/schemas/2008/dev-status/1"
+           targetNamespace="http://polygene.apache.org/schemas/2008/dev-status/1"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">
-  <xs:element name="module" type="ns:moduleType" xmlns:ns="http://zest.apache.org/schemas/2008/dev-status/1"/>
+  <xs:element name="module" type="ns:moduleType" xmlns:ns="http://polygene.apache.org/schemas/2008/dev-status/1"/>
   <xs:complexType name="licensesType">
     <xs:sequence>
       <xs:element type="xs:string" name="license">
@@ -48,8 +48,8 @@
   </xs:complexType>
   <xs:complexType name="moduleType">
     <xs:sequence>
-      <xs:element type="ns:statusType" name="status" xmlns:ns="http://zest.apache.org/schemas/2008/dev-status/1"/>
-      <xs:element type="ns:licensesType" name="licenses" xmlns:ns="http://zest.apache.org/schemas/2008/dev-status/1"/>
+      <xs:element type="ns:statusType" name="status" xmlns:ns="http://polygene.apache.org/schemas/2008/dev-status/1"/>
+      <xs:element type="ns:licensesType" name="licenses" xmlns:ns="http://polygene.apache.org/schemas/2008/dev-status/1"/>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="statusType">

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/xsl/disqus-footer.xsl
----------------------------------------------------------------------
diff --git a/manual/src/xsl/disqus-footer.xsl b/manual/src/xsl/disqus-footer.xsl
index 3384040..e4707e1 100644
--- a/manual/src/xsl/disqus-footer.xsl
+++ b/manual/src/xsl/disqus-footer.xsl
@@ -101,7 +101,7 @@
   var disqus_url = window.location;
   if ( disqus_url.protocol === "http:" || disqus_url.protocol === "https:" )
   {
-    var docsLocation = "http://zest.apache.org/chunked/snapshot/";
+    var docsLocation = "http://polygene.apache.org/chunked/snapshot/";
     var path = disqus_url.pathname;
     var position = path.lastIndexOf('/');
     if ( position === -1 )
@@ -114,7 +114,7 @@
       disqus_url = docsLocation + page;
     }
   }
-  var disqus_shortname = "zest";
+  var disqus_shortname = "polygene";
   var disqus_developer = 0;
 
 (function() {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/xsl/fo.xsl
----------------------------------------------------------------------
diff --git a/manual/src/xsl/fo.xsl b/manual/src/xsl/fo.xsl
index 75ffcc1..50d18af 100644
--- a/manual/src/xsl/fo.xsl
+++ b/manual/src/xsl/fo.xsl
@@ -346,7 +346,7 @@
       <xsl:with-param name="master-reference">titlepage</xsl:with-param>
       <xsl:with-param name="content">
         <fo:block text-align="center" margin-top="5.0cm">
-          <fo:external-graphic src="url(images/zest-blue.png)"
+          <fo:external-graphic src="url(images/polygene-blue.png)"
                                content-width="12cm"
                                content-height="2.94cm"
                                scaling="uniform"/>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/xsl/head-offline.xsl
----------------------------------------------------------------------
diff --git a/manual/src/xsl/head-offline.xsl b/manual/src/xsl/head-offline.xsl
index f44ec1c..57fa60a 100644
--- a/manual/src/xsl/head-offline.xsl
+++ b/manual/src/xsl/head-offline.xsl
@@ -25,15 +25,15 @@
 
 <!-- favicon -->
 
-<link rel="shortcut icon" href="http://zest.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
-<link rel="icon" href="http://zest.apache.org/favicon.ico" type="image/x-icon" />
+<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" />
+<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" />
 
 <!-- style -->
 
 <link href="css/shCore.css" rel="stylesheet" type="text/css" />
 <link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" />
 <link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" />
-<link href="css/zest.css" rel="stylesheet" type="text/css" />
+<link href="css/polygene.css" rel="stylesheet" type="text/css" />
 
 <!-- Syntax Highlighter -->
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/dci/build.gradle
----------------------------------------------------------------------
diff --git a/samples/dci/build.gradle b/samples/dci/build.gradle
index 08e3487..c5e97c9 100644
--- a/samples/dci/build.gradle
+++ b/samples/dci/build.gradle
@@ -24,11 +24,11 @@ description = "Sample of how DCI (Data, Context & Interaction) pattern is implem
 jar { manifest { name = "Apache Polygene\u2122 Sample - DCI" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.core.runtime  /* TODO: Get rid of this dependency */
-  compile zest.library( 'constraints' )
+  compile polygene.core.bootstrap
+  compile polygene.core.runtime  /* TODO: Get rid of this dependency */
+  compile polygene.library( 'constraints' )
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.easymock
 
   testRuntime libraries.logback


[08/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
new file mode 100644
index 0000000..6aa5041
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
@@ -0,0 +1,338 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.property;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.DefaultValues;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.property.InvalidPropertyTypeException;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.service.NoSuchServiceException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.Serialization;
+import org.apache.polygene.api.type.ValueCompositeType;
+import org.apache.polygene.api.type.ValueType;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.value.MissingValueSerializationException;
+import org.apache.polygene.api.value.ValueDeserializer;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.composite.ValueConstraintsInstance;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+import org.apache.polygene.runtime.types.ValueTypeFactory;
+
+/**
+ * Model for a Property.
+ *
+ * <p>Equality is based on the Property accessor object (property type and name), not on the QualifiedName.</p>
+ */
+public class PropertyModel
+    implements PropertyDescriptor, PropertyInfo, Binder, Visitable<PropertyModel>
+{
+    private Type type;
+
+    private transient AccessibleObject accessor; // Interface accessor
+
+    private final QualifiedName qualifiedName;
+
+    private final ValueConstraintsInstance constraints; // May be null
+
+    protected final MetaInfo metaInfo;
+
+    private final Object initialValue;
+
+    private final boolean useDefaults;
+
+    private final boolean immutable;
+
+    private ValueType valueType;
+
+    protected PropertyInfo builderInfo;
+
+    private final boolean queryable;
+
+    public PropertyModel( AccessibleObject accessor,
+                          boolean immutable,
+                          boolean useDefaults,
+                          ValueConstraintsInstance constraints,
+                          MetaInfo metaInfo,
+                          Object initialValue
+    )
+    {
+        if( accessor instanceof Method )
+        {
+            Method m = (Method) accessor;
+            if( !m.getReturnType().equals( Property.class ) )
+            {
+                throw new InvalidPropertyTypeException( accessor );
+            }
+        }
+        this.immutable = immutable;
+        this.metaInfo = metaInfo;
+        type = GenericPropertyInfo.propertyTypeOf( accessor );
+        this.accessor = accessor;
+        qualifiedName = QualifiedName.fromAccessor( accessor );
+
+        this.useDefaults = useDefaults;
+
+        this.initialValue = initialValue;
+
+        this.constraints = constraints;
+
+        final Queryable queryable = accessor.getAnnotation( Queryable.class );
+        this.queryable = queryable == null || queryable.value();
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    public String name()
+    {
+        return qualifiedName.name();
+    }
+
+    @Override
+    public QualifiedName qualifiedName()
+    {
+        return qualifiedName;
+    }
+
+    @Override
+    public Type type()
+    {
+        return type;
+    }
+
+    @Override
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public ValueType valueType()
+    {
+        return valueType;
+    }
+
+    @Override
+    public boolean isImmutable()
+    {
+        return immutable;
+    }
+
+    public PropertyInfo getBuilderInfo()
+    {
+        return builderInfo;
+    }
+
+    @Override
+    public boolean queryable()
+    {
+        return queryable;
+    }
+
+    @Override
+    public Object initialValue( ModuleDescriptor module )
+    {
+        // Use supplied value from assembly
+        Object value = initialValue;
+
+        // Check for @UseDefaults annotation
+        if( useDefaults )
+        {
+            if( value == null || ( ( value instanceof String ) && ( (String) value ).length() == 0 ) )
+            {
+                if( valueType instanceof ValueCompositeType )
+                {
+                    Class<?> propertyType = valueType().types().findFirst().orElse( null );
+                    value = module.instance().newValue( propertyType );
+                }
+                else
+                {
+                    value = DefaultValues.getDefaultValueOf( type );
+                }
+            }
+            else
+            {
+                Class<?> propertyType = valueType().types().findFirst().orElse( null );
+                if( value instanceof String && !propertyType.equals( String.class ) )
+                {
+                    try
+                    {
+                        // here we could possibly deserialize json to other types...
+                        ValueDeserializer deserializer = module.instance()
+                            .serviceFinder()
+                            .findService( ValueDeserializer.class )
+                            .get();
+                        if( deserializer != null )
+                        {
+                            value = deserializer.deserialize( module, propertyType ).apply( (String) value );
+                        }
+                    }
+                    catch( NoSuchServiceException e )
+                    {
+                        throw new MissingValueSerializationException( "@UseDefaults with initialization value requires that there is a visible ValueDeserializer service available.", e);
+                    }
+                }
+            }
+        }
+        return value;
+    }
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        ValueTypeFactory factory = ValueTypeFactory.instance();
+        Class<?> declaringClass = ( (Member) accessor() ).getDeclaringClass();
+        Class<?> mainType = resolution.model().types().findFirst().orElse( null );
+        Serialization.Variant variant = findVariant();
+        valueType = factory.newValueType( type(), declaringClass, mainType, resolution.layer(), resolution.module(), variant );
+        builderInfo = new BuilderPropertyInfo();
+        if( type instanceof TypeVariable )
+        {
+            type = Classes.resolveTypeVariable( (TypeVariable) type, declaringClass, mainType );
+        }
+    }
+
+    private Serialization.Variant findVariant()
+    {
+        Serialization serialization = metaInfo.get( Serialization.class );
+        Serialization.Variant variant = null;
+        if( serialization != null )
+        {
+            variant = serialization.value();
+        }
+        if( variant == null )
+        {
+            variant = Serialization.Variant.entry;
+        }
+        return variant;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super PropertyModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        return visitor.visit( this );
+    }
+
+    @Override
+    public void checkConstraints( Object value )
+        throws ConstraintViolationException
+    {
+        if( constraints == null )
+        {
+            return;
+        }
+        constraints.checkConstraints( value, accessor );
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        PropertyModel that = (PropertyModel) o;
+        return accessor.equals( that.accessor );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return accessor.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        if( accessor instanceof Field )
+        {
+            return ( (Field) accessor ).toGenericString();
+        }
+        else
+        {
+            return ( (Method) accessor ).toGenericString();
+        }
+    }
+
+    private class BuilderPropertyInfo implements PropertyInfo
+    {
+        @Override
+        public boolean isImmutable()
+        {
+            return false;
+        }
+
+        @Override
+        public QualifiedName qualifiedName()
+        {
+            return qualifiedName;
+        }
+
+        @Override
+        public Type type()
+        {
+            return type;
+        }
+
+        @Override
+        public void checkConstraints( Object value )
+            throws ConstraintViolationException
+        {
+            if( constraints != null )
+            {
+                List<ConstraintViolation> violations = constraints.checkConstraints( value );
+                if( !violations.isEmpty() )
+                {
+                    Stream<Class<?>> empty = Stream.empty();
+                    throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/query/IterableQuerySource.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/query/IterableQuerySource.java b/core/runtime/src/main/java/org/apache/polygene/runtime/query/IterableQuerySource.java
new file mode 100644
index 0000000..b12ba18
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/query/IterableQuerySource.java
@@ -0,0 +1,245 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.query;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.grammar.OrderBy;
+import org.apache.polygene.spi.query.QuerySource;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.api.util.Classes.instanceOf;
+
+/**
+ * JAVADOC
+ */
+public class IterableQuerySource
+    implements QuerySource
+{
+    private final Iterable iterable;
+
+    /**
+     * Constructor.
+     *
+     * @param iterable iterable
+     */
+    @SuppressWarnings( "raw" )
+    IterableQuerySource( final Iterable iterable )
+    {
+        this.iterable = iterable;
+    }
+
+    @Override
+    public <T> T find( Class<T> resultType,
+                       Predicate<Composite> whereClause,
+                       List<OrderBy> orderBySegments,
+                       Integer firstResult,
+                       Integer maxResults,
+                       Map<String, Object> variables
+    )
+    {
+        return stream( resultType, whereClause, orderBySegments, firstResult, maxResults, variables )
+            .findFirst().orElse( null );
+    }
+
+    @Override
+    public <T> long count( Class<T> resultType,
+                           Predicate<Composite> whereClause,
+                           List<OrderBy> orderBySegments,
+                           Integer firstResult,
+                           Integer maxResults,
+                           Map<String, Object> variables
+    )
+    {
+        return list( resultType, whereClause, orderBySegments, firstResult, maxResults, variables ).size();
+    }
+
+    @Override
+    public <T> Stream<T> stream( Class<T> resultType,
+                                     Predicate<Composite> whereClause,
+                                     List<OrderBy> orderBySegments,
+                                     Integer firstResult,
+                                     Integer maxResults,
+                                     Map<String, Object> variables
+    )
+    {
+        return list( resultType, whereClause, orderBySegments, firstResult, maxResults, variables ).stream();
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    private <T> List<T> list( Class<T> resultType,
+                              Predicate<Composite> whereClause,
+                              List<OrderBy> orderBySegments,
+                              Integer firstResult,
+                              Integer maxResults,
+                              Map<String, Object> variables
+    )
+    {
+        // Ensure it's a list first
+        List<T> list = filter( resultType, whereClause );
+
+        // Order list
+        if( orderBySegments != null )
+        {
+            // Sort it
+            list.sort( new OrderByComparator( orderBySegments ) );
+        }
+
+        // Cut results
+        if( firstResult != null )
+        {
+            if( firstResult > list.size() )
+            {
+                return Collections.emptyList();
+            }
+
+            int toIdx;
+            if( maxResults != null )
+            {
+                toIdx = Math.min( firstResult + maxResults, list.size() );
+            }
+            else
+            {
+                toIdx = list.size();
+            }
+
+            list = list.subList( firstResult, toIdx );
+        }
+        else
+        {
+            int toIdx;
+            if( maxResults != null )
+            {
+                toIdx = Math.min( maxResults, list.size() );
+            }
+            else
+            {
+                toIdx = list.size();
+            }
+
+            list = list.subList( 0, toIdx );
+        }
+
+        return list;
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    private <T> List<T> filter( Class<T> resultType, Predicate whereClause )
+    {
+        Stream stream = StreamSupport.stream( iterable.spliterator(), false );
+        if( whereClause == null )
+        {
+            return List.class.cast( stream.filter( resultType::isInstance )
+                                          .collect( toList() ) );
+        }
+        else
+        {
+            return List.class.cast( stream.filter( instanceOf( resultType ).and( whereClause ) )
+                                          .collect( toList() ) );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "IterableQuerySource{" + iterable + '}';
+    }
+
+    private static class OrderByComparator<T extends Composite>
+        implements Comparator<T>
+    {
+
+        private final Iterable<OrderBy> orderBySegments;
+
+        private OrderByComparator( Iterable<OrderBy> orderBySegments )
+        {
+            this.orderBySegments = orderBySegments;
+        }
+
+        @Override
+        @SuppressWarnings( {"raw", "unchecked"} )
+        public int compare( T o1, T o2 )
+        {
+            for( OrderBy orderBySegment : orderBySegments )
+            {
+                try
+                {
+                    final Property prop1 = orderBySegment.property().apply( o1 );
+                    final Property prop2 = orderBySegment.property().apply( o2 );
+                    if( prop1 == null || prop2 == null )
+                    {
+                        if( prop1 == null && prop2 == null )
+                        {
+                            return 0;
+                        }
+                        else if( prop1 != null )
+                        {
+                            return 1;
+                        }
+                        return -1;
+                    }
+                    final Object value1 = prop1.get();
+                    final Object value2 = prop2.get();
+                    if( value1 == null || value2 == null )
+                    {
+                        if( value1 == null && value2 == null )
+                        {
+                            return 0;
+                        }
+                        else if( value1 != null )
+                        {
+                            return 1;
+                        }
+                        return -1;
+                    }
+                    if( value1 instanceof Comparable )
+                    {
+                        int result = ( (Comparable) value1 ).compareTo( value2 );
+                        if( result != 0 )
+                        {
+                            if( orderBySegment.order() == OrderBy.Order.ASCENDING )
+                            {
+                                return result;
+                            }
+                            else
+                            {
+                                return -result;
+                            }
+                        }
+                    }
+                }
+                catch( Exception e )
+                {
+                    return 0;
+                }
+            }
+
+            return 0;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImpl.java
new file mode 100644
index 0000000..2cf716b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImpl.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.query;
+
+import org.apache.polygene.api.query.NotQueryableException;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.service.NoSuchServiceException;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.spi.query.EntityFinder;
+
+/**
+ * Default implementation of {@link QueryBuilderFactory}
+ */
+public final class QueryBuilderFactoryImpl
+    implements QueryBuilderFactory
+{
+    private ServiceFinder finder;
+
+    /**
+     * Constructor.
+     *
+     * @param finder The ServiceFinder of the Module this QueryBuilderFactory belongs to.
+     */
+    public QueryBuilderFactoryImpl( ServiceFinder finder )
+    {
+        NullArgumentException.validateNotNull( "ServiceFinder", finder );
+        this.finder = finder;
+    }
+
+    /**
+     * @see QueryBuilderFactory#newQueryBuilder(Class)
+     */
+    @Override
+    public <T> QueryBuilder<T> newQueryBuilder( final Class<T> resultType )
+    {
+        NotQueryableException.throwIfNotQueryable( resultType );
+
+        final ServiceReference<EntityFinder> serviceReference;
+        try
+        {
+            serviceReference = finder.findService( EntityFinder.class );
+            return new QueryBuilderImpl<T>( serviceReference.get(), resultType, null );
+        }
+        catch( NoSuchServiceException e )
+        {
+            return new QueryBuilderImpl<T>( null, resultType, null );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderImpl.java
new file mode 100644
index 0000000..7d5cb4b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryBuilderImpl.java
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.query;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.query.Query;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.query.QueryExpressions;
+import org.apache.polygene.spi.query.EntityFinder;
+import org.apache.polygene.spi.query.QueryBuilderSPI;
+import org.apache.polygene.spi.query.QuerySource;
+
+/**
+ * Default implementation of {@link QueryBuilder}
+ */
+final class QueryBuilderImpl<T>
+    implements QueryBuilder<T>, QueryBuilderSPI<T>
+{
+
+    /**
+     * Entity finder to be used to locate entities.
+     */
+    private final EntityFinder entityFinder;
+
+    /**
+     * Type of queried entities.
+     */
+    private final Class<T> resultType;
+    /**
+     * Where clause.
+     */
+    private final Predicate<Composite> whereClause;
+
+    /**
+     * Constructor.
+     *
+     * @param entityFinder entity finder to be used to locate entities; canot be null
+     * @param resultType   type of queried entities; cannot be null
+     * @param whereClause  current where-clause
+     */
+    QueryBuilderImpl( final EntityFinder entityFinder,
+                      final Class<T> resultType,
+                      final Predicate<Composite> whereClause
+    )
+    {
+        this.entityFinder = entityFinder;
+        this.resultType = resultType;
+        this.whereClause = whereClause;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public QueryBuilder<T> where( Predicate<Composite> specification )
+    {
+        if( specification == null )
+        {
+            throw new IllegalArgumentException( "Where clause cannot be null" );
+        }
+        if( this.whereClause != null )
+        {
+            specification = QueryExpressions.and( this.whereClause, specification );
+        }
+        return new QueryBuilderImpl<>( entityFinder, resultType, specification );
+    }
+
+    @Override
+    public Query<T> newQuery( Iterable<T> iterable )
+    {
+        return new QueryImpl<>( resultType, whereClause, new IterableQuerySource( iterable ) );
+    }
+
+    // SPI
+    @Override
+    public Query<T> newQuery( QuerySource querySource )
+    {
+        return new QueryImpl<>( resultType, whereClause, querySource );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryImpl.java
new file mode 100644
index 0000000..d4d768c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/query/QueryImpl.java
@@ -0,0 +1,220 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.query;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.Query;
+import org.apache.polygene.api.query.QueryExecutionException;
+import org.apache.polygene.api.query.QueryExpressions;
+import org.apache.polygene.api.query.grammar.OrderBy;
+import org.apache.polygene.spi.query.QuerySource;
+
+/**
+ * Default implementation of {@link org.apache.polygene.api.query.Query}.
+ */
+/* package */ class QueryImpl<T>
+    implements Query<T>
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Type of queried entities.
+     */
+    private final Class<T> resultType;
+    /**
+     * Where clause.
+     */
+    private final Predicate<Composite> whereClause;
+    private QuerySource querySource;
+    /**
+     * Order by clause segments.
+     */
+    private List<OrderBy> orderBySegments;
+    /**
+     * First result to be returned.
+     */
+    private Integer firstResult;
+    /**
+     * Maximum number of results to be returned.
+     */
+    private Integer maxResults;
+    /**
+     * Mapping between variable name and variable values.
+     */
+    private Map<String, Object> variables;
+
+    /**
+     * Constructor.
+     *
+     * @param resultType  type of queried entities; cannot be null
+     * @param whereClause where clause
+     */
+    /* package */ QueryImpl( final Class<T> resultType,
+               final Predicate<Composite> whereClause,
+               final QuerySource querySource
+    )
+    {
+        this.resultType = resultType;
+        this.whereClause = whereClause;
+        this.querySource = querySource;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#orderBy(org.apache.polygene.api.query.grammar.OrderBy[])
+     */
+    @Override
+    public Query<T> orderBy( final OrderBy... segments )
+    {
+        orderBySegments = Arrays.asList( segments );
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#orderBy(org.apache.polygene.api.property.Property, org.apache.polygene.api.query.grammar.OrderBy.Order)
+     */
+    @Override
+    public Query<T> orderBy( Property<?> property, OrderBy.Order order )
+    {
+        if( orderBySegments == null )
+        {
+            orderBySegments = new ArrayList<>();
+        }
+        orderBySegments.add( new OrderBy( QueryExpressions.property( property ), order ) );
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#orderBy(org.apache.polygene.api.property.Property)
+     */
+    @Override
+    public Query<T> orderBy( Property<?> property )
+    {
+        orderBy( property, OrderBy.Order.ASCENDING );
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#firstResult(int)
+     */
+    @Override
+    public Query<T> firstResult( int firstResult )
+    {
+        this.firstResult = firstResult;
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#maxResults(int)
+     */
+    @Override
+    public Query<T> maxResults( int maxResults )
+    {
+        this.maxResults = maxResults;
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#setVariable(String, Object)
+     */
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public Query<T> setVariable( final String name, final Object value )
+    {
+        if( variables == null )
+        {
+            variables = new HashMap<String, Object>();
+        }
+        variables.put( name, value );
+
+        return this;
+    }
+
+    /**
+     * @see org.apache.polygene.api.query.Query#getVariable(String)
+     */
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public <V> V getVariable( final String name )
+    {
+        if( variables == null )
+        {
+            return null;
+        }
+        else
+        {
+            return (V) variables.get( name );
+        }
+    }
+
+    @Override
+    public Class<T> resultType()
+    {
+        return resultType;
+    }
+
+    @Override
+    public T find()
+        throws QueryExecutionException
+    {
+        return querySource.find( resultType, whereClause, orderBySegments, firstResult, maxResults, variables );
+    }
+
+    @Override
+    public long count()
+        throws QueryExecutionException
+    {
+        return querySource.count( resultType, whereClause, orderBySegments, firstResult, maxResults, variables );
+    }
+
+    @Override
+    public Iterator<T> iterator()
+    {
+        return stream().iterator();
+    }
+
+    @Override
+    public Stream<T> stream()
+    {
+        return querySource.stream( resultType, whereClause, orderBySegments, firstResult, maxResults, variables );
+    }
+
+    @Override
+    public String toString()
+    {
+        return "Query{" +
+               " FROM " + querySource +
+               " WHERE " + whereClause +
+               ( orderBySegments != null ? " ORDER BY " + orderBySegments : "" ) +
+               ( firstResult != null ? " FIRST " + firstResult : "" ) +
+               ( maxResults != null ? " MAX " + maxResults : "" ) +
+               " EXPECT " + resultType +
+               ( variables != null ? " WITH VARIABLES " + variables : "" ) +
+               '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceInstance.java
new file mode 100644
index 0000000..104938f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceInstance.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.service.ServiceImporter;
+
+/**
+ * JAVADOC
+ */
+public final class ImportedServiceInstance<T>
+    implements Activation
+{
+    private final T instance;
+    private final ServiceImporter<T> importer;
+
+    public ImportedServiceInstance( T instance, ServiceImporter<T> importer )
+    {
+        this.importer = importer;
+        this.instance = instance;
+    }
+
+    public T instance()
+    {
+        return instance;
+    }
+
+    public ServiceImporter importer()
+    {
+        return importer;
+    }
+
+    public boolean isAvailable()
+    {
+        return importer.isAvailable( instance );
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        // NOOP
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        // NOOP
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceModel.java
new file mode 100644
index 0000000..174735f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceModel.java
@@ -0,0 +1,197 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+
+/**
+ * JAVADOC
+ */
+public final class ImportedServiceModel
+    implements ImportedServiceDescriptor, VisitableHierarchy<Object, Object>
+{
+    private final ModuleDescriptor module;
+    private final Class<?> type;
+    private final Visibility visibility;
+    @SuppressWarnings( "raw" )
+    private final Class<? extends ServiceImporter> serviceImporter;
+    private final Identity identity;
+    private final boolean importOnStartup;
+    private final MetaInfo metaInfo;
+    private final ActivatorsModel<?> activatorsModel;
+    private final String moduleName;
+
+    @SuppressWarnings( "raw" )
+    public ImportedServiceModel( ModuleDescriptor module,
+                                 Class serviceType,
+                                 Visibility visibility,
+                                 Class<? extends ServiceImporter> serviceImporter,
+                                 Identity identity,
+                                 boolean importOnStartup,
+                                 MetaInfo metaInfo,
+                                 ActivatorsModel<?> activatorsModel,
+                                 String moduleName
+    )
+    {
+        this.module = module;
+        type = serviceType;
+        this.visibility = visibility;
+        this.serviceImporter = serviceImporter;
+        this.identity = identity;
+        this.importOnStartup = importOnStartup;
+        this.metaInfo = metaInfo;
+        this.activatorsModel = activatorsModel;
+        this.moduleName = moduleName;
+    }
+
+    public boolean isImportOnStartup()
+    {
+        return importOnStartup;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public Stream<Class<?>> types()
+    {
+        return Stream.of( type );
+    }
+
+    @Override
+    public Visibility visibility()
+    {
+        return visibility;
+    }
+
+    @Override
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    @SuppressWarnings( "raw" )
+    public Class<? extends ServiceImporter> serviceImporter()
+    {
+        return serviceImporter;
+    }
+
+    @Override
+    public Class<?> type()
+    {
+        return type;
+    }
+
+    @Override
+    public Identity identity()
+    {
+        return identity;
+    }
+
+    public String moduleName()
+    {
+        return moduleName;
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public ActivatorsInstance<?> newActivatorsInstance( ModuleDescriptor module )
+        throws Exception
+    {
+        return new ActivatorsInstance( activatorsModel.newInstances( module ) );
+    }
+
+    @Override
+    public boolean isAssignableTo( Class<?> type )
+    {
+        return this.type.isAssignableFrom( type );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            activatorsModel.accept( visitor );
+        }
+        return visitor.visitLeave( this );
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public <T> ImportedServiceInstance<T> importInstance( ModuleDescriptor module )
+    {
+        try
+        {
+            ServiceImporter importer = module.instance().newObject( serviceImporter );
+            T instance = (T) importer.importService( this );
+            return new ImportedServiceInstance<>( instance, importer );
+        }
+        catch( ServiceImporterException e )
+        {
+            throw e;
+        }
+        catch( Exception e )
+        {
+            throw new ServiceImporterException( "Could not import service " + identity, e );
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    public Object newProxy( InvocationHandler serviceInvocationHandler )
+    {
+        if( type.isInterface() )
+        {
+            return Proxy.newProxyInstance( type.getClassLoader(),
+                                           new Class[]{ type },
+                                           serviceInvocationHandler );
+        }
+        else
+        {
+            Class[] interfaces = type.getInterfaces();
+            return Proxy.newProxyInstance( type.getClassLoader(),
+                                           interfaces,
+                                           serviceInvocationHandler );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return type.getName() + ":" + identity;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceReferenceInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceReferenceInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceReferenceInstance.java
new file mode 100644
index 0000000..328e26b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServiceReferenceInstance.java
@@ -0,0 +1,221 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.service.ServiceUnavailableException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+
+/**
+ * Implementation of ServiceReference. This manages the reference to the imported service.
+ * <p>
+ * Whenever the service is requested it is returned directly to the client. That means that
+ * to handle service passivation and unavailability correctly, any proxying must be done in the
+ * service importer.
+ * </p>
+ *
+ * @param <T> Service Type
+ */
+public final class ImportedServiceReferenceInstance<T>
+    implements ServiceReference<T>, Activation
+{
+    private volatile ImportedServiceInstance<T> serviceInstance;
+    private T instance;
+    private final ModuleDescriptor module;
+    private final ImportedServiceModel serviceModel;
+    private final ActivationDelegate activation = new ActivationDelegate( this );
+    private boolean active = false;
+
+    public ImportedServiceReferenceInstance( ImportedServiceModel serviceModel, ModuleDescriptor module )
+    {
+        this.module = module;
+        this.serviceModel = serviceModel;
+    }
+
+    @Override
+    public Identity identity()
+    {
+        return serviceModel.identity();
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return serviceModel.types();
+    }
+
+    @Override
+    public <M> M metaInfo( Class<M> infoType )
+    {
+        return serviceModel.metaInfo( infoType );
+    }
+
+    @Override
+    public synchronized T get()
+    {
+        return getInstance();
+    }
+
+    public ImportedServiceModel serviceDescriptor()
+    {
+        return serviceModel;
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        if( serviceModel.isImportOnStartup() )
+        {
+            getInstance();
+        }
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        if( serviceInstance != null )
+        {
+            try
+            {
+                activation.passivate( () -> active = false );
+            }
+            finally
+            {
+                serviceInstance = null;
+                active = false;
+            }
+        }
+    }
+
+    @Override
+    public boolean isActive()
+    {
+        return active;
+    }
+
+    @Override
+    public boolean isAvailable()
+    {
+        try
+        {
+            getInstance();
+            return serviceInstance.isAvailable();
+        }
+        catch( ServiceImporterException ex )
+        {
+            return false;
+        }
+    }
+
+    @Override
+    public ModelDescriptor model()
+    {
+        return serviceModel;
+    }
+
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    private T getInstance()
+        throws ServiceImporterException
+    {
+        // DCL that works with Java 1.5 volatile semantics
+        if( serviceInstance == null )
+        {
+            synchronized( this )
+            {
+                if( serviceInstance == null )
+                {
+                    serviceInstance = serviceModel.<T>importInstance( module );
+                    instance = serviceInstance.instance();
+
+                    try
+                    {
+                        activation.activate(
+                            serviceModel.newActivatorsInstance( module ),
+                            serviceInstance, () -> {
+                                active = true;
+                            }
+                        );
+                    }
+                    catch( Exception e )
+                    {
+                        serviceInstance = null;
+                        throw new ServiceUnavailableException( "Could not activate service " + serviceModel.identity(), e );
+                    }
+                }
+            }
+        }
+
+        return instance;
+    }
+
+    @Override
+    public String toString()
+    {
+        return serviceModel.identity() + ", active=" + isActive() + ", module='" + serviceModel.moduleName() + "'";
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return identity().hashCode();
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        if( obj == null )
+        {
+            return false;
+        }
+        if( getClass() != obj.getClass() )
+        {
+            return false;
+        }
+        final ServiceReference other = (ServiceReference) obj;
+        return identity().equals( other.identity() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesInstance.java
new file mode 100644
index 0000000..61a15c9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesInstance.java
@@ -0,0 +1,128 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * JAVADOC
+ */
+public class ImportedServicesInstance
+    implements Activation, ActivationEventListenerRegistration
+{
+    private final ImportedServicesModel servicesModel;
+    private final List<ServiceReference<?>> serviceReferences;
+    private final ActivationDelegate activation = new ActivationDelegate( this, false );
+
+    public ImportedServicesInstance( ImportedServicesModel servicesModel,
+                                     List<ServiceReference<?>> serviceReferences
+    )
+    {
+        this.servicesModel = servicesModel;
+        this.serviceReferences = serviceReferences;
+        for( ServiceReference serviceReference : serviceReferences )
+        {
+            serviceReference.registerActivationEventListener( activation );
+        }
+    }
+
+    public Stream<ImportedServiceModel> models()
+    {
+        return servicesModel.models();
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        Iterable<Activation> activatees = serviceReferences.stream().filter( Activation.class::isInstance )
+                                                           .map( Activation.class::cast )
+                                                           .collect( toList() );
+        activation.activate( ActivatorsInstance.EMPTY, activatees );
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        activation.passivate();
+    }
+
+    public Stream<ServiceReference<?>> visibleServices( final Visibility visibility )
+    {
+        return serviceReferences.stream()
+            .filter( item ->
+                         ( (ImportedServiceReferenceInstance) item ).serviceDescriptor()
+                             .visibility()
+                             .ordinal() >= visibility.ordinal()
+            );
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "Services{" );
+        String sep = " ";
+        for( ServiceReference serviceReference : serviceReferences )
+        {
+            sb.append( sep ).
+                append( serviceReference.identity() ).
+                append( "(active=" ).append( serviceReference.isActive() ).append( ")" );
+            sep = ", ";
+        }
+        return sb.append( " }" ).toString();
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    public Stream<? extends ImportedServiceDescriptor> stream()
+    {
+        return servicesModel.models();
+    }
+
+    public Stream<ServiceReference<?>> references()
+    {
+        return serviceReferences.stream();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesModel.java
new file mode 100644
index 0000000..af34755
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ImportedServicesModel.java
@@ -0,0 +1,77 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public class ImportedServicesModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private List<ImportedServiceModel> importedServiceModels;
+
+    public ImportedServicesModel( List<ImportedServiceModel> importedServiceModels )
+    {
+        this.importedServiceModels = importedServiceModels;
+    }
+
+    public ImportedServicesInstance newInstance( ModuleDescriptor module )
+    {
+        List<ServiceReference<?>> serviceReferences = new ArrayList<>();
+        for( ImportedServiceModel serviceModel : importedServiceModels )
+        {
+            ImportedServiceReferenceInstance serviceReferenceInstance = new ImportedServiceReferenceInstance( serviceModel, module );
+            serviceReferences.add( serviceReferenceInstance );
+        }
+
+        return new ImportedServicesInstance( this, serviceReferences );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ImportedServiceModel importedServiceModel : importedServiceModels )
+            {
+                if( !importedServiceModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Stream<ImportedServiceModel> models()
+    {
+        return importedServiceModels.stream();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceInstance.java
new file mode 100644
index 0000000..da40e1f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceInstance.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.lang.reflect.Proxy;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.configuration.Configuration;
+import org.apache.polygene.api.configuration.Enabled;
+import org.apache.polygene.api.service.Availability;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.runtime.composite.TransientInstance;
+import org.apache.polygene.runtime.composite.TransientStateInstance;
+
+/**
+ * JAVADOC
+ */
+public class ServiceInstance
+    extends TransientInstance
+    implements Activation
+{
+    public static TransientInstance serviceInstanceOf( ServiceComposite composite )
+    {
+        return (TransientInstance) Proxy.getInvocationHandler( composite );
+    }
+
+    private final boolean implementsServiceAvailable;
+    private final boolean hasEnabledConfiguration;
+
+    public ServiceInstance( ServiceModel compositeModel,
+                            Object[] mixins,
+                            TransientStateInstance state
+    )
+    {
+        super( compositeModel, mixins, state );
+
+        implementsServiceAvailable =
+            Classes.assignableTypeSpecification( Availability.class ).test( descriptor() );
+        hasEnabledConfiguration = compositeModel.configurationType() != null
+                                  && Enabled.class.isAssignableFrom( compositeModel.configurationType() );
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        // NOOP
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        // NOOP
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public boolean isAvailable()
+    {
+        // Check Enabled in configuration first
+        if( hasEnabledConfiguration && !( (Configuration<Enabled>) proxy() ).get().enabled().get() )
+        {
+            return false;
+        }
+
+        // Ask service if it's available
+        return !implementsServiceAvailable || ( (Availability) proxy() ).isAvailable();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceModel.java
new file mode 100644
index 0000000..abbe40b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceModel.java
@@ -0,0 +1,192 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.ParameterizedType;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.configuration.Configuration;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.composite.CompositeMethodsModel;
+import org.apache.polygene.runtime.composite.CompositeModel;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.composite.TransientStateInstance;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.property.PropertyInstance;
+
+/**
+ * JAVADOC
+ */
+public final class ServiceModel extends CompositeModel
+    implements ServiceDescriptor
+{
+    private final Identity identity;
+    private final boolean instantiateOnStartup;
+    private final ActivatorsModel<?> activatorsModel;
+    private final Class configurationType;
+
+    public ServiceModel( ModuleDescriptor module,
+                         List<Class<?>> types,
+                         Visibility visibility,
+                         MetaInfo metaInfo,
+                         ActivatorsModel<?> activatorsModel,
+                         MixinsModel mixinsModel,
+                         StateModel stateModel,
+                         CompositeMethodsModel compositeMethodsModel,
+                         Identity identity,
+                         boolean instantiateOnStartup
+    )
+    {
+        super( module, types, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel );
+
+        this.identity = identity;
+        this.instantiateOnStartup = instantiateOnStartup;
+        this.activatorsModel = activatorsModel;
+
+        // Calculate configuration type
+        this.configurationType = calculateConfigurationType();
+    }
+
+    @Override
+    public boolean isInstantiateOnStartup()
+    {
+        return instantiateOnStartup;
+    }
+
+    @Override
+    public Identity identity()
+    {
+        return identity;
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public ActivatorsInstance<?> newActivatorsInstance( ModuleDescriptor module )
+        throws Exception
+    {
+        return new ActivatorsInstance( activatorsModel.newInstances( module ) );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> Class<T> configurationType()
+    {
+        return configurationType;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( activatorsModel.accept( visitor ) )
+            {
+                if( compositeMethodsModel.accept( visitor ) )
+                {
+                    if( stateModel.accept( visitor ) )
+                    {
+                        mixinsModel.accept( visitor );
+                    }
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public ServiceInstance newInstance( final ModuleDescriptor module )
+    {
+        Object[] mixins = mixinsModel.newMixinHolder();
+
+        Map<AccessibleObject, Property<?>> properties = new HashMap<>();
+        stateModel.properties().forEach( propertyModel -> {
+            Object initialValue = propertyModel.initialValue( module );
+            if( propertyModel.accessor().equals( HasIdentity.IDENTITY_METHOD ) )
+            {
+                initialValue = identity;
+            }
+
+            Property<?> property = new PropertyInstance<>( propertyModel, initialValue );
+            properties.put( propertyModel.accessor(), property );
+        } );
+
+        TransientStateInstance state = new TransientStateInstance( properties );
+        ServiceInstance compositeInstance = new ServiceInstance( this, mixins, state );
+
+        // Instantiate all mixins
+        int i = 0;
+        UsesInstance uses = UsesInstance.EMPTY_USES.use( this );
+        InjectionContext injectionContext = new InjectionContext( compositeInstance, uses, state );
+        for( MixinModel mixinModel : mixinsModel.mixinModels() )
+        {
+            mixins[ i++ ] = mixinModel.newInstance( injectionContext );
+        }
+
+        return compositeInstance;
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + ":" + identity;
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public Class calculateConfigurationType()
+    {
+        DependencyModel.ScopeSpecification thisSpec = new DependencyModel.ScopeSpecification( This.class );
+        Predicate<DependencyModel> configurationCheck = item -> item.rawInjectionType().equals( Configuration.class );
+        return dependencies().filter( thisSpec.and( configurationCheck ) )
+            .filter( dependencyModel -> dependencyModel.rawInjectionType().equals( Configuration.class ) )
+            .filter( dependencyModel -> dependencyModel.injectionType() instanceof ParameterizedType )
+            .map( dependencyModel -> Classes.RAW_CLASS.apply( ( (ParameterizedType) dependencyModel.injectionType() ).getActualTypeArguments()[ 0 ] ) )
+            .reduce( null, ( injectionClass, type ) -> {
+                if( injectionClass == null )
+                {
+                    injectionClass = type;
+                }
+                else
+                {
+                    if( injectionClass.isAssignableFrom( type ) )
+                    {
+                        injectionClass = type;
+                    }
+                }
+                return injectionClass;
+            } );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceReferenceInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceReferenceInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceReferenceInstance.java
new file mode 100644
index 0000000..e6e53bd
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServiceReferenceInstance.java
@@ -0,0 +1,323 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.lang.reflect.Method;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.service.ServiceUnavailableException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+
+/**
+ * Implementation of ServiceReference.
+ * <p>
+ * This manages the actual instance of the service and implements the service Activation.
+ * </p>
+ * <p>
+ * Whenever the service is requested a proxy is returned which points to this class. This means
+ * that the instance can be passivated even though a client is holding on to a service proxy.
+ * </p>
+ * @param <T> Service Type
+ */
+public final class ServiceReferenceInstance<T>
+    implements ServiceReference<T>, Activation, ModelDescriptor
+{
+    private volatile ServiceInstance instance;
+    private final T serviceProxy;
+    private final ModuleDescriptor module;
+    private final ServiceModel serviceModel;
+    private final ActivationDelegate activation = new ActivationDelegate( this );
+    private boolean active = false;
+
+    ServiceReferenceInstance( ServiceModel serviceModel, ModuleDescriptor module )
+    {
+        this.module = module;
+        this.serviceModel = serviceModel;
+
+        serviceProxy = newProxy();
+    }
+
+    @Override
+    public Identity identity()
+    {
+        return serviceModel.identity();
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return serviceModel.types();
+    }
+
+    @Override
+    public <M> M metaInfo( Class<M> infoType )
+    {
+        return serviceModel.metaInfo( infoType );
+    }
+
+    @Override
+    public synchronized T get()
+    {
+        return serviceProxy;
+    }
+
+    @Override
+    public boolean isActive()
+    {
+        return active;
+    }
+
+    @Override
+    public boolean isAvailable()
+    {
+        return getInstance().isAvailable();
+    }
+
+    @Override
+    public ModelDescriptor model()
+    {
+        return serviceModel;
+    }
+
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        if( serviceModel.isInstantiateOnStartup() )
+        {
+            getInstance();
+        }
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        if( instance != null )
+        {
+            try {
+                activation.passivate( () -> active = false );
+            } finally {
+                instance = null;
+                active = false;
+            }
+        }
+    }
+
+    private ServiceInstance getInstance()
+        throws ServiceImporterException
+    {
+        // DCL that works with Java 1.5 volatile semantics
+        if( instance == null )
+        {
+            synchronized( this )
+            {
+                if( instance == null )
+                {
+                    instance = serviceModel.newInstance( module );
+
+                    try
+                    {
+                        activation.activate( serviceModel.newActivatorsInstance( module ),
+                                             instance,
+                                             () -> active = true );
+                    }
+                    catch( Exception e )
+                    {
+                        instance = null;
+                        throw new ServiceUnavailableException( "Could not activate service " + serviceModel.identity(), e );
+                    }
+                }
+            }
+        }
+
+        return instance;
+    }
+
+    @Override
+    public String toString()
+    {
+        return serviceModel.identity() + "(active=" + isActive() + ",module='" + module.name() + "')";
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public T newProxy()
+    {
+        return (T) serviceModel.newProxy( new ServiceReferenceInstance.ServiceInvocationHandler() );
+    }
+
+    public ServiceDescriptor serviceDescriptor()
+    {
+        return serviceModel;
+    }
+
+    @Override
+    public Visibility visibility()
+    {
+        return serviceModel.visibility();
+    }
+
+    @Override
+    public boolean isAssignableTo( Class<?> type )
+    {
+        return serviceModel.isAssignableTo( type );
+    }
+
+    public final class ServiceInvocationHandler
+        implements CompositeInstance
+    {
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public <P> P proxy()
+        {
+            return (P) ServiceReferenceInstance.this.get();
+        }
+
+        @Override
+        public <P> P newProxy( Class<P> mixinType )
+            throws IllegalArgumentException
+        {
+            return getInstance().newProxy( mixinType );
+        }
+
+        @Override
+        public <M> M metaInfo( Class<M> infoType )
+        {
+            return ServiceReferenceInstance.this.metaInfo( infoType );
+        }
+
+        @Override
+        public Stream<Class<?>> types()
+        {
+            return ServiceReferenceInstance.this.types();
+        }
+
+        @Override
+        public CompositeDescriptor descriptor()
+        {
+            return ServiceReferenceInstance.this.serviceDescriptor();
+        }
+
+        @Override
+        public Object invokeComposite( Method method, Object[] args )
+            throws Throwable
+        {
+            return getInstance().invokeComposite( method, args );
+        }
+
+        @Override
+        public StateHolder state()
+        {
+            return getInstance().state();
+        }
+
+        @Override
+        public Object invoke( Object object, Method method, Object[] objects )
+            throws Throwable
+        {
+            if( method.getDeclaringClass().equals( Object.class ) )
+            {
+                switch( method.getName() )
+                {
+                    case "toString":
+                        return serviceModel.toString();
+                    case "equals":
+                        return objects[0] == object;
+                    case "hashCode":
+                        return serviceModel.toString().hashCode();
+                }
+            }
+
+            ServiceInstance instance = getInstance();
+
+/*
+            if (!instance.isAvailable())
+            {
+                throw new ServiceUnavailableException("Service is currently not available");
+            }
+
+*/
+            return instance.invoke( object, method, objects );
+        }
+
+        @Override
+        public String toString()
+        {
+            return serviceModel.toString();
+        }
+
+        @Override
+        public ModuleDescriptor module()
+        {
+            return module;
+        }
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return identity().hashCode();
+    }
+
+    @Override
+    @SuppressWarnings( "raw" )
+    public boolean equals( Object obj )
+    {
+        if ( obj == null ) {
+            return false;
+        }
+        if ( getClass() != obj.getClass() ) {
+            return false;
+        }
+        final ServiceReference other = ( ServiceReference ) obj;
+        return identity().equals( other.identity() );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesInstance.java
new file mode 100644
index 0000000..c40a74a
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesInstance.java
@@ -0,0 +1,122 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.runtime.activation.ActivationDelegate;
+import org.apache.polygene.runtime.activation.ActivatorsInstance;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * JAVADOC
+ */
+public class ServicesInstance
+    implements Activation, ActivationEventListenerRegistration
+{
+    private final ServicesModel servicesModel;
+    private final List<ServiceReference<?>> serviceReferences;
+    private final ActivationDelegate activation = new ActivationDelegate( this, false );
+
+    public ServicesInstance( ServicesModel servicesModel, List<ServiceReference<?>> serviceReferences )
+    {
+        this.servicesModel = servicesModel;
+        this.serviceReferences = serviceReferences;
+        for( ServiceReference serviceReference : serviceReferences )
+        {
+            serviceReference.registerActivationEventListener( activation );
+        }
+    }
+
+    public Stream<? extends ServiceDescriptor> models()
+    {
+        return servicesModel.models();
+    }
+
+    @Override
+    public void activate()
+        throws ActivationException
+    {
+        Iterable<Activation> activatees = serviceReferences.stream().filter( Activation.class::isInstance )
+                                                           .map( Activation.class::cast )
+                                                           .collect( toList() );
+        activation.activate( ActivatorsInstance.EMPTY, activatees );
+    }
+
+    @Override
+    public void passivate()
+        throws PassivationException
+    {
+        activation.passivate();
+    }
+
+    public Stream<ServiceReference<?>> visibleServices( final Visibility visibility )
+    {
+        return serviceReferences.stream()
+            .filter( item -> ( (ServiceReferenceInstance) item ).serviceDescriptor()
+                                 .visibility().ordinal() >= visibility.ordinal() );
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "Services{" );
+        String sep = " ";
+        for( ServiceReference serviceReference : serviceReferences )
+        {
+            sb.append( sep ).
+                append( serviceReference.identity() ).
+                append( "(active=" ).append( serviceReference.isActive() ).append( ")" );
+            sep = ", ";
+        }
+        return sb.append( " }" ).toString();
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activation.registerActivationEventListener( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activation.deregisterActivationEventListener( listener );
+    }
+
+    public Stream<? extends ServiceDescriptor> descriptors()
+    {
+        return servicesModel.models();
+    }
+
+    public Stream<ServiceReference<?>> references()
+    {
+        return serviceReferences.stream();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesModel.java
new file mode 100644
index 0000000..ebdf64c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/service/ServicesModel.java
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public class ServicesModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<ServiceModel> serviceModels;
+
+    public ServicesModel( List<ServiceModel> serviceModels )
+    {
+        this.serviceModels = serviceModels;
+    }
+
+    public ServicesInstance newInstance( ModuleDescriptor module )
+    {
+        List<ServiceReference<?>> serviceReferences = new ArrayList<>();
+        for( ServiceModel serviceModel : serviceModels )
+        {
+            ServiceReferenceInstance serviceReferenceInstance = new ServiceReferenceInstance( serviceModel, module );
+            serviceReferences.add( serviceReferenceInstance );
+        }
+
+        return new ServicesInstance( this, serviceReferences );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ServiceModel serviceModel : serviceModels )
+            {
+                if( !serviceModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Stream<? extends ServiceDescriptor> models()
+    {
+        return serviceModels.stream();
+    }
+
+    public boolean contains( Class<?> type )
+    {
+        for( ServiceModel model : serviceModels )
+        {
+            if( model.hasType( type ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+}


[37/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
new file mode 100644
index 0000000..5f2628c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueDeserializer.java
@@ -0,0 +1,166 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.io.InputStream;
+import java.util.function.Function;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.ValueType;
+
+/**
+ * Use a ValueDeserializer to create new values instances from serialized state.
+ *
+ * <p>
+ * Serialized state must be one of:
+ * </p>
+ * <ul>
+ * <li>a ValueComposite,</li>
+ * <li>an EntityReference,</li>
+ * <li>a Collection,</li>
+ * <li>a Map,</li>
+ * <li>a Plain Value.</li>
+ * </ul>
+ * <p>
+ * Nested plain values, EntityReferences, Collections, Maps, ValueComposites are supported.
+ * EntityReferences are deserialized as their reference string.
+ * </p>
+ * <p>
+ * Plain values can be one of:
+ * </p>
+ * <ul>
+ * <li>String,</li>
+ * <li>Character or char,</li>
+ * <li>Boolean or boolean,</li>
+ * <li>Integer or int,</li>
+ * <li>Long or long,</li>
+ * <li>Short or short,</li>
+ * <li>Byte or byte,</li>
+ * <li>Float or float,</li>
+ * <li>Double or double,</li>
+ * <li>BigInteger,</li>
+ * <li>BigDecimal,</li>
+ * <li>Date,</li>
+ * <li>DateTime (JodaTime),</li>
+ * <li>LocalDateTime (JodaTime),</li>
+ * <li>LocalDate (JodaTime).</li>
+ * </ul>
+ * <p>
+ * Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are deserialized
+ * from base64 encoded bytes using pure Java serialization. If it happens that the input is invalid, a
+ * ValueSerializationException is thrown.
+ * </p>
+ * <p>
+ * Having type information in the serialized payload allows to keep actual ValueComposite types and by so
+ * circumvent {@link org.apache.polygene.api.composite.AmbiguousTypeException} when deserializing.
+ * </p>
+ */
+public interface ValueDeserializer
+{
+
+    /**
+     * Factory method for a typed deserialize function.
+     *
+     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+     *
+     * @param type the value type
+     * @param <T>  the parametrized function return type
+     *
+     * @return a deserialization function
+     */
+    <T> Function<String, T> deserialize( ModuleDescriptor module, Class<T> type );
+
+    /**
+     * Factory method for a typed deserialize function.
+     *
+     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+     *
+     * @param valueType the value type
+     * @param <T>       the parametrized function return type
+     *
+     * @return a deserialization function
+     */
+    <T> Function<String, T> deserialize( ModuleDescriptor module, ValueType valueType );
+
+    /**
+     * Factory method for an untyped deserialize function.
+     *
+     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
+     *
+     * @param <T> the parametrized function return type
+     * @return a deserialization function
+     */
+//    <T> BiFunction<ValueType, String, T> deserialize();
+
+    /**
+     * Deserialize a value from a state.
+     *
+     * @param <T>   the parametrized returned type
+     * @param type  the value type
+     * @param input the state
+     *
+     * @return the value
+     *
+     * @throws ValueSerializationException if the deserialization failed
+     */
+    <T> T deserialize( ModuleDescriptor module, Class<?> type, String input )
+        throws ValueSerializationException;
+
+    /**
+     * Deserialize a value from a state.
+     *
+     * @param <T>       the parametrized returned type
+     * @param valueType the value type
+     * @param input     the state
+     *
+     * @return the value
+     *
+     * @throws ValueSerializationException if the deserialization failed
+     */
+    <T> T deserialize( ModuleDescriptor module, ValueType valueType, String input )
+        throws ValueSerializationException;
+
+    /**
+     * Deserialize a value from a state.
+     *
+     * @param <T>   the parametrized returned type
+     * @param type  the value type
+     * @param input the state stream
+     *
+     * @return the value
+     *
+     * @throws ValueSerializationException if the deserialization failed
+     */
+    <T> T deserialize( ModuleDescriptor module, Class<?> type, InputStream input )
+        throws ValueSerializationException;
+
+    /**
+     * Deserialize a value from a state.
+     *
+     * @param <T>       the parametrized returned type
+     * @param valueType the value type
+     * @param input     the state stream
+     *
+     * @return the value
+     *
+     * @throws ValueSerializationException if the deserialization failed
+     */
+    <T> T deserialize( ModuleDescriptor module, ValueType valueType, InputStream input )
+        throws ValueSerializationException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
new file mode 100644
index 0000000..91c1081
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerialization.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+/**
+ * ValueSerialization API.
+ *
+ * See {@link ValueSerializer} and {@link ValueDeserializer}.
+ */
+public interface ValueSerialization
+    extends ValueSerializer, ValueDeserializer
+{
+
+    /**
+     * Serialization format @Service tags.
+     *
+     * <p>
+     *     ValueSerialization implementations should be tagged with theses at assembly time so that consumers can
+     *     specify which format they need.
+     * </p>
+     */
+    interface Formats
+    {
+
+        /**
+         * Tag a ValueSerialization service that support the JSON format.
+         */
+        String JSON = "json";
+        /**
+         * Tag a ValueSerialization service that support the XML format.
+         */
+        String XML = "xml";
+        /**
+         * Tag a ValueSerialization service that support the YAML format.
+         */
+        String YAML = "yaml";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
new file mode 100644
index 0000000..62faa75
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializationException.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+/**
+ * Thrown when an error occur during value state (de)serialization.
+ */
+public class ValueSerializationException
+    extends RuntimeException
+{
+
+    private static final long serialVersionUID = 1L;
+
+    public ValueSerializationException()
+    {
+        super();
+    }
+
+    public ValueSerializationException( String message )
+    {
+        super( message );
+    }
+
+    public ValueSerializationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public ValueSerializationException( Throwable cause )
+    {
+        super( cause.getClass().getName() + ": " + cause.getMessage(), cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
new file mode 100644
index 0000000..f2c6138
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/ValueSerializer.java
@@ -0,0 +1,327 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+
+/**
+ * Use a ValueSerializer to serialize values state.
+ *
+ * <p>
+ *     Serialized object must be one of:
+ * </p>
+ * <ul>
+ *     <li>a ValueComposite,</li>
+ *     <li>an EntityComposite or EntityReference,</li>
+ *     <li>an Iterable,</li>
+ *     <li>a Map,</li>
+ *     <li>a Plain Value.</li>
+ * </ul>
+ * <p>
+ *     Nested plain values, EntityReferences, Iterables, Maps, ValueComposites and EntityComposites are supported.
+ *     EntityComposites and EntityReferences are serialized as their reference string.
+ * </p>
+ * <p>
+ *     Plain values can be one of:
+ * </p>
+ * <ul>
+ *     <li>String,</li>
+ *     <li>Character or char,</li>
+ *     <li>Boolean or boolean,</li>
+ *     <li>Integer or int,</li>
+ *     <li>Long or long,</li>
+ *     <li>Short or short,</li>
+ *     <li>Byte or byte,</li>
+ *     <li>Float or float,</li>
+ *     <li>Double or double,</li>
+ *     <li>BigInteger,</li>
+ *     <li>BigDecimal,</li>
+ *     <li>Date,</li>
+ *     <li>DateTime (JodaTime),</li>
+ *     <li>LocalDateTime (JodaTime),</li>
+ *     <li>LocalDate (JodaTime).</li>
+ * </ul>
+ * <p>
+ *     Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are serialized to
+ *     base64 encoded bytes using pure Java serialization. If it happens that the value is not Serializable, a
+ *     ValueSerializationException is thrown.
+ * </p>
+ * <p>
+ *     Having type information in the serialized payload allows to keep actual ValueComposite types and by so
+ *     circumvent {@link AmbiguousTypeException} when deserializing.
+ * </p>
+ */
+public interface ValueSerializer
+{
+
+    /**
+     * Factory method for a serialize function.
+     *
+     * @param <T> the parametrized function input type
+     * @return a serialization function.
+     */
+    <T> Function<T, String> serialize();
+
+    /**
+     * Factory method for a serialize function.
+     *
+     * @param <T> the parametrized function input type
+     * @param options ValueSerializer Options
+     * @return a serialization function.
+     */
+    <T> Function<T, String> serialize( Options options );
+
+    /**
+     * Factory method for a serialize function.
+     *
+     * @param <T> the parametrized function input type
+     * @param includeTypeInfo if type information should be included in the output
+     * @return a serialization function.
+     */
+    @Deprecated
+    <T> Function<T, String> serialize( boolean includeTypeInfo );
+
+    /**
+     * Serialize the state of a value with type information.
+     *
+     * @param object an Object to serialize
+     * @return the state
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    String serialize( Object object )
+        throws ValueSerializationException;
+
+    /**
+     * Serialize the state of a value.
+     *
+     * @param options ValueSerializer Options
+     * @param object an Object to serialize
+     * @return the state
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    String serialize( Options options, Object object )
+        throws ValueSerializationException;
+
+    /**
+     * Serialize the state of a value.
+     *
+     * @param object an Object to serialize
+     * @param includeTypeInfo if type information should be included in the output
+     * @return the state
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    @Deprecated
+    String serialize( Object object, boolean includeTypeInfo )
+        throws ValueSerializationException;
+
+    /**
+     * Serialize the state of a value with type information.
+     *
+     * @param object an Object to serialize
+     * @param output that will be used as output
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    void serialize( Object object, OutputStream output )
+        throws ValueSerializationException;
+
+    /**
+     * Serialize the state of a value.
+     *
+     * @param options ValueSerializer Options
+     * @param object an Object to serialize
+     * @param output that will be used as output
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    void serialize( Options options, Object object, OutputStream output )
+        throws ValueSerializationException;
+
+    /**
+     * Serialize the state of a value.
+     *
+     * @param object an Object to serialize
+     * @param output that will be used as output
+     * @param includeTypeInfo if type information should be included in the output
+     * @throws ValueSerializationException if the Value serialization failed
+     */
+    @Deprecated
+    void serialize( Object object, OutputStream output, boolean includeTypeInfo )
+        throws ValueSerializationException;
+
+    /**
+     * Serialization options.
+     */
+    final class Options
+    {
+        /**
+         * Boolean flag to include type information.
+         * Default to TRUE.
+         */
+        public static final String INCLUDE_TYPE_INFO = "includeTypeInfo";
+        public static final String MAP_ENTRIES_AS_OBJECTS = "mapentriesasobjects";
+        private final Map<String, String> options = new HashMap<>();
+
+        /**
+         * Create new default ValueSerializer Options.
+         */
+        public Options()
+        {
+            this.options.put( INCLUDE_TYPE_INFO, "true" );
+            this.options.put( MAP_ENTRIES_AS_OBJECTS, "false" );
+        }
+
+        /**
+         * Set {@link #INCLUDE_TYPE_INFO} option to TRUE.
+         * @return This
+         */
+        public Options withTypeInfo()
+        {
+            return put( INCLUDE_TYPE_INFO, true );
+        }
+
+        /**
+         * Set {@link #INCLUDE_TYPE_INFO} option to FALSE.
+         * @return This
+         */
+        public Options withoutTypeInfo()
+        {
+            return put( INCLUDE_TYPE_INFO, false );
+        }
+
+        public Options withMapEntriesAsObjects()
+        {
+            return put( MAP_ENTRIES_AS_OBJECTS, true );
+        }
+
+        public Options withMapEntriesAsKeyValuePairs()
+        {
+            return put( MAP_ENTRIES_AS_OBJECTS, false );
+        }
+
+        /**
+         * Get Boolean option value.
+         * @param option The option
+         * @return The boolean value of the option, or null if absent
+         */
+        public Boolean getBoolean( String option )
+        {
+            if( !options.containsKey( option ) )
+            {
+                return null;
+            }
+            return Boolean.valueOf( options.get( option ) );
+        }
+
+        /**
+         * Get Integer option value.
+         * @param option The option
+         * @return The integer value of the option, or null if absent
+         */
+        public Integer getInteger( String option )
+        {
+            if( !options.containsKey( option ) )
+            {
+                return null;
+            }
+            return Integer.valueOf( options.get( option ) );
+        }
+
+        /**
+         * Get String option value.
+         * @param option The option
+         * @return The string value of the option, or null if absent
+         */
+        public String getString( String option )
+        {
+            return options.get( option );
+        }
+
+        /**
+         * Put an option String value.
+         * @param option The option
+         * @param value The value
+         * @return This Options instance
+         */
+        public Options put( String option, String value )
+        {
+            if( value == null )
+            {
+                return remove( option );
+            }
+            options.put( option, value );
+            return this;
+        }
+
+        /**
+         * Put an option boolean value.
+         * @param option The option
+         * @param value The value
+         * @return This Options instance
+         */
+        public Options put( String option, Boolean value )
+        {
+            if( value == null )
+            {
+                return remove( option );
+            }
+            options.put( option, Boolean.toString( value ) );
+            return this;
+        }
+
+        /**
+         * Put an option Integer value.
+         * @param option The option
+         * @param value The value
+         * @return This Options instance
+         */
+        public Options put( String option, Integer value )
+        {
+            if( value == null )
+            {
+                return remove( option );
+            }
+            options.put( option, value.toString() );
+            return this;
+        }
+
+        /**
+         * Remove an option value.
+         * @param option The option
+         * @return This Options instance
+         */
+        public Options remove( String option )
+        {
+            options.remove( option );
+            return this;
+        }
+
+        /**
+         * Get all defined options as a Map.
+         * @return All defined options in a new Map
+         */
+        public Map<String, String> toMap()
+        {
+            return new HashMap<>( options );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/value/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/value/package.html b/core/api/src/main/java/org/apache/polygene/api/value/package.html
new file mode 100644
index 0000000..def90fa
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/value/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Value API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/ZestAPI.java b/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
deleted file mode 100644
index 953e4c5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/ZestAPI.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.util.function.Function;
-import org.apache.zest.api.association.AbstractAssociation;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.composite.InvalidCompositeException;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.service.ServiceDescriptor;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.value.ValueDescriptor;
-
-/**
- * Encapsulation of the Polygene API.
- */
-public interface PolygeneAPI
-{
-    /**
-     * If a Modifier gets a reference to the Composite using @This,
-     * then that reference must be dereferenced using this method
-     * before handing it out for others to use.
-     *
-     * @param <T>       Parameterized type of the Composite
-     * @param composite instance reference injected in Modified using @This
-     *
-     * @return the dereferenced Composite
-     */
-    <T> T dereference( T composite );
-
-    /**
-     * Returns the Module or UnitOfWork where the Composite belongs.
-     *
-     * @param compositeOrUow The Composite (Service, Value, Entity or Transient) or UnitOfWork to lookup the Module it
-     *                       belongs to.
-     *
-     * @return The Module instance where the Composite or UnitOfWork belongs to.
-     */
-    ModuleDescriptor moduleOf( Object compositeOrUow );
-
-    /**
-     * Returns the ModelDescriptor of the Composite.
-     *
-     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
-     *                                    ModelDescriptor
-     *
-     * @return The ModelDescriptor of the Composite
-     */
-    ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference );
-
-    /**
-     * Returns the CompositeDescriptor of the Composite.
-     *
-     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
-     *                                    CompositeDescriptor
-     *
-     * @return The CompositeDescriptor of the Composite
-     */
-    CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference );
-
-    /**
-     * Returns the TransientDescriptor of the TransientComposite.
-     *
-     * @param transsient The TransientComposite for which to lookup the TransientDescriptor
-     *
-     * @return The TransientDescriptor of the TransientComposite
-     */
-    TransientDescriptor transientDescriptorFor( Object transsient );
-
-    /**
-     * Returns the EntityDescriptor of the EntityComposite.
-     *
-     * @param entity The EntityComposite for which to lookup the EntityDescriptor
-     *
-     * @return The EntityDescriptor of the EntityComposite
-     */
-    EntityDescriptor entityDescriptorFor( Object entity );
-
-    /**
-     * Returns the ValueDescriptor of the ValueComposite.
-     *
-     * @param value The ValueComposite for which to lookup the ValueDescriptor
-     *
-     * @return The ValueDescriptor of the ValueComposite
-     */
-    ValueDescriptor valueDescriptorFor( Object value );
-
-    /**
-     * Returns the ServiceDescriptor of the ServiceComposite.
-     *
-     * @param service The ServiceComposite for which to lookup the ServiceDescriptor
-     *
-     * @return The ServiceDescriptor of the ServiceComposite
-     */
-    ServiceDescriptor serviceDescriptorFor( Object service );
-
-    /**
-     * Returns the PropertyDescriptor of the Property.
-     *
-     * @param property The Property for which to lookup the PropertyDescriptor
-     *
-     * @return The PropertyDescriptor of the Property
-     */
-    PropertyDescriptor propertyDescriptorFor( Property<?> property );
-
-    /**
-     * Returns the AssociationDescriptor of the Association.
-     *
-     * @param association The Association for which to lookup the AssociationDescriptor
-     *
-     * @return The AssociationDescriptor of the Association
-     */
-    AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
-
-    /**
-     * Function that returns the CompositeDescriptor of a Composite.
-     */
-    Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
-        if( composite instanceof Proxy )
-        {
-            InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
-            return ( (CompositeInstance) invocationHandler ).descriptor();
-        }
-        try
-        {
-            Class<? extends Composite> compositeClass = composite.getClass();
-            Field instanceField = compositeClass.getField( "_instance" );
-            Object instance = instanceField.get( composite );
-            return ( (CompositeInstance) instance ).descriptor();
-        }
-        catch( Exception e )
-        {
-            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
-            exception.initCause( e );
-            throw exception;
-        }
-    };
-
-    /**
-     * Function that returns the CompositeInstance of a Composite.
-     */
-    Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
-        if( composite instanceof Proxy )
-        {
-            return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) );
-        }
-        try
-        {
-            Class<? extends Composite> compositeClass = composite.getClass();
-            Field instanceField = compositeClass.getField( "_instance" );
-            Object instance = instanceField.get( composite );
-            return (CompositeInstance) instance;
-        }
-        catch( Exception e )
-        {
-            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
-            exception.initCause( e );
-            throw exception;
-        }
-    };
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activation.java b/core/api/src/main/java/org/apache/zest/api/activation/Activation.java
deleted file mode 100644
index 3130421..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activation.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Interface used by Structure elements and Services that can be activated and passivated.
- * <p>Application and Layer expose this interface so you can activate and passivate them.</p>
- * <p>Module and ServiceComposite activation/passivation is handled by the Polygene runtime.</p>
- */
-@SuppressWarnings("JavaDoc")
-public interface Activation
-{
-    /**
-     * Activate.
-     * <p>Fail fast execution order is:</p>
-     * <ul>
-     *   <li>Fire {@link ActivationEvent.EventType#ACTIVATING}</li>
-     *   <li>Call {@link Activator#beforeActivation(java.lang.Object)} on each Activator</li>
-     *   <li>Call {@link #activate()} children</li>
-     *   <li>Call {@link Activator#afterActivation(java.lang.Object)} on each Activator</li>
-     *   <li>Fire {@link ActivationEvent.EventType#ACTIVATED}</li>
-     * </ul>
-     * <p>If an Exception is thrown, already activated nodes are passivated.</p>
-     * @throws ActivationException with first Exception of activation plus the PassivationException if any
-     */
-    void activate()
-        throws ActivationException;
-
-    /**
-     * Passivate.
-     * <p>Fail safe execution order is:</p>
-     * <ul>
-     *   <li>Fire {@link ActivationEvent.EventType#PASSIVATING}</li>
-     *   <li>Call {@link Activator#beforePassivation(java.lang.Object)} on each Activator</li>
-     *   <li>Call {@link #passivate()} children</li>
-     *   <li>Call {@link Activator#afterPassivation(java.lang.Object)} on each Activator</li>
-     *   <li>Fire {@link ActivationEvent.EventType#PASSIVATED}</li>
-     * </ul>
-     * @throws PassivationException after passivation with all Exceptions of passivation if any
-     */
-    void passivate()
-        throws PassivationException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
deleted file mode 100644
index 344f720..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEvent.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.time.Instant;
-import org.apache.zest.api.time.SystemTime;
-
-/**
- * ActivationEvents are fired during activation and passivation of instances in Polygene.
- */
-public final class ActivationEvent
-{
-    public enum EventType
-    {
-        ACTIVATING, ACTIVATED, PASSIVATING, PASSIVATED
-    }
-
-    private final Instant timestamp;
-    private final Object source;
-    private final EventType type;
-
-    public ActivationEvent( Object source, EventType type )
-    {
-        this.timestamp = SystemTime.now();
-        this.source = source;
-        this.type = type;
-    }
-
-    /**
-     * @return the source of the Activation event
-     */
-    public Object source()
-    {
-        return source;
-    }
-
-    /**
-     * @return the type of the Activation event
-     */
-    public EventType type()
-    {
-        return type;
-    }
-
-
-    /**
-     *
-     * @return The instant that this event was created.
-     */
-    public Instant eventTime()
-    {
-        return timestamp;
-    }
-
-    /**
-     * @return an informative message describing the event
-     */
-    public String message()
-    {
-        switch( type )
-        {
-        case ACTIVATING:
-            return "Activating " + source;
-        case ACTIVATED:
-            return "Activated " + source;
-        case PASSIVATING:
-            return "Passivating " + source;
-        case PASSIVATED:
-            return "Passivated " + source;
-        }
-        return "";
-    }
-
-    /**
-     * @see #message()
-     */
-    @Override
-    public String toString()
-    {
-        return message() + "@" + timestamp;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
deleted file mode 100644
index 53febcc..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Listener for ActivationEvent events
- */
-public interface ActivationEventListener
-{
-    void onEvent( ActivationEvent event )
-        throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java
deleted file mode 100644
index 7a13520..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationEventListenerRegistration.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Use this to register listeners for ActivationEvents.
- *
- * This is implemented by Application, Layer, Module, for example.
- */
-public interface ActivationEventListenerRegistration
-{
-    /**
-     * @param listener will be notified when Activation events occur
-     */
-    void registerActivationEventListener( ActivationEventListener listener );
-
-    /**
-     * @param listener will not be notified when Activation events occur anymore
-     */
-    void deregisterActivationEventListener( ActivationEventListener listener );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
deleted file mode 100644
index 293f3cb..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivationException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Thrown when unable to activate.
- */
-public class ActivationException extends Exception
-{
-    private static final long serialVersionUID = 1L;
-    public ActivationException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activator.java b/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
deleted file mode 100644
index c2da2f2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Assemble Activators to hook Services Activation.
- *
- * @param <ActivateeType> Type of the activatee.
- *
- * @see ActivatorAdapter
- * @see org.apache.zest.api.service.ServiceActivation
- */
-public interface Activator<ActivateeType>
-{
-
-    /**
-     * Called before activatee activation.
-     *
-     * @param activating The instance that is about to be activated.
-     *
-     * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
-     */
-    void beforeActivation( ActivateeType activating )
-        throws Exception;
-
-    /**
-     * Called after activatee activation.
-     *
-     * @param activated The instance that has just been activated.
-     *
-     * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
-     */
-    void afterActivation( ActivateeType activated )
-        throws Exception;
-
-    /**
-     * Called before activatee passivation.
-     *
-     * @param passivating The instance that is about to be passivated.
-     *
-     * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
-     */
-    void beforePassivation( ActivateeType passivating )
-        throws Exception;
-
-    /**
-     * Called after activatee passivation.
-     *
-     * @param passivated The instance that has just been passivated.
-     *
-     * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
-     */
-    void afterPassivation( ActivateeType passivated )
-        throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
deleted file mode 100644
index 68baab6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorAdapter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Adapter for Activator.
- * <p>If you are thinking about Service activation, see {@link org.apache.zest.api.service.ServiceActivatorAdapter}.</p>
- *
- * @param <ActivateeType> Type of the activatee.
- */
-public class ActivatorAdapter<ActivateeType>
-    implements Activator<ActivateeType>
-{
-    /**
-     * Called before activatee activation.
-     * @param activating Activating activatee
-     */
-    @Override
-    public void beforeActivation( ActivateeType activating )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called after activatee activation.
-     * @param activated Activating activatee
-     */
-    @Override
-    public void afterActivation( ActivateeType activated )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called before activatee passivation.
-     * @param passivating Passivating activatee
-     */
-    @Override
-    public void beforePassivation( ActivateeType passivating )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called after activatee passivation.
-     * @param passivated Passivated activatee
-     */
-    @Override
-    public void afterPassivation( ActivateeType passivated )
-        throws Exception
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java b/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java
deleted file mode 100644
index 7adcc30..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ActivatorDescriptor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-/**
- * Activator Descriptor.
- */
-public interface ActivatorDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/Activators.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/Activators.java b/core/api/src/main/java/org/apache/zest/api/activation/Activators.java
deleted file mode 100644
index 9b12f59..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/Activators.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used in ServiceComposites to declare Activator implementation classes.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
-@Documented
-public @interface Activators
-{
-
-    /**
-     * @return Activator implementation classes.
-     */
-    Class<? extends Activator<?>>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java b/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
deleted file mode 100644
index 0923e67..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/ApplicationPassivationThread.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.io.PrintStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.zest.api.structure.Application;
-
-/**
- * Application Passivation Thread to use as a Shutdown Hook.
- * <pre>Runtime.getRuntime().addShutdownHook( new ApplicationPassivationThread( application ) );</pre>
- */
-public final class ApplicationPassivationThread
-    extends Thread
-{
-    /**
-     * Create a new Application Passivation Thread that output errors to STDERR.
-     * @param application The Application to passivate
-     */
-    @SuppressWarnings("unused")
-    public ApplicationPassivationThread(final Application application )
-    {
-        this( application, null, null );
-    }
-
-    /**
-     * Create a new Application Passivation Thread that output errors to a Logger.
-     * @param application The Application to passivate
-     * @param logger Logger for errors
-     */
-    @SuppressWarnings("unused")
-    public ApplicationPassivationThread(Application application, Logger logger )
-    {
-        this( application, null, logger );
-    }
-
-    /**
-     * Create a new Application Passivation Thread that output errors to a PrintStream.
-     * @param application The Application to passivate
-     * @param output PrintStream for errors
-     */
-    public ApplicationPassivationThread( Application application, PrintStream output )
-    {
-        this( application, output, null );
-    }
-
-    private ApplicationPassivationThread( Application application, PrintStream output, Logger logger )
-    {
-        super( new ApplicationPassivation( application, output, logger ),
-               application.name() + " Passivation Thread" );
-    }
-
-    private static class ApplicationPassivation
-        implements Runnable
-    {
-
-        private final Application application;
-        private final PrintStream output;
-        private final Logger logger;
-
-        private ApplicationPassivation( Application application, PrintStream output, Logger logger )
-        {
-            this.application = application;
-            this.output = output;
-            this.logger = logger;
-        }
-
-        @Override
-        public void run()
-        {
-            try
-            {
-                application.passivate();
-            }
-            catch( PassivationException ex )
-            {
-                String message = application.name() + " " + ex.getMessage();
-                if( logger != null )
-                {
-                    logger.log( Level.SEVERE, message, ex );
-                }
-                else if( output != null )
-                {
-                    output.println( message );
-                    ex.printStackTrace( output );
-                }
-                else
-                {
-                    ex.printStackTrace();
-                }
-            }
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java b/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
deleted file mode 100644
index fd212da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/PassivationException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Thrown when unable to passivate.
- *
- * Printed StackTrace contains all causes in order as suppressed exceptions.
- */
-public final class PassivationException
-    extends Exception
-{
-
-    private static final long serialVersionUID = 1L;
-    private final List<Exception> causes;
-
-    /**
-     * Create new PassivationException.
-     * @param exceptions All exceptions encountered during passivation, in order
-     */
-    public PassivationException( Collection<Exception> exceptions )
-    {
-        super( "Passivation Exception - [has " + exceptions.size() + " cause(s)]" );
-        exceptions.forEach( this::addSuppressed );
-        this.causes = new ArrayList<>( exceptions );
-    }
-
-    /**
-     * @return All exceptions encountered during passivation, in order
-     */
-    public List<Exception> causes()
-    {
-        return causes;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/activation/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/activation/package.html b/core/api/src/main/java/org/apache/zest/api/activation/package.html
deleted file mode 100644
index c11d85f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/activation/package.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Activation API.</h2>
-        <p>
-            The Activation API package contains types used by client code to integrate with the Polygene\u2122 Runtime activation
-            mechanism. In assembly, client code can easily listen to Structure (Application, Layers and Modules) and
-            Services activation events, or, declare Structure and Service Activators.
-        </p>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java b/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
deleted file mode 100644
index 59e4347..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AbstractAssociation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-/**
- * Base interface for all associations.
- */
-public interface AbstractAssociation
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/Association.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/Association.java b/core/api/src/main/java/org/apache/zest/api/association/Association.java
deleted file mode 100644
index 5b5a62a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/Association.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * Association to a single EntityComposite.
- */
-public interface Association<T> extends AbstractAssociation
-{
-    /**
-     * Get the associated entity.
-     *
-     * @return the associated entity
-     */
-    T get();
-
-    /**
-     * Set the associated entity.
-     *
-     * @param associated the entity
-     *
-     * @throws IllegalArgumentException thrown if the entity is not a valid reference for this association
-     * @throws IllegalStateException    thrown if association is immutable
-     */
-    void set( T associated )
-        throws IllegalArgumentException, IllegalStateException;
-
-    /**
-     * @return the the reference of the associated entity.
-     */
-    EntityReference reference();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
deleted file mode 100644
index 7eeb241..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationDescriptor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Type;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.structure.MetaInfoHolder;
-
-/**
- * Association Descriptor.
- */
-public interface AssociationDescriptor extends MetaInfoHolder
-{
-    /**
-     * Get the qualified name of the association. This is constructed by
-     * concatenating the name of the declaring interface with the name
-     * of the method, using ":" as separator.
-     * <p>
-     * Example:
-     * </p>
-     * <p>
-     * com.somecompany.MyInterface with association method
-     * </p>
-     * <pre><code>
-     * Association&lt;String&gt; someAssociation();
-     * </code></pre>
-     * will have the qualified name:
-     * <pre><code>
-     * com.somecompany.MyInterface:someAssociation
-     * </code></pre>
-     *
-     * @return the qualified name of the association
-     */
-    QualifiedName qualifiedName();
-
-    /**
-     * Get the type of the associated Entities
-     *
-     * @return the type of the associated Entities
-     */
-    Type type();
-
-    boolean isImmutable();
-
-    boolean isAggregated();
-
-    AccessibleObject accessor();
-
-    boolean queryable();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
deleted file mode 100644
index 0cbd3da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationMixin.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for associations.
- */
-@AppliesTo( { AssociationMixin.AssociationFilter.class } )
-public final class AssociationMixin
-    implements InvocationHandler
-{
-    @State
-    private AssociationStateHolder associations;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        return associations.associationFor( method );
-    }
-
-    /**
-     * Associations generic mixin AppliesToFilter.
-     */
-    static class AssociationFilter
-        implements AppliesToFilter
-    {
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
-        {
-            return Association.class.isAssignableFrom( method.getReturnType() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
deleted file mode 100644
index 2e9c522..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateDescriptor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.composite.StateDescriptor;
-
-/**
- * Associations State Descriptor.
- */
-public interface AssociationStateDescriptor extends StateDescriptor
-{
-    AssociationDescriptor getAssociationByName( String name )
-        throws IllegalArgumentException;
-
-    AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException;
-
-    AssociationDescriptor getManyAssociationByName( String name )
-        throws IllegalArgumentException;
-
-    AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException;
-
-    AssociationDescriptor getNamedAssociationByName( String name )
-        throws IllegalArgumentException;
-
-    AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException;
-
-    Stream<? extends AssociationDescriptor> associations();
-
-    Stream<? extends AssociationDescriptor> manyAssociations();
-
-    Stream<? extends AssociationDescriptor> namedAssociations();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
deleted file mode 100644
index b2e999d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationStateHolder.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.util.stream.Stream;
-import org.apache.zest.api.property.StateHolder;
-
-/**
- * This represents the state of a entity (properties+associations).
- */
-public interface AssociationStateHolder
-    extends StateHolder
-{
-    /**
-     * Get an association for a specific accessor method.
-     *
-     * @param associationMethod for the association
-     *
-     * @return the association
-     */
-    <T> Association<T> associationFor( AccessibleObject associationMethod );
-
-    /**
-     * Get all associations.
-     *
-     * @return stream of associations
-     */
-    Stream<? extends Association<?>> allAssociations();
-
-    /**
-     * Get a many-association for a specific accessor method.
-     *
-     * @param manyassociationMethod for the many-association
-     *
-     * @return the association
-     */
-    <T> ManyAssociation<T> manyAssociationFor( AccessibleObject manyassociationMethod );
-
-    /**
-     * Get all ManyAssociations.
-     *
-     * @return stream of many-associations
-     */
-    Stream<? extends ManyAssociation<?>> allManyAssociations();
-
-    /**
-     * Get a named-association for a specific accessor method.
-     *
-     * @param namedassociationMethod for the named-association
-     *
-     * @return the association
-     */
-    <T> NamedAssociation<T> namedAssociationFor( AccessibleObject namedassociationMethod );
-
-    /**
-     * Get all named-associations.
-     *
-     * @return stream of named-associations
-     */
-    Stream<? extends NamedAssociation<?>> allNamedAssociations();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java b/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java
deleted file mode 100644
index b6b7e50..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/AssociationWrapper.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you want to catch getting and setting association, then create a GenericConcern
- * that wraps the Polygene-supplied Association instance with AssociationWrappers. Override
- * get() and/or set() to perform your custom code.
- */
-public class AssociationWrapper
-    implements Association<Object>
-{
-    protected Association<Object> next;
-
-    public AssociationWrapper( Association<Object> next )
-    {
-        this.next = next;
-    }
-
-    public Association<Object> next()
-    {
-        return next;
-    }
-
-    @Override
-    public Object get()
-    {
-        return next.get();
-    }
-
-    @Override
-    public void set( Object associated )
-        throws IllegalArgumentException
-    {
-        next.set( associated );
-    }
-
-    @Override
-    public EntityReference reference()
-    {
-        return next.reference();
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return next.hashCode();
-    }
-
-    @Override
-    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
-    public boolean equals( Object obj )
-    {
-        return next.equals( obj );
-    }
-
-    @Override
-    public String toString()
-    {
-        return next.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java b/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
deleted file mode 100644
index 2d53bc7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/GenericAssociationInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Generic Association info.
- */
-public final class GenericAssociationInfo
-{
-    public static Type associationTypeOf( AccessibleObject accessor )
-    {
-        return toAssociationType( typeOf( accessor ) );
-    }
-
-    public static Type toAssociationType( Type methodReturnType )
-    {
-        if( methodReturnType instanceof ParameterizedType )
-        {
-            ParameterizedType parameterizedType = (ParameterizedType) methodReturnType;
-            if( AbstractAssociation.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) )
-            {
-                return parameterizedType.getActualTypeArguments()[ 0 ];
-            }
-        }
-        if (!(methodReturnType instanceof Class))
-        {
-            throw new IllegalArgumentException( "Unable to make an association with " + methodReturnType );
-        }
-        Type[] interfaces = ((Class<?>) methodReturnType).getGenericInterfaces();
-        for (Type anInterface : interfaces)
-        {
-            Type associationType = toAssociationType(anInterface);
-            if (associationType != null)
-            {
-                return associationType;
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
deleted file mode 100644
index 0283d62..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * Association to a collection of entities.
- */
-public interface ManyAssociation<T> extends Iterable<T>, AbstractAssociation
-{
-    /**
-     * Returns the number of references in this association.
-     * @return the number of references in this association.
-     */
-    int count();
-
-    boolean contains( T entity );
-
-    boolean add( int i, T entity );
-
-    boolean add( T entity );
-
-    boolean remove( T entity );
-
-    T get( int i );
-
-    List<T> toList();
-
-    Set<T> toSet();
-
-    /**
-     * Returns a stream of the references to the associated entities.
-     * @return the references to the associated entities.
-     */
-    Stream<EntityReference> references();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
deleted file mode 100644
index a948b55..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationMixin.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for associations.
- */
-@AppliesTo( { ManyAssociationMixin.AssociationFilter.class } )
-public final class ManyAssociationMixin
-    implements InvocationHandler
-{
-    @State
-    private AssociationStateHolder associations;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        return associations.manyAssociationFor( method );
-    }
-
-    /**
-     * ManyAssociations generic mixin AppliesToFilter.
-     */
-    static class AssociationFilter
-        implements AppliesToFilter
-    {
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
-        {
-            return ManyAssociation.class.isAssignableFrom( method.getReturnType() );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java b/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
deleted file mode 100644
index b23aff9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/ManyAssociationWrapper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you want to catch calls to ManyAssociations, then create a GenericConcern
- * that wraps the Polygene-supplied ManyAssociation instance with ManyAssociationWrappers. Override
- * methods to perform your custom code.
- */
-public class ManyAssociationWrapper
-    implements ManyAssociation<Object>
-{
-    protected ManyAssociation<Object> next;
-
-    public ManyAssociationWrapper( ManyAssociation<Object> next )
-    {
-        this.next = next;
-    }
-
-    public ManyAssociation<Object> next()
-    {
-        return next;
-    }
-
-    @Override
-    public int count()
-    {
-        return next.count();
-    }
-
-    @Override
-    public boolean contains( Object entity )
-    {
-        return next.contains( entity );
-    }
-
-    @Override
-    public boolean add( int i, Object entity )
-    {
-        return next.add( i, entity );
-    }
-
-    @Override
-    public boolean add( Object entity )
-    {
-        return next.add( entity );
-    }
-
-    @Override
-    public boolean remove( Object entity )
-    {
-        return next.remove( entity );
-    }
-
-    @Override
-    public Object get( int i )
-    {
-        return next.get( i );
-    }
-
-    @Override
-    public List<Object> toList()
-    {
-        return next.toList();
-    }
-
-    @Override
-    public Set<Object> toSet()
-    {
-        return next.toSet();
-    }
-
-    @Override
-    public Stream<EntityReference> references()
-    {
-        return next.references();
-    }
-
-    @Override
-    public Iterator<Object> iterator()
-    {
-        return next.iterator();
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return next.hashCode();
-    }
-
-    @Override
-    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
-    public boolean equals( Object obj )
-    {
-        return next.equals( obj );
-    }
-
-    @Override
-    public String toString()
-    {
-        return next.toString();
-    }
-}


[36/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/NamedAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociation.java b/core/api/src/main/java/org/apache/zest/api/association/NamedAssociation.java
deleted file mode 100644
index aced892..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * Association to named Entities.
- * The Iterable&lt;String&gt; returns the names in the association set.
- * @param <T> Parameterized associatee type
- */
-public interface NamedAssociation<T>
-    extends Iterable<String>, AbstractAssociation
-{
-    /**
-     * @return The number of named associations in this NamedAssociation.
-     */
-    int count();
-
-    /**
-     * Checks if there is an association with the given name.
-     * @param name The name of the association we are checking if it exists.
-     * @return true if it exists, false otherwise
-     */
-    boolean containsName( String name );
-
-    /**
-     * Adds a named assocation.
-     * @param name The name of the association.
-     * @param entity The entity for this named association.
-     * @return true if putted, false otherwise
-     */
-    boolean put( String name, T entity );
-
-    /**
-     * Remove a named association.
-     * @param name The name of the association.
-     * @return true if removed, false otherwise
-     */
-    boolean remove( String name );
-
-    /**
-     * Retrieves a named association.
-     * @param name The name of the association.
-     * @return The entity that has previously been associated.
-     */
-    T get( String name );
-
-    /**
-     * Checks if the entity is present.
-     * Note that this is potentially a very slow operation, depending on the size of the NamedAssociation.
-     * @param entity The entity to look for.
-     * @return The name of the entity if found, otherwise null.
-     */
-    String nameOf( T entity );
-
-    /**
-     * @return A fully populated Map with the content of this NamedAssociation.
-     */
-    Map<String, T> toMap();
-
-    /**
-     * Returns a stream of the references to the associated entities.
-     * @return the references to the associated entities.
-     */
-    Stream<Map.Entry<String, EntityReference>> references();
-
-    /** Returns the EntityReference for the Association with the given name.
-     *
-     * @param name The name of the association to return the EntityReference for
-     * @return The EntityReference of the association.
-     */
-    EntityReference referenceOf( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationMixin.java b/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationMixin.java
deleted file mode 100644
index 40e2d06..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationMixin.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for NamedAssociations.
- */
-@AppliesTo( NamedAssociationMixin.AssociationFilter.class )
-public final class NamedAssociationMixin
-    implements InvocationHandler
-{
-    @State
-    private AssociationStateHolder associations;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        return associations.namedAssociationFor( method );
-    }
-
-    /**
-     * NamedAssociations generic mixin AppliesToFilter.
-     */
-    static class AssociationFilter
-        implements AppliesToFilter
-    {
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
-        {
-            return NamedAssociation.class.isAssignableFrom( method.getReturnType() );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationWrapper.java b/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationWrapper.java
deleted file mode 100644
index a5515d6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/NamedAssociationWrapper.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.association;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you want to catch calls to NamedAssociations, then create a GenericConcern
- * that wraps the Polygene-supplied NamedAssociations instance with NamedAssociationsWrapper. Override
- * methods to perform your custom code.
- */
-public class NamedAssociationWrapper
-    implements NamedAssociation<Object>
-{
-    protected NamedAssociation<Object> next;
-
-    public NamedAssociationWrapper( NamedAssociation<Object> next )
-    {
-        this.next = next;
-    }
-
-    public NamedAssociation<Object> next()
-    {
-        return next;
-    }
-
-    @Override
-    public Iterator<String> iterator()
-    {
-        return next.iterator();
-    }
-
-    @Override
-    public int count()
-    {
-        return next.count();
-    }
-
-    @Override
-    public boolean containsName( String name )
-    {
-        return next.containsName( name );
-    }
-
-    @Override
-    public boolean put( String name, Object entity )
-    {
-        return next.put( name, entity );
-    }
-
-    @Override
-    public boolean remove( String name )
-    {
-        return next.remove( name );
-    }
-
-    @Override
-    public Object get( String name )
-    {
-        return next.get( name );
-    }
-
-    @Override
-    public String nameOf( Object entity )
-    {
-        return next.nameOf( entity );
-    }
-
-    @Override
-    public Map<String, Object> toMap()
-    {
-        return next.toMap();
-    }
-
-    @Override
-    public Stream<Map.Entry<String, EntityReference>> references()
-    {
-        return next.references();
-    }
-
-    @Override
-    public EntityReference referenceOf( String name )
-    {
-        return next.referenceOf( name );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return next.hashCode();
-    }
-
-    @Override
-    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
-    public boolean equals( Object obj )
-    {
-        return next.equals( obj );
-    }
-
-    @Override
-    public String toString()
-    {
-        return next.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/association/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/association/package.html b/core/api/src/main/java/org/apache/zest/api/association/package.html
deleted file mode 100644
index d478216..0000000
--- a/core/api/src/main/java/org/apache/zest/api/association/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Association API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/cache/CacheOptions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/cache/CacheOptions.java b/core/api/src/main/java/org/apache/zest/api/cache/CacheOptions.java
deleted file mode 100644
index 0db321e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/cache/CacheOptions.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.cache;
-
-/**
- * CacheOptions is a metaInfo class for the Cache system for Entity persistence.
- * CacheOptions should be assigned to the Usecase of the UnitOfWork, to give hint on caching to entity stores.
- * See {@link org.apache.zest.api.usecase.UsecaseBuilder} on how to set the metaInfo on Usecases.
- */
-public final class CacheOptions
-{
-    public static final CacheOptions ALWAYS = new CacheOptions( true, true, true );
-    public static final CacheOptions NEVER = new CacheOptions( false, false, false );
-
-    private final boolean cacheOnRead;
-    private final boolean cacheOnWrite;
-    private final boolean cacheOnNew;
-
-    /**
-     * Constructor for CacheOptions.
-     *
-     * @param cacheOnRead  if true, give the hint to the Cache system that it may not be a good idea to cache the
-     *                     read values. This is useful when it is known that the read will be over a large set and
-     *                     shouldn't affect the existing cached entities. For instance, when traversing the EntityStore
-     *                     this option is set to false.
-     * @param cacheOnWrite if true, give the hint to the Cache system that it may not be a good idea to cache the
-     *                     entity when the value is updated. If this is false, the cache should be emptied from any
-     *                     cached entity instead of updated. There are few cases when this is useful, and if this is
-     *                     false, it makes sense that the <i>cacheOnRead</i> is also false.
-     * @param cacheOnNew   if true, give the hint to the Cache system that it may not be a good idea to cache a newly
-     *                     created Entity, as it is not likely to be read in the near future. This is useful when
-     *                     batch inserts are being made.
-     */
-    public CacheOptions( boolean cacheOnRead, boolean cacheOnWrite, boolean cacheOnNew )
-    {
-        this.cacheOnRead = cacheOnRead;
-        this.cacheOnWrite = cacheOnWrite;
-        this.cacheOnNew = cacheOnNew;
-    }
-
-    /**
-     * @return if true, give the hint to the Cache system that it may not be a good idea to cache the
-     *         read values. This is useful when it is known that the read will be over a large set and
-     *         shouldn't affect the existing cached entities. For instance, when traversing the EntityStore
-     */
-    public boolean cacheOnRead()
-    {
-        return cacheOnRead;
-    }
-
-    /**
-     * @return if true, give the hint to the Cache system that it may not be a good idea to cache the
-     *         entity when the value is updated. If this is false, the cache should be emptied from any
-     *         cached entity instead of updated. There are few cases when this is useful, and if this is
-     *         false, it makes sense that the <i>cacheOnRead</i> is also false.
-     */
-    public boolean cacheOnWrite()
-    {
-        return cacheOnWrite;
-    }
-
-    /**
-     * @return if true, give the hint to the Cache system that it may not be a good idea to cache a newly
-     *         created Entity, as it is not likely to be read in the near future. This is useful when
-     *         batch inserts are being made.
-     */
-    public boolean cacheOnNew()
-    {
-        return cacheOnNew;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/cache/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/cache/package.html b/core/api/src/main/java/org/apache/zest/api/cache/package.html
deleted file mode 100644
index a2109c1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/cache/package.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Cache API.</h2>
-        <p>
-            The Cache API/SPI is an extension point for Entity Store caching.
-        </p>
-        <p>
-            The API part is only to allow caching options to be passed to the underlying extension in a uniform and
-            standard way. CacheOptions are to be passed as meta info on the optional Cache extension that is specified
-            during assembly phase. Example;
-        </p>
-<pre><code>
-public void assemble( ModuleAssembly module )
-{
-    CacheOptions options = new CacheOptions( true, true, false );
-    module.addServices( EhCacheService.class ).setMetaInfo( options );
-}
-</code></pre>
-        <p>
-            Not all EntityStore implementations use the Cache extension, so check the implementation details of the
-            EntityStore whether the cache extension can bring any benefits or not.
-        </p>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/AppliesTo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/AppliesTo.java b/core/api/src/main/java/org/apache/zest/api/common/AppliesTo.java
deleted file mode 100644
index 6ca824a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/AppliesTo.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Fragments that implement InvocationHandler and which should only be applied to methods that have a particular
- * annotation or implement a known interface should use this annotation.
- * <p>
- * &#64;AppliesTo can specify one of;
- * </p>
- * <ul>
- * <li>An annotation,</li>
- * <li>An interface,</li>
- * <li>An AppliesToFilter implementation.</li>
- * </ul>
- * <p>
- * Example with annotation:
- * </p>
- * <pre><code>
- *
- * &#64;AppliesTo( Sessional.class )   // Tells Polygene to apply this concern on methods with &#64;Sessional annotation
- * public class SessionConcern extends GenericConcern
- * {
- *     public Object invoke( Object proxy, Method method, Object[] args )
- *         throws Throwable
- *     {
- *         ... do session stuff ...
- *     }
- * }
- *
- * &#64;Retention( RetentionPolicy.RUNTIME )
- * &#64;Target( ElementType.METHOD )
- * &#64;Documented
- * &#64;Inherited
- * public @interface Sessional
- * {
- * }
- *
- * public class MyMixin
- *     implements My
- * {
- *     &#64;Sessional
- *     public void doSomethingSessional()
- *     {
- *        // ... do your logic wrapped in a session
- *     }
- *
- *     public void doSomethingWithoutSession()
- *     {
- *        // ... do stuff that are not wrapped in session.
- *     }
- * }
- *
- * public interface My
- * {
- *     void doSomethingSessional();
- *
- *     void doSomethingWithoutSession();
- * }
- *
- * &#64;Concerns( SessionConcern.class )
- * &#64;Mixins( MyMixin.class )
- * public interface MyComposite extends My, TransientComposite
- * {}
- * </code></pre>
- * <p>
- * The doSomethingWithoutSession method do not have the &#64;Sessional annotation, therefore the SessionConcern will
- * not be placed into the call sequence of these methods, and
- * vice-versa. The &#64;Sessional annotation can be placed either on the interface method or the implementation
- * method, depending on whether it is a contract or implementation detail.
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface AppliesTo
-{
-    /**
-     * List of interfaces, annotations or AppliesToFilter
-     * implementation classes.
-     * If one of them matches the current element it will be
-     * accepted, so this list can be considered an "or".
-     *
-     * @return array of classes or interfaces to be used by the filter
-     */
-    Class<?>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/AppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/AppliesToFilter.java b/core/api/src/main/java/org/apache/zest/api/common/AppliesToFilter.java
deleted file mode 100644
index 64b4693..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/AppliesToFilter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.reflect.Method;
-
-/**
- * Implementations of this interface can be specified in the &#64;AppliesTo.
- * <p>
- * AppliesTo filters are one of the driving technologies in Polygene. They allow you to apply fragments (Mixins,
- * Concerns, SideEffects), often generic ones, depending on the context that they are evaluated under. This
- * mechanism is heavily used internally in Polygene to achieve many other features.
- * </p>
- * <p>
- * The starting point is the basic use of AppliesToFilter, where the &#64;AppliesTo annotation is given an
- * AppliesToFilter implementation as an argument, for instance at a Mixin implementation;
- * </p>
- * <pre><code>
- * &#64;AppliesTo( MyAppliesToFilter.class )
- * public class SomeMixin
- *     implements InvocationHandler
- * {
- *
- * }
- *
- * public class MyAppliesToFilter
- *     implements AppliesToFilter
- * {
- *     public boolean appliesTo( Method method, Class&lt;?&gt; mixin, Class&lt;?&gt; compositeType, Class&lt;?&gt; fragmentClass )
- *     {
- *         return method.getName().startsWith( "my" );
- *     }
- * }
- * </code></pre>
- * <p>
- * In the case above, the generic mixin will only be applied to the methods that that is defined by the
- * AppliesToFilter. This is the primary way to define limits on the application of generic fragments, since
- * especially mixins are rarely applied to all methods.
- * </p>
- */
-public interface AppliesToFilter
-{
-    /**
-     * This is an internal AppliesToFilter which is assigned if no other AppliesToFilters are found for a given
-     * fragment.
-     * <p>
-     * There is no reason for user code to use this AppliesToFilter directly, and should be perceived as an
-     * internal class in Polygene.
-     * </p>
-     */
-    AppliesToFilter ALWAYS = new AppliesToFilter()
-    {
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-        {
-            return true;
-        }
-    };
-
-    /**
-     * Check if the Fragment should be applied or not. Will be call when applied to Mixins, Concerns, SideEffects.
-     *
-     * @param method        method that is invoked
-     * @param mixin         mixin implementation for the method
-     * @param compositeType composite type
-     * @param fragmentClass fragment that is being applies
-     *
-     * @return true if the filter passes, otherwise false
-     */
-    boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/ConstructionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/ConstructionException.java b/core/api/src/main/java/org/apache/zest/api/common/ConstructionException.java
deleted file mode 100644
index 3009b4c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/ConstructionException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-/**
- * Thrown when a Fragment or object could not be instantiated.
- * This includes, but not be limited to;
- * <ul>
- * <li>private constructor.</li>
- * <li>abstract class for Constraints.</li>
- * <li>interface instead of a class.</li>
- * <li>useful constructor missing.</li>
- * <li>exception thrown in the constructor.</li>
- * <li>Subclassing of org.apache.zest.api.property.Property</li>
- * </ul>
- * <p>
- * See the nested exception for additional details.
- * </p>
- */
-public class ConstructionException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public ConstructionException()
-    {
-    }
-
-    public ConstructionException( String message )
-    {
-        super( message );
-    }
-
-    public ConstructionException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-    public ConstructionException( Throwable cause )
-    {
-        super( cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/InvalidApplicationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/InvalidApplicationException.java b/core/api/src/main/java/org/apache/zest/api/common/InvalidApplicationException.java
deleted file mode 100644
index 8551df9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/InvalidApplicationException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-/**
- * Thrown when an application is considered to not be constructed properly.
- * This happens primarily when client code tries to instantiate Composites
- * and objects which have not been registered in the ModuleAssembly.
- */
-public class InvalidApplicationException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public InvalidApplicationException( String string )
-    {
-        super( string );
-    }
-
-    public InvalidApplicationException( String string, Throwable cause )
-    {
-        super( string, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/MetaInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/MetaInfo.java b/core/api/src/main/java/org/apache/zest/api/common/MetaInfo.java
deleted file mode 100644
index 3280db0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/MetaInfo.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.sideeffect.SideEffects;
-import org.apache.zest.api.util.Classes;
-
-import static java.util.Arrays.asList;
-import static org.apache.zest.api.util.Classes.typesOf;
-
-/**
- * Used to declare and access meta-info.
- * <p>
- * <strong>This is effectively an internal class and should not be used directly.</strong>
- * </p>
- * <p>
- * MetaInfo can be set on composites during the assembly phase, a.k.a the bootstrap
- * process. MetaInfo is any additional data that one wishes to associate at the 'class level' instead of instance
- * level of a composite declaration.
- * </p>
- * <p>
- * To set the MetaInfo on a Composite, call the {@code setMetaInfo()} methods on the various composite declaration
- * types, such as;
- * </p>
- * <pre><code>
- * public void assemble( ModuleAssembly module )
- *     throws AssemblyException
- * {
- *     Map&lt;String,String&gt; properties = ...;
- *     module.services( MyService.class ).setMetaInfo( properties );
- * }
- * </code></pre>
- * <p>
- * which can later be retrieved by calling the {@code metaInfo()} method on the composite itself. For the example
- * above that would be;
- * </p>
- * <pre><code>
- * &#64;Mixins(MyServiceMixin.class)
- * public interface MyService extends ServiceComposite
- * {
- *
- * }
- *
- * public abstract class MyServiceMixin
- *     implements MyService
- * {
- *     private Properties props;
- *
- *     public MyServiceMixin()
- *     {
- *         props = metaInfo( Map.class );
- *     }
- * }
- * </code></pre>
- */
-public final class MetaInfo
-{
-    private final static Collection<Class> ignored;
-
-    static
-    {
-        ignored = new HashSet<>( 4, 0.8f ); // Optimize size used.
-        ignored.addAll( asList( Mixins.class, Concerns.class, SideEffects.class ) );
-    }
-
-    private final Map<Class<?>, Object> metaInfoMap;
-
-    public MetaInfo()
-    {
-        metaInfoMap = new LinkedHashMap<>();
-    }
-
-    public MetaInfo( MetaInfo metaInfo )
-    {
-        metaInfoMap = new LinkedHashMap<>();
-        metaInfoMap.putAll( metaInfo.metaInfoMap );
-    }
-
-    public void set( Object metaInfo )
-    {
-        if( metaInfo instanceof Annotation )
-        {
-            Annotation annotation = (Annotation) metaInfo;
-            metaInfoMap.put( annotation.annotationType(), metaInfo );
-        }
-        else
-        {
-            Class<?> metaInfoclass = metaInfo.getClass();
-            typesOf( metaInfoclass )
-                .map( Classes.RAW_CLASS )
-                .forEach( type -> metaInfoMap.put( type, metaInfo ) );
-        }
-    }
-
-    public <T> T get( Class<T> metaInfoType )
-    {
-        return metaInfoType.cast( metaInfoMap.get( metaInfoType ) );
-    }
-
-    public <T> void add( Class<T> infoType, T info )
-    {
-        metaInfoMap.put( infoType, info );
-    }
-
-    public MetaInfo withAnnotations( AnnotatedElement annotatedElement )
-    {
-        for( Annotation annotation : annotatedElement.getAnnotations() )
-        {
-            if( !ignored.contains( annotation.annotationType() )
-                && get( annotation.annotationType() ) == null )
-            {
-                set( annotation );
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public String toString()
-    {
-        return metaInfoMap.toString();
-    }
-
-    public void remove( Class serviceFinderClass )
-    {
-        metaInfoMap.remove( serviceFinderClass );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/Optional.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/Optional.java b/core/api/src/main/java/org/apache/zest/api/common/Optional.java
deleted file mode 100644
index f421341..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/Optional.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to denote that something is optional.
- * <ul>
- * <li>
- * If applied to a method parameter, then the value is allowed to be null. Default
- * is that method parameters have to be non-null.
- * </li>
- * <li>
- * If applied to a Property declaration, then the value may be null after construction of
- * the instance, or may be set to null at a later time.
- * </li>
- * <li>
- * If applied to an injected member field, it is allowed tha none get injected. For instance, an <code>&#64;Optional
- * &#64;Service</code> would allow a service to not have been declared and the field will be null.
- * </li>
- * </ul>
- * <p>
- * Optionality is not the default in Polygene, and if injections, property values and parameters in methods are not
- * non-null, the Polygene runtime will throw an {@link org.apache.zest.api.constraint.ConstraintViolationException}, indicating
- * which field/property/parameter in which composite and mixin the problem has been detected.
- * </p>
- * <p>
- * Example;
- * </p>
- * <pre><code>
- * &#64;Optional &#64;Service
- * MyService service;   // If no MyService instance is declared and visible to this service injection point
- *                      // the 'service' field will be null.
- *
- * &#64;Service
- * YourService other;   // If no YourService instance is declared and visible to this service injection point
- *                      // the Polygene runtime will throw a ConstraintViolationException.
- *
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD } )
-@Documented
-public @interface Optional
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/QualifiedName.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/QualifiedName.java b/core/api/src/main/java/org/apache/zest/api/common/QualifiedName.java
deleted file mode 100644
index 01a8f01..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/QualifiedName.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.io.Serializable;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import org.apache.zest.api.util.NullArgumentException;
-
-/**
- * QualifiedName is a representation of Property names to their full declaration.
- * <p>
- * A QualifiedName is created by combining the name of a method and the name of the type that declares the method.
- * This class also contains many static utility methods to manage QualifiedName instances.
- * </p>
- * <p>
- * <strong>NOTE: Unless you do very generic libraries, entity stores and other extensions that is deeply coupled into
- * the Polygene runtime, it is very unlikely you will need to use this class directly.</strong>
- * </p>
- * <p>
- * It is also important to notice that the QualifiedName needs to be long-term stable, as the names are written
- * to persistent storage. So any changes in the formatting <strong>must be made in a backward-compatible manner
- * </strong>.
- * </p>
- * <p>
- * The QualifiedName has two intrinsic parts, one being the {@code type} and the other the {@code name}. The
- * {@code type} comes from the class where the QualifiedName originates from and internally kept as a {@link TypeName}
- * instance. The name is the name from the method name. When the QualifiedName instance is converted to an external
- * string representation, via the offical and formal {@link #toString()} method, the {@code type} is normalized, i.e.
- * any dollar characters ($) in the name are replaced by dashes (-), to make them URI friendly.
- * </p>
- * <p>
- * QualifiedName instances are immutable, implements {@link #hashCode()} and {@link #equals(Object)} as a value
- * object and can safely be used as keys in {@link java.util.Map}.
- */
-public final class QualifiedName
-    implements Comparable<QualifiedName>, Serializable
-{
-    private final TypeName typeName;
-    private final String name;
-
-    /**
-     * Creates a QualifiedName from a method.
-     * <p>
-     * This factory method will create a QualifiedName from the Method itself.
-     *
-     * </p>
-     *
-     * @param method Type method that returns a Property, for which the QualifiedName will be representing.
-     *
-     * @return A QualifiedName representing this method.
-     *
-     * @throws NullArgumentException If the {@code method} argument passed is null.
-     */
-    public static QualifiedName fromAccessor( AccessibleObject method )
-    {
-        NullArgumentException.validateNotNull( "method", method );
-        return fromClass( ( (Member) method ).getDeclaringClass(), ( (Member) method ).getName() );
-    }
-
-    /**
-     * Creates a QualifiedName instance from the Class and a given name.
-     * <p>
-     * This factory method converts the {@code type} to a {@link TypeName} and appends the given {@code name}.
-     *
-     * @param type The Class that is the base of the QualifiedName.
-     * @param name The qualifier name which will be appended to the base name derived from the {@code type} argument.
-     *
-     * @return A QualifiedName instance representing the {@code type} and {@code name} arguments.
-     *
-     * @throws NullArgumentException if any of the two arguments are {@code null}, or if the name string is empty.
-     */
-    public static QualifiedName fromClass( Class type, String name )
-    {
-        return new QualifiedName( TypeName.nameOf( type ), name );
-    }
-
-    /**
-     * Creates a Qualified name from a type as string and a name qualifier.
-     *
-     * @param type The type name as a a string, which must be properly formatted. No checks for correctly formatted
-     *             type name is performed.
-     * @param name The qualifier name which will be appended to the base name derived from the {@code type} argument.
-     *
-     * @return A QualifiedName instance representing the {@code type} and {@code name} arguments.
-     *
-     * @throws NullArgumentException if any of the two arguments are {@code null} or either string is empty.
-     */
-    public static QualifiedName fromName( String type, String name )
-    {
-        return new QualifiedName( TypeName.nameOf( type ), name );
-    }
-
-    /**
-     * Creates a QualifiedName from the external string format of QualifiedName.
-     * <p>
-     * This factory method is the reverse of {@link QualifiedName#toString() }  method, and creates a new QualifiedName
-     * instance from the string representation of the QualifiedName.
-     * </p>
-     *
-     * @param fullQualifiedName The QualifiedName external string representation to be converted back into a QualifiedName
-     *                      instance.
-     *
-     * @return The QualifiedName instance represented by the {@code qualifiedName} argument.
-     *
-     * @throws IllegalArgumentException If the {@code qualifiedName} argument has wrong format.
-     */
-    public static QualifiedName fromFQN( String fullQualifiedName )
-    {
-        NullArgumentException.validateNotEmpty( "qualifiedName", fullQualifiedName );
-        int idx = fullQualifiedName.lastIndexOf( ":" );
-        if( idx == -1 )
-        {
-            throw new IllegalArgumentException( "Name '" + fullQualifiedName + "' is not a qualified name" );
-        }
-        final String type = fullQualifiedName.substring( 0, idx );
-        final String name = fullQualifiedName.substring( idx + 1 );
-        return new QualifiedName( TypeName.nameOf( type ), name );
-    }
-
-    QualifiedName( TypeName typeName, String name )
-    {
-        NullArgumentException.validateNotNull( "typeName", typeName );
-        NullArgumentException.validateNotEmpty( "name", name );
-        this.typeName = typeName;
-        this.name = name;
-    }
-
-    /**
-     * Returns the normalized string of the type part of the QualifiedName.
-     *
-     * <p>
-     * The normalized type name means that all dollar ($) characters have been replaced by dashes (-).
-     * </p>
-     *
-     * @return the normalized string of the type part of the QualifiedName.
-     */
-    public String type()
-    {
-        return typeName.normalized();
-    }
-
-    /**
-     * Returns the name component of the QualifiedName.
-     *
-     * @return the name component of the QualifiedName.
-     */
-    public String name()
-    {
-        return name;
-    }
-
-    /**
-     * Returns the URI of the QualifiedName.
-     *
-     * <p>
-     * The URI is the {@link #toNamespace()} followed by the {@code name} component.
-     * <p>
-     *
-     * @return the URI of the QualifiedName.
-     *
-     * @see #toNamespace()
-     */
-    public String toURI()
-    {
-        return toNamespace() + name;
-    }
-
-    /**
-     * Return the URI of the {@link TypeName} component of the QualifiedName.
-     * <p>
-     * The URI of the {@link TypeName} component is in the form of;
-     * </p>
-     * <pre>
-     * "urn:zest:type:" normalizedClassName
-     * </pre>
-     * <p>
-     * where {@code normalizedClassName} is the fully-qualified class name having had any dollar ($) characters replaced
-     * by URI friendly dashes (-), with a trailing hash (#). Examples;
-     * </p>
-     * <pre>
-     * urn:zest:type:org.apache.zest.api.common.QualifiedName#
-     * urn:zest:type:org.apache.zest.samples.MyClass-MyInnerClass#
-     * </pre>
-     *
-     * @return the URI of the {@link TypeName} component of the QualifiedName.
-     */
-    public String toNamespace()
-    {
-        return typeName.toURI() + "#";
-    }
-
-    /**
-     * Return the formal and official, long-term stable, external string representation of a QualifiedName.
-     * <p>
-     * This returns the {@link org.apache.zest.api.common.TypeName#toString()} followed by the {@code name} component.
-     * </p>
-     *
-     * @return the formal and official, long-term stable, external string representation of a QualifiedName.
-     */
-    @Override
-    public String toString()
-    {
-        return typeName + ":" + name;
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        QualifiedName that = (QualifiedName) o;
-
-        return name.equals( that.name ) && typeName.equals( that.typeName );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return 31 * typeName.hashCode() + name.hashCode();
-    }
-
-    @Override
-    public int compareTo( QualifiedName other )
-    {
-        final int result = typeName.compareTo( other.typeName );
-        if( result != 0 )
-        {
-            return result;
-        }
-        return name.compareTo( other.name );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/TypeName.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/TypeName.java b/core/api/src/main/java/org/apache/zest/api/common/TypeName.java
deleted file mode 100644
index 3f167ec..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/TypeName.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.io.Serializable;
-import java.lang.reflect.Type;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.util.NullArgumentException;
-
-/**
- * Represents a Type name.
- */
-public final class TypeName
-    implements Serializable, Comparable<TypeName>
-{
-    private final String name;
-
-    public static TypeName nameOf( Class type )
-    {
-        NullArgumentException.validateNotNull( "type", type );
-        return new TypeName( type.getName() );
-    }
-
-    public static TypeName nameOf( Type type )
-    {
-        return nameOf( Classes.RAW_CLASS.apply( type ) );
-    }
-
-    public static TypeName nameOf( String typeName )
-    {
-        return new TypeName( typeName );
-    }
-
-    private TypeName( String name )
-    {
-        NullArgumentException.validateNotEmpty( "name", name );
-        this.name = name;
-    }
-
-    public String normalized()
-    {
-        return Classes.normalizeClassToURI( name );
-    }
-
-    public String toURI()
-    {
-        return Classes.toURI( name );
-    }
-
-    public String name()
-    {
-        return name;
-    }
-
-    @Override
-    public String toString()
-    {
-        return name;
-    }
-
-    public boolean isClass( final Class<?> type )
-    {
-        return type.getName().equals( name );
-    }
-
-    @Override
-    public boolean equals( final Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        final TypeName other = (TypeName) o;
-
-        return name.equals( other.name );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return name.hashCode();
-    }
-
-    @Override
-    public int compareTo( final TypeName typeName )
-    {
-        return this.name.compareTo( typeName.name );
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/UseDefaults.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/UseDefaults.java b/core/api/src/main/java/org/apache/zest/api/common/UseDefaults.java
deleted file mode 100644
index 5a36824..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/UseDefaults.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to denote that the initial value of a Property will be the default value for the type if none is
- * specified during construction.
- * <p>
- * These are the default values used for various types:
- * </p>
- * <pre>
- * Byte: 0
- * Short: 0
- * Character: 0
- * Integer: 0
- * Long: 0L
- * Double: 0.0d
- * Float: 0.0f
- * Boolean: false
- * String: ""
- * List: empty java.util.ArrayList
- * Set: empty java.util.HashSet
- * Collection: empty java.util.ArrayList
- * enum: first declared value
- * </pre>
- * <p>
- * If this annotation is not used, the property will be set to null, and unless {@code &#64;Optional} is declared
- * is not allowed.
- * </p>
- * <p>
- * The <code>&#64;UseDefaults</code> annotation can also have a value in its declaration. This value is used,
- * unless it is overridden in the assembly (see below). Java does not support generic types of annotation values,
- * so it accepts String values, which are deserialized from JSON using the ValueSerialization SPI. This allows
- * for (albeit somewhat tedious) any object type to have a default value declared on it. If the property type is
- * String, then no value deserialization is done.
- * </p>
- * <p>
- * It is also possible to change the default values for Composites during the assembly. This is done by calling the
- * {@code org.apache.zest.bootstrap.ModuleAssembly#forMixin(Class)} method.
- * </p>
- * <p>
- * Example;
- * Let's assume that we have the following mixin type;
- *
- * <pre><code>
- * public interface SomeType
- * {
- *     &#64;UseDefaults
- *     Property&lt;String&gt; someValue();
- * }
- * </code></pre>
- * And that we want to have {@code someValue()} to be initialized to "&lt;unknown&gt;" instead of the empty string.
- * Then we need to declare the default for that with the following in the assembler.
- * <pre><code>
- * public void assemble( ModuleAssembly module )
- * {
- *     module.forMixin( SomeType.class ).declareDefaults().someValue().set( "&lt;unknown&gt;" );
- * }
- * }
- * </code></pre>
- */
-@SuppressWarnings( "JavadocReference" )
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.METHOD, ElementType.FIELD } )
-@Documented
-public @interface UseDefaults
-{
-    String value() default "";
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/Visibility.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/Visibility.java b/core/api/src/main/java/org/apache/zest/api/common/Visibility.java
deleted file mode 100644
index 60bb524..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/Visibility.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-/**
- * Visibility is a core concept in the Polygene structure system. It defines the locale of composites and objects, i.e.
- * how far they can be 'seen' and therefor be used.
- * <p>
- * When a Composite or Object is declared in the assembly phase, and no visibility is set, only other
- * composites/objects within the same module can use that declaration. For a declared composite/object to be usable
- * from other modules a higher visibility must be set, either that the Composite/Object can be used by others within
- * the same Layer, or even to be used by those in the layer above.
- * </p>
- */
-public enum Visibility
-{
-    /**
-     * Artifact is visible only in the declaring module (default)
-     */
-    module,
-    /**
-     * Artifact is visible to all modules in the same layer
-     */
-    layer,
-    /**
-     * Artifact is visible to other modules in the same layer and any modules in extending layers
-     */
-    application
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/common/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/common/package.html b/core/api/src/main/java/org/apache/zest/api/common/package.html
deleted file mode 100644
index 38a7a39..0000000
--- a/core/api/src/main/java/org/apache/zest/api/common/package.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Common API.</h2>
-        <p>
-            The Common API package is a collection of really low-level types needed at the core of the Polygene\u2122 Runtime. It is also
-            a collection of types that are not particularly cohesive, and effectively this package contains the loose ends
-            that does not belong elsewhere.
-        </p>
-        <p>
-            In this package, you can safely ignore the following classes;
-        </p>
-        <ul>
-            <li>MetaInfo</li>
-            <li>QualifiedName</li>
-            <li>TypeName</li>
-        </ul>
-        <p>UNLESS you are into deep integration into the Polygene\u2122 Runtime.</p>
-
-        <h3>&#64;AppliesTo and AppliesToFilter</h3>
-        <p>
-            This tandem of interface + annotation are primarily used for Generic Fragments, to indicate which methods on the
-            interface the fragment should be applied to.
-        </p>
-
-        <h3>&#64;Optional</h3>
-        <p>
-            In Polygene\u2122, method arguments, property values and injected fields are not allowed to be null by default. To allow
-            any of these to be null, i.e. undeclared, it is required that the argument, field or method is marked with the
-            &#64;Optional annotation.
-        </p>
-
-        <h3>&#64;UseDefaults</h3>
-        <p>
-            Since null is not allowed without the &#64;Optional annotation, it can sometimes by tedious to initialize all
-            the property values. And the &#64;UseDefaults annotation allows us to declare that Polygene\u2122 should set the Property
-            to a default value. These are either the pre-defined ones, or can be set per property declaration during the
-            assembly.
-        </p>
-
-        <h3>&#64;Visibility</h3>
-        <p>
-            Visibility is another innovative concept in Polygene\u2122, which leverage the structure system (Application, Layer, Module)
-            to limit the 'reach' when requesting composites and objects. The Visibility is declared per Composite/Object,
-            preferably in the most restrictive mode possible, and the visibility resolver will ensure a predictable resolution
-            algorithm;
-        </p>
-        <ol>
-            <li>Search the module of the caller first. If one and only one composite type fulfilling the request is available
-                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
-                continue to the next step.
-            </li>
-            <li>Search all modules in the Layer of the caller for composite that has a declaration other than
-                <code>Visibility.module</code>. If one and only one composite type fulfilling the request is available
-                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
-                continue to the next step.
-            </li>
-            <li>Search all modules in the Layer(s) (if any) directly below of the caller for composite that has a declaration of
-                <code>Visibility.application</code>. If one and only one composite type fulfilling the request is available
-                return that to the caller. If two or more are found, throw an AmbiguousTypeException. If no composite found
-                continue to the next step.
-            </li>
-            <li>Throw an NoSuchCompositeException (or related) exception.</li>
-        </ol>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/AmbiguousTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/AmbiguousTypeException.java b/core/api/src/main/java/org/apache/zest/api/composite/AmbiguousTypeException.java
deleted file mode 100644
index 6176828..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/AmbiguousTypeException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * This Exception is thrown when more than one Composite implements a MixinType
- * that one tries to use to create a Composite instance from.
- * <p>
- * For instance;
- * </p>
- * <pre><code>
- * public interface AbcComposite extends TransientComposite, Abc
- * {}
- *
- * public interface DefComposite extends TransientComposite, Def
- * {}
- *
- * public interface Abc
- * {}
- *
- * public interface Def extends Abc
- * {}
- *
- *
- * TransientBuilder cb = factory.newTransientBuilder( Abc.class );
- * </code></pre>
- * <p>
- * In the code above, both the AbcComposite and DefComposite implement Abc, and therefore
- * the <code>newTransientBuilder</code> method can not unambiguously figure out which
- * one is intended.
- * </p>
- */
-public class AmbiguousTypeException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public AmbiguousTypeException( String message )
-    {
-        super( message );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/Composite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/Composite.java b/core/api/src/main/java/org/apache/zest/api/composite/Composite.java
deleted file mode 100644
index 879b2c5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/Composite.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.PropertyMixin;
-
-/**
- * Base Composite interface.
- * <p>
- * All Composite objects must implement this interface. Let the
- * Composite interface extend this one. An implementation will be provided
- * by the framework.
- * </p>
- * <p>
- * Properties and associations are handled by default.
- * </p>
- */
-@Mixins( { PropertyMixin.class } )
-public interface Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/CompositeContext.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/CompositeContext.java b/core/api/src/main/java/org/apache/zest/api/composite/CompositeContext.java
deleted file mode 100644
index e516947..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/CompositeContext.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.stream.Stream;
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.structure.ModuleDescriptor;
-
-/**
- * Thread-associated composites. This is basically a ThreadLocal which maintains a reference
- * to a TransientComposite instance for each thread. This can be used to implement various context
- * patterns without having to pass the context explicitly as a parameter to methods.
- */
-public class CompositeContext<T extends TransientComposite>
-    extends ThreadLocal<T>
-{
-    private ModuleDescriptor module;
-    private Class<T> type;
-
-    public CompositeContext( ModuleDescriptor module, Class<T> type )
-    {
-        this.module = module;
-        this.type = type;
-    }
-
-    @Override
-    protected T initialValue()
-    {
-        return module.instance().newTransient( type );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public T proxy()
-    {
-        TransientComposite composite = get();
-
-        Stream<Class<?>> types = PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite ).types();
-        return (T) Proxy.newProxyInstance(
-            composite.getClass().getClassLoader(),
-            types.toArray( Class[]::new ),
-            new ContextInvocationhandler() );
-    }
-
-    private class ContextInvocationhandler
-        implements InvocationHandler
-    {
-
-        @Override
-        public Object invoke( Object object, Method method, Object[] objects )
-            throws Throwable
-        {
-            try
-            {
-                return method.invoke( get(), objects );
-            }
-            catch( InvocationTargetException e )
-            {
-                throw e.getTargetException();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/CompositeDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/CompositeDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/CompositeDescriptor.java
deleted file mode 100644
index 9210a78..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/CompositeDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.util.stream.Stream;
-
-/**
- * Composite Descriptor.
- */
-public interface CompositeDescriptor
-    extends ModelDescriptor
-{
-    Class<?> primaryType();
-
-    Stream<Class<?>> mixinTypes();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/CompositeInstance.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/CompositeInstance.java b/core/api/src/main/java/org/apache/zest/api/composite/CompositeInstance.java
deleted file mode 100644
index 15027b1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/CompositeInstance.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.InvocationHandler;
-import org.apache.zest.api.property.StateHolder;
-import org.apache.zest.api.structure.MetaInfoHolder;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * Composite Instance.
- */
-public interface CompositeInstance
-    extends InvocationHandler, CompositeInvoker, HasTypes, MetaInfoHolder
-{
-    <T> T proxy();
-
-    <T> T newProxy( Class<T> mixinType )
-        throws IllegalArgumentException;
-
-    ModuleDescriptor module();
-
-    CompositeDescriptor descriptor();
-
-    StateHolder state();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/CompositeInvoker.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/CompositeInvoker.java b/core/api/src/main/java/org/apache/zest/api/composite/CompositeInvoker.java
deleted file mode 100644
index 51837bd..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/CompositeInvoker.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.Method;
-
-/**
- * Composite method invoker.
- * <p>
- * All composites must implement this interface. Methods that are invoked
- * may reside either in the public Composite interface or in any internal mixins.
- * </p>
- * <p>
- * <strong><i>NOTE:</i></strong>Client code should never use method in this class. We have not been able to hide this
- * from client code, but IF we find a way to do, this interface may disappear.
- * </p>
- */
-public interface CompositeInvoker
-{
-
-    Object invokeComposite( Method method, Object[] args )
-        throws Throwable;
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/ConstructorDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/ConstructorDescriptor.java
deleted file mode 100644
index c676905..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/ConstructorDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.Constructor;
-
-/**
- * Composite constructor descriptor.
- */
-public interface ConstructorDescriptor
-{
-    Constructor<?> constructor();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/DecoratorMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/DecoratorMixin.java b/core/api/src/main/java/org/apache/zest/api/composite/DecoratorMixin.java
deleted file mode 100644
index e5f0235..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/DecoratorMixin.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import org.apache.zest.api.injection.scope.Uses;
-
-/**
- * Generic decorator mixin that allows a Composite to wrap
- * any other Composite as long as they share an interface.
- * <p>
- * Can be used to effectively implement
- * singleton mixins, since the decorated object can be shared between
- * many instances.
- * </p>
- */
-public class DecoratorMixin
-    implements InvocationHandler
-{
-    private Object delegate;
-
-    public DecoratorMixin( @Uses Object delegate )
-    {
-        if( delegate instanceof Class )
-        {
-            Thread.dumpStack();
-        }
-        this.delegate = delegate;
-    }
-
-    @Override
-    public Object invoke( Object object, Method method, Object[] args )
-        throws Throwable
-    {
-        if( delegate instanceof InvocationHandler )
-        {
-            InvocationHandler handler = (InvocationHandler) delegate;
-            return handler.invoke( object, method, args );
-        }
-        else
-        {
-            try
-            {
-                return method.invoke( delegate, args );
-            }
-            catch( InvocationTargetException e )
-            {
-                throw e.getCause();
-            }
-            catch( IllegalArgumentException e )
-            {
-                String message = constructMessage( method, args );
-                throw new IllegalArgumentException( message, e );
-            }
-        }
-    }
-
-    private String constructMessage( Method method, Object[] args )
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append( "\nmethod: " );
-        builder.append( method.getDeclaringClass().getName() );
-        builder.append( "." );
-        builder.append( method.getName() );
-        builder.append( "\ndelegate: " );
-        builder.append( delegate );
-        builder.append( "\ndelegateType: " );
-        builder.append( delegate == null ? "n/a" : delegate.getClass().getName() );
-        builder.append( "\narguments: \n" );
-        for( Object arg : args )
-        {
-            builder.append( "    " );
-            Class argClass = arg.getClass();
-            if( Proxy.isProxyClass( argClass ) )
-            {
-                builder.append( Proxy.getInvocationHandler( arg ).getClass().getName() );
-            }
-            else
-            {
-                builder.append( argClass.getName() );
-            }
-            builder.append( '\n' );
-        }
-        return builder.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/DependencyDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/DependencyDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/DependencyDescriptor.java
deleted file mode 100644
index f7a92f9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/DependencyDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-/**
- * Composite dependency descriptor.
- */
-public interface DependencyDescriptor
-{
-    Annotation injectionAnnotation();
-
-    Type injectionType();
-
-    Class<?> injectedClass();
-
-    Class<?> rawInjectionType();
-
-    boolean optional();
-
-    Annotation[] annotations();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/InjectedFieldDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/InjectedFieldDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/InjectedFieldDescriptor.java
deleted file mode 100644
index 2a866d4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/InjectedFieldDescriptor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.Field;
-
-/**
- * Composite injected field descriptor.
- */
-public interface InjectedFieldDescriptor
-{
-    Field field();
-
-    DependencyDescriptor dependency();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/InjectedMethodDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/InjectedMethodDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/InjectedMethodDescriptor.java
deleted file mode 100644
index 4f2cc8e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/InjectedMethodDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.Method;
-
-/**
- * Composite injected method descriptor.
- */
-public interface InjectedMethodDescriptor
-{
-    Method method();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/InjectedParametersDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/InjectedParametersDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/InjectedParametersDescriptor.java
deleted file mode 100644
index 80833ca..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/InjectedParametersDescriptor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * Composite constructors and method injected parameters descriptor.
- */
-public interface InjectedParametersDescriptor
-{
-}


[72/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
new file mode 100644
index 0000000..914823d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiAnnotationMemberValue;
+import com.intellij.psi.PsiClass;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinUtil.getMixinsAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class MixinsAnnotationDeclaredOnMixinType extends AbstractInspection
+{
+    @NotNull
+    public final String getShortName()
+    {
+        return "MixinsAnnotationDeclaredOnMixinType";
+    }
+
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "mixins.annotation.declared.on.mixin.type";
+    }
+
+    @Override
+    public ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
+                                           @NotNull InspectionManager manager,
+                                           boolean isOnTheFly )
+    {
+        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
+        if( mixinsAnnotation == null )
+        {
+            return null;
+        }
+
+        if( psiClass.isInterface() )
+        {
+            return null;
+        }
+
+        String message = message( "mixins.annotation.declared.on.mixin.type.error.declared.on.class" );
+        RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix( mixinsAnnotation );
+        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( mixinsAnnotation, message, fix,
+                                                                               GENERIC_ERROR_OR_WARNING );
+        return new ProblemDescriptor[]{ problemDescriptor };
+
+    }
+
+    private static class RemoveInvalidMixinClassReferenceFix extends AbstractFix
+    {
+        private final PsiAnnotationMemberValue mixinsAnnotation;
+
+        public RemoveInvalidMixinClassReferenceFix( @NotNull PsiAnnotationMemberValue mixinsAnnotation )
+        {
+            super( message( "mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation" ) );
+            this.mixinsAnnotation = mixinsAnnotation;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            mixinsAnnotation.delete();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
new file mode 100644
index 0000000..d3c269f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneSideEffectConstants
+{
+    public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects";
+
+    public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf";
+    public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect";
+
+    private PolygeneSideEffectConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
new file mode 100644
index 0000000..c1533fc
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneSideEffectUtil
+{
+    /**
+     * @param searchContext Search context.
+     * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getGenericSideEffectClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericSideEffectClass( @NotNull Project project,
+                                                      @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
+    }
+
+    /**
+     * @param searchContext Search context.
+     * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getSideEffectOfClass( project, searchScope );
+    }
+
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getSideEffectOfClass( @NotNull Project project,
+                                                 @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
+    }
+
+    /**
+     * @param elementWithinJavaClass element within java class.
+     * @return {@code @SideEffects} annotation declaration of the class that contains the element.
+     *         Returns {@code null} if not found, or {@code element} is an invalid context.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
+    {
+        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
+        return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
+    }
+
+    /**
+     * @param annotation annotation to process.
+     * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
+     *         {@code null} or annotation is not a {@code @SideEffects} annotation.
+     * @since 0.1
+     */
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
+    {
+        if( annotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = annotation.getQualifiedName();
+        if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( annotation );
+    }
+
+    /**
+     * @param value annotation member value.
+     * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
+     *         class reference.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
+     *
+     * @param psiClass class to check.
+     * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
+     * @since 0.1
+     */
+    public static boolean isASideEffect( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
+        return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
+     *         {@code psiClass} does
+     *         not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
+     * @since 0.1
+     */
+    public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
+        return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
+    }
+
+    private PolygeneSideEffectUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..bf46eb3
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,177 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.sideEffects.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiAnnotationMemberValue;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiJavaCodeReferenceElement;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
+import org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class SideEffectsAnnotationDeclaredCorrectlyInspection extends AbstractInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "side.effects.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "SideEffectsAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @Override
+    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
+                                                 @NotNull InspectionManager manager,
+                                                 boolean isOnTheFly )
+    {
+        // If class does not have @SideEffects, ignore
+        PsiAnnotation sideEffectsAnnotation = getSideEffectsAnnotation( psiClass );
+        if( sideEffectsAnnotation == null )
+        {
+            return null;
+        }
+
+        // If @SideEffects declared in class, suggest remove @SideEffects annotation
+        if( !psiClass.isInterface() )
+        {
+            String message = message( "side.effects.annotation.declared.correctly.error.annotation.declared.in.class" );
+            RemoveSideEffectsAnnotationFix fix = new RemoveSideEffectsAnnotationFix( sideEffectsAnnotation );
+            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( sideEffectsAnnotation, message, fix,
+                                                                                   GENERIC_ERROR_OR_WARNING );
+            return new ProblemDescriptor[]{ problemDescriptor };
+        }
+
+        // If @SideEffects annotation is empty, ignore
+        List<PsiAnnotationMemberValue> sideEffectsAnnotationValue =
+            getSideEffectsAnnotationValue( sideEffectsAnnotation );
+        if( sideEffectsAnnotationValue.isEmpty() )
+        {
+            return null;
+        }
+
+        // If SideEffectOf is not resolved, ignore
+        Project project = psiClass.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( psiClass );
+        PsiClass sideEffectOfClass = PolygeneSideEffectUtil.getGenericSideEffectClass( project, searchScope );
+        if( sideEffectOfClass == null )
+        {
+            return null;
+        }
+
+        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+        for( PsiAnnotationMemberValue sideEffectClassReferenceWrapper : sideEffectsAnnotationValue )
+        {
+            PsiJavaCodeReferenceElement sideEffectClassReference =
+                getSideEffectClassReference( sideEffectClassReferenceWrapper );
+
+            // If it's not a class reference, ignore
+            if( sideEffectClassReference == null )
+            {
+                continue;
+            }
+
+            // If class reference can't be resolved, ignore
+            PsiClass sideEffectClass = (PsiClass) sideEffectClassReference.resolve();
+            if( sideEffectClass == null )
+            {
+                continue;
+            }
+
+            // If side effect class does not inherit SideEffectOf class, suggest remove that reference.
+            if( !sideEffectClass.isInheritor( sideEffectOfClass, true ) )
+            {
+                String message = PolygeneResourceBundle.message(
+                    "side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of",
+                    sideEffectClass.getQualifiedName()
+                );
+
+                RemoveAnnotationValueFix fix = new RemoveAnnotationValueFix(
+                    sideEffectClassReferenceWrapper, sideEffectClassReference
+                );
+                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                    sideEffectClassReferenceWrapper, message, fix, GENERIC_ERROR_OR_WARNING );
+                problems.add( problemDescriptor );
+            }
+            else
+            {
+                // TODO: Test whether it is a generic side effect
+                // TODO: Test whether it is a specific side effect
+            }
+        }
+
+        return problems.toArray( new ProblemDescriptor[problems.size()] );
+    }
+
+    private static class RemoveSideEffectsAnnotationFix extends AbstractFix
+    {
+        private final PsiAnnotation sideEffectsAnnotation;
+
+        private RemoveSideEffectsAnnotationFix( @NotNull PsiAnnotation sideEffectsAnnotation )
+        {
+            super( message( "side.effects.annotation.declared.correctly.fix.remove.annotation" ) );
+            this.sideEffectsAnnotation = sideEffectsAnnotation;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            sideEffectsAnnotation.delete();
+        }
+    }
+
+    private static class RemoveAnnotationValueFix extends AbstractFix
+    {
+        private final PsiAnnotationMemberValue annotationValueToRemove;
+
+        private RemoveAnnotationValueFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
+                                          @NotNull PsiJavaCodeReferenceElement sideEffectClassReference )
+        {
+            super( message( "side.effects.annotation.declared.correctly.fix.remove.class.reference",
+                            sideEffectClassReference.getQualifiedName() ) );
+            this.annotationValueToRemove = annotationValueToRemove;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            annotationValueToRemove.delete();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
deleted file mode 100644
index 42d1104..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea;
-
-import com.intellij.codeInspection.InspectionToolProvider;
-import com.intellij.facet.FacetTypeRegistry;
-import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
-import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptor;
-import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory;
-import com.intellij.openapi.components.ApplicationComponent;
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.appliesTo.inspections.AppliesToAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.common.facet.PolygeneFacetType;
-import org.apache.polygene.ide.plugin.idea.concerns.inspections.ConcernsAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.invocation.inspections.InvocationAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.service.inspections.ServiceAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.structure.inspections.StructureAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinImplementsMixinType;
-import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinsAnnotationDeclaredOnMixinType;
-import org.apache.polygene.ide.plugin.idea.sideEffects.inspections.SideEffectsAnnotationDeclaredCorrectlyInspection;
-
-import javax.swing.*;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneApplicationComponent
-    implements ApplicationComponent, InspectionToolProvider, FileTemplateGroupDescriptorFactory
-{
-    @NonNls
-    private static String[] FILE_TEMPLATES = {
-        "GenericConcernOf.java"
-    };
-
-    private final PolygeneFacetType polygeneFacetType;
-
-    public PolygeneApplicationComponent()
-    {
-        polygeneFacetType = new PolygeneFacetType();
-    }
-
-    @NotNull
-    public final String getComponentName()
-    {
-        return "PolygeneApplicationComponent";
-    }
-
-    public final void initComponent()
-    {
-        registerFacet();
-        registerIntentions();
-    }
-
-    private void registerFacet()
-    {
-        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.registerFacetType( polygeneFacetType );
-    }
-
-    private void registerIntentions()
-    {
-//        IntentionManager intentionManager = IntentionManager.getInstance();
-//        intentionManager.registerIntentionAndMetaData( new AddConcernOnType(), "intention.category.control.flow" );
-    }
-
-    public final void disposeComponent()
-    {
-        unregisterFacet();
-    }
-
-    private void unregisterFacet()
-    {
-        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.unregisterFacetType( polygeneFacetType );
-    }
-
-    public final Class[] getInspectionClasses()
-    {
-        return new Class[]{
-            // Concerns
-            ConcernsAnnotationDeclaredCorrectlyInspection.class,
-            // Mixins
-            MixinImplementsMixinType.class,
-            MixinsAnnotationDeclaredOnMixinType.class,
-            // Side effects
-            SideEffectsAnnotationDeclaredCorrectlyInspection.class,
-            // Injections
-            InvocationAnnotationDeclaredCorrectlyInspection.class,
-            ServiceAnnotationDeclaredCorrectlyInspection.class,
-            StructureAnnotationDeclaredCorrectlyInspection.class,
-            // AppliesTo
-            AppliesToAnnotationDeclaredCorrectlyInspection.class
-        };
-    }
-
-    public final FileTemplateGroupDescriptor getFileTemplatesDescriptor()
-    {
-        FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor(
-            message( "polygene.file.template.group.title" ), null
-        );
-
-        FileTypeManager fileTypeManager = FileTypeManager.getInstance();
-        for( @NonNls String template : FILE_TEMPLATES )
-        {
-            Icon icon = fileTypeManager.getFileTypeByFileName( template ).getIcon();
-            group.addTemplate( new FileTemplateDescriptor( template, icon ) );
-        }
-
-        return group;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
deleted file mode 100644
index e50589d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneAppliesToConstants
-{
-    public static final String QUALIFIED_NAME_APPLIES_TO = "org.apache.polygene.api.common.AppliesTo";
-    public static final String QUALIFIED_NAME_APPLIES_TO_FILTER = "org.apache.polygene.api.common.AppliesToFilter";
-
-    private PolygeneAppliesToConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
deleted file mode 100644
index fd56b6b..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO;
-import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO_FILTER;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneAppliesToUtil
-{
-    /**
-     * @param searchContext Search context.
-     * @return {@code AppliesToFilter} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getAppliesToFilterClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getAppliesToFilterClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code AppliesToFilter} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getAppliesToFilterClass( @NotNull Project project,
-                                                    @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_APPLIES_TO_FILTER, scope );
-    }
-
-    /**
-     * @param elementWithinJavaClass element within java class.
-     * @return {@code @AppliesTo} annotation declaration of the class that contains the element.
-     *         Returns {@code null} if not found, or {@code element} is an invalid context.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getAppliesToAnnotation( @NotNull PsiElement elementWithinJavaClass )
-    {
-        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
-        return findAnnotation( psiClass, QUALIFIED_NAME_APPLIES_TO );
-    }
-
-    /**
-     * @param annotation annotation to process.
-     * @return {@code @AppliesTo} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
-     *         {@code null} or annotation is not a {@code @AppliesTo} annotation.
-     * @since 0.1
-     */
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getAppliesToAnnotationValue( @Nullable PsiAnnotation annotation )
-    {
-        if( annotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = annotation.getQualifiedName();
-        if( !QUALIFIED_NAME_APPLIES_TO.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( annotation );
-    }
-
-    /**
-     * @param value annotation member value.
-     * @return Applies to class reference given the {@code value} parameter. Returns {@code null} if it's not a
-     *         class reference.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiJavaCodeReferenceElement getAppliesToValueClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is implements
-     * {@code AppliesToFilter} class.
-     *
-     * @param psiClass             class to check.
-     * @param appliesToFilterClass {@code AppliesToFilter} class.
-     * @return {@code true} if {@code psiClass} implements {@code AppliesToFilter} class, {@code false} otherwise.
-     * @since 0.1
-     */
-    public static boolean isAnAppliesToFilter( @NotNull PsiClass psiClass, @NotNull PsiClass appliesToFilterClass )
-    {
-        return !psiClass.isInterface() && psiClass.isInheritor( appliesToFilterClass, true );
-    }
-
-    private PolygeneAppliesToUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index b64d762..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.appliesTo.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToUtil.*;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.isImplementsInvocationHandler;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAGenericConcern;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isAGenericSideEffect;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class AppliesToAnnotationDeclaredCorrectlyInspection extends AbstractInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "applies.to.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "AppliesToAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @Override
-    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
-                                                 @NotNull InspectionManager manager,
-                                                 boolean isOnTheFly )
-    {
-        PsiAnnotation appliesToAnnotation = getAppliesToAnnotation( psiClass );
-        if( appliesToAnnotation == null )
-        {
-            // If class does not have @AppliesTo, ignore
-            return null;
-        }
-
-        String classQualifiedName = psiClass.getQualifiedName();
-        // @AppliesTo can only be declared on class
-        if( psiClass.isInterface() )
-        {
-            // Suggest remove applies to
-            String message = message(
-                "applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class"
-            );
-            ProblemDescriptor problemDescriptor = createRemoveAppliesToFilterProblemDescriptor(
-                manager, message, appliesToAnnotation );
-            return new ProblemDescriptor[]{ problemDescriptor };
-        }
-
-        // If @AppliesTo annotation is empty, ignore
-        List<PsiAnnotationMemberValue> appliesToAnnotationValues = getAppliesToAnnotationValue( appliesToAnnotation );
-        if( appliesToAnnotationValues.isEmpty() )
-        {
-            return null;
-        }
-
-        // If AppliesToFilter is not resolved, ignore
-        Project project = psiClass.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( psiClass );
-        PsiClass appliesToFilterClass = getAppliesToFilterClass( project, searchScope );
-        if( appliesToFilterClass == null )
-        {
-            return null;
-        }
-
-        boolean classIsAConcern = isAConcern( psiClass );
-        boolean classIsASideEffect = isASideEffect( psiClass );
-        boolean classIsAGenericConcern = classIsAConcern && isAGenericConcern( psiClass );
-        boolean classIsAGenericSideEffect = classIsASideEffect && isAGenericSideEffect( psiClass );
-        boolean classIsAMixin = !classIsAConcern && !classIsASideEffect;
-        boolean classIsAGenericMixin = classIsAMixin && isImplementsInvocationHandler( psiClass );
-
-        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-        for( PsiAnnotationMemberValue appliesToAnnotationValue : appliesToAnnotationValues )
-        {
-            PsiJavaCodeReferenceElement appliesToValueClassReference =
-                getAppliesToValueClassReference( appliesToAnnotationValue );
-
-            // If it's not a class reference, ignore
-            if( appliesToValueClassReference == null )
-            {
-                continue;
-            }
-
-            // If class reference can't be resolved, ignore
-            PsiClass appliesToValueClass = (PsiClass) appliesToValueClassReference.resolve();
-            if( appliesToValueClass == null )
-            {
-                continue;
-            }
-
-            String appliesToValueQualifiedName = appliesToValueClass.getQualifiedName();
-            boolean appliesToValueIsAnAnnotation = appliesToValueClass.isAnnotationType();
-            boolean appliesToValueIsImplementingAppliesToFilter =
-                appliesToValueClass.isInheritor( appliesToFilterClass, true );
-
-            String message = null;
-            if( appliesToValueIsAnAnnotation && classIsAMixin )
-            {
-                // If Class is a mixin and appliesToValueClass is an annotation
-                message = message(
-                    "applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin",
-                    appliesToValueQualifiedName
-                );
-            }
-            else if( appliesToValueIsAnAnnotation || appliesToValueIsImplementingAppliesToFilter )
-            {
-                if( classIsAConcern && !classIsAGenericConcern )
-                {
-                    // If psiClass is a concern but not generic concern
-                    message = message(
-                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern",
-                        appliesToValueQualifiedName, classQualifiedName
-                    );
-                }
-                else if( classIsASideEffect && !classIsAGenericSideEffect )
-                {
-                    // If psiClass a side effect but not a generic side effect
-                    message = message(
-                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect",
-                        appliesToValueQualifiedName, classQualifiedName
-                    );
-                }
-                else if( appliesToValueIsImplementingAppliesToFilter && !classIsAGenericMixin )
-                {
-                    message = message(
-                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler",
-                        appliesToValueQualifiedName, classQualifiedName
-                    );
-                }
-            }
-            else if( appliesToValueClass.isInterface() )
-            {
-                if( !psiClass.isInheritor( appliesToValueClass, true ) &&
-                    !( classIsAGenericConcern || classIsAGenericSideEffect ) )
-                {
-                    // If psiClass does not implement that interface and it's not a generic concern or generic side effect
-                    if( classIsAConcern )
-                    {
-                        message = message(
-                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern",
-                            appliesToValueQualifiedName, classQualifiedName );
-                    }
-                    else if( classIsASideEffect )
-                    {
-                        message = message(
-                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect",
-                            appliesToValueQualifiedName, classQualifiedName );
-                    }
-                    else
-                    {
-                        message = message(
-                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler",
-                            appliesToValueQualifiedName, classQualifiedName );
-                    }
-                }
-            }
-            else
-            {
-                if( classIsAMixin )
-                {
-                    message = message(
-                        "applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin",
-                        appliesToValueQualifiedName
-                    );
-                }
-                else
-                {
-                    message = message(
-                        "applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin",
-                        appliesToValueQualifiedName
-                    );
-                }
-            }
-
-            if( message != null )
-            {
-                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                    appliesToAnnotationValue,
-                    message,
-                    new RemoveAnnotationValueFix( appliesToAnnotationValue, appliesToValueClassReference ),
-                    GENERIC_ERROR_OR_WARNING );
-                problems.add( problemDescriptor );
-            }
-        }
-
-        return problems.toArray( new ProblemDescriptor[problems.size()] );
-    }
-
-    @NotNull
-    private ProblemDescriptor createRemoveAppliesToFilterProblemDescriptor( @NotNull InspectionManager manager,
-                                                                            @NotNull String problemMessage,
-                                                                            @NotNull PsiAnnotation appliesToAnnotation )
-    {
-        RemoveAppliesToFilterAnnotationFix fix = new RemoveAppliesToFilterAnnotationFix( appliesToAnnotation );
-        return manager.createProblemDescriptor( appliesToAnnotation, problemMessage, fix, GENERIC_ERROR_OR_WARNING );
-    }
-
-    private static class RemoveAppliesToFilterAnnotationFix extends AbstractFix
-    {
-        private final PsiAnnotation appliesToFilterAnnotation;
-
-        private RemoveAppliesToFilterAnnotationFix( @NotNull PsiAnnotation appliesToFilterAnnotation )
-        {
-            super( message( "applies.to.annotation.declared.correctly.fix.remove.annotation" ) );
-            this.appliesToFilterAnnotation = appliesToFilterAnnotation;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            appliesToFilterAnnotation.delete();
-        }
-    }
-
-    private static class RemoveAnnotationValueFix extends AbstractFix
-    {
-        private final PsiAnnotationMemberValue annotationValueToRemove;
-
-        private RemoveAnnotationValueFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
-                                          @NotNull PsiJavaCodeReferenceElement appliesToValueClassReference )
-        {
-            super( message( "applies.to.annotation.declared.correctly.fix.remove.class.reference",
-                            appliesToValueClassReference.getQualifiedName() ) );
-            this.annotationValueToRemove = annotationValueToRemove;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            annotationValueToRemove.delete();
-        }
-    }
-
-    private static class ClassImplementInterfaceFix extends AbstractFix
-    {
-        private final PsiClass psiClass;
-        private final PsiClass interfaceToImplement;
-
-        private ClassImplementInterfaceFix( @NotNull PsiClass psiClass,
-                                            @NotNull PsiClass interfaceToImplement )
-        {
-            super( message( "applies.to.annotation.declared.correctly.fix.remove.class.reference",
-                            interfaceToImplement.getQualifiedName() ) );
-            this.psiClass = psiClass;
-            this.interfaceToImplement = interfaceToImplement;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            PsiReferenceList implementList = psiClass.getImplementsList();
-            if( implementList != null )
-            {
-
-                implementList.add( interfaceToImplement );
-            }
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
deleted file mode 100644
index b47a045..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.actions;
-
-import com.intellij.CommonBundle;
-import com.intellij.ide.actions.CreateElementActionBase;
-import com.intellij.ide.fileTemplates.FileTemplate;
-import com.intellij.ide.fileTemplates.FileTemplateManager;
-import com.intellij.ide.fileTemplates.JavaTemplateUtil;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.CodeStyleManager;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Properties;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public abstract class AbstractCreateElementActionBase extends CreateElementActionBase
-{
-    @NonNls
-    private static final String NAME_TEMPLATE_PROPERTY = "NAME";
-
-    protected AbstractCreateElementActionBase( String text, String description )
-    {
-        super( text, description, null );
-    }
-
-    @NotNull
-    protected final PsiElement[] invokeDialog( Project project, PsiDirectory directory )
-    {
-        Module module = ModuleUtil.findModuleForFile( directory.getVirtualFile(), project );
-        if( module == null )
-        {
-            return PsiElement.EMPTY_ARRAY;
-        }
-
-        MyInputValidator validator = doInvokeDialog( project, directory );
-        return validator.getCreatedElements();
-    }
-
-    protected MyInputValidator doInvokeDialog( Project project, PsiDirectory directory )
-    {
-        MyInputValidator validator = new MyInputValidator( project, directory );
-        Messages.showInputDialog( project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator );
-        return validator;
-    }
-
-    /**
-     * @return Dialog prompt.
-     */
-    protected abstract String getDialogPrompt();
-
-    /**
-     * @return Dialog title.
-     */
-    protected abstract String getDialogTitle();
-
-    protected String getErrorTitle()
-    {
-        return CommonBundle.getErrorTitle();
-    }
-
-    protected final void checkBeforeCreate( String newName, PsiDirectory directory )
-        throws IncorrectOperationException
-    {
-        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
-        javaDirectoryService.checkCreateClass( directory, newName );
-    }
-
-    protected static PsiClass createClassFromTemplate( @NotNull PsiDirectory directory,
-                                                       @NotNull String className,
-                                                       @NotNull String templateName,
-                                                       @NonNls String... parameters )
-        throws IncorrectOperationException
-    {
-        String classFileName = className + "." + StdFileTypes.JAVA.getDefaultExtension();
-        PsiFile file = createFromTemplateInternal( directory, className, classFileName, templateName, parameters );
-        return ( (PsiJavaFile) file ).getClasses()[ 0 ];
-    }
-
-    protected static PsiFile createFromTemplateInternal( @NotNull PsiDirectory directory,
-                                                         @NotNull String name,
-                                                         @NotNull String fileName,
-                                                         @NotNull String templateName,
-                                                         @NonNls String... parameters )
-        throws IncorrectOperationException
-    {
-        // Load template
-        FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance();
-        FileTemplate template = fileTemplateManager.getJ2eeTemplate( templateName );
-
-        // Process template properties
-        Properties properties = new Properties( fileTemplateManager.getDefaultProperties() );
-        JavaTemplateUtil.setPackageNameAttribute( properties, directory );
-        properties.setProperty( NAME_TEMPLATE_PROPERTY, name );
-
-        // Add parameters
-        for( int i = 0; i < parameters.length; i += 2 )
-        {
-            properties.setProperty( parameters[ i ], parameters[ i + 1 ] );
-        }
-
-        // Create text from template with specified properties
-        String text;
-        try
-        {
-            text = template.getText( properties );
-        }
-        catch( Exception e )
-        {
-            String message = "Unable to load template for " +
-                             fileTemplateManager.internalTemplateToSubject( templateName );
-            throw new RuntimeException( message, e );
-        }
-
-        // Serialized text to file
-        PsiManager psiManager = PsiManager.getInstance( directory.getProject() );
-        PsiFileFactory fileFactory = PsiFileFactory.getInstance( directory.getProject() );
-        PsiFile file = fileFactory.createFileFromText( fileName, text );
-
-        // Reformat the file according to project/default style
-        CodeStyleManager codeStyleManager = CodeStyleManager.getInstance( psiManager );
-        codeStyleManager.reformat( file );
-
-        // Add newly created file to directory
-        return (PsiFile) directory.add( file );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
deleted file mode 100644
index d53e0e1..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.actions;
-
-import com.intellij.ide.IdeView;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.psi.JavaDirectoryService;
-import com.intellij.psi.PsiDirectory;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneCreateActionGroup extends DefaultActionGroup
-{
-    public PolygeneCreateActionGroup()
-    {
-        super( message( "polygene.action.group.title" ), true );
-        getTemplatePresentation().setDescription( message( "polygene.action.group.description" ) );
-    }
-
-    public void update( AnActionEvent e )
-    {
-        Presentation presentation = e.getPresentation();
-        presentation.setVisible( shouldActionGroupVisible( e ) );
-    }
-
-    private boolean shouldActionGroupVisible( AnActionEvent e )
-    {
-        Module module = e.getData( LangDataKeys.MODULE );
-        if( module == null )
-        {
-            return false;
-        }
-
-        // TODO: Enable this once PolygeneFacet can be automatically added/removed
-//        if( PolygeneFacet.getInstance( module ) == null )
-//        {
-//            return false;
-//        }
-
-        // Are we on IDE View and under project source folder?
-        Project project = e.getData( PlatformDataKeys.PROJECT );
-        IdeView view = e.getData( LangDataKeys.IDE_VIEW );
-        if( view != null && project != null )
-        {
-            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance( project ).getFileIndex();
-            PsiDirectory[] dirs = view.getDirectories();
-            for( PsiDirectory dir : dirs )
-            {
-                if( projectFileIndex.isInSourceContent( dir.getVirtualFile() ) && JavaDirectoryService.getInstance().getPackage( dir ) != null )
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
deleted file mode 100644
index 7342707..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetManager;
-import com.intellij.facet.FacetType;
-import com.intellij.openapi.module.Module;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacet extends Facet<PolygeneFacetConfiguration>
-{
-    public PolygeneFacet( @NotNull FacetType facetType,
-                      @NotNull Module module,
-                      String name,
-                      @NotNull PolygeneFacetConfiguration configuration,
-                      Facet underlyingFacet
-    )
-    {
-        super( facetType, module, name, configuration, underlyingFacet );
-    }
-
-    @Nullable
-    public static PolygeneFacet getInstance( @NotNull Module module )
-    {
-        return FacetManager.getInstance( module ).getFacetByType( PolygeneFacetType.ID );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
deleted file mode 100644
index 6a6f28e..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.FacetConfiguration;
-import com.intellij.facet.ui.FacetEditorContext;
-import com.intellij.facet.ui.FacetEditorTab;
-import com.intellij.facet.ui.FacetValidatorsManager;
-import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.WriteExternalException;
-import org.jdom.Element;
-import org.apache.polygene.ide.plugin.idea.common.facet.ui.PolygeneFacetEditorTab;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetConfiguration
-    implements FacetConfiguration
-{
-    public FacetEditorTab[] createEditorTabs( FacetEditorContext editorContext,
-                                              FacetValidatorsManager validatorsManager )
-    {
-        return new FacetEditorTab[]{
-            new PolygeneFacetEditorTab( editorContext )
-        };
-    }
-
-    public final void readExternal( Element element )
-        throws InvalidDataException
-    {
-        // Do nothing
-    }
-
-    public final void writeExternal( Element element )
-        throws WriteExternalException
-    {
-        // Do nothing
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
deleted file mode 100644
index b45de9f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetType;
-import com.intellij.facet.FacetTypeId;
-import com.intellij.facet.autodetecting.FacetDetector;
-import com.intellij.facet.autodetecting.FacetDetectorRegistry;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.JavaModuleType;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleType;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VirtualFileFilter;
-import com.intellij.psi.JavaElementVisitor;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiImportStatement;
-import com.intellij.psi.PsiReferenceExpression;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetType extends FacetType<PolygeneFacet, PolygeneFacetConfiguration>
-{
-    public static final FacetTypeId<PolygeneFacet> ID = new FacetTypeId<PolygeneFacet>();
-
-    public PolygeneFacetType()
-    {
-        super( ID, "PolygeneFacet", "Polygene Facet" );
-    }
-
-    public final PolygeneFacetConfiguration createDefaultConfiguration()
-    {
-        return new PolygeneFacetConfiguration();
-    }
-
-    public final PolygeneFacet createFacet( @NotNull Module module,
-                                        String name,
-                                        @NotNull PolygeneFacetConfiguration configuration,
-                                        @Nullable Facet underlyingFacet )
-    {
-        return new PolygeneFacet( this, module, name, configuration, underlyingFacet );
-    }
-
-    public final boolean isSuitableModuleType( ModuleType moduleType )
-    {
-        return moduleType instanceof JavaModuleType;
-    }
-
-    @Override
-    public final void registerDetectors( FacetDetectorRegistry<PolygeneFacetConfiguration> registry )
-    {
-        registry.registerOnTheFlyDetector(
-            StdFileTypes.JAVA, VirtualFileFilter.ALL, new HasPolygeneImportPackageCondition(),
-            new FacetDetector<PsiFile, PolygeneFacetConfiguration>( "PolygeneFacetDetector" )
-            {
-                @Override
-                public PolygeneFacetConfiguration detectFacet( PsiFile source,
-                                                           Collection<PolygeneFacetConfiguration> existingConfigurations )
-                {
-                    if( !existingConfigurations.isEmpty() )
-                    {
-                        return existingConfigurations.iterator().next();
-                    }
-
-                    return createDefaultConfiguration();
-                }
-            }
-        );
-    }
-
-    private static class HasPolygeneImportPackageCondition
-        implements Condition<PsiFile>
-    {
-        public final boolean value( PsiFile psiFile )
-        {
-            final boolean[] hasPolygeneImportPackage = new boolean[]{ false };
-
-            psiFile.accept( new JavaElementVisitor()
-            {
-                @Override
-                public final void visitImportStatement( PsiImportStatement statement )
-                {
-                    String packageName = statement.getQualifiedName();
-                    if( packageName != null && packageName.startsWith( "org.apache.polygene" ) )
-                    {
-                        hasPolygeneImportPackage[ 0 ] = true;
-                    }
-                }
-
-                @Override
-                public void visitReferenceExpression( PsiReferenceExpression expression )
-                {
-                    // Ignore
-                }
-            } );
-            return hasPolygeneImportPackage[ 0 ];
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
deleted file mode 100644
index dc4b121..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet.ui;
-
-import com.intellij.facet.ui.FacetEditorContext;
-import com.intellij.facet.ui.FacetEditorTab;
-import com.intellij.openapi.options.ConfigurationException;
-import org.jetbrains.annotations.Nls;
-
-import javax.swing.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetEditorTab extends FacetEditorTab
-{
-    private final FacetEditorContext editorContext;
-
-    public PolygeneFacetEditorTab( FacetEditorContext aContext )
-    {
-        editorContext = aContext;
-    }
-
-    @Nls
-    public final String getDisplayName()
-    {
-        return "Polygene";
-    }
-
-    public JComponent createComponent()
-    {
-        return new JPanel();
-    }
-
-    public final boolean isModified()
-    {
-        return false;
-    }
-
-    public final void apply()
-        throws ConfigurationException
-    {
-        // From UI to configuration
-    }
-
-    public final void reset()
-    {
-        // From Configuration to UI
-    }
-
-    public final void disposeUIResources()
-    {
-        // Do nothing for now
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
deleted file mode 100644
index 1369766..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.inspections;
-
-import com.intellij.codeInspection.LocalQuickFix;
-import org.jetbrains.annotations.NotNull;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public abstract class AbstractFix
-    implements LocalQuickFix
-{
-    private String fixName;
-
-    protected AbstractFix( @NotNull String name )
-    {
-        fixName = name;
-    }
-
-    @NotNull
-    public final String getName()
-    {
-        return fixName;
-    }
-
-    @NotNull
-    public final String getFamilyName()
-    {
-        return message( "polygene.quick.fixes.family.name" );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
deleted file mode 100644
index a6d0a38..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.inspections;
-
-import com.intellij.codeHighlighting.HighlightDisplayLevel;
-import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
-import org.jetbrains.annotations.Nls;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
-
-import static com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public abstract class AbstractInspection extends BaseJavaLocalInspectionTool
-{
-    private static final String POLYGENE_IDEA_INSPECTIONS_NAME = "polygene.inspections.name";
-
-    @Nls @NotNull public String getGroupDisplayName()
-    {
-        return PolygeneResourceBundle.message( POLYGENE_IDEA_INSPECTIONS_NAME );
-    }
-
-    @NotNull
-    protected abstract String resourceBundlePrefixId();
-
-    @Nls @NotNull
-    public final String getDisplayName()
-    {
-        return PolygeneResourceBundle.message( resourceBundlePrefixId() + ".name.display" );
-    }
-
-    @NotNull @Override
-    public HighlightDisplayLevel getDefaultLevel()
-    {
-        return ERROR;
-    }
-
-    @Override
-    public boolean isEnabledByDefault()
-    {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/intentions/AbstractIntention.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/intentions/AbstractIntention.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/intentions/AbstractIntention.java
deleted file mode 100644
index d50693f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/intentions/AbstractIntention.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.intentions;
-
-import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
-import com.intellij.openapi.editor.CaretModel;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.ReadonlyStatusHandler;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * This class is based from {@code com.siyeh.ipp.base.Intention}
- *
- * @author edward.yakop@gmail.com
- */
-public abstract class AbstractIntention extends PsiElementBaseIntentionAction
-{
-    protected abstract boolean isIntentionValidFor( PsiElement element );
-
-    protected abstract String resourceBundlePrefixId();
-
-    /**
-     * Implement this method to process intention.
-     *
-     * @param project The project in which the availability is checked.
-     * @param editor  The editor in which the intention will be invoked.
-     * @param element The element under caret.
-     */
-    protected abstract void processIntention( @NotNull Project project,
-                                              @NotNull Editor editor,
-                                              @NotNull PsiElement element );
-
-    public void invoke( @NotNull Project project, Editor editor, PsiFile file )
-        throws IncorrectOperationException
-    {
-        if( isFileReadOnly( project, file ) )
-        {
-            return;
-        }
-
-        final PsiElement element = findMatchingElement( file, editor );
-        if( element == null )
-        {
-            return;
-        }
-
-        processIntention( project, editor, element );
-    }
-
-    protected static boolean isFileReadOnly( @NotNull Project project, @NotNull PsiFile file )
-    {
-        VirtualFile virtualFile = file.getVirtualFile();
-        ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance( project );
-        ReadonlyStatusHandler.OperationStatus operationStatus =
-            readonlyStatusHandler.ensureFilesWritable( virtualFile );
-        return operationStatus.hasReadonlyFiles();
-    }
-
-    @Nullable
-    private PsiElement findMatchingElement( @NotNull PsiFile file, @NotNull Editor editor )
-    {
-        CaretModel caretModel = editor.getCaretModel();
-        int position = caretModel.getOffset();
-        PsiElement element = file.findElementAt( position );
-        return findMatchingElement( element );
-    }
-
-    @Nullable
-    private PsiElement findMatchingElement( @Nullable PsiElement element )
-    {
-        while( element != null )
-        {
-            if( isIntentionValidFor( element ) )
-            {
-                return element;
-            }
-            else
-            {
-                element = element.getParent();
-                if( element instanceof PsiFile )
-                {
-                    break;
-                }
-            }
-        }
-
-        return null;
-    }
-
-    @Override
-    public boolean isAvailable( @NotNull Project project, Editor editor, @Nullable PsiElement element )
-    {
-        return isIntentionValidFor( element );
-    }
-
-    @NotNull
-    public final String getFamilyName()
-    {
-        return message( resourceBundlePrefixId() + ".family.name" );
-    }
-
-    @NotNull
-    @Override
-    public final String getText()
-    {
-        return message( resourceBundlePrefixId() + ".name" );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
deleted file mode 100644
index 4840a04..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.psi;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static java.util.Collections.emptyList;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class PsiAnnotationUtil
-{
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getAnnotationDefaultParameterValue( @Nullable PsiAnnotation annotation )
-    {
-        if( annotation == null )
-        {
-            return emptyList();
-        }
-
-        List<PsiAnnotationMemberValue> defaultParameterValues = new LinkedList<PsiAnnotationMemberValue>();
-
-        PsiAnnotationParameterList list = annotation.getParameterList();
-        PsiNameValuePair[] attributes = list.getAttributes();
-        for( PsiNameValuePair valuePair : attributes )
-        {
-            String parameterName = valuePair.getName();
-            if( parameterName == null || PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals( parameterName ) )
-            {
-                PsiAnnotationMemberValue value = valuePair.getValue();
-                if( value == null )
-                {
-                    continue;
-                }
-
-                if( value instanceof PsiArrayInitializerMemberValue )
-                {
-                    // If It's an array
-                    PsiArrayInitializerMemberValue valueWrapper = (PsiArrayInitializerMemberValue) value;
-                    PsiAnnotationMemberValue[] values = valueWrapper.getInitializers();
-                    for( PsiAnnotationMemberValue psiAnnotationMemberValue : values )
-                    {
-                        if( psiAnnotationMemberValue != null )
-                        {
-                            defaultParameterValues.add( psiAnnotationMemberValue );
-                        }
-                    }
-                }
-                else
-                {
-                    // If there's only one value
-                    defaultParameterValues.add( value );
-                }
-
-                break;
-            }
-        }
-
-        return defaultParameterValues;
-    }
-
-    @Nullable
-    public static PsiJavaCodeReferenceElement getClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        if( value instanceof PsiClassObjectAccessExpression )
-        {
-            PsiClassObjectAccessExpression objectAccessExpression = (PsiClassObjectAccessExpression) value;
-            PsiTypeElement typeElement = objectAccessExpression.getOperand();
-            return typeElement.getInnermostComponentReferenceElement();
-        }
-
-        return null;
-    }
-}


[67/81] [abbrv] zest-java git commit: ZEST-195 ; Fix file names.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-ca.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-ca.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-ca.jceks
new file mode 100644
index 0000000..e288b8c
Binary files /dev/null and b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-ca.jceks differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-client-cert.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-client-cert.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-client-cert.jceks
new file mode 100644
index 0000000..aae1ee1
Binary files /dev/null and b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-client-cert.jceks differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-server-cert.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-server-cert.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-server-cert.jceks
new file mode 100644
index 0000000..5311cd7
Binary files /dev/null and b/libraries/http/src/test/resources/org/apache/polygene/library/http/polygene-lib-http-unittests-server-cert.jceks differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-ca.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-ca.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-ca.jceks
deleted file mode 100644
index e288b8c..0000000
Binary files a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-ca.jceks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-client-cert.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-client-cert.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-client-cert.jceks
deleted file mode 100644
index aae1ee1..0000000
Binary files a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-client-cert.jceks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-server-cert.jceks
----------------------------------------------------------------------
diff --git a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-server-cert.jceks b/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-server-cert.jceks
deleted file mode 100644
index 5311cd7..0000000
Binary files a/libraries/http/src/test/resources/org/apache/polygene/library/http/zest-lib-http-unittests-server-cert.jceks and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractPolygeneServletBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractPolygeneServletBootstrap.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractPolygeneServletBootstrap.java
new file mode 100644
index 0000000..3a0ee39
--- /dev/null
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractPolygeneServletBootstrap.java
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.servlet.lifecycle;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.library.servlet.PolygeneServlet;
+import org.apache.polygene.library.servlet.PolygeneServletSupport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Abstract ServletContextListener implementing ApplicationAssembler.
+ *
+ * Extends this class to easily bind a Polygene Application activation/passivation to your webapp lifecycle.
+ *
+ * The {@link Application} is set as a {@link ServletContext} attribute named using a constant.
+ * In your servlets, filters, whatever has access to the {@link ServletContext} use the following code to get a
+ * handle on the {@link Application}:
+ *
+ * <pre>
+ *  org.apache.polygene.api.structure.Application application;
+ *
+ *  application = ( Application ) servletContext.getAttribute( PolygeneServletSupport.APP_IN_CTX );
+ *
+ *  // Or, shorter:
+ *
+ *  application = PolygeneServletSupport.application( servletContext );
+ *
+ * </pre>
+ *
+ * Rembember that the servlet specification states:
+ *
+ * In cases where the container is distributed over many virtual machines, a Web application will have an instance of
+ * the ServletContext for each JVM.
+ *
+ * Context attributes are local to the JVM in which they were created. This prevents ServletContext attributes from
+ * being a shared memory store in a distributed container. When information needs to be shared between servlets running
+ * in a distributed environment, the information should be placed into a session, stored in a database, or set in an
+ * Enterprise JavaBeans component.
+ */
+public abstract class AbstractPolygeneServletBootstrap
+        implements ServletContextListener, ApplicationAssembler
+{
+
+    private static final Logger LOGGER = LoggerFactory.getLogger( PolygeneServlet.class.getPackage().getName() );
+    // Polygene Runtime
+    protected PolygeneAPI api;
+    protected Energy4Java polygene;
+    // Polygene Application
+    protected ApplicationDescriptor applicationModel;
+    protected Application application;
+
+    @Override
+    public final void contextInitialized( ServletContextEvent sce )
+    {
+        try {
+
+            ServletContext context = sce.getServletContext();
+
+            LOGGER.trace( "Assembling Application" );
+            polygene = new Energy4Java();
+            applicationModel = polygene.newApplicationModel( this );
+
+            LOGGER.trace( "Instanciating and activating Application" );
+            application = applicationModel.newInstance( polygene.api() );
+            api = polygene.api();
+            beforeApplicationActivation( application );
+            application.activate();
+            afterApplicationActivation( application );
+
+            LOGGER.trace( "Storing Application in ServletContext" );
+            context.setAttribute( PolygeneServletSupport.APP_IN_CTX, application );
+
+        } catch ( Exception ex ) {
+            if ( application != null ) {
+                try {
+                    beforeApplicationPassivation( application );
+                    application.passivate();
+                    afterApplicationPassivation( application );
+                } catch ( Exception ex1 ) {
+                    LOGGER.warn( "Application not null and could not passivate it.", ex1 );
+                }
+            }
+            throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex );
+        }
+    }
+
+    protected void beforeApplicationActivation( Application app )
+    {
+    }
+
+    protected void afterApplicationActivation( Application app )
+    {
+    }
+
+    @Override
+    public final void contextDestroyed( ServletContextEvent sce )
+    {
+        try {
+            if ( application != null ) {
+                beforeApplicationPassivation( application );
+                application.passivate();
+                afterApplicationPassivation( application );
+            }
+        } catch ( Exception ex ) {
+            LOGGER.warn( "Unable to passivate Polygene Application.", ex );
+        }
+    }
+
+    protected void beforeApplicationPassivation( Application app )
+    {
+    }
+
+    protected void afterApplicationPassivation( Application app )
+    {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
deleted file mode 100644
index 3a0ee39..0000000
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.servlet.lifecycle;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.api.common.InvalidApplicationException;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.library.servlet.PolygeneServlet;
-import org.apache.polygene.library.servlet.PolygeneServletSupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract ServletContextListener implementing ApplicationAssembler.
- *
- * Extends this class to easily bind a Polygene Application activation/passivation to your webapp lifecycle.
- *
- * The {@link Application} is set as a {@link ServletContext} attribute named using a constant.
- * In your servlets, filters, whatever has access to the {@link ServletContext} use the following code to get a
- * handle on the {@link Application}:
- *
- * <pre>
- *  org.apache.polygene.api.structure.Application application;
- *
- *  application = ( Application ) servletContext.getAttribute( PolygeneServletSupport.APP_IN_CTX );
- *
- *  // Or, shorter:
- *
- *  application = PolygeneServletSupport.application( servletContext );
- *
- * </pre>
- *
- * Rembember that the servlet specification states:
- *
- * In cases where the container is distributed over many virtual machines, a Web application will have an instance of
- * the ServletContext for each JVM.
- *
- * Context attributes are local to the JVM in which they were created. This prevents ServletContext attributes from
- * being a shared memory store in a distributed container. When information needs to be shared between servlets running
- * in a distributed environment, the information should be placed into a session, stored in a database, or set in an
- * Enterprise JavaBeans component.
- */
-public abstract class AbstractPolygeneServletBootstrap
-        implements ServletContextListener, ApplicationAssembler
-{
-
-    private static final Logger LOGGER = LoggerFactory.getLogger( PolygeneServlet.class.getPackage().getName() );
-    // Polygene Runtime
-    protected PolygeneAPI api;
-    protected Energy4Java polygene;
-    // Polygene Application
-    protected ApplicationDescriptor applicationModel;
-    protected Application application;
-
-    @Override
-    public final void contextInitialized( ServletContextEvent sce )
-    {
-        try {
-
-            ServletContext context = sce.getServletContext();
-
-            LOGGER.trace( "Assembling Application" );
-            polygene = new Energy4Java();
-            applicationModel = polygene.newApplicationModel( this );
-
-            LOGGER.trace( "Instanciating and activating Application" );
-            application = applicationModel.newInstance( polygene.api() );
-            api = polygene.api();
-            beforeApplicationActivation( application );
-            application.activate();
-            afterApplicationActivation( application );
-
-            LOGGER.trace( "Storing Application in ServletContext" );
-            context.setAttribute( PolygeneServletSupport.APP_IN_CTX, application );
-
-        } catch ( Exception ex ) {
-            if ( application != null ) {
-                try {
-                    beforeApplicationPassivation( application );
-                    application.passivate();
-                    afterApplicationPassivation( application );
-                } catch ( Exception ex1 ) {
-                    LOGGER.warn( "Application not null and could not passivate it.", ex1 );
-                }
-            }
-            throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex );
-        }
-    }
-
-    protected void beforeApplicationActivation( Application app )
-    {
-    }
-
-    protected void afterApplicationActivation( Application app )
-    {
-    }
-
-    @Override
-    public final void contextDestroyed( ServletContextEvent sce )
-    {
-        try {
-            if ( application != null ) {
-                beforeApplicationPassivation( application );
-                application.passivate();
-                afterApplicationPassivation( application );
-            }
-        } catch ( Exception ex ) {
-            LOGGER.warn( "Unable to passivate Polygene Application.", ex );
-        }
-    }
-
-    protected void beforeApplicationPassivation( Application app )
-    {
-    }
-
-    protected void afterApplicationPassivation( Application app )
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest-context.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest-context.xml b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest-context.xml
new file mode 100644
index 0000000..1e29446
--- /dev/null
+++ b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest-context.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
+    xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+       http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd">
+
+    <polygene:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap" />
+    <polygene:service id="commentService" />
+
+    <bean id="commentServiceHolder" class="org.apache.polygene.library.spring.bootstrap.CommentServiceHolder">
+        <constructor-arg ref="commentService" />
+    </bean>
+
+    <!-- This Spring bean is injected as a service to the Apache Polygene application -->
+    <bean id="toUppercaseService" class="org.apache.polygene.library.spring.bootstrap.ToUppercaseService" />
+
+</beans>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
deleted file mode 100644
index 1e29446..0000000
--- a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
-    xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-       http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd">
-
-    <polygene:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap" />
-    <polygene:service id="commentService" />
-
-    <bean id="commentServiceHolder" class="org.apache.polygene.library.spring.bootstrap.CommentServiceHolder">
-        <constructor-arg ref="commentService" />
-    </bean>
-
-    <!-- This Spring bean is injected as a service to the Apache Polygene application -->
-    <bean id="toUppercaseService" class="org.apache.polygene.library.spring.bootstrap.ToUppercaseService" />
-
-</beans>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest-context.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest-context.xml b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest-context.xml
new file mode 100644
index 0000000..24bc63f
--- /dev/null
+++ b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest-context.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+  <bean id="commentService" class="org.apache.polygene.library.spring.importer.CommentServiceBean"/>
+  <bean id="commentService2" class="org.apache.polygene.library.spring.importer.CommentServiceBean2"/>
+</beans>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/ZestImportServiceTest-context.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/ZestImportServiceTest-context.xml b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/ZestImportServiceTest-context.xml
deleted file mode 100644
index 24bc63f..0000000
--- a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/importer/ZestImportServiceTest-context.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-  <bean id="commentService" class="org.apache.polygene.library.spring.importer.CommentServiceBean"/>
-  <bean id="commentService2" class="org.apache.polygene.library.spring.importer.CommentServiceBean2"/>
-</beans>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/docs/tutorials/howto-depend-on-polygene.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-depend-on-polygene.txt b/manual/src/docs/tutorials/howto-depend-on-polygene.txt
new file mode 100644
index 0000000..d71fd71
--- /dev/null
+++ b/manual/src/docs/tutorials/howto-depend-on-polygene.txt
@@ -0,0 +1,193 @@
+///////////////////////////////////////////////////////////////
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+///////////////////////////////////////////////////////////////
+
+[[howto-depend-on-polygene,Depend on Polygene\u2122 in your build]]
+= Depend on Polygene\u2122 in your build =
+
+NOTE: Some of the <<libraries>> and <<extensions>> depend on artifacts that are not deployed in central, you'll need to
+add other repositories to your build scripts accordingly.
+
+Release artifacts, including sources and javadoc, are deployed to Maven Central:
+
+http://repo1.maven.org/maven2/ (US)
+
+http://uk.maven.org/maven2/ (Europe)
+
+Snapshot artifacts, including sources and javadoc, are built against the `develop` branch and deployed weekly to the Apache SNAPSHOTS repository:
+
+http://repository.apache.org/snapshots/
+
+
+== Manually ==
+
+If you don't rely on your build scripts dependency resolution mechanism you should
+https://polygene.apache.org/download.html[download] the SDK distribution.
+
+
+== Using Maven ==
+
+You simply declare dependencies on Polygene\u2122 artifacts:
+
+[source,xml]
+----
+<dependencies>
+    <dependency>
+        <groupId>org.apache.polygene.core</groupId>
+        <artifactId>org.apache.polygene.core.bootstrap</artifactId>
+        <version>POLYGENE_VERSION</version>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.polygene.core</groupId>
+        <artifactId>org.apache.polygene.core.runtime</artifactId>
+        <version>POLYGENE_VERSION</version>
+        <scope>runtime</scope>
+    </dependency>
+    <dependency>
+        <groupId>org.apache.polygene.core</groupId>
+        <artifactId>org.apache.polygene.core.testsupport</artifactId>
+        <version>POLYGENE_VERSION</version>
+        <scope>test</scope>
+    </dependency>
+</dependencies>
+----
+
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
+
+If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
+
+[source,xml]
+----
+<repositories>
+    <repository>
+        <id>apache-snapshots</id>
+        <url>https://repository.apache.org/snapshots/</url>
+        <releases><enabled>false</enabled></releases>
+        <snapshots><enabled>true</enabled></snapshots>
+    </repository>
+</repositories>
+----
+
+
+== Using Gradle ==
+
+You simply declare dependencies on Polygene\u2122 artifacts:
+
+[source,groovy]
+----
+dependencies {
+    compile     "org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION"
+    runtime     "org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION"
+}
+----
+
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
+
+If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
+
+[source,groovy]
+----
+repositories {
+    maven { name 'apache-snapshots'; url "https://repository.apache.org/snapshots/" }
+}
+----
+
+
+== Using Buildr ==
+
+You simply declare dependencies on Polygene\u2122 artifacts:
+
+[source,ruby]
+----
+compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION'
+package(:war).with :libs => 'org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION'
+test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION'
+----
+
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
+
+If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
+
+[source,ruby]
+----
+repositories.remote << 'https://repository.apache.org/snapshots/'
+----
+
+
+== Using SBT ==
+
+You simply declare dependencies on Polygene\u2122 artifacts:
+
+[source,scala]
+----
+libraryDependencies += \
+    "org.apache.polygene.core" % "org.apache.polygene.core.bootstrap" % "POLYGENE_VERSION" \
+    withSources() withJavadoc()
+libraryDependencies += \
+    "org.apache.polygene.core" % "org.apache.polygene.core.runtime" % "POLYGENE_VERSION" % "runtime" \
+    withSources() withJavadoc()
+libraryDependencies += \
+    "org.apache.polygene.core" % "org.apache.polygene.core.testsupport" % "POLYGENE_VERSION" % "test" \
+    withSources() withJavadoc()
+----
+
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
+
+If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
+
+[source,scala]
+----
+resolvers += "apache-snapshots" at "https://repository.apache.org/snapshots/"
+----
+
+
+== Using Ivy ==
+
+You simply declare dependencies on Polygene\u2122 artifacts:
+
+[source,xml]
+----
+<ivy-module>
+    <dependencies>
+        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.bootstrap"
+                    rev="POLYGENE_VERSION"  conf="default" />
+        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.runtime"
+                    rev="POLYGENE_VERSION"  conf="runtime" />
+        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.testsupport"
+                    rev="POLYGENE_VERSION"  conf="test" />
+    </dependencies>
+</ivy-module>
+----
+
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
+
+If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository in a `ivysettings.xml` file:
+
+[source,xml]
+----
+<ivysettings>
+    <settings defaultResolver="chain"/>
+    <resolvers>
+        <chain name="chain">
+            <ibiblio name="apache-snapshots" m2compatible="true"
+                     root="https://repository.apache.org/snapshots/"/>
+        </chain>
+    </resolvers>
+</ivysettings>
+----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/docs/tutorials/howto-depend-on-zest.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-depend-on-zest.txt b/manual/src/docs/tutorials/howto-depend-on-zest.txt
deleted file mode 100644
index d71fd71..0000000
--- a/manual/src/docs/tutorials/howto-depend-on-zest.txt
+++ /dev/null
@@ -1,193 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
-///////////////////////////////////////////////////////////////
-
-[[howto-depend-on-polygene,Depend on Polygene\u2122 in your build]]
-= Depend on Polygene\u2122 in your build =
-
-NOTE: Some of the <<libraries>> and <<extensions>> depend on artifacts that are not deployed in central, you'll need to
-add other repositories to your build scripts accordingly.
-
-Release artifacts, including sources and javadoc, are deployed to Maven Central:
-
-http://repo1.maven.org/maven2/ (US)
-
-http://uk.maven.org/maven2/ (Europe)
-
-Snapshot artifacts, including sources and javadoc, are built against the `develop` branch and deployed weekly to the Apache SNAPSHOTS repository:
-
-http://repository.apache.org/snapshots/
-
-
-== Manually ==
-
-If you don't rely on your build scripts dependency resolution mechanism you should
-https://polygene.apache.org/download.html[download] the SDK distribution.
-
-
-== Using Maven ==
-
-You simply declare dependencies on Polygene\u2122 artifacts:
-
-[source,xml]
-----
-<dependencies>
-    <dependency>
-        <groupId>org.apache.polygene.core</groupId>
-        <artifactId>org.apache.polygene.core.bootstrap</artifactId>
-        <version>POLYGENE_VERSION</version>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.polygene.core</groupId>
-        <artifactId>org.apache.polygene.core.runtime</artifactId>
-        <version>POLYGENE_VERSION</version>
-        <scope>runtime</scope>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.polygene.core</groupId>
-        <artifactId>org.apache.polygene.core.testsupport</artifactId>
-        <version>POLYGENE_VERSION</version>
-        <scope>test</scope>
-    </dependency>
-</dependencies>
-----
-
-Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
-
-If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
-
-[source,xml]
-----
-<repositories>
-    <repository>
-        <id>apache-snapshots</id>
-        <url>https://repository.apache.org/snapshots/</url>
-        <releases><enabled>false</enabled></releases>
-        <snapshots><enabled>true</enabled></snapshots>
-    </repository>
-</repositories>
-----
-
-
-== Using Gradle ==
-
-You simply declare dependencies on Polygene\u2122 artifacts:
-
-[source,groovy]
-----
-dependencies {
-    compile     "org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION"
-    runtime     "org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION"
-}
-----
-
-Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
-
-If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
-
-[source,groovy]
-----
-repositories {
-    maven { name 'apache-snapshots'; url "https://repository.apache.org/snapshots/" }
-}
-----
-
-
-== Using Buildr ==
-
-You simply declare dependencies on Polygene\u2122 artifacts:
-
-[source,ruby]
-----
-compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION'
-package(:war).with :libs => 'org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION'
-test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION'
-----
-
-Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
-
-If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
-
-[source,ruby]
-----
-repositories.remote << 'https://repository.apache.org/snapshots/'
-----
-
-
-== Using SBT ==
-
-You simply declare dependencies on Polygene\u2122 artifacts:
-
-[source,scala]
-----
-libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.bootstrap" % "POLYGENE_VERSION" \
-    withSources() withJavadoc()
-libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.runtime" % "POLYGENE_VERSION" % "runtime" \
-    withSources() withJavadoc()
-libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.testsupport" % "POLYGENE_VERSION" % "test" \
-    withSources() withJavadoc()
-----
-
-Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
-
-If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
-
-[source,scala]
-----
-resolvers += "apache-snapshots" at "https://repository.apache.org/snapshots/"
-----
-
-
-== Using Ivy ==
-
-You simply declare dependencies on Polygene\u2122 artifacts:
-
-[source,xml]
-----
-<ivy-module>
-    <dependencies>
-        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.bootstrap"
-                    rev="POLYGENE_VERSION"  conf="default" />
-        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.runtime"
-                    rev="POLYGENE_VERSION"  conf="runtime" />
-        <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.testsupport"
-                    rev="POLYGENE_VERSION"  conf="test" />
-    </dependencies>
-</ivy-module>
-----
-
-Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
-
-If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository in a `ivysettings.xml` file:
-
-[source,xml]
-----
-<ivysettings>
-    <settings defaultResolver="chain"/>
-    <resolvers>
-        <chain name="chain">
-            <ibiblio name="apache-snapshots" m2compatible="true"
-                     root="https://repository.apache.org/snapshots/"/>
-        </chain>
-    </resolvers>
-</ivysettings>
-----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/docs/website/resources/css/polygene.css
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/resources/css/polygene.css b/manual/src/docs/website/resources/css/polygene.css
new file mode 100644
index 0000000..d512429
--- /dev/null
+++ b/manual/src/docs/website/resources/css/polygene.css
@@ -0,0 +1,825 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+ */
+
+span.remark
+{
+    background: yellow;
+}
+
+td p
+{
+    margin: 0.125em 0;
+}
+
+#disqus_thread
+{
+    max-width: 40em;
+}
+
+body #toolbar_item command_help
+{
+    /* display: none !important; */
+}
+
+pre {
+    max-width: 55em;
+    overflow: scroll;
+}
+
+.syntaxhighlighter a,
+.syntaxhighlighter div,
+.syntaxhighlighter code,
+.syntaxhighlighter table,
+.syntaxhighlighter table td,
+.syntaxhighlighter table tr,
+.syntaxhighlighter table tbody,
+.syntaxhighlighter table thead,
+.syntaxhighlighter table caption,
+.syntaxhighlighter textarea
+{
+    font-size: 12px !important;
+    font-family: Consolas, Monaco, "Bitstream Vera Sans Mono", monospace !important;
+    line-height: 14px !important;
+}
+
+.syntaxhighlighter {
+    background-color: rgba(11,117,188,0.1) !important;
+    /*
+    overflow: visible !important;
+    */
+    border: 1px solid #0b75bc;
+    padding: 8px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    border-radius: 5px;
+}
+
+.syntaxhighlighter .line.alt1 {
+    background-color: rgba(11,117,188,0.05) !important;
+}
+.syntaxhighlighter .line.alt2 {
+    background-color:  rgba(11,117,188,0.1)  !important;
+}
+
+html
+{
+    text-align: center;
+}
+
+html body
+{
+    background: url("bg.png");
+    margin: 0 auto;
+    text-align: left;
+}
+
+div.navheader, div.navfooter {
+    padding: 0 5%;
+}
+
+body, div.navheader th, div.navheader td, div.navfooter td
+{
+    font-family: Georgia, "Times New Roman", Times, serif;
+    color: #4c4c4c;
+}
+
+a {
+    color: #0b75bc;
+}
+
+a:hover {
+    text-decoration: none;
+}
+
+a:visited {
+    color: #0b75bc;
+    /* color: #08568a; */
+}
+
+hr {
+    border-color: #0b75bc;
+    border-style: solid;
+}
+
+.navheader a {
+    color: #acacac;
+    text-decoration: none;
+    font-family: Helvetica, Arial, sans-serif;
+}
+
+.navheader a:hover, .navfooter a:hover {
+    text-decoration: underline;
+}
+
+h1, h2, h3, h4, h5, h6,
+div.toc p b,
+div.important th, div.info th, div.tip th,
+div.warning th, div.note th, div.caution th,
+p.legalnotice-title,
+div.refnamediv p,
+div.sidebar p.title,
+th,
+div.table-contents td p span.strong strong,
+tr.question td b p
+{
+    color: #0b75bc;
+    font-family: Helvetica, Arial, sans-serif;
+    text-shadow: 0 1px 0 #fff;
+}
+
+
+.book, .chapter, .part {
+    width:90%;
+    margin: 0 auto;
+}
+
+td p strong
+{
+    font-size: 1.067em;
+}
+
+tr.question td b p
+{
+    font-size: 1em;
+    margin: 0.5em 0 0 0;
+}
+
+tr.question td
+{
+    padding: 0;
+}
+
+tr.answer td, tr.answer td p
+{
+    padding-top: 0;
+}
+
+tr.answer td
+{
+    padding-left: 1em;
+}
+
+div.navheader
+{
+    height: 50px;
+    background: url(../../../../resources/css/navHead_bg.png) repeat-x;
+}
+
+div.navheader hr
+{
+    display: none;
+}
+
+div.refentry body h2.title, div.refentry body h1.title, div.refentry div.refnamediv p,
+body > div.section h1, body > div.section h2,
+body > div.part h1, body > div.part h2,
+body > div.chapter h1, body > div.chapter h2,
+body > div.book h1,
+body > div.preface h2,
+body > div.appendix h2
+{
+    border-bottom: none;
+    margin-top: 2.2em;
+    margin-bottom: .7em;
+}
+
+div.legalnotice
+{
+    padding-top: 3em;
+}
+
+p.legalnotice-title b
+{
+    font-size: 1.5em;
+    font-style: normal;
+    font-weight: bold;
+}
+
+p.legalnotice-title
+{
+    margin-bottom: 2em;
+}
+
+body > div.book h1.title
+{
+    margin-top: 0.5em;
+    padding-top: 0;
+    margin-bottom: 0;
+}
+
+div.part h1.title
+{
+    margin-top: 1.5em;
+}
+
+.book div.titlepage {
+    position: absolute;
+    top: 40px;
+    background: url(logo.png) no-repeat left top;
+    min-height: 250px;
+    padding-left: 150px;
+}
+
+.book div.titlepage .authorgroup {
+    font-size: 150%;
+}
+
+.book div.titlepage hr {
+    display: none;
+}
+
+div.titlepage h3.corpauthor
+{
+}
+
+div.refnamediv
+{
+    padding-top: 24px;
+    margin-bottom: 24px;
+}
+
+div.refsynopsisdiv h2, div.refsect1 h2
+{
+    border-bottom: none;
+}
+
+div.titlepage h3.corpauthor a.ulink, div.titlepage h3.corpauthor a.ulink:link,
+div.titlepage h3.corpauthor a.ulink:visited, div.titlepage h3.corpauthor a.ulink:hover
+div.titlepage h3.corpauthor a.ulink:focus, div.titlepage h3.corpauthor a.ulink:active
+{
+    color: #dddddd;
+    text-decoration: none;
+    font-style: normal;
+    padding-left: 0.6em;
+}
+
+div.refnamediv h2
+{
+    display: none;
+}
+
+div.refnamediv p
+{
+    font-size: 1em;
+    font-weight: bold;
+    margin-top: 3em;
+    margin-bottom: 2em;
+    width: 60%;
+    line-height: 1.2;
+}
+
+p, li, dt, div.navheader th, div.navheader td, div.navfooter td
+{
+    font-family: Georgia, "Times New Roman", Times, serif;
+    font-size: .9375em;
+    text-shadow: 0 1px 0 #fff;
+}
+
+p, ul, ol
+{
+    margin-top: 0;
+    margin-bottom: 1em;
+}
+
+li p
+{
+    margin-bottom: 0.5em;
+}
+
+div.list-of-figures p, div.list-of-tables p
+{
+    margin-top: 1.5em;
+}
+
+div.list-of-figures p b, div.list-of-tables p b, div.sidebar p b
+{
+    font-style: normal;
+    font-weight: bold;
+}
+
+div.toc
+{
+    margin-bottom: 1em;
+}
+
+.book .toc {
+    margin-top: 220px;
+}
+
+div.toc p {
+    width: 100%;
+    font-family: Helvetica, Arial, sans-serif;
+    color: #0b75bc;
+    font-size: 120%;
+    border-bottom: 1px solid #0b75bc;
+}
+
+div.toc a, div.toc a:visited {
+    color: #0b75bc;
+}
+
+div.toc dt {
+    margin-bottom: 8px;
+}
+
+div.toc dl dl {
+    margin: 5px 0;
+}
+
+p.copyright
+{
+    margin: 0;
+    padding: 10px 0 5px 0;
+    text-align: center;
+    max-width: 100%;
+    background: #0b75bc url(../../../../resources/css/copyright_bg.png) repeat-x top;
+    color: #fff;
+    text-shadow: none;
+    border-bottom: 1px solid #095e96;
+}
+
+.titlepage p.copyright {
+    background: none;
+    border: none;
+    text-align: left;
+    color: #0b75bc;
+}
+
+code.literal
+{
+    font-family: Consolas, Monaco, monospace;
+    font-size: .9375em;
+}
+
+td code.literal
+{
+    font-size: .8em;
+}
+
+li
+{
+    line-height: 1.3em;
+}
+
+p
+{
+    line-height: 1.6em;
+}
+
+.toc p {
+    max-width: 100%;
+}
+
+ul, ol
+{
+    max-width: 38em;
+}
+
+div.sidebar
+{
+    max-width: 30em;
+    padding: 0.67em 1em;
+    background: #c1d5d9 url("../../../../resources/css/content-bg.png") repeat-x;
+}
+
+div.sidebar p.title
+{
+    margin: 0;
+}
+
+div.sidebar ul
+{
+    margin-top: 0.3em;
+    margin-bottom: 0.3em;
+}
+
+p b, div.figure p.title b, div.table p.title b
+{
+    font-style: italic;
+    font-weight: normal;
+}
+
+/* BEGIN SIDE NOTES */
+div.important, div.info, div.tip, div.note,
+div.warning, div.caution
+{
+    float: right;
+    max-width: 20em;
+    margin: 1em 0 1em 1em !important;
+    padding: 1em !important;
+    font-size: 0.9em;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    border-radius: 5px;
+}
+div.important, div.info, div.tip, div.note
+{
+    background-color:  rgba(11, 117, 188, 0.1) !important;
+    border: 1px solid #0b75bc;
+}
+div.warning
+{
+    background-color:  rgba(188, 117, 11, 0.1) !important;
+    border: 1px solid #bc750b;
+}
+div.caution
+{
+    background-color:  rgba(188, 11, 11, 0.1) !important;
+    border: 1px solid #bc0b0b;
+}
+div.important h3, div.info h3, div.tip h3, div.note h3,
+div.warning h3, div.caution h3
+{
+    margin: 0 0 0.5em 0 !important;
+    line-height: 50px;
+    padding-right: 55px;
+    background-position: top right !important;
+    background-repeat: no-repeat !important;
+}
+div.important h3
+{
+    background-image: url("important.png");
+}
+div.info h3, div.tip h3
+{
+    background-image: url("tip.png");
+}
+div.note h3
+{
+    background-image: url("note.png");
+}
+div.warning h3
+{
+    background-image: url("warning.png");
+    color: #bc750b;
+}
+div.caution h3
+{
+    background-image: url("caution.png");
+    color: #bc0b0b;
+}
+div.important p, div.info p, div.tip p, div.note p,
+div.warning p, div.caution p
+{
+    margin: 0 0 0.5em 0 !important;
+}
+/* END SIDE NOTES */
+
+
+div.table, div.informaltable
+{
+    width: 100%;
+    clear: both;
+}
+div.table div.table-contents, div.informaltable div.table-contents
+{
+    background-color: rgba(11,117,188,0.1) !important;
+    border: 1px solid #0b75bc;
+    padding: 8px;
+    -moz-border-radius: 5px;
+    -webkit-border-radius: 5px;
+    border-radius: 5px;
+}
+
+div.table table, div.informaltable table
+{
+    width: 100%;
+    border: none;
+    border-collapse: collapse;
+}
+
+td, th
+{
+    padding: 2px 4px;
+}
+
+div.table table, div.informaltable table,
+div.table table th, div.informaltable table th,
+div.table table td, div.informaltable table td,
+div.table table tr, div.informaltable table tr,
+div.table table tbody, div.informaltable table tbody,
+div.table table thead, div.informaltable table thead,
+div.table table tfoot, div.informaltable table tfoot
+{
+    font-size: 15px;
+    text-align: center;
+}
+div.table table td,
+div.informaltable table td,
+div.table table th,
+div.informaltable table th
+{
+    border: 1px solid #3D8AC9;
+}
+div.table table tr:first-child th,
+div.informaltable table tr:first-child th
+{
+  border-top: 0;
+}
+div.table table tr:last-child td,
+div.informaltable table tr:last-child td
+{
+  border-bottom: 0;
+}
+div.table table tr td:first-child,
+div.informaltable table tr td:first-child,
+div.table table tr th:first-child,
+div.informaltable table tr th:first-child
+{
+  border-left: 0;
+}
+div.table table tr td:last-child,
+div.informaltable table tr td:last-child,
+div.table table tr th:last-child,
+div.informaltable table tr th:last-child
+{
+  border-right: 0;
+}
+
+div.queryresult table tbody td p code.literal
+{
+    color: #000000;
+}
+
+div.queryresult table thead tr,
+div.queryresult table tfoot tr
+{
+    background: #cad9dc;
+}
+
+div.queryresult table tbody
+{
+    background: #d1dee1;
+}
+
+div.queryresult table tbody tr.evenresult
+{
+    background: #dfe8eb;
+}
+
+div.queryresult table thead th
+{
+    font-size: 0.9375em;
+}
+
+div.queryresult table tfoot th
+{
+    font-size: 0.8125em;
+    font-weight: normal;
+}
+
+div.table table th, div.informaltable table th
+{
+    color: #3D8AC9;
+}
+div.table-contents td p span.strong strong
+{
+    color: #333333;
+}
+
+div.informaltable span.strong strong
+{
+    font-weight: normal;
+    font-style: italic;
+}
+
+div.informalfigure a img, div.figure a img
+{
+    border: none;
+}
+
+/* additional styles for slides */
+
+div.slide h1
+{
+    margin-top: 40px;
+    margin-bottom: 1em;
+    color: white;
+    border-bottom: none;
+}
+
+div.slide p, div.slide li
+{
+    font-size: 1.25em;
+}
+
+.navfooter{
+    background: #0b75bc;
+    border: 1px solid #0b75bc;
+    border-top: 1px solid #3c91c9;
+}
+
+.navfooter a {
+    color: #fff;
+    color: rgba(255,255,255,0.8);
+    text-decoration: none;
+    text-shadow: none;
+    font-family: Helvetica, Arial, sans-serif;
+}
+
+h1 { font-size: 1.8em; margin-bottom: 1em; }
+h2 { font-size: 1.6em; margin-bottom: 1em; }
+h3 { font-size: 1.4em; margin-bottom: 1em; }
+h4 { font-size: 1.2em; margin-bottom: 0.5em; }
+h5 { font-size: 1em; margin-bottom: 0.5em; }
+
+.devstatus-code-none {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #f08080;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-code-early {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: orange;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-code-beta {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bold;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: yellow;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-code-stable {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #adff2f;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-code-mature {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #7cfc00;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-docs-none {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #f08080;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-docs-brief {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: yellow;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-docs-good {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #adff2f;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-docs-complete {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #7cfc00;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-tests-none {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #f08080;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-tests-some {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: yellow;
+    text-align: center;
+    text-shadow: none  !important;
+}
+.devstatus-tests-good {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #adff2f;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+.devstatus-tests-complete {
+    border: solid black 2px;
+    margin-right: 5px !important;
+    display: block;
+    float: right;
+    width: 4em;
+    font-size: 10pt !important;
+    font-weight: bolder;
+    font-family: "Courier New", "Courier", monospace !important;
+    background-color: #7cfc00;
+    text-align: center;
+    text-shadow: none  !important;
+}
+
+
+.section .variablelist dt .term {
+    font-weight: bolder;
+    font-family: Consolas, Monaco, monospace;
+    background: #DEDEDE;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/docs/website/resources/css/zest.css
----------------------------------------------------------------------
diff --git a/manual/src/docs/website/resources/css/zest.css b/manual/src/docs/website/resources/css/zest.css
deleted file mode 100644
index d512429..0000000
--- a/manual/src/docs/website/resources/css/zest.css
+++ /dev/null
@@ -1,825 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
- */
-
-span.remark
-{
-    background: yellow;
-}
-
-td p
-{
-    margin: 0.125em 0;
-}
-
-#disqus_thread
-{
-    max-width: 40em;
-}
-
-body #toolbar_item command_help
-{
-    /* display: none !important; */
-}
-
-pre {
-    max-width: 55em;
-    overflow: scroll;
-}
-
-.syntaxhighlighter a,
-.syntaxhighlighter div,
-.syntaxhighlighter code,
-.syntaxhighlighter table,
-.syntaxhighlighter table td,
-.syntaxhighlighter table tr,
-.syntaxhighlighter table tbody,
-.syntaxhighlighter table thead,
-.syntaxhighlighter table caption,
-.syntaxhighlighter textarea
-{
-    font-size: 12px !important;
-    font-family: Consolas, Monaco, "Bitstream Vera Sans Mono", monospace !important;
-    line-height: 14px !important;
-}
-
-.syntaxhighlighter {
-    background-color: rgba(11,117,188,0.1) !important;
-    /*
-    overflow: visible !important;
-    */
-    border: 1px solid #0b75bc;
-    padding: 8px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
-    border-radius: 5px;
-}
-
-.syntaxhighlighter .line.alt1 {
-    background-color: rgba(11,117,188,0.05) !important;
-}
-.syntaxhighlighter .line.alt2 {
-    background-color:  rgba(11,117,188,0.1)  !important;
-}
-
-html
-{
-    text-align: center;
-}
-
-html body
-{
-    background: url("bg.png");
-    margin: 0 auto;
-    text-align: left;
-}
-
-div.navheader, div.navfooter {
-    padding: 0 5%;
-}
-
-body, div.navheader th, div.navheader td, div.navfooter td
-{
-    font-family: Georgia, "Times New Roman", Times, serif;
-    color: #4c4c4c;
-}
-
-a {
-    color: #0b75bc;
-}
-
-a:hover {
-    text-decoration: none;
-}
-
-a:visited {
-    color: #0b75bc;
-    /* color: #08568a; */
-}
-
-hr {
-    border-color: #0b75bc;
-    border-style: solid;
-}
-
-.navheader a {
-    color: #acacac;
-    text-decoration: none;
-    font-family: Helvetica, Arial, sans-serif;
-}
-
-.navheader a:hover, .navfooter a:hover {
-    text-decoration: underline;
-}
-
-h1, h2, h3, h4, h5, h6,
-div.toc p b,
-div.important th, div.info th, div.tip th,
-div.warning th, div.note th, div.caution th,
-p.legalnotice-title,
-div.refnamediv p,
-div.sidebar p.title,
-th,
-div.table-contents td p span.strong strong,
-tr.question td b p
-{
-    color: #0b75bc;
-    font-family: Helvetica, Arial, sans-serif;
-    text-shadow: 0 1px 0 #fff;
-}
-
-
-.book, .chapter, .part {
-    width:90%;
-    margin: 0 auto;
-}
-
-td p strong
-{
-    font-size: 1.067em;
-}
-
-tr.question td b p
-{
-    font-size: 1em;
-    margin: 0.5em 0 0 0;
-}
-
-tr.question td
-{
-    padding: 0;
-}
-
-tr.answer td, tr.answer td p
-{
-    padding-top: 0;
-}
-
-tr.answer td
-{
-    padding-left: 1em;
-}
-
-div.navheader
-{
-    height: 50px;
-    background: url(../../../../resources/css/navHead_bg.png) repeat-x;
-}
-
-div.navheader hr
-{
-    display: none;
-}
-
-div.refentry body h2.title, div.refentry body h1.title, div.refentry div.refnamediv p,
-body > div.section h1, body > div.section h2,
-body > div.part h1, body > div.part h2,
-body > div.chapter h1, body > div.chapter h2,
-body > div.book h1,
-body > div.preface h2,
-body > div.appendix h2
-{
-    border-bottom: none;
-    margin-top: 2.2em;
-    margin-bottom: .7em;
-}
-
-div.legalnotice
-{
-    padding-top: 3em;
-}
-
-p.legalnotice-title b
-{
-    font-size: 1.5em;
-    font-style: normal;
-    font-weight: bold;
-}
-
-p.legalnotice-title
-{
-    margin-bottom: 2em;
-}
-
-body > div.book h1.title
-{
-    margin-top: 0.5em;
-    padding-top: 0;
-    margin-bottom: 0;
-}
-
-div.part h1.title
-{
-    margin-top: 1.5em;
-}
-
-.book div.titlepage {
-    position: absolute;
-    top: 40px;
-    background: url(logo.png) no-repeat left top;
-    min-height: 250px;
-    padding-left: 150px;
-}
-
-.book div.titlepage .authorgroup {
-    font-size: 150%;
-}
-
-.book div.titlepage hr {
-    display: none;
-}
-
-div.titlepage h3.corpauthor
-{
-}
-
-div.refnamediv
-{
-    padding-top: 24px;
-    margin-bottom: 24px;
-}
-
-div.refsynopsisdiv h2, div.refsect1 h2
-{
-    border-bottom: none;
-}
-
-div.titlepage h3.corpauthor a.ulink, div.titlepage h3.corpauthor a.ulink:link,
-div.titlepage h3.corpauthor a.ulink:visited, div.titlepage h3.corpauthor a.ulink:hover
-div.titlepage h3.corpauthor a.ulink:focus, div.titlepage h3.corpauthor a.ulink:active
-{
-    color: #dddddd;
-    text-decoration: none;
-    font-style: normal;
-    padding-left: 0.6em;
-}
-
-div.refnamediv h2
-{
-    display: none;
-}
-
-div.refnamediv p
-{
-    font-size: 1em;
-    font-weight: bold;
-    margin-top: 3em;
-    margin-bottom: 2em;
-    width: 60%;
-    line-height: 1.2;
-}
-
-p, li, dt, div.navheader th, div.navheader td, div.navfooter td
-{
-    font-family: Georgia, "Times New Roman", Times, serif;
-    font-size: .9375em;
-    text-shadow: 0 1px 0 #fff;
-}
-
-p, ul, ol
-{
-    margin-top: 0;
-    margin-bottom: 1em;
-}
-
-li p
-{
-    margin-bottom: 0.5em;
-}
-
-div.list-of-figures p, div.list-of-tables p
-{
-    margin-top: 1.5em;
-}
-
-div.list-of-figures p b, div.list-of-tables p b, div.sidebar p b
-{
-    font-style: normal;
-    font-weight: bold;
-}
-
-div.toc
-{
-    margin-bottom: 1em;
-}
-
-.book .toc {
-    margin-top: 220px;
-}
-
-div.toc p {
-    width: 100%;
-    font-family: Helvetica, Arial, sans-serif;
-    color: #0b75bc;
-    font-size: 120%;
-    border-bottom: 1px solid #0b75bc;
-}
-
-div.toc a, div.toc a:visited {
-    color: #0b75bc;
-}
-
-div.toc dt {
-    margin-bottom: 8px;
-}
-
-div.toc dl dl {
-    margin: 5px 0;
-}
-
-p.copyright
-{
-    margin: 0;
-    padding: 10px 0 5px 0;
-    text-align: center;
-    max-width: 100%;
-    background: #0b75bc url(../../../../resources/css/copyright_bg.png) repeat-x top;
-    color: #fff;
-    text-shadow: none;
-    border-bottom: 1px solid #095e96;
-}
-
-.titlepage p.copyright {
-    background: none;
-    border: none;
-    text-align: left;
-    color: #0b75bc;
-}
-
-code.literal
-{
-    font-family: Consolas, Monaco, monospace;
-    font-size: .9375em;
-}
-
-td code.literal
-{
-    font-size: .8em;
-}
-
-li
-{
-    line-height: 1.3em;
-}
-
-p
-{
-    line-height: 1.6em;
-}
-
-.toc p {
-    max-width: 100%;
-}
-
-ul, ol
-{
-    max-width: 38em;
-}
-
-div.sidebar
-{
-    max-width: 30em;
-    padding: 0.67em 1em;
-    background: #c1d5d9 url("../../../../resources/css/content-bg.png") repeat-x;
-}
-
-div.sidebar p.title
-{
-    margin: 0;
-}
-
-div.sidebar ul
-{
-    margin-top: 0.3em;
-    margin-bottom: 0.3em;
-}
-
-p b, div.figure p.title b, div.table p.title b
-{
-    font-style: italic;
-    font-weight: normal;
-}
-
-/* BEGIN SIDE NOTES */
-div.important, div.info, div.tip, div.note,
-div.warning, div.caution
-{
-    float: right;
-    max-width: 20em;
-    margin: 1em 0 1em 1em !important;
-    padding: 1em !important;
-    font-size: 0.9em;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
-    border-radius: 5px;
-}
-div.important, div.info, div.tip, div.note
-{
-    background-color:  rgba(11, 117, 188, 0.1) !important;
-    border: 1px solid #0b75bc;
-}
-div.warning
-{
-    background-color:  rgba(188, 117, 11, 0.1) !important;
-    border: 1px solid #bc750b;
-}
-div.caution
-{
-    background-color:  rgba(188, 11, 11, 0.1) !important;
-    border: 1px solid #bc0b0b;
-}
-div.important h3, div.info h3, div.tip h3, div.note h3,
-div.warning h3, div.caution h3
-{
-    margin: 0 0 0.5em 0 !important;
-    line-height: 50px;
-    padding-right: 55px;
-    background-position: top right !important;
-    background-repeat: no-repeat !important;
-}
-div.important h3
-{
-    background-image: url("important.png");
-}
-div.info h3, div.tip h3
-{
-    background-image: url("tip.png");
-}
-div.note h3
-{
-    background-image: url("note.png");
-}
-div.warning h3
-{
-    background-image: url("warning.png");
-    color: #bc750b;
-}
-div.caution h3
-{
-    background-image: url("caution.png");
-    color: #bc0b0b;
-}
-div.important p, div.info p, div.tip p, div.note p,
-div.warning p, div.caution p
-{
-    margin: 0 0 0.5em 0 !important;
-}
-/* END SIDE NOTES */
-
-
-div.table, div.informaltable
-{
-    width: 100%;
-    clear: both;
-}
-div.table div.table-contents, div.informaltable div.table-contents
-{
-    background-color: rgba(11,117,188,0.1) !important;
-    border: 1px solid #0b75bc;
-    padding: 8px;
-    -moz-border-radius: 5px;
-    -webkit-border-radius: 5px;
-    border-radius: 5px;
-}
-
-div.table table, div.informaltable table
-{
-    width: 100%;
-    border: none;
-    border-collapse: collapse;
-}
-
-td, th
-{
-    padding: 2px 4px;
-}
-
-div.table table, div.informaltable table,
-div.table table th, div.informaltable table th,
-div.table table td, div.informaltable table td,
-div.table table tr, div.informaltable table tr,
-div.table table tbody, div.informaltable table tbody,
-div.table table thead, div.informaltable table thead,
-div.table table tfoot, div.informaltable table tfoot
-{
-    font-size: 15px;
-    text-align: center;
-}
-div.table table td,
-div.informaltable table td,
-div.table table th,
-div.informaltable table th
-{
-    border: 1px solid #3D8AC9;
-}
-div.table table tr:first-child th,
-div.informaltable table tr:first-child th
-{
-  border-top: 0;
-}
-div.table table tr:last-child td,
-div.informaltable table tr:last-child td
-{
-  border-bottom: 0;
-}
-div.table table tr td:first-child,
-div.informaltable table tr td:first-child,
-div.table table tr th:first-child,
-div.informaltable table tr th:first-child
-{
-  border-left: 0;
-}
-div.table table tr td:last-child,
-div.informaltable table tr td:last-child,
-div.table table tr th:last-child,
-div.informaltable table tr th:last-child
-{
-  border-right: 0;
-}
-
-div.queryresult table tbody td p code.literal
-{
-    color: #000000;
-}
-
-div.queryresult table thead tr,
-div.queryresult table tfoot tr
-{
-    background: #cad9dc;
-}
-
-div.queryresult table tbody
-{
-    background: #d1dee1;
-}
-
-div.queryresult table tbody tr.evenresult
-{
-    background: #dfe8eb;
-}
-
-div.queryresult table thead th
-{
-    font-size: 0.9375em;
-}
-
-div.queryresult table tfoot th
-{
-    font-size: 0.8125em;
-    font-weight: normal;
-}
-
-div.table table th, div.informaltable table th
-{
-    color: #3D8AC9;
-}
-div.table-contents td p span.strong strong
-{
-    color: #333333;
-}
-
-div.informaltable span.strong strong
-{
-    font-weight: normal;
-    font-style: italic;
-}
-
-div.informalfigure a img, div.figure a img
-{
-    border: none;
-}
-
-/* additional styles for slides */
-
-div.slide h1
-{
-    margin-top: 40px;
-    margin-bottom: 1em;
-    color: white;
-    border-bottom: none;
-}
-
-div.slide p, div.slide li
-{
-    font-size: 1.25em;
-}
-
-.navfooter{
-    background: #0b75bc;
-    border: 1px solid #0b75bc;
-    border-top: 1px solid #3c91c9;
-}
-
-.navfooter a {
-    color: #fff;
-    color: rgba(255,255,255,0.8);
-    text-decoration: none;
-    text-shadow: none;
-    font-family: Helvetica, Arial, sans-serif;
-}
-
-h1 { font-size: 1.8em; margin-bottom: 1em; }
-h2 { font-size: 1.6em; margin-bottom: 1em; }
-h3 { font-size: 1.4em; margin-bottom: 1em; }
-h4 { font-size: 1.2em; margin-bottom: 0.5em; }
-h5 { font-size: 1em; margin-bottom: 0.5em; }
-
-.devstatus-code-none {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #f08080;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-code-early {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: orange;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-code-beta {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bold;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: yellow;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-code-stable {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #adff2f;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-code-mature {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #7cfc00;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-docs-none {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #f08080;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-docs-brief {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: yellow;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-docs-good {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #adff2f;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-docs-complete {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #7cfc00;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-tests-none {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #f08080;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-tests-some {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: yellow;
-    text-align: center;
-    text-shadow: none  !important;
-}
-.devstatus-tests-good {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #adff2f;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-.devstatus-tests-complete {
-    border: solid black 2px;
-    margin-right: 5px !important;
-    display: block;
-    float: right;
-    width: 4em;
-    font-size: 10pt !important;
-    font-weight: bolder;
-    font-family: "Courier New", "Courier", monospace !important;
-    background-color: #7cfc00;
-    text-align: center;
-    text-shadow: none  !important;
-}
-
-
-.section .variablelist dt .term {
-    font-weight: bolder;
-    font-family: Consolas, Monaco, monospace;
-    background: #DEDEDE;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/resources/images/polygene-blue.png
----------------------------------------------------------------------
diff --git a/manual/src/resources/images/polygene-blue.png b/manual/src/resources/images/polygene-blue.png
new file mode 100644
index 0000000..6918246
Binary files /dev/null and b/manual/src/resources/images/polygene-blue.png differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/manual/src/resources/images/zest-blue.png
----------------------------------------------------------------------
diff --git a/manual/src/resources/images/zest-blue.png b/manual/src/resources/images/zest-blue.png
deleted file mode 100644
index 6918246..0000000
Binary files a/manual/src/resources/images/zest-blue.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
new file mode 100644
index 0000000..e50589d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneAppliesToConstants
+{
+    public static final String QUALIFIED_NAME_APPLIES_TO = "org.apache.polygene.api.common.AppliesTo";
+    public static final String QUALIFIED_NAME_APPLIES_TO_FILTER = "org.apache.polygene.api.common.AppliesToFilter";
+
+    private PolygeneAppliesToConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
new file mode 100644
index 0000000..fd56b6b
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO;
+import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO_FILTER;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneAppliesToUtil
+{
+    /**
+     * @param searchContext Search context.
+     * @return {@code AppliesToFilter} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getAppliesToFilterClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getAppliesToFilterClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code AppliesToFilter} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getAppliesToFilterClass( @NotNull Project project,
+                                                    @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_APPLIES_TO_FILTER, scope );
+    }
+
+    /**
+     * @param elementWithinJavaClass element within java class.
+     * @return {@code @AppliesTo} annotation declaration of the class that contains the element.
+     *         Returns {@code null} if not found, or {@code element} is an invalid context.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getAppliesToAnnotation( @NotNull PsiElement elementWithinJavaClass )
+    {
+        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
+        return findAnnotation( psiClass, QUALIFIED_NAME_APPLIES_TO );
+    }
+
+    /**
+     * @param annotation annotation to process.
+     * @return {@code @AppliesTo} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
+     *         {@code null} or annotation is not a {@code @AppliesTo} annotation.
+     * @since 0.1
+     */
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getAppliesToAnnotationValue( @Nullable PsiAnnotation annotation )
+    {
+        if( annotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = annotation.getQualifiedName();
+        if( !QUALIFIED_NAME_APPLIES_TO.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( annotation );
+    }
+
+    /**
+     * @param value annotation member value.
+     * @return Applies to class reference given the {@code value} parameter. Returns {@code null} if it's not a
+     *         class reference.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiJavaCodeReferenceElement getAppliesToValueClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is implements
+     * {@code AppliesToFilter} class.
+     *
+     * @param psiClass             class to check.
+     * @param appliesToFilterClass {@code AppliesToFilter} class.
+     * @return {@code true} if {@code psiClass} implements {@code AppliesToFilter} class, {@code false} otherwise.
+     * @since 0.1
+     */
+    public static boolean isAnAppliesToFilter( @NotNull PsiClass psiClass, @NotNull PsiClass appliesToFilterClass )
+    {
+        return !psiClass.isInterface() && psiClass.isInheritor( appliesToFilterClass, true );
+    }
+
+    private PolygeneAppliesToUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToConstants.java
deleted file mode 100644
index e50589d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneAppliesToConstants
-{
-    public static final String QUALIFIED_NAME_APPLIES_TO = "org.apache.polygene.api.common.AppliesTo";
-    public static final String QUALIFIED_NAME_APPLIES_TO_FILTER = "org.apache.polygene.api.common.AppliesToFilter";
-
-    private PolygeneAppliesToConstants()
-    {
-    }
-}
\ No newline at end of file


[75/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
deleted file mode 100644
index 98e7ecc..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.css
+++ /dev/null
@@ -1,66 +0,0 @@
-.selected {
-  background-color: #CFD8DC !important;
-  color: white;
-}
-.heroes {
-  margin: 0 0 2em 0;
-  list-style-type: none;
-  padding: 0;
-  width: 15em;
-}
-.heroes li {
-  cursor: pointer;
-  position: relative;
-  left: 0;
-  background-color: #EEE;
-  margin: .5em;
-  padding: .3em 0;
-  height: 1.6em;
-  border-radius: 4px;
-}
-.heroes li:hover {
-  color: #607D8B;
-  background-color: #DDD;
-  left: .1em;
-}
-.heroes li.selected:hover {
-  background-color: #BBD8DC !important;
-  color: white;
-}
-.heroes .text {
-  position: relative;
-  top: -3px;
-}
-.heroes .badge {
-  display: inline-block;
-  font-size: small;
-  color: white;
-  padding: 0.8em 0.7em 0 0.7em;
-  background-color: #607D8B;
-  line-height: 1em;
-  position: relative;
-  left: -1px;
-  top: -4px;
-  height: 1.8em;
-  margin-right: .8em;
-  border-radius: 4px 0 0 4px;
-}
-button {
-  font-family: Arial;
-  background-color: #eee;
-  border: none;
-  padding: 5px 10px;
-  border-radius: 4px;
-  cursor: pointer;
-  cursor: hand;
-}
-button:hover {
-  background-color: #cfd8dc;
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
deleted file mode 100644
index 0688e6a..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<div>
-  <h2>My Heroes</h2>
-  <ul class="heroes">
-    <li *ngFor="#hero of heroes"
-      [class.selected]="hero === selectedHero"
-      (click)="onSelect(hero)">
-      <span class="badge">{{hero.id}}</span> {{hero.name}}
-    </li>
-  </ul>
-  <div *ngIf="selectedHero">
-    <h2>{{selectedHero.name | uppercase}} is my hero</h2>
-    <button (click)="gotoDetail()">View Details</button>
-  </div>
-</div>
-
-
-<!-- 
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js
deleted file mode 100644
index a4c1363..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js
+++ /dev/null
@@ -1,42 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var core_1 = require('angular2/core');
-var hero_detail_component_1 = require('./hero-detail.component');
-var HeroesComponent = (function () {
-    function HeroesComponent(_heroService, _router) {
-        this._heroService = _heroService;
-        this._router = _router;
-    }
-    HeroesComponent.prototype.getHeroes = function () {
-        var _this = this;
-        this._heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes; });
-    };
-    HeroesComponent.prototype.gotoDetail = function () {
-        this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
-    };
-    HeroesComponent.prototype.ngOnInit = function () {
-        this.getHeroes();
-    };
-    HeroesComponent.prototype.onSelect = function (hero) { this.selectedHero = hero; };
-    HeroesComponent = __decorate([
-        core_1.Component({
-            selector: 'my-heroes',
-            templateUrl: 'app/heroes.component.html',
-            styleUrls: ['app/heroes.component.css'],
-            directives: [hero_detail_component_1.HeroDetailComponent]
-        })
-    ], HeroesComponent);
-    return HeroesComponent;
-}());
-exports.HeroesComponent = HeroesComponent;
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=heroes.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js.map
deleted file mode 100644
index ca03d9d..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"heroes.component.js","sourceRoot":"","sources":["heroes.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAGhD,sCAAkC,yBAAyB,CAAC,CAAA;AAS5D;IAIE,yBAAoB,YAAyB,EAAU,OAAe;QAAlD,iBAAY,GAAZ,YAAY,CAAa;QAAU,YAAO,GAAP,OAAO,CAAQ;IAAI,CAAC;IAE3E,mCAAS,GAAT;QAAA,iBAEC;QADC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,CAAC,CAAC;IACrE,CAAC;IAED,oCAAU,GAAV;QACE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,kCAAQ,GAAR;QACE,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,kCAAQ,GAAR,UAAS,IAAU,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAxBpD;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,WAAW,EAAE,2BAA2B;YACxC,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,UAAU,EAAE,CAAC,2CAAmB,CAAC;SAClC,CAAC;uBAAA;IAoBF,sBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,uBAAe,kBAmB3B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
deleted file mode 100644
index 0002025..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/heroes.component.ts
+++ /dev/null
@@ -1,39 +0,0 @@
-import {Component, OnInit} from 'angular2/core';
-import {Router} from 'angular2/router';
-import {HeroService} from './hero.service';
-import {HeroDetailComponent} from './hero-detail.component';
-import {Hero} from './hero';
-
-@Component({
-  selector: 'my-heroes',
-  templateUrl: 'app/heroes.component.html',
-  styleUrls: ['app/heroes.component.css'],
-  directives: [HeroDetailComponent]
-})
-export class HeroesComponent implements OnInit {
-  heroes: Hero[];
-  selectedHero: Hero;
-
-  constructor(private _heroService: HeroService, private _router: Router) { }
-
-  getHeroes() {
-    this._heroService.getHeroes().then(heroes => this.heroes = heroes);
-  }
-
-  gotoDetail() {
-    this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
-  }
-
-  ngOnInit() {
-    this.getHeroes();
-  }
-
-  onSelect(hero: Hero) { this.selectedHero = hero; }
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/main.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/main.js b/tools/generator-zest/app/templates/Heroes/webapp/app/main.js
deleted file mode 100644
index 9b4c297..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/main.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-var browser_1 = require('angular2/platform/browser');
-var router_1 = require('angular2/router');
-var hero_service_1 = require('./hero.service');
-var app_component_1 = require('./app.component');
-browser_1.bootstrap(app_component_1.AppComponent, [
-    router_1.ROUTER_PROVIDERS,
-    hero_service_1.HeroService
-]);
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=main.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/main.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/main.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/main.js.map
deleted file mode 100644
index c830f42..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/main.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,wBAAwB,2BAA2B,CAAC,CAAA;AACpD,uBAA+B,iBAAiB,CAAC,CAAA;AACjD,6BAA0B,gBAAgB,CAAC,CAAA;AAC3C,8BAA2B,iBAAiB,CAAC,CAAA;AAE7C,mBAAS,CAAC,4BAAY,EAAE;IACtB,yBAAgB;IAChB,0BAAW;CACZ,CAAC,CAAC;AAGH;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
deleted file mode 100644
index 95e2d0b..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/main.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import {bootstrap} from 'angular2/platform/browser';
-import {ROUTER_PROVIDERS} from 'angular2/router';
-import {HeroService} from './hero.service';
-import {AppComponent} from './app.component';
-
-bootstrap(AppComponent, [
-  ROUTER_PROVIDERS,
-  HeroService
-]);
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js b/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js
deleted file mode 100644
index 9fe1f8a..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-exports.HEROES = [
-    { "id": 11, "name": "Mr. Nice" },
-    { "id": 12, "name": "Narco" },
-    { "id": 13, "name": "Bombasto" },
-    { "id": 14, "name": "Celeritas" },
-    { "id": 15, "name": "Magneta" },
-    { "id": 16, "name": "RubberMan" },
-    { "id": 17, "name": "Dynama" },
-    { "id": 18, "name": "Dr IQ" },
-    { "id": 19, "name": "Magma" },
-    { "id": 20, "name": "Tornado" }
-];
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/ 
-//# sourceMappingURL=mock-heroes.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js.map b/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js.map
deleted file mode 100644
index dc81a97..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"mock-heroes.js","sourceRoot":"","sources":["mock-heroes.ts"],"names":[],"mappings":";AAEW,cAAM,GAAW;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAC;IAC9B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAC;IAC9B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAC;IAC/B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC;IAC7B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAC;IAC/B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAC;IAC5B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC;CAC7B,CAAC;AAGF;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts b/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
deleted file mode 100644
index 673cf53..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/app/mock-heroes.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Hero } from './hero';
-
-export var HEROES: Hero[] = [
-	{"id": 11, "name": "Mr. Nice"},
-	{"id": 12, "name": "Narco"},
-	{"id": 13, "name": "Bombasto"},
-	{"id": 14, "name": "Celeritas"},
-	{"id": 15, "name": "Magneta"},
-	{"id": 16, "name": "RubberMan"},
-	{"id": 17, "name": "Dynama"},
-	{"id": 18, "name": "Dr IQ"},
-	{"id": 19, "name": "Magma"},
-	{"id": 20, "name": "Tornado"}
-];
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/index.html
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/index.html b/tools/generator-zest/app/templates/Heroes/webapp/index.html
deleted file mode 100644
index 753dd48..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/index.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <script>document.write('<base href="' + document.location + '" />');</script>
-    <title>Angular 2 Tour of Heroes</title>
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <link rel="stylesheet" href="styles.css">
-
-    <!-- IE required polyfills, in this exact order -->
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system-polyfills.js"></script>
-    <script src="https://npmcdn.com/angular2@2.0.0-beta.15/es6/dev/src/testing/shims_for_IE.js"></script>
-   
-    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system.js"></script>
-    <script src="https://npmcdn.com/typescript@1.8.10/lib/typescript.js"></script>
-    <script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
-    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
-    <script src="https://code.angularjs.org/2.0.0-beta.15/router.dev.js"></script>
-    <script>
-      System.config({
-        transpiler: 'typescript', 
-        typescriptOptions: { emitDecoratorMetadata: true }, 
-        packages: {'app': {defaultExtension: 'ts'}} 
-      });
-        System.import('app/main')
-              .then(null, console.error.bind(console));
-    </script>
-  </head>
-
-  <body>
-    <my-app>Loading...</my-app>
-  </body>
-</html>
-
-
-<!-- 
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
--->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/Heroes/webapp/styles.css
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/webapp/styles.css b/tools/generator-zest/app/templates/Heroes/webapp/styles.css
deleted file mode 100644
index 1774fd6..0000000
--- a/tools/generator-zest/app/templates/Heroes/webapp/styles.css
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Master Styles */
-h1 {
-  color: #369; 
-  font-family: Arial, Helvetica, sans-serif;   
-  font-size: 250%;
-}
-h2, h3 { 
-  color: #444;
-  font-family: Arial, Helvetica, sans-serif;   
-  font-weight: lighter;
-}
-body { 
-  margin: 2em; 
-}
-body, input[text], button { 
-  color: #888; 
-  font-family: Cambria, Georgia; 
-}
-a {
-  cursor: pointer;
-  cursor: hand;
-}
-button {
-  font-family: Arial;
-  background-color: #eee;
-  border: none;
-  padding: 5px 10px;
-  border-radius: 4px;
-  cursor: pointer;
-  cursor: hand;
-}
-button:hover {
-  background-color: #cfd8dc;
-}
-button:disabled {
-  background-color: #eee;
-  color: #aaa; 
-  cursor: auto;
-}
-
-/* Navigation link styles */
-nav a {
-  padding: 5px 10px;
-  text-decoration: none;
-  margin-top: 10px;
-  display: inline-block;
-  background-color: #eee;
-  border-radius: 4px;
-}
-nav a:visited, a:link {
-  color: #607D8B;
-}
-nav a:hover {
-  color: #039be5;
-  background-color: #CFD8DC;
-}
-nav a.router-link-active {
-  color: #039be5;
-}
-
-/* items class */
-.items {
-  margin: 0 0 2em 0;
-  list-style-type: none;
-  padding: 0;
-  width: 24em;
-}
-.items li {
-  cursor: pointer;
-  position: relative;
-  left: 0;
-  background-color: #EEE;
-  margin: .5em;
-  padding: .3em 0;
-  height: 1.6em;
-  border-radius: 4px;
-}
-.items li:hover {
-  color: #607D8B;
-  background-color: #DDD;
-  left: .1em;
-}
-.items li.selected:hover {
-  background-color: #BBD8DC;
-  color: white;
-}
-.items .text {
-  position: relative;
-  top: -3px;
-}
-.items {
-  margin: 0 0 2em 0;
-  list-style-type: none;
-  padding: 0;
-  width: 24em;
-}
-.items li {
-  cursor: pointer;
-  position: relative;
-  left: 0;
-  background-color: #EEE;
-  margin: .5em;
-  padding: .3em 0;
-  height: 1.6em;
-  border-radius: 4px;
-}
-.items li:hover {
-  color: #607D8B;
-  background-color: #DDD;
-  left: .1em;
-}
-.items li.selected {
-  background-color: #CFD8DC;
-  color: white;
-}
-
-.items li.selected:hover {
-  background-color: #BBD8DC;
-}
-.items .text {
-  position: relative;
-  top: -3px;
-}
-.items .badge {
-  display: inline-block;
-  font-size: small;
-  color: white;
-  padding: 0.8em 0.7em 0 0.7em;
-  background-color: #607D8B;
-  line-height: 1em;
-  position: relative;
-  left: -1px;
-  top: -4px;
-  height: 1.8em;
-  margin-right: .8em;
-  border-radius: 4px 0 0 4px;
-}
-
-/* everywhere else */
-* { 
-  font-family: Arial, Helvetica, sans-serif; 
-}
-
-
-/*
-Copyright 2016 Google Inc. All Rights Reserved.
-Use of this source code is governed by an MIT-style license that
-can be found in the LICENSE file at http://angular.io/license
-*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
deleted file mode 100644
index a1206a9..0000000
--- a/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
+++ /dev/null
@@ -1,55 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import java.util.function.Function;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.LayerAssembler;
-import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
-
-public class InfrastructureLayer extends LayeredLayerAssembler
-    implements LayerAssembler
-{
-    public static final String NAME = "Infrastructure Layer";
-    private final ModuleAssembly configModule;
-    private final Function<Application, Module> typeFinder;
-
-    public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )
-    {
-        this.configModule = configModule;
-        this.typeFinder = typeFinder;
-    }
-
-    @Override
-    public LayerAssembly assemble( LayerAssembly layer )
-        throws AssemblyException
-    {
-        createModule( layer, FileConfigurationModule.class );
-
-        new <%= polygene.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= polygene.entitystore %>StorageModule.NAME ) );
-        new <%= polygene.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= polygene.indexing %>IndexingModule.NAME ) );
-        new <%= polygene.serialization %>SerializationModule( typeFinder ).assemble( layer, layer.module( <%= polygene.serialization %>SerializationModule.NAME ) );
-        return layer;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl b/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
deleted file mode 100644
index dd1d17c..0000000
--- a/tools/generator-zest/app/templates/JacksonSerializationModule/bootstrap.tmpl
+++ /dev/null
@@ -1,53 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import java.util.function.Function;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
-
-public class JacksonSerializationModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Jackson Serialization Module";
-    private final Function<Application, Module> typeFinder;
-
-    public JacksonSerializationModule( Function<Application, Module> typeFinder )
-    {
-        this.typeFinder = typeFinder;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        new JacksonValueSerializationAssembler()
-            .visibleIn( Visibility.application )
-            .withValuesModuleFinder( typeFinder )
-            .assemble( module );
-        return module;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl b/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
deleted file mode 100644
index b5ebe24..0000000
--- a/tools/generator-zest/app/templates/NoCachingModule/bootstrap.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler;
-
-public class NoCachingModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "No Caching Module";
-    private final ModuleAssembly configModule;
-
-    public NoCachingModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl b/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl
deleted file mode 100644
index 8376a2b..0000000
--- a/tools/generator-zest/app/templates/RdfIndexingModule/bootstrap.tmpl
+++ /dev/null
@@ -1,50 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
-import org.apache.polygene.library.rdf.repository.NativeConfiguration;
-
-public class RdfIndexingModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "Rdf Indexing Module";
-    private final ModuleAssembly configModule;
-
-    public RdfIndexingModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
-        new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );
-        return module;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
deleted file mode 100644
index fc73bf6..0000000
--- a/tools/generator-zest/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
+++ /dev/null
@@ -1,54 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.model.security;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-public class HardcodedSecurityRepositoryMixin
-    implements SecurityRepository
-{
-
-    @Override
-    public boolean verifyPassword( String userName, String password )
-    {
-        if( userName.equals("admin") && password.equals("secret") )
-        {
-            return true;
-        }
-        if( userName.equals("user") && password.equals("123") )
-        {
-            return true;
-        }
-        return false;
-    }
-
-    @UnitOfWorkPropagation
-    public List<String> findRoleNamesOfUser( String name )
-    {
-        if( "admin".equals( name ) )
-        {
-            return Collections.singletonList("admin");
-        }
-        return Collections.singletonList("user");
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl b/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl
deleted file mode 100644
index f007485..0000000
--- a/tools/generator-zest/app/templates/RestApiModule/SecurityRepository.tmpl
+++ /dev/null
@@ -1,36 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.model.security;
-
-import java.util.List;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-@Concerns( UnitOfWorkConcern.class )
-public interface SecurityRepository
-{
-    @UnitOfWorkPropagation
-    boolean verifyPassword( String user, String password );
-
-    @UnitOfWorkPropagation
-    List<String> findRoleNamesOfUser( String name );
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl b/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl
deleted file mode 100644
index 3b21a9d..0000000
--- a/tools/generator-zest/app/templates/RestApiModule/SimpleEnroler.tmpl
+++ /dev/null
@@ -1,52 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.rest.security;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Uses;
-import org.restlet.Application;
-import org.restlet.data.ClientInfo;
-import org.restlet.security.Enroler;
-import org.restlet.security.Role;
-import <%= packageName %>.model.security.SecurityRepository;
-
-
-public class SimpleEnroler
-    implements Enroler
-{
-    @Service
-    private SecurityRepository repository;
-
-    @Uses
-    private Application application;
-
-    @Override
-    public void enrole( ClientInfo clientInfo )
-    {
-        org.restlet.security.User user = clientInfo.getUser();
-        String name = user.getName();
-        List<String> roleList = repository.findRoleNamesOfUser( name );
-        List<Role> restletRoles = new ArrayList<>();
-        roleList.stream().map( roleName -> Role.get( application, roleName ) );
-        clientInfo.setRoles( restletRoles );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl b/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
deleted file mode 100644
index e8b7e11..0000000
--- a/tools/generator-zest/app/templates/RestApiModule/SimpleVerifier.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.rest.security;
-
-import org.apache.polygene.api.injection.scope.Service;
-import org.restlet.security.SecretVerifier;
-import org.restlet.security.Verifier;
-import <%= packageName %>.model.security.SecurityRepository;
-
-public class SimpleVerifier extends SecretVerifier
-    implements Verifier
-{
-    @Service
-    private SecurityRepository repository;
-
-    @Override
-    public int verify( String user, char[] secret )
-    {
-        if( user == null || secret == null )
-        {
-            return RESULT_UNKNOWN;
-        }
-        if( repository.verifyPassword( user, String.valueOf( secret ) ) )
-        {
-            return RESULT_VALID;
-        }
-        return RESULT_INVALID;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl b/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl
deleted file mode 100644
index 202776d..0000000
--- a/tools/generator-zest/app/templates/RestApiModule/bootstrap.tmpl
+++ /dev/null
@@ -1,56 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.connectivity;
-
-import <%= packageName %>.rest.security.SimpleEnroler;
-import <%= packageName %>.rest.security.SimpleVerifier;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.library.restlet.assembly.RestletCrudConnectivityAssembler;
-import org.apache.polygene.library.restlet.resource.EntryPoint;
-<% if( hasFeature('sample (heroes) web application') ) { %>
-import <%= packageName %>.model.heroes.Hero;
-<% } -%>
-
-public class RestApiModule
-    implements ModuleAssembler
-{
-    public static String NAME;
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.objects( SimpleVerifier.class, SimpleEnroler.class);
-
-        new RestletCrudConnectivityAssembler().assemble( module );
-        module.values( EntryPoint.class );
-<% if( hasFeature('sample (heroes) web application') ) { -%>
-        module.values( Hero.class );
-        module.services( Hero.class );
-<% } else { -%>
-        module.values( /* add value types */   );
-        module.services(  /* add services */  );
-<% } -%>
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
deleted file mode 100644
index 91c66e6..0000000
--- a/tools/generator-zest/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
+++ /dev/null
@@ -1,51 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.model.security;
-
-import java.util.Collections;
-import java.util.List;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-public class HardcodedSecurityRepositoryMixin
-    implements SecurityRepository
-{
-
-    @Override
-    public boolean verifyPassword( String userName, String password )
-    {
-        if( userName.equals("admin") && password.equals("secret") )        {
-            return true;
-        }
-        if( userName.equals("user") && password.equals("123") )        {
-            return true;
-        }
-        return false;
-    }
-
-    @UnitOfWorkPropagation
-    public List<String> findRoleNamesOfUser( String name )
-    {
-        if( "admin".equals( name ) )
-        {
-            return Collections.singletonList("admin");
-        }
-        return Collections.singletonList("user");
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl b/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl
deleted file mode 100644
index c503999..0000000
--- a/tools/generator-zest/app/templates/SecurityModule/SecurityRepository.tmpl
+++ /dev/null
@@ -1,35 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.model.security;
-
-import java.util.List;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-
-@Concerns( UnitOfWorkConcern.class )
-public interface SecurityRepository
-{
-    @UnitOfWorkPropagation
-    boolean verifyPassword( String user, String password );
-
-    @UnitOfWorkPropagation
-    List<String> findRoleNamesOfUser( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl b/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl
deleted file mode 100644
index b944612..0000000
--- a/tools/generator-zest/app/templates/SecurityModule/bootstrap.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.domain;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import <%= packageName %>.model.security.SecurityRepository;
-import <%= packageName %>.model.security.HardcodedSecurityRepositoryMixin;
-
-public class SecurityModule
-    implements ModuleAssembler
-{
-    public static String NAME;
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( SecurityRepository.class )
-            .withMixins( HardcodedSecurityRepositoryMixin.class )
-            .visibleIn( Visibility.application )
-            .instantiateOnStartup();
-
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl b/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
deleted file mode 100644
index 467fadd..0000000
--- a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
+++ /dev/null
@@ -1,51 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 <%= packageName %>.bootstrap.infrastructure;
-
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.<%- polygene.entitystore.toLowerCase() %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler;
-
-public class <%- polygene.entitystore %>StorageModule
-    implements ModuleAssembler
-{
-    public static final String NAME = "<%- polygene.entitystore %> Storage Module";
-    private final ModuleAssembly configModule;
-
-    public <%- polygene.entitystore %>StorageModule( ModuleAssembly configModule )
-    {
-        this.configModule = configModule;
-    }
-
-    @Override
-    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
-        throws AssemblyException
-    {
-        new <%- polygene.entitystore %>EntityStoreAssembler()
-            .visibleIn( Visibility.application  )
-            .withConfig( configModule, Visibility.application )
-            .identifiedBy( "<%- polygene.entitystore %>store" )
-            .assemble( module );
-        return module;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
deleted file mode 100644
index f307e8b..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
+++ /dev/null
@@ -1,41 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-
-plugins {
-  id 'war'
-  id "org.akhikhl.gretty" version "1.4.0"
-}
-
-dependencies {
-  compile project( ":bootstrap" )
-  compile project( ":model" )
-  compile project( ":rest" )
-
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
-
-  compile "javax.servlet:servlet-api:2.5"
-  compile "org.restlet.jee:org.restlet:2.3.4"
-
-  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
-  runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
deleted file mode 100644
index 3261944..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
+++ /dev/null
@@ -1,36 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-dependencies {
-  compile project( ":model" )
-  compile project( ":rest" )
-
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
-
-
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
-<% if( hasFeature( 'rest api' ) ) { %>
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
-<% } %>
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion"
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl
deleted file mode 100644
index 7f75b20..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-model.tmpl
+++ /dev/null
@@ -1,23 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-
-// dependencies {
-//   compile "org.restlet.jee:org.restlet:2.3.4"
-// }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
deleted file mode 100644
index 5c389c2..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
+++ /dev/null
@@ -1,27 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-
-dependencies {
-  compile project( ":model" )
-
-  compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
deleted file mode 100644
index c1960ba..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
+++ /dev/null
@@ -1,46 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-
-version = 1.0
-
-rootProject.ext {
-  polygeneVersion = 0
-}
-
-allprojects() {
-  apply plugin: 'java'
-  apply plugin: 'maven'
-
-  defaultTasks 'assemble'
-
-  repositories {
-    mavenLocal()
-    mavenCentral()
-    maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
-<% if( polygene.entitystore == 'Jdbm' ) { -%>
-    maven { name 'clojure-repo'; url 'http://clojars.org/repo/' }
-<% } -%>
-  }
-
-  dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_
deleted file mode 100644
index 0087cd3..0000000
Binary files a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.jar_ and /dev/null differ

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_ b/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_
deleted file mode 100644
index 731cb78..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradle-wrapper.properties_
+++ /dev/null
@@ -1,24 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl b/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl
deleted file mode 100644
index 3d06f18..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradlew-bat.tmpl
+++ /dev/null
@@ -1,109 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/gradlew.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradlew.tmpl b/tools/generator-zest/app/templates/buildtool/gradlew.tmpl
deleted file mode 100755
index 11c35cc..0000000
--- a/tools/generator-zest/app/templates/buildtool/gradlew.tmpl
+++ /dev/null
@@ -1,183 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-#!/usr/bin/env bash
-
-##############################################################################
-##
-##  Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
-    echo "$*"
-}
-
-die ( ) {
-    echo
-    echo "$*"
-    echo
-    exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
-  CYGWIN* )
-    cygwin=true
-    ;;
-  Darwin* )
-    darwin=true
-    ;;
-  MINGW* )
-    msys=true
-    ;;
-esac
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
-    ls=`ls -ld "$PRG"`
-    link=`expr "$ls" : '.*-> \(.*\)$'`
-    if expr "$link" : '/.*' > /dev/null; then
-        PRG="$link"
-    else
-        PRG=`dirname "$PRG"`"/$link"
-    fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
-        # IBM's JDK on AIX uses strange locations for the executables
-        JAVACMD="$JAVA_HOME/jre/sh/java"
-    else
-        JAVACMD="$JAVA_HOME/bin/java"
-    fi
-    if [ ! -x "$JAVACMD" ] ; then
-        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-    fi
-else
-    JAVACMD="java"
-    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
-    MAX_FD_LIMIT=`ulimit -H -n`
-    if [ $? -eq 0 ] ; then
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
-            MAX_FD="$MAX_FD_LIMIT"
-        fi
-        ulimit -n $MAX_FD
-        if [ $? -ne 0 ] ; then
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
-        fi
-    else
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
-    fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
-    # We build the pattern for arguments to be converted via cygpath
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
-    SEP=""
-    for dir in $ROOTDIRSRAW ; do
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
-        SEP="|"
-    done
-    OURCYGPATTERN="(^($ROOTDIRS))"
-    # Add a user-defined pattern to the cygpath arguments
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
-    fi
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
-    i=0
-    for arg in "$@" ; do
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
-
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
-        else
-            eval `echo args$i`="\"$arg\""
-        fi
-        i=$((i+1))
-    done
-    case $i in
-        (0) set -- ;;
-        (1) set -- "$args0" ;;
-        (2) set -- "$args0" "$args1" ;;
-        (3) set -- "$args0" "$args1" "$args2" ;;
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
-    esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
-    JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/app/templates/buildtool/settings.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/settings.tmpl b/tools/generator-zest/app/templates/buildtool/settings.tmpl
deleted file mode 100644
index 3016193..0000000
--- a/tools/generator-zest/app/templates/buildtool/settings.tmpl
+++ /dev/null
@@ -1,41 +0,0 @@
-<%#
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.
- *
- *
--%>
-include 'app',
-        'bootstrap',
-        'model',
-        'rest'
-
-rootProject.name = '<%= polygene.entitystore %>'
-
-validateProject(rootProject, "")
-
-def validateProject(project, parentName)
-{
-  assert project.projectDir.isDirectory()
-  if( new File("$project.projectDir/src/main/java").exists() )
-  {
-    assert project.buildFile.isFile()
-  }
-  if( parentName.length() > 0 )
-  println "Project: " + project.name
-  project.children.each { child ->
-    validateProject(child, project.name)
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-zest/package.json
----------------------------------------------------------------------
diff --git a/tools/generator-zest/package.json b/tools/generator-zest/package.json
deleted file mode 100644
index 25e2d02..0000000
--- a/tools/generator-zest/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  "name": "generator-polygene",
-  "version": "0.1.0",
-  "description": "",
-  "files": [
-    "app"
-  ],
-  "keywords": [
-    "yeoman-generator"
-  ],
-  "dependencies": {
-    "yeoman-generator": "^0.24.1"
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/PolygeneApplicationComponent.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/PolygeneApplicationComponent.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/PolygeneApplicationComponent.java
new file mode 100644
index 0000000..42d1104
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/PolygeneApplicationComponent.java
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea;
+
+import com.intellij.codeInspection.InspectionToolProvider;
+import com.intellij.facet.FacetTypeRegistry;
+import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
+import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptor;
+import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory;
+import com.intellij.openapi.components.ApplicationComponent;
+import com.intellij.openapi.fileTypes.FileTypeManager;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.appliesTo.inspections.AppliesToAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.common.facet.PolygeneFacetType;
+import org.apache.polygene.ide.plugin.idea.concerns.inspections.ConcernsAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.invocation.inspections.InvocationAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.service.inspections.ServiceAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.structure.inspections.StructureAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinImplementsMixinType;
+import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinsAnnotationDeclaredOnMixinType;
+import org.apache.polygene.ide.plugin.idea.sideEffects.inspections.SideEffectsAnnotationDeclaredCorrectlyInspection;
+
+import javax.swing.*;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneApplicationComponent
+    implements ApplicationComponent, InspectionToolProvider, FileTemplateGroupDescriptorFactory
+{
+    @NonNls
+    private static String[] FILE_TEMPLATES = {
+        "GenericConcernOf.java"
+    };
+
+    private final PolygeneFacetType polygeneFacetType;
+
+    public PolygeneApplicationComponent()
+    {
+        polygeneFacetType = new PolygeneFacetType();
+    }
+
+    @NotNull
+    public final String getComponentName()
+    {
+        return "PolygeneApplicationComponent";
+    }
+
+    public final void initComponent()
+    {
+        registerFacet();
+        registerIntentions();
+    }
+
+    private void registerFacet()
+    {
+        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
+        facetTypeRegistry.registerFacetType( polygeneFacetType );
+    }
+
+    private void registerIntentions()
+    {
+//        IntentionManager intentionManager = IntentionManager.getInstance();
+//        intentionManager.registerIntentionAndMetaData( new AddConcernOnType(), "intention.category.control.flow" );
+    }
+
+    public final void disposeComponent()
+    {
+        unregisterFacet();
+    }
+
+    private void unregisterFacet()
+    {
+        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
+        facetTypeRegistry.unregisterFacetType( polygeneFacetType );
+    }
+
+    public final Class[] getInspectionClasses()
+    {
+        return new Class[]{
+            // Concerns
+            ConcernsAnnotationDeclaredCorrectlyInspection.class,
+            // Mixins
+            MixinImplementsMixinType.class,
+            MixinsAnnotationDeclaredOnMixinType.class,
+            // Side effects
+            SideEffectsAnnotationDeclaredCorrectlyInspection.class,
+            // Injections
+            InvocationAnnotationDeclaredCorrectlyInspection.class,
+            ServiceAnnotationDeclaredCorrectlyInspection.class,
+            StructureAnnotationDeclaredCorrectlyInspection.class,
+            // AppliesTo
+            AppliesToAnnotationDeclaredCorrectlyInspection.class
+        };
+    }
+
+    public final FileTemplateGroupDescriptor getFileTemplatesDescriptor()
+    {
+        FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor(
+            message( "polygene.file.template.group.title" ), null
+        );
+
+        FileTypeManager fileTypeManager = FileTypeManager.getInstance();
+        for( @NonNls String template : FILE_TEMPLATES )
+        {
+            Icon icon = fileTypeManager.getFileTypeByFileName( template ).getIcon();
+            group.addTemplate( new FileTemplateDescriptor( template, icon ) );
+        }
+
+        return group;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
new file mode 100644
index 0000000..e50589d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToConstants.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneAppliesToConstants
+{
+    public static final String QUALIFIED_NAME_APPLIES_TO = "org.apache.polygene.api.common.AppliesTo";
+    public static final String QUALIFIED_NAME_APPLIES_TO_FILTER = "org.apache.polygene.api.common.AppliesToFilter";
+
+    private PolygeneAppliesToConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
new file mode 100644
index 0000000..fd56b6b
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/common/PolygeneAppliesToUtil.java
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO;
+import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO_FILTER;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneAppliesToUtil
+{
+    /**
+     * @param searchContext Search context.
+     * @return {@code AppliesToFilter} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getAppliesToFilterClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getAppliesToFilterClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code AppliesToFilter} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getAppliesToFilterClass( @NotNull Project project,
+                                                    @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_APPLIES_TO_FILTER, scope );
+    }
+
+    /**
+     * @param elementWithinJavaClass element within java class.
+     * @return {@code @AppliesTo} annotation declaration of the class that contains the element.
+     *         Returns {@code null} if not found, or {@code element} is an invalid context.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getAppliesToAnnotation( @NotNull PsiElement elementWithinJavaClass )
+    {
+        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
+        return findAnnotation( psiClass, QUALIFIED_NAME_APPLIES_TO );
+    }
+
+    /**
+     * @param annotation annotation to process.
+     * @return {@code @AppliesTo} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
+     *         {@code null} or annotation is not a {@code @AppliesTo} annotation.
+     * @since 0.1
+     */
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getAppliesToAnnotationValue( @Nullable PsiAnnotation annotation )
+    {
+        if( annotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = annotation.getQualifiedName();
+        if( !QUALIFIED_NAME_APPLIES_TO.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( annotation );
+    }
+
+    /**
+     * @param value annotation member value.
+     * @return Applies to class reference given the {@code value} parameter. Returns {@code null} if it's not a
+     *         class reference.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiJavaCodeReferenceElement getAppliesToValueClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is implements
+     * {@code AppliesToFilter} class.
+     *
+     * @param psiClass             class to check.
+     * @param appliesToFilterClass {@code AppliesToFilter} class.
+     * @return {@code true} if {@code psiClass} implements {@code AppliesToFilter} class, {@code false} otherwise.
+     * @since 0.1
+     */
+    public static boolean isAnAppliesToFilter( @NotNull PsiClass psiClass, @NotNull PsiClass appliesToFilterClass )
+    {
+        return !psiClass.isInterface() && psiClass.isInheritor( appliesToFilterClass, true );
+    }
+
+    private PolygeneAppliesToUtil()
+    {
+    }
+}
\ No newline at end of file


[47/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/release/CheckReleaseSpecTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/CheckReleaseSpecTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/CheckReleaseSpecTask.groovy
deleted file mode 100644
index 72eb41d..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/CheckReleaseSpecTask.groovy
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import groovy.transform.CompileStatic
-import org.gradle.api.DefaultTask
-import org.gradle.api.GradleException
-import org.gradle.api.Project
-import org.gradle.api.artifacts.ProjectDependency
-import org.gradle.api.tasks.TaskAction
-
-@CompileStatic
-class CheckReleaseSpecTask extends DefaultTask
-{
-  CheckReleaseSpecTask()
-  {
-    description = 'Ensure that no releasable module depend on module(s) that don\'t fit the release criteria.'
-    doFirst {
-      def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
-      dependsOn approvedProjects.collect { each -> each.configurations.getByName( 'runtime' ) }
-    }
-  }
-
-  @TaskAction
-  void check()
-  {
-    Map<Project, Set<ProjectDependency>> notReleasable = [ : ]
-    def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
-    approvedProjects.each { approvedProject ->
-      def projectDependencies = approvedProject.configurations.getByName( 'runtime' ).allDependencies.findAll {
-        it instanceof ProjectDependency
-      } as Set<ProjectDependency>
-      projectDependencies.each { dep ->
-        def depNotReleaseApproved = approvedProjects.findAll { rp ->
-          rp.group == dep.dependencyProject.group && rp.name == dep.dependencyProject.name
-        }.isEmpty()
-        if( depNotReleaseApproved )
-        {
-          if( !notReleasable[ approvedProject ] )
-          {
-            notReleasable[ approvedProject ] = [ ] as Set
-          }
-          notReleasable[ approvedProject ] << dep
-        }
-      }
-    }
-    if( !notReleasable.isEmpty() )
-    {
-      def errorMessage = new StringBuilder()
-      errorMessage << "At least one releasable module depends on module(s) that don't fit the release criteria!\n"
-      errorMessage << "\tOffending module -> Non releasable dependencies\n"
-      notReleasable.each { k, v ->
-        def noRlsDeps = v.collect { d -> ':' + d.dependencyProject.group + ':' + d.dependencyProject.name }
-        errorMessage << "\t$k -> ${ noRlsDeps })\n"
-      }
-      errorMessage << "Check the dev-status.xml file content in each modules directory."
-      throw new GradleException( errorMessage.toString() )
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
deleted file mode 100644
index 0d81bac..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release;
-
-import org.gradle.api.Project
-
-class ModuleReleaseSpec
-{
-  def boolean satisfiedBy( Project project )
-  {
-    def devStatusFile = new File( project.projectDir, "dev-status.xml" )
-    if( !devStatusFile.exists() )
-    {
-      return false
-    }
-    def module = new XmlSlurper().parse( devStatusFile )
-    def codebase = module.status.codebase.text()
-    def docs = module.status.documentation.text()
-    def tests = module.status.unittests.text()
-    def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
-    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
-    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
-    satisfied |= ( codebase == 'stable' )
-    satisfied |= ( codebase == 'mature' )
-    // TODO Add a task to report this easily
-    // println "$project.name($satisfied) -> $codebase, $docs, $tests"
-    return satisfied
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseApprovedProjectsTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseApprovedProjectsTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseApprovedProjectsTask.groovy
deleted file mode 100644
index 3fe168e..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseApprovedProjectsTask.groovy
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import groovy.json.JsonBuilder
-import groovy.transform.CompileStatic
-import org.gradle.api.DefaultTask
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-
-/**
- * Write paths of release approved projects to a JSON file.
- *
- * This task sole purpose is proper up-do-date behaviour when changing {@literal dev-status.xml} files.
- */
-@CompileStatic
-class ReleaseApprovedProjectsTask extends DefaultTask
-{
-  @InputFiles
-  FileCollection getDevStatusFiles()
-  {
-    return project.files( project.allprojects
-                                 .collect( { project -> project.file( 'dev-status.xml' ) } )
-                                 .findAll( { it.exists() } ) )
-  }
-
-  @OutputFile
-  File getJsonApprovedProjects()
-  {
-    return new File( new File( project.buildDir, 'release' ), 'approved-projects.json' )
-  }
-
-  @TaskAction
-  void approveProjects()
-  {
-    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
-    jsonApprovedProjects.parentFile.mkdirs()
-    jsonApprovedProjects.text = new JsonBuilder( releaseSpec.approvedProjects.collect( { it.path } ) ).toPrettyString()
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecExtension.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecExtension.groovy
deleted file mode 100644
index 4ca5813..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecExtension.groovy
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-
-/**
- * Provide release approved projects.
- *
- * There's no up-to-date checking on Gradle extensions.
- * Depend on {@link ReleaseApprovedProjectsTask} to get a good up-to-date behavior.
- */
-@CompileStatic
-class ReleaseSpecExtension
-{
-  static final String NAME = 'releaseSpec'
-  Set<Project> approvedProjects
-
-  ReleaseSpecExtension( Project rootProject )
-  {
-    def spec = new ModuleReleaseSpec()
-    approvedProjects = rootProject.allprojects.findAll( { p -> spec.satisfiedBy( p ) } )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecPlugin.groovy
deleted file mode 100644
index 55eac67..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/release/ReleaseSpecPlugin.groovy
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.release
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.TaskGroups
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-
-@CompileStatic
-class ReleaseSpecPlugin implements Plugin<Project>
-{
-  static class TaskNames
-  {
-    static final String RELEASE_APPROVED_PROJECTS = 'releaseSpecApprovedProjects'
-    static final String CHECK_RELEASE_SPEC = 'checkReleaseSpec'
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    if( project != project.rootProject )
-    {
-      throw new IllegalStateException( "This plugin is only applicable to the root project" )
-    }
-    applyReleaseSpec( project )
-  }
-
-  private static void applyReleaseSpec( Project project )
-  {
-    project.extensions.create( ReleaseSpecExtension.NAME, ReleaseSpecExtension, project.rootProject )
-    project.tasks.create( TaskNames.RELEASE_APPROVED_PROJECTS, ReleaseApprovedProjectsTask ) { Task task ->
-      task.group = TaskGroups.RELEASE
-      task.description = 'Apply release specification to projects in the build'
-    }
-    project.tasks.create( TaskNames.CHECK_RELEASE_SPEC, CheckReleaseSpecTask ) { Task task ->
-      task.group = TaskGroups.RELEASE_VERIFICATION
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/tasks/ExecLogged.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/tasks/ExecLogged.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/tasks/ExecLogged.groovy
deleted file mode 100644
index 30075cf..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/tasks/ExecLogged.groovy
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.tasks
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Action
-import org.gradle.api.GradleException
-import org.gradle.api.Project
-import org.gradle.api.tasks.AbstractExecTask
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-import org.gradle.internal.logging.ConsoleRenderer
-import org.gradle.process.ExecSpec
-
-@CompileStatic
-class ExecLogged extends AbstractExecTask<ExecLogged>
-{
-  @OutputFile
-  File stdoutFile = project.file( "$project.buildDir/tmp/${ getName() }/stdout.log" )
-
-  @OutputFile
-  File stderrFile = project.file( "$project.buildDir/tmp/${ getName() }/stderr.log" )
-
-  ExecLogged()
-  {
-    super( ExecLogged.class )
-  }
-
-  @TaskAction
-  protected void exec()
-  {
-    [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
-    def outStream = stdoutFile.newOutputStream()
-    def errStream = stderrFile.newOutputStream()
-    try
-    {
-      super.exec()
-    }
-    catch( Exception ex )
-    {
-      throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
-    }
-    finally
-    {
-      close outStream, errStream
-    }
-  }
-
-  static void execLogged( Project project, File stdoutFile, File stderrFile, Action<? super ExecSpec> specAction )
-  {
-    [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
-    def outStream = stdoutFile.newOutputStream()
-    def errStream = stderrFile.newOutputStream()
-    try
-    {
-      project.exec { ExecSpec spec ->
-        specAction.execute( spec )
-        spec.standardOutput = outStream
-        spec.errorOutput = errStream
-      }
-    }
-    catch( Exception ex )
-    {
-      throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
-    }
-    finally
-    {
-      close outStream, errStream
-    }
-  }
-
-  private static void close( Closeable... closeables )
-    throws IOException
-  {
-    def errors = [ ] as List<IOException>
-    for( Closeable closeable : closeables )
-    {
-      try
-      {
-        closeable.close()
-      }
-      catch( IOException ex )
-      {
-        errors.add( ex )
-      }
-    }
-    if( !errors.empty )
-    {
-      def ex = new IOException( 'Failed to close some' )
-      errors.each { ex.addSuppressed it }
-      throw ex
-    }
-  }
-
-  private static String errorMessage( Exception ex, File stdoutFile, File stderrFile )
-  {
-    def consoleRenderer = new ConsoleRenderer()
-    return "${ ex.message }\n" +
-           "\tSTDOUT ${ consoleRenderer.asClickableFileUrl( stdoutFile ) }\n" +
-           "\tSTDERR ${ consoleRenderer.asClickableFileUrl( stderrFile ) }"
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/test/AggregatedJacocoReportTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/test/AggregatedJacocoReportTask.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/test/AggregatedJacocoReportTask.groovy
deleted file mode 100644
index 40c2278..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/test/AggregatedJacocoReportTask.groovy
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.test
-
-import org.gradle.api.DefaultTask
-import org.gradle.api.Project
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputDirectory
-import org.gradle.api.tasks.TaskAction
-
-class AggregatedJacocoReportTask extends DefaultTask
-{
-  @InputFiles
-  FileCollection getJacocoExecDataDirectories()
-  {
-    return project.files( project.subprojects.collect( { Project p -> "${ p.buildDir.path }/jacoco" } ) )
-  }
-
-  @OutputDirectory
-  File getOutputDirectory()
-  {
-    return project.file( "$project.buildDir/reports/coverage" )
-  }
-
-  @TaskAction
-  void report()
-  {
-    def coveredProjects = project.subprojects.findAll { p -> new File( "${ p.buildDir.path }/jacoco" ).exists() }
-    def coreProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.core' ) }
-    def libProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.lib' ) }
-    def extProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.ext' ) }
-    def toolsProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.tool' ) }
-    def tutoProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.tuto' ) }
-    def samplesProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.zest.sample' ) }
-    def classpath = project.configurations.getByName( 'jacoco' ).asPath
-    project.ant {
-      taskdef name: 'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: classpath
-      mkdir dir: outputDirectory
-      jacocoreport {
-        executiondata {
-          coveredProjects.collect { p -> fileset( dir: "${ p.buildDir.path }/jacoco" ) { include( name: '*.exec' ) } }
-        }
-        structure( name: "Apache Polygene\u2122 (Java Edition) SDK" ) {
-          group( name: "Core" ) {
-            classfiles { coreProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { coreProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-          group( name: "Libraries" ) {
-            classfiles { libProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { libProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-          group( name: "Extensions" ) {
-            classfiles { extProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { extProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-          group( name: "Tools" ) {
-            classfiles { toolsProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { toolsProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-          group( name: "Tutorials" ) {
-            classfiles { tutoProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { tutoProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-          group( name: "Samples" ) {
-            classfiles { samplesProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
-            sourcefiles { samplesProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
-          }
-        }
-        csv destfile: "${ outputDirectory }/jacoco.csv", encoding: "UTF-8"
-        xml destfile: "${ outputDirectory }/jacoco.xml", encoding: "UTF-8"
-        html destdir: outputDirectory, encoding: "UTF-8", locale: "en", footer: "Apache Polygene\u2122 (Java Edition) SDK"
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
deleted file mode 100644
index a78f588..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/version/VersionClassPlugin.groovy
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle.version
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.Plugin
-import org.gradle.api.Task
-import org.gradle.api.file.SourceDirectorySet
-import org.gradle.api.plugins.JavaPlugin
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.SourceSet
-import org.gradle.api.tasks.bundling.Jar
-
-// TODO:release:perf Placeholder for date for dev versions
-// TODO:release:perf Add git data, placeholders for dev versions
-@CompileStatic
-class VersionClassPlugin implements Plugin<Project>
-{
-  def void apply( Project project )
-  {
-    project.getPlugins().apply( JavaPlugin.class )
-    def genSrc = 'generated-src/version'
-    def generatedSrcDir = new File( project.buildDir, genSrc )
-
-    Task makeVersionClassTask = project.task( 'makeVersionClass' )
-    makeVersionClassTask.doLast {
-      def now = new Date()
-      def tmpGroup = project.name
-      if( tmpGroup.startsWith( "org.apache.zest.core" ) )
-      {
-        tmpGroup = tmpGroup - ".core"
-      }
-      tmpGroup = tmpGroup.replace( '-', '_' )
-      def outFilename = "java/" + tmpGroup.replace( '.', '/' ) + "/BuildVersion.java"
-      def outFile = new File( generatedSrcDir, outFilename )
-      outFile.getParentFile().mkdirs()
-      def f = new FileWriter( outFile )
-      f.write( 'package ' + tmpGroup + ';\n' )
-      f.write( """
-/**
- * Simple class for storing the version derived from the build system.
- *
- */
-public interface BuildVersion
-{
-    /** The version of the project from the gradle build.gradle file. */
-    String VERSION = \"""" + project.version + """\";
-
-    /** The name of the project from the gradle build.gradle file. */
-    String NAME = \"""" + project.name + """\";
-
-    /** The group of the project from the gradle build.gradle file. */
-    String GROUP = \"""" + project.group + """\";
-
-    /** The date this file was generated, usually the last date that the project was modified. */
-    String DATE = \"""" + now + """\";
-
-    /** The full details of the version, including the build date. */
-    String DETAILED_VERSION = GROUP + ":" + NAME + ":" + VERSION + " " + DATE;
-}\n
-""" )
-      f.close()
-    }
-    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
-    sourceSets.create( "version" ) { SourceSet sourceSet ->
-      sourceSet.java { SourceDirectorySet dirSet ->
-        dirSet.srcDir project.buildDir.name + '/' + genSrc + '/java'
-      }
-    }
-    makeVersionClassTask.getInputs().files( sourceSets.getByName( 'main' ).allSource )
-    makeVersionClassTask.getOutputs().file( generatedSrcDir )
-    if( project.getBuildFile() != null && project.getBuildFile().exists() )
-    {
-      makeVersionClassTask.getInputs().files( project.getBuildFile() )
-    }
-    project.getTasks().getByName( 'compileJava' ).dependsOn( 'compileVersionJava' )
-    project.getTasks().getByName( 'compileVersionJava' ).dependsOn( 'makeVersionClass' )
-    project.getTasks().getByName( 'jar' ) { Jar task ->
-      task.from sourceSets.getByName( 'version' ).output
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java b/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
new file mode 100644
index 0000000..ae03999
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.function.Function;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * Encapsulation of the Polygene API.
+ */
+public interface PolygeneAPI
+{
+    /**
+     * If a Modifier gets a reference to the Composite using @This,
+     * then that reference must be dereferenced using this method
+     * before handing it out for others to use.
+     *
+     * @param <T>       Parameterized type of the Composite
+     * @param composite instance reference injected in Modified using @This
+     *
+     * @return the dereferenced Composite
+     */
+    <T> T dereference( T composite );
+
+    /**
+     * Returns the Module or UnitOfWork where the Composite belongs.
+     *
+     * @param compositeOrUow The Composite (Service, Value, Entity or Transient) or UnitOfWork to lookup the Module it
+     *                       belongs to.
+     *
+     * @return The Module instance where the Composite or UnitOfWork belongs to.
+     */
+    ModuleDescriptor moduleOf( Object compositeOrUow );
+
+    /**
+     * Returns the ModelDescriptor of the Composite.
+     *
+     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
+     *                                    ModelDescriptor
+     *
+     * @return The ModelDescriptor of the Composite
+     */
+    ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference );
+
+    /**
+     * Returns the CompositeDescriptor of the Composite.
+     *
+     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
+     *                                    CompositeDescriptor
+     *
+     * @return The CompositeDescriptor of the Composite
+     */
+    CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference );
+
+    /**
+     * Returns the TransientDescriptor of the TransientComposite.
+     *
+     * @param transsient The TransientComposite for which to lookup the TransientDescriptor
+     *
+     * @return The TransientDescriptor of the TransientComposite
+     */
+    TransientDescriptor transientDescriptorFor( Object transsient );
+
+    /**
+     * Returns the EntityDescriptor of the EntityComposite.
+     *
+     * @param entity The EntityComposite for which to lookup the EntityDescriptor
+     *
+     * @return The EntityDescriptor of the EntityComposite
+     */
+    EntityDescriptor entityDescriptorFor( Object entity );
+
+    /**
+     * Returns the ValueDescriptor of the ValueComposite.
+     *
+     * @param value The ValueComposite for which to lookup the ValueDescriptor
+     *
+     * @return The ValueDescriptor of the ValueComposite
+     */
+    ValueDescriptor valueDescriptorFor( Object value );
+
+    /**
+     * Returns the ServiceDescriptor of the ServiceComposite.
+     *
+     * @param service The ServiceComposite for which to lookup the ServiceDescriptor
+     *
+     * @return The ServiceDescriptor of the ServiceComposite
+     */
+    ServiceDescriptor serviceDescriptorFor( Object service );
+
+    /**
+     * Returns the PropertyDescriptor of the Property.
+     *
+     * @param property The Property for which to lookup the PropertyDescriptor
+     *
+     * @return The PropertyDescriptor of the Property
+     */
+    PropertyDescriptor propertyDescriptorFor( Property<?> property );
+
+    /**
+     * Returns the AssociationDescriptor of the Association.
+     *
+     * @param association The Association for which to lookup the AssociationDescriptor
+     *
+     * @return The AssociationDescriptor of the Association
+     */
+    AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
+
+    /**
+     * Function that returns the CompositeDescriptor of a Composite.
+     */
+    Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
+        if( composite instanceof Proxy )
+        {
+            InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
+            return ( (CompositeInstance) invocationHandler ).descriptor();
+        }
+        try
+        {
+            Class<? extends Composite> compositeClass = composite.getClass();
+            Field instanceField = compositeClass.getField( "_instance" );
+            Object instance = instanceField.get( composite );
+            return ( (CompositeInstance) instance ).descriptor();
+        }
+        catch( Exception e )
+        {
+            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
+            exception.initCause( e );
+            throw exception;
+        }
+    };
+
+    /**
+     * Function that returns the CompositeInstance of a Composite.
+     */
+    Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
+        if( composite instanceof Proxy )
+        {
+            return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) );
+        }
+        try
+        {
+            Class<? extends Composite> compositeClass = composite.getClass();
+            Field instanceField = compositeClass.getField( "_instance" );
+            Object instance = instanceField.get( composite );
+            return (CompositeInstance) instance;
+        }
+        catch( Exception e )
+        {
+            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
+            exception.initCause( e );
+            throw exception;
+        }
+    };
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/Activation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/Activation.java b/core/api/src/main/java/org/apache/polygene/api/activation/Activation.java
new file mode 100644
index 0000000..3b03d82
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/Activation.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Interface used by Structure elements and Services that can be activated and passivated.
+ * <p>Application and Layer expose this interface so you can activate and passivate them.</p>
+ * <p>Module and ServiceComposite activation/passivation is handled by the Polygene runtime.</p>
+ */
+@SuppressWarnings("JavaDoc")
+public interface Activation
+{
+    /**
+     * Activate.
+     * <p>Fail fast execution order is:</p>
+     * <ul>
+     *   <li>Fire {@link ActivationEvent.EventType#ACTIVATING}</li>
+     *   <li>Call {@link Activator#beforeActivation(java.lang.Object)} on each Activator</li>
+     *   <li>Call {@link #activate()} children</li>
+     *   <li>Call {@link Activator#afterActivation(java.lang.Object)} on each Activator</li>
+     *   <li>Fire {@link ActivationEvent.EventType#ACTIVATED}</li>
+     * </ul>
+     * <p>If an Exception is thrown, already activated nodes are passivated.</p>
+     * @throws ActivationException with first Exception of activation plus the PassivationException if any
+     */
+    void activate()
+        throws ActivationException;
+
+    /**
+     * Passivate.
+     * <p>Fail safe execution order is:</p>
+     * <ul>
+     *   <li>Fire {@link ActivationEvent.EventType#PASSIVATING}</li>
+     *   <li>Call {@link Activator#beforePassivation(java.lang.Object)} on each Activator</li>
+     *   <li>Call {@link #passivate()} children</li>
+     *   <li>Call {@link Activator#afterPassivation(java.lang.Object)} on each Activator</li>
+     *   <li>Fire {@link ActivationEvent.EventType#PASSIVATED}</li>
+     * </ul>
+     * @throws PassivationException after passivation with all Exceptions of passivation if any
+     */
+    void passivate()
+        throws PassivationException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEvent.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEvent.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEvent.java
new file mode 100644
index 0000000..f40488f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEvent.java
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.time.Instant;
+import org.apache.polygene.api.time.SystemTime;
+
+/**
+ * ActivationEvents are fired during activation and passivation of instances in Polygene.
+ */
+public final class ActivationEvent
+{
+    public enum EventType
+    {
+        ACTIVATING, ACTIVATED, PASSIVATING, PASSIVATED
+    }
+
+    private final Instant timestamp;
+    private final Object source;
+    private final EventType type;
+
+    public ActivationEvent( Object source, EventType type )
+    {
+        this.timestamp = SystemTime.now();
+        this.source = source;
+        this.type = type;
+    }
+
+    /**
+     * @return the source of the Activation event
+     */
+    public Object source()
+    {
+        return source;
+    }
+
+    /**
+     * @return the type of the Activation event
+     */
+    public EventType type()
+    {
+        return type;
+    }
+
+
+    /**
+     *
+     * @return The instant that this event was created.
+     */
+    public Instant eventTime()
+    {
+        return timestamp;
+    }
+
+    /**
+     * @return an informative message describing the event
+     */
+    public String message()
+    {
+        switch( type )
+        {
+        case ACTIVATING:
+            return "Activating " + source;
+        case ACTIVATED:
+            return "Activated " + source;
+        case PASSIVATING:
+            return "Passivating " + source;
+        case PASSIVATED:
+            return "Passivated " + source;
+        }
+        return "";
+    }
+
+    /**
+     * @see #message()
+     */
+    @Override
+    public String toString()
+    {
+        return message() + "@" + timestamp;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListener.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListener.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListener.java
new file mode 100644
index 0000000..108ebc6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListener.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Listener for ActivationEvent events
+ */
+public interface ActivationEventListener
+{
+    void onEvent( ActivationEvent event )
+        throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListenerRegistration.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListenerRegistration.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListenerRegistration.java
new file mode 100644
index 0000000..2e7d83a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationEventListenerRegistration.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Use this to register listeners for ActivationEvents.
+ *
+ * This is implemented by Application, Layer, Module, for example.
+ */
+public interface ActivationEventListenerRegistration
+{
+    /**
+     * @param listener will be notified when Activation events occur
+     */
+    void registerActivationEventListener( ActivationEventListener listener );
+
+    /**
+     * @param listener will not be notified when Activation events occur anymore
+     */
+    void deregisterActivationEventListener( ActivationEventListener listener );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivationException.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationException.java
new file mode 100644
index 0000000..cf6d978
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivationException.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Thrown when unable to activate.
+ */
+public class ActivationException extends Exception
+{
+    private static final long serialVersionUID = 1L;
+    public ActivationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/Activator.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/Activator.java b/core/api/src/main/java/org/apache/polygene/api/activation/Activator.java
new file mode 100644
index 0000000..90a68b5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/Activator.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Assemble Activators to hook Services Activation.
+ *
+ * @param <ActivateeType> Type of the activatee.
+ *
+ * @see ActivatorAdapter
+ * @see org.apache.polygene.api.service.ServiceActivation
+ */
+public interface Activator<ActivateeType>
+{
+
+    /**
+     * Called before activatee activation.
+     *
+     * @param activating The instance that is about to be activated.
+     *
+     * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
+     */
+    void beforeActivation( ActivateeType activating )
+        throws Exception;
+
+    /**
+     * Called after activatee activation.
+     *
+     * @param activated The instance that has just been activated.
+     *
+     * @throws Exception Allowed to throw Exception which will be wrapped in an ActivationException
+     */
+    void afterActivation( ActivateeType activated )
+        throws Exception;
+
+    /**
+     * Called before activatee passivation.
+     *
+     * @param passivating The instance that is about to be passivated.
+     *
+     * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
+     */
+    void beforePassivation( ActivateeType passivating )
+        throws Exception;
+
+    /**
+     * Called after activatee passivation.
+     *
+     * @param passivated The instance that has just been passivated.
+     *
+     * @throws Exception Allowed to throw Exception which will be wrapped in an PassivationException
+     */
+    void afterPassivation( ActivateeType passivated )
+        throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorAdapter.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorAdapter.java
new file mode 100644
index 0000000..208e492
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorAdapter.java
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Adapter for Activator.
+ * <p>If you are thinking about Service activation, see {@link org.apache.polygene.api.service.ServiceActivatorAdapter}.</p>
+ *
+ * @param <ActivateeType> Type of the activatee.
+ */
+public class ActivatorAdapter<ActivateeType>
+    implements Activator<ActivateeType>
+{
+    /**
+     * Called before activatee activation.
+     * @param activating Activating activatee
+     */
+    @Override
+    public void beforeActivation( ActivateeType activating )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called after activatee activation.
+     * @param activated Activating activatee
+     */
+    @Override
+    public void afterActivation( ActivateeType activated )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called before activatee passivation.
+     * @param passivating Passivating activatee
+     */
+    @Override
+    public void beforePassivation( ActivateeType passivating )
+        throws Exception
+    {
+    }
+
+    /**
+     * Called after activatee passivation.
+     * @param passivated Passivated activatee
+     */
+    @Override
+    public void afterPassivation( ActivateeType passivated )
+        throws Exception
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorDescriptor.java
new file mode 100644
index 0000000..75b482f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ActivatorDescriptor.java
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+/**
+ * Activator Descriptor.
+ */
+public interface ActivatorDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/Activators.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/Activators.java b/core/api/src/main/java/org/apache/polygene/api/activation/Activators.java
new file mode 100644
index 0000000..912760a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/Activators.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used in ServiceComposites to declare Activator implementation classes.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.TYPE )
+@Documented
+public @interface Activators
+{
+
+    /**
+     * @return Activator implementation classes.
+     */
+    Class<? extends Activator<?>>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/ApplicationPassivationThread.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/ApplicationPassivationThread.java b/core/api/src/main/java/org/apache/polygene/api/activation/ApplicationPassivationThread.java
new file mode 100644
index 0000000..7197257
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/ApplicationPassivationThread.java
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.io.PrintStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.polygene.api.structure.Application;
+
+/**
+ * Application Passivation Thread to use as a Shutdown Hook.
+ * <pre>Runtime.getRuntime().addShutdownHook( new ApplicationPassivationThread( application ) );</pre>
+ */
+public final class ApplicationPassivationThread
+    extends Thread
+{
+    /**
+     * Create a new Application Passivation Thread that output errors to STDERR.
+     * @param application The Application to passivate
+     */
+    @SuppressWarnings("unused")
+    public ApplicationPassivationThread(final Application application )
+    {
+        this( application, null, null );
+    }
+
+    /**
+     * Create a new Application Passivation Thread that output errors to a Logger.
+     * @param application The Application to passivate
+     * @param logger Logger for errors
+     */
+    @SuppressWarnings("unused")
+    public ApplicationPassivationThread(Application application, Logger logger )
+    {
+        this( application, null, logger );
+    }
+
+    /**
+     * Create a new Application Passivation Thread that output errors to a PrintStream.
+     * @param application The Application to passivate
+     * @param output PrintStream for errors
+     */
+    public ApplicationPassivationThread( Application application, PrintStream output )
+    {
+        this( application, output, null );
+    }
+
+    private ApplicationPassivationThread( Application application, PrintStream output, Logger logger )
+    {
+        super( new ApplicationPassivation( application, output, logger ),
+               application.name() + " Passivation Thread" );
+    }
+
+    private static class ApplicationPassivation
+        implements Runnable
+    {
+
+        private final Application application;
+        private final PrintStream output;
+        private final Logger logger;
+
+        private ApplicationPassivation( Application application, PrintStream output, Logger logger )
+        {
+            this.application = application;
+            this.output = output;
+            this.logger = logger;
+        }
+
+        @Override
+        public void run()
+        {
+            try
+            {
+                application.passivate();
+            }
+            catch( PassivationException ex )
+            {
+                String message = application.name() + " " + ex.getMessage();
+                if( logger != null )
+                {
+                    logger.log( Level.SEVERE, message, ex );
+                }
+                else if( output != null )
+                {
+                    output.println( message );
+                    ex.printStackTrace( output );
+                }
+                else
+                {
+                    ex.printStackTrace();
+                }
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/PassivationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/PassivationException.java b/core/api/src/main/java/org/apache/polygene/api/activation/PassivationException.java
new file mode 100644
index 0000000..98eaa0f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/PassivationException.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.activation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Thrown when unable to passivate.
+ *
+ * Printed StackTrace contains all causes in order as suppressed exceptions.
+ */
+public final class PassivationException
+    extends Exception
+{
+
+    private static final long serialVersionUID = 1L;
+    private final List<Exception> causes;
+
+    /**
+     * Create new PassivationException.
+     * @param exceptions All exceptions encountered during passivation, in order
+     */
+    public PassivationException( Collection<Exception> exceptions )
+    {
+        super( "Passivation Exception - [has " + exceptions.size() + " cause(s)]" );
+        exceptions.forEach( this::addSuppressed );
+        this.causes = new ArrayList<>( exceptions );
+    }
+
+    /**
+     * @return All exceptions encountered during passivation, in order
+     */
+    public List<Exception> causes()
+    {
+        return causes;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/activation/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/activation/package.html b/core/api/src/main/java/org/apache/polygene/api/activation/package.html
new file mode 100644
index 0000000..c11d85f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/activation/package.html
@@ -0,0 +1,29 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Activation API.</h2>
+        <p>
+            The Activation API package contains types used by client code to integrate with the Polygene\u2122 Runtime activation
+            mechanism. In assembly, client code can easily listen to Structure (Application, Layers and Modules) and
+            Services activation events, or, declare Structure and Service Activators.
+        </p>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AbstractAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AbstractAssociation.java b/core/api/src/main/java/org/apache/polygene/api/association/AbstractAssociation.java
new file mode 100644
index 0000000..55ec7d8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AbstractAssociation.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+/**
+ * Base interface for all associations.
+ */
+public interface AbstractAssociation
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/Association.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/Association.java b/core/api/src/main/java/org/apache/polygene/api/association/Association.java
new file mode 100644
index 0000000..5e458ce
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/Association.java
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * Association to a single EntityComposite.
+ */
+public interface Association<T> extends AbstractAssociation
+{
+    /**
+     * Get the associated entity.
+     *
+     * @return the associated entity
+     */
+    T get();
+
+    /**
+     * Set the associated entity.
+     *
+     * @param associated the entity
+     *
+     * @throws IllegalArgumentException thrown if the entity is not a valid reference for this association
+     * @throws IllegalStateException    thrown if association is immutable
+     */
+    void set( T associated )
+        throws IllegalArgumentException, IllegalStateException;
+
+    /**
+     * @return the the reference of the associated entity.
+     */
+    EntityReference reference();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AssociationDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AssociationDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/association/AssociationDescriptor.java
new file mode 100644
index 0000000..e7a1c01
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AssociationDescriptor.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Type;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+
+/**
+ * Association Descriptor.
+ */
+public interface AssociationDescriptor extends MetaInfoHolder
+{
+    /**
+     * Get the qualified name of the association. This is constructed by
+     * concatenating the name of the declaring interface with the name
+     * of the method, using ":" as separator.
+     * <p>
+     * Example:
+     * </p>
+     * <p>
+     * com.somecompany.MyInterface with association method
+     * </p>
+     * <pre><code>
+     * Association&lt;String&gt; someAssociation();
+     * </code></pre>
+     * will have the qualified name:
+     * <pre><code>
+     * com.somecompany.MyInterface:someAssociation
+     * </code></pre>
+     *
+     * @return the qualified name of the association
+     */
+    QualifiedName qualifiedName();
+
+    /**
+     * Get the type of the associated Entities
+     *
+     * @return the type of the associated Entities
+     */
+    Type type();
+
+    boolean isImmutable();
+
+    boolean isAggregated();
+
+    AccessibleObject accessor();
+
+    boolean queryable();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AssociationMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AssociationMixin.java b/core/api/src/main/java/org/apache/polygene/api/association/AssociationMixin.java
new file mode 100644
index 0000000..e26d324
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AssociationMixin.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.injection.scope.State;
+
+/**
+ * Generic mixin for associations.
+ */
+@AppliesTo( { AssociationMixin.AssociationFilter.class } )
+public final class AssociationMixin
+    implements InvocationHandler
+{
+    @State
+    private AssociationStateHolder associations;
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return associations.associationFor( method );
+    }
+
+    /**
+     * Associations generic mixin AppliesToFilter.
+     */
+    static class AssociationFilter
+        implements AppliesToFilter
+    {
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
+        {
+            return Association.class.isAssignableFrom( method.getReturnType() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateDescriptor.java
new file mode 100644
index 0000000..dbee470
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateDescriptor.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.composite.StateDescriptor;
+
+/**
+ * Associations State Descriptor.
+ */
+public interface AssociationStateDescriptor extends StateDescriptor
+{
+    AssociationDescriptor getAssociationByName( String name )
+        throws IllegalArgumentException;
+
+    AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException;
+
+    AssociationDescriptor getManyAssociationByName( String name )
+        throws IllegalArgumentException;
+
+    AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException;
+
+    AssociationDescriptor getNamedAssociationByName( String name )
+        throws IllegalArgumentException;
+
+    AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException;
+
+    Stream<? extends AssociationDescriptor> associations();
+
+    Stream<? extends AssociationDescriptor> manyAssociations();
+
+    Stream<? extends AssociationDescriptor> namedAssociations();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateHolder.java b/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateHolder.java
new file mode 100644
index 0000000..6b1cf42
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AssociationStateHolder.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.stream.Stream;
+import org.apache.polygene.api.property.StateHolder;
+
+/**
+ * This represents the state of a entity (properties+associations).
+ */
+public interface AssociationStateHolder
+    extends StateHolder
+{
+    /**
+     * Get an association for a specific accessor method.
+     *
+     * @param associationMethod for the association
+     *
+     * @return the association
+     */
+    <T> Association<T> associationFor( AccessibleObject associationMethod );
+
+    /**
+     * Get all associations.
+     *
+     * @return stream of associations
+     */
+    Stream<? extends Association<?>> allAssociations();
+
+    /**
+     * Get a many-association for a specific accessor method.
+     *
+     * @param manyassociationMethod for the many-association
+     *
+     * @return the association
+     */
+    <T> ManyAssociation<T> manyAssociationFor( AccessibleObject manyassociationMethod );
+
+    /**
+     * Get all ManyAssociations.
+     *
+     * @return stream of many-associations
+     */
+    Stream<? extends ManyAssociation<?>> allManyAssociations();
+
+    /**
+     * Get a named-association for a specific accessor method.
+     *
+     * @param namedassociationMethod for the named-association
+     *
+     * @return the association
+     */
+    <T> NamedAssociation<T> namedAssociationFor( AccessibleObject namedassociationMethod );
+
+    /**
+     * Get all named-associations.
+     *
+     * @return stream of named-associations
+     */
+    Stream<? extends NamedAssociation<?>> allNamedAssociations();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/AssociationWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/AssociationWrapper.java b/core/api/src/main/java/org/apache/polygene/api/association/AssociationWrapper.java
new file mode 100644
index 0000000..b41b41f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/AssociationWrapper.java
@@ -0,0 +1,81 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * If you want to catch getting and setting association, then create a GenericConcern
+ * that wraps the Polygene-supplied Association instance with AssociationWrappers. Override
+ * get() and/or set() to perform your custom code.
+ */
+public class AssociationWrapper
+    implements Association<Object>
+{
+    protected Association<Object> next;
+
+    public AssociationWrapper( Association<Object> next )
+    {
+        this.next = next;
+    }
+
+    public Association<Object> next()
+    {
+        return next;
+    }
+
+    @Override
+    public Object get()
+    {
+        return next.get();
+    }
+
+    @Override
+    public void set( Object associated )
+        throws IllegalArgumentException
+    {
+        next.set( associated );
+    }
+
+    @Override
+    public EntityReference reference()
+    {
+        return next.reference();
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return next.hashCode();
+    }
+
+    @Override
+    @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
+    public boolean equals( Object obj )
+    {
+        return next.equals( obj );
+    }
+
+    @Override
+    public String toString()
+    {
+        return next.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/GenericAssociationInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/GenericAssociationInfo.java b/core/api/src/main/java/org/apache/polygene/api/association/GenericAssociationInfo.java
new file mode 100644
index 0000000..c42f172
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/GenericAssociationInfo.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import static org.apache.polygene.api.util.Classes.typeOf;
+
+/**
+ * Generic Association info.
+ */
+public final class GenericAssociationInfo
+{
+    public static Type associationTypeOf( AccessibleObject accessor )
+    {
+        return toAssociationType( typeOf( accessor ) );
+    }
+
+    public static Type toAssociationType( Type methodReturnType )
+    {
+        if( methodReturnType instanceof ParameterizedType )
+        {
+            ParameterizedType parameterizedType = (ParameterizedType) methodReturnType;
+            if( AbstractAssociation.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) )
+            {
+                return parameterizedType.getActualTypeArguments()[ 0 ];
+            }
+        }
+        if (!(methodReturnType instanceof Class))
+        {
+            throw new IllegalArgumentException( "Unable to make an association with " + methodReturnType );
+        }
+        Type[] interfaces = ((Class<?>) methodReturnType).getGenericInterfaces();
+        for (Type anInterface : interfaces)
+        {
+            Type associationType = toAssociationType(anInterface);
+            if (associationType != null)
+            {
+                return associationType;
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java
new file mode 100644
index 0000000..a2247b9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/association/ManyAssociation.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.association;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * Association to a collection of entities.
+ */
+public interface ManyAssociation<T> extends Iterable<T>, AbstractAssociation
+{
+    /**
+     * Returns the number of references in this association.
+     * @return the number of references in this association.
+     */
+    int count();
+
+    boolean contains( T entity );
+
+    boolean add( int i, T entity );
+
+    boolean add( T entity );
+
+    boolean remove( T entity );
+
+    T get( int i );
+
+    List<T> toList();
+
+    Set<T> toSet();
+
+    /**
+     * Returns a stream of the references to the associated entities.
+     * @return the references to the associated entities.
+     */
+    Stream<EntityReference> references();
+}


[79/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
new file mode 100644
index 0000000..047ffef
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.entitystore.jdbm;
+
+import java.io.File;
+import org.apache.derby.iapi.services.io.FileUtil;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.cache.ehcache.EhCacheConfiguration;
+import org.apache.polygene.cache.ehcache.EhCachePoolService;
+import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
+import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+/**
+ * Performance test for JdbmEntityStoreComposite
+ */
+public class JdbmEntityStorePerformanceTest
+    extends AbstractEntityStorePerformanceTest
+{
+    public JdbmEntityStorePerformanceTest()
+    {
+        super( "JdbmEntityStore", createAssembler() );
+    }
+
+    private static Assembler createAssembler()
+    {
+        return new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                new JdbmEntityStoreAssembler().assemble( module );
+                new OrgJsonValueSerializationAssembler().assemble( module );
+                ModuleAssembly configModule = module.layer().module( "Config" );
+                configModule.entities( JdbmConfiguration.class ).visibleIn( Visibility.layer );
+                new EntityTestAssembler().assemble( configModule );
+
+                module.services( EhCachePoolService.class );
+                configModule.entities( EhCacheConfiguration.class ).visibleIn( Visibility.layer );
+            }
+        };
+    }
+
+    @Override
+    public void cleanUp()
+        throws Exception
+    {
+        super.cleanUp();
+        FileUtil.removeDirectory( new File( "build/tmp/jdbm" ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
new file mode 100644
index 0000000..bd664e1
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.entitystore.memory;
+
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin;
+import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class MemoryEntityStorePerformanceTest
+    extends AbstractEntityStorePerformanceTest
+{
+
+    public MemoryEntityStorePerformanceTest()
+    {
+        super( "MemoryEntityStore", createAssembler() );
+    }
+
+    private static Assembler createAssembler()
+    {
+        return new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                new MemoryEntityStoreAssembler().assemble( module );
+                new OrgJsonValueSerializationAssembler().assemble( module );
+            }
+        };
+    }
+
+    // Alternate variant that uses the standard MapEntityStore
+    @Mixins( MapEntityStoreMixin.class )
+    interface MemoryEntityStoreService2
+        extends MemoryEntityStoreService
+    {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
new file mode 100644
index 0000000..d1ea720
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import javax.sql.DataSource;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.usecase.UsecaseBuilder;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.internal.SQLs;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+import org.apache.polygene.library.sql.common.SQLUtil;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+/**
+ * Performance test for DerbySQLEntityStore.
+ */
+public class DerbySQLEntityStorePerformanceTest
+    extends AbstractEntityStorePerformanceTest
+{
+
+    public DerbySQLEntityStorePerformanceTest()
+    {
+        super( "DerbySQLEntityStore", createAssembler() );
+    }
+
+    private static Assembler createAssembler()
+    {
+        return new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                ModuleAssembly config = module.layer().module( "config" );
+                new EntityTestAssembler().assemble( config );
+
+                new OrgJsonValueSerializationAssembler().assemble( module );
+
+                // DataSourceService
+                new DBCPDataSourceServiceAssembler().
+                    identifiedBy( "derby-datasource-service" ).
+                    visibleIn( Visibility.module ).
+                    withConfig( config, Visibility.layer ).
+                    assemble( module );
+
+                // DataSource
+                new DataSourceAssembler().
+                    withDataSourceServiceIdentity( "derby-datasource-service" ).
+                    identifiedBy( "derby-datasource" ).
+                    withCircuitBreaker().
+                    assemble( module );
+
+                // SQL EntityStore
+                new DerbySQLEntityStoreAssembler().
+                    withConfig( config, Visibility.layer ).
+                    assemble( module );
+            }
+        };
+    }
+
+    @Override
+    protected void cleanUp()
+        throws Exception
+    {
+        if( uowf == null )
+        {
+            return;
+        }
+        UnitOfWork uow = this.uowf.newUnitOfWork( UsecaseBuilder.newUsecase(
+            "Delete " + getClass().getSimpleName() + " test data" ) );
+        try
+        {
+            SQLConfiguration config = uow.get( SQLConfiguration.class,
+                                               DerbySQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            String schemaName = config.schemaName().get();
+            if( schemaName == null )
+            {
+                schemaName = SQLs.DEFAULT_SCHEMA_NAME;
+            }
+
+            Statement stmt = null;
+            try
+            {
+                stmt = connection.createStatement();
+                stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
+                connection.commit();
+            }
+            finally
+            {
+                SQLUtil.closeQuietly( stmt );
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.cleanUp();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
new file mode 100644
index 0000000..e0c2bcc
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
@@ -0,0 +1,154 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import org.junit.Ignore;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
+import org.apache.polygene.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.internal.SQLs;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+import org.apache.polygene.library.sql.common.SQLUtil;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
+
+/**
+ * Performance test for PostgreSQLEntityStore.
+ * <p>
+ * WARN This test is deactivated on purpose, please do not commit it activated.
+ * </p>
+ * <p>
+ * To run it see PostgreSQLEntityStoreTest.
+ * </p>
+ */
+@Ignore( "WARN Tearing down this test is broken!" )
+public class PostgreSQLEntityStorePerformanceTest
+    extends AbstractEntityStorePerformanceTest
+{
+
+    public PostgreSQLEntityStorePerformanceTest()
+    {
+        super( "PostgreSQLEntityStore", createAssembler() );
+    }
+
+    private static Assembler createAssembler()
+    {
+        return new Assembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                ModuleAssembly config = module.layer().module( "config" );
+                config.services( MemoryEntityStoreService.class );
+
+                // DataSourceService
+                new DBCPDataSourceServiceAssembler().
+                    identifiedBy( "postgresql-datasource-service" ).
+                    visibleIn( Visibility.module ).
+                    withConfig( config, Visibility.layer ).
+                    assemble( module );
+
+                // DataSource
+                new DataSourceAssembler().
+                    withDataSourceServiceIdentity( "postgresql-datasource-service" ).
+                    identifiedBy( "postgresql-datasource" ).
+                    withCircuitBreaker().
+                    assemble( module );
+
+                // SQL EntityStore
+                new PostgreSQLEntityStoreAssembler().
+                    withConfig( config, Visibility.layer ).
+                    assemble( module );
+            }
+
+        };
+    }
+
+    @Override
+    protected void cleanUp()
+        throws Exception
+    {
+        try
+        {
+            super.cleanUp();
+        }
+        finally
+        {
+
+            Energy4Java polygene = new Energy4Java();
+            Assembler[][][] assemblers = new Assembler[][][]
+            {
+                {
+                    {
+                        createAssembler()
+                    }
+                }
+            };
+            Application application = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            {
+            } );
+            application.activate();
+
+            Module moduleInstance = application.findModule( "Layer 1", "config" );
+            UnitOfWorkFactory uowf = moduleInstance.unitOfWorkFactory();
+            UnitOfWork uow = uowf.newUnitOfWork();
+            try
+            {
+                SQLConfiguration config = uow.get( SQLConfiguration.class,
+                                                   PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+                // TODO fix AbstractEntityStorePerformanceTest to extend from AbstractPolygeneTest
+                Connection connection = null; // SQLUtil.getConnection( this.serviceLocator );
+                String schemaName = config.schemaName().get();
+                if( schemaName == null )
+                {
+                    schemaName = SQLs.DEFAULT_SCHEMA_NAME;
+                }
+
+                Statement stmt = null;
+                try
+                {
+                    stmt = connection.createStatement();
+                    stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
+                    connection.commit();
+                }
+                finally
+                {
+                    SQLUtil.closeQuietly( stmt );
+                }
+            }
+            finally
+            {
+                uow.discard();
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
new file mode 100644
index 0000000..a8e54ee
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/indexing/rdf/QueryPerformanceTest.java
@@ -0,0 +1,399 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.indexing.rdf;
+
+import java.io.File;
+import org.apache.derby.iapi.services.io.FileUtil;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.Query;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
+import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
+import org.apache.polygene.index.rdf.indexing.RdfIndexingService;
+import org.apache.polygene.index.rdf.query.SesameExpressions;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+import static org.apache.polygene.api.query.QueryExpressions.eq;
+import static org.apache.polygene.api.query.QueryExpressions.templateFor;
+
+@SuppressWarnings( "ResultOfMethodCallIgnored" )
+public class QueryPerformanceTest
+    implements ApplicationAssembler
+{
+    private static final int NUMBER_OF_ENTITIES = 100000;
+    private static final String LAYER_INFRASTRUCTURE = "LAYER_INFRASTRUCTURE";
+    private static final String MODULE_PERSISTENCE = "MODULE_PERSISTENCE";
+    private static final String LAYER_CONFIGURATION = "CONFIGURATION";
+    private static final String LAYER_DOMAIN = "LAYER_DOMAIN";
+    private static final String MODULE_DOMAIN = "MODULE_DOMAIN";
+    private static final String MODULE_CONFIG = "MODULE_CONFIG";
+
+    private Application application;
+    private Module module;
+    private UnitOfWorkFactory uowf;
+    private static final String QUERY1 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
+                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
+                                         + "SELECT ?entityType ?reference\n"
+                                         + "WHERE {\n"
+                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
+                                         + "?entity rdf:type ?entityType. \n"
+                                         + "?entity ns0:reference ?reference. \n"
+                                         + "?entity ns1:name \"Lead64532\". \n"
+                                         + "}";
+    private static final String QUERY2 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
+                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
+                                         + "SELECT ?entityType ?reference\n"
+                                         + "WHERE {\n"
+                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
+                                         + "?entity rdf:type ?entityType. \n"
+                                         + "?entity ns0:reference ?reference. \n"
+                                         + "?entity ns1:name \"Lead98276\". \n"
+                                         + "}";
+    private static final String QUERY3 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
+                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
+                                         + "SELECT ?entityType ?reference\n"
+                                         + "WHERE {\n"
+                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
+                                         + "?entity rdf:type ?entityType. \n"
+                                         + "?entity ns0:reference ?reference. \n"
+                                         + "?entity ns1:name \"Lead2\". \n"
+                                         + "}";
+    private static final String QUERY4 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
+                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
+                                         + "SELECT ?entityType ?reference\n"
+                                         + "WHERE {\n"
+                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
+                                         + "?entity rdf:type ?entityType. \n"
+                                         + "?entity ns0:reference ?reference. \n"
+                                         + "?entity ns1:name \"Lead14332\". \n"
+                                         + "}";
+    private static final String QUERY5 = "PREFIX ns0: <urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#> \n"
+                                         + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+                                         + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+                                         + "PREFIX ns1: <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead#> \n"
+                                         + "SELECT ?entityType ?reference\n"
+                                         + "WHERE {\n"
+                                         + "?entityType rdfs:subClassOf <urn:polygene:type:org.apache.polygene.test.performance.indexing.rdf.QueryPerformanceTest-Lead>. \n"
+                                         + "?entity rdf:type ?entityType. \n"
+                                         + "?entity ns0:reference ?reference. \n"
+                                         + "?entity ns1:name \"Lead632\". \n"
+                                         + "}";
+    private File indexingDataDir;
+
+    @Before
+    public void setup()
+        throws Exception
+    {
+        Energy4Java polygene = new Energy4Java();
+        application = polygene.newApplication( this );
+        module = application.findModule( LAYER_DOMAIN, MODULE_DOMAIN );
+        application.activate();
+        indexingDataDir = module.findService( RdfIndexingService.class ).get().dataDir();
+        uowf = module.unitOfWorkFactory();
+    }
+
+    @After
+    public void tearDown()
+        throws Exception
+    {
+        try
+        {
+            if( application != null )
+            {
+                System.out.println( "Shutting Down test." );
+                application.passivate();
+            }
+        }
+        finally
+        {
+            FileUtil.removeDirectory( indexingDataDir );
+        }
+    }
+
+    @Override
+    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException
+    {
+        ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
+        LayerAssembly infra = createInfrastructureLayer( applicationAssembly );
+        LayerAssembly domain = createDomainLayer( applicationAssembly );
+        LayerAssembly config = createConfigurationLayer( applicationAssembly );
+        infra.uses( config );
+        domain.uses( infra );
+        return applicationAssembly;
+    }
+
+    @Test
+    public void testIndexingFluentQueries()
+        throws Exception
+    {
+        LeadRepository leadRepo = populateEntityStore();
+        measureFluentQuery( leadRepo, "Lead64531" );
+        measureFluentQuery( leadRepo, "Lead98275" );
+        measureFluentQuery( leadRepo, "Lead3" );
+        measureFluentQuery( leadRepo, "Lead14331" );
+        measureFluentQuery( leadRepo, "Lead631" );
+    }
+
+    @Test
+    public void testIndexingNamedQueries()
+        throws Exception
+    {
+        LeadRepository leadRepo = populateEntityStore();
+        measureNamedQuery( leadRepo, QUERY1 );
+        measureNamedQuery( leadRepo, QUERY2 );
+        measureNamedQuery( leadRepo, QUERY3 );
+        measureNamedQuery( leadRepo, QUERY4 );
+        measureNamedQuery( leadRepo, QUERY5 );
+    }
+
+    private LeadRepository populateEntityStore()
+        throws UnitOfWorkCompletionException
+    {
+        UnitOfWork uow = uowf.newUnitOfWork();
+        try
+        {
+            LeadRepository leadRepo = module.findService( LeadRepositoryService.class ).get();
+            if( leadRepo.findByName( "Lead99999" ) == null )
+            {
+                ServiceReference<LeadEntityFactoryService> leadFactoryRef = module.findService( LeadEntityFactoryService.class );
+                LeadEntityFactory leadFactory = leadFactoryRef.get();
+                long start, end;
+                start = System.currentTimeMillis();
+                for( int i = 1; i < NUMBER_OF_ENTITIES; i++ )
+                {
+                    if( ( i % 10000 ) == 0 )
+                    {
+                        System.out.print( "\r" + i );
+                        uow.complete();
+                        uow = uowf.newUnitOfWork();
+                    }
+                    leadFactory.create( "Lead" + i );
+                }
+                System.out.println();
+                uow.complete();
+                end = System.currentTimeMillis();
+                System.out.println( "Population time: " + ( end - start ) );
+            }
+            return leadRepo;
+        }
+        finally
+        {
+            if( uow != null && uow.isOpen() )
+            {
+                uow.discard();
+            }
+        }
+    }
+
+    private void measureFluentQuery( LeadRepository leadRepo, String nameOfEntity )
+        throws Exception
+    {
+        long start;
+        long end;
+        try( UnitOfWork uow = uowf.newUnitOfWork() )
+        {
+            start = System.currentTimeMillis();
+            Lead lead = leadRepo.findByName( nameOfEntity );
+            end = System.currentTimeMillis();
+            if( lead == null )
+            {
+                Assert.fail( "Entity was not found or more than one entity was found." );
+                return;
+            }
+            System.out.println( "Lead: " + lead );
+            System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
+            uow.complete();
+        }
+    }
+
+    private void measureNamedQuery( LeadRepository leadRepo, String queryName )
+        throws Exception
+    {
+        long start;
+        long end;
+        try( UnitOfWork uow = uowf.newUnitOfWork() )
+        {
+            start = System.currentTimeMillis();
+            Lead lead = leadRepo.findByFixedQuery( queryName );
+            end = System.currentTimeMillis();
+            if( lead == null )
+            {
+                Assert.fail( "Entity was not found or more than one entity was found." );
+                return;
+            }
+            System.out.println( "Lead: " + lead );
+            System.out.println( "Retrieval time of " + lead.name().get() + " by name: " + ( end - start ) );
+            uow.complete();
+        }
+    }
+
+    private LayerAssembly createDomainLayer( ApplicationAssembly applicationAssembly )
+        throws AssemblyException
+    {
+        LayerAssembly domainLayer = applicationAssembly.layer( LAYER_DOMAIN );
+        ModuleAssembly domainModule = domainLayer.module( MODULE_DOMAIN );
+        domainModule.addServices( LeadRepositoryService.class );
+        domainModule.addServices( LeadEntityFactoryService.class );
+        domainModule.entities( LeadEntity.class );
+        return domainLayer;
+    }
+
+    private LayerAssembly createInfrastructureLayer( ApplicationAssembly applicationAssembly )
+        throws AssemblyException
+    {
+        LayerAssembly infrastructureLayer = applicationAssembly.layer( LAYER_INFRASTRUCTURE );
+
+        // Persistence module
+        ModuleAssembly persistenceModule = infrastructureLayer.module( MODULE_PERSISTENCE );
+
+        // Indexing
+        new RdfNativeSesameStoreAssembler().assemble( persistenceModule );
+
+        // Entity store
+        new OrgJsonValueSerializationAssembler().assemble( persistenceModule );
+        new MemoryEntityStoreAssembler().visibleIn( Visibility.application ).assemble( persistenceModule );
+
+        return infrastructureLayer;
+    }
+
+    private LayerAssembly createConfigurationLayer( ApplicationAssembly applicationAssembly )
+        throws AssemblyException
+    {
+        LayerAssembly layer = applicationAssembly.layer( LAYER_CONFIGURATION );
+        ModuleAssembly configModule = layer.module( MODULE_CONFIG );
+        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
+        new EntityTestAssembler().assemble( configModule );
+        return layer;
+    }
+
+    public interface Lead
+    {
+        Property<String> name();
+    }
+
+    public interface LeadEntity
+        extends Lead, EntityComposite
+    {
+    }
+
+    @Mixins( LeadEntityFactoryMixin.class )
+    public interface LeadEntityFactoryService
+        extends LeadEntityFactory, ServiceComposite
+    {
+    }
+
+    public interface LeadEntityFactory
+    {
+        Lead create( String name );
+    }
+
+    public static class LeadEntityFactoryMixin
+        implements LeadEntityFactory
+    {
+        @Structure
+        private UnitOfWorkFactory uowf;
+
+        @Override
+        public Lead create( String name )
+        {
+            UnitOfWork uow = uowf.currentUnitOfWork();
+            EntityBuilder<LeadEntity> builder = uow.newEntityBuilder( LeadEntity.class );
+            Lead prototype = builder.instanceFor( LeadEntity.class );
+            prototype.name().set( name );
+            return builder.newInstance();
+        }
+    }
+
+    public interface LeadRepository
+    {
+        Lead findByFixedQuery( String name );
+
+        Lead findByName( String name );
+    }
+
+    @Mixins( LeadRepositoryMixin.class )
+    public interface LeadRepositoryService
+        extends LeadRepository, ServiceComposite
+    {
+    }
+
+    public static class LeadRepositoryMixin
+        implements LeadRepository
+    {
+        @Structure
+        private QueryBuilderFactory qbf;
+
+        @Structure
+        private UnitOfWorkFactory uowf;
+
+        @Override
+        public Lead findByFixedQuery( String queryString )
+        {
+            UnitOfWork uow = uowf.currentUnitOfWork();
+            Query<Lead> query = uow.newQuery( qbf.newQueryBuilder( Lead.class ).where( SesameExpressions.sparql( queryString ) ) );
+            return query.find();
+        }
+
+        @Override
+        public Lead findByName( String name )
+        {
+            UnitOfWork uow = uowf.currentUnitOfWork();
+            QueryBuilder<Lead> builder = qbf.newQueryBuilder( Lead.class );
+            Lead template = templateFor( Lead.class );
+
+            Query<Lead> query = uow.newQuery( builder.where( eq( template.name(), name ) ) );
+            return query.find();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
new file mode 100644
index 0000000..449ecf4
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
@@ -0,0 +1,287 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.runtime.composite;
+
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Test;
+
+/**
+ * Tests performance of new composite creation.
+ */
+public class CompositeCreationPerformanceTest
+{
+    @Test
+    public void newInstanceForRegisteredCompositePerformance()
+        throws ActivationException, AssemblyException, InterruptedException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.transients( AnyComposite.class );
+                module.objects( AnyObject.class );
+                module.values( AnyValue.class );
+            }
+        };
+        int warmups = 10;
+        int runs = 20;
+        long waitBeforeRun = 1000;
+        long waitBetweenRuns = 500;
+        long timeForJavaObject = 0;
+        {
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testJavaObjectCreationPerformance( false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForJavaObject += testJavaObjectCreationPerformance( true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForJavaObject = timeForJavaObject / runs;
+        }
+        long timeForTransientComposite = 0;
+        {
+            TransientBuilderFactory module = assembler.module();
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testCompositeCreationPerformance( module, false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForTransientComposite += testCompositeCreationPerformance( module, true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForTransientComposite = timeForTransientComposite / runs;
+        }
+        long timeForManagedObject = 0;
+        {
+            ObjectFactory objectFactory = assembler.module();
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testObjectCreationPerformance( objectFactory, false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForManagedObject += testObjectCreationPerformance( objectFactory, true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForManagedObject = timeForManagedObject / runs;
+        }
+        long timeForValueComposite = 0;
+        {
+            ValueBuilderFactory valueBuilderFactory = assembler.module();
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testValueCreationPerformance( valueBuilderFactory, false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForValueComposite += testValueCreationPerformance( valueBuilderFactory, true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForValueComposite = timeForValueComposite / runs;
+        }
+
+        long timeForTransientCompositeBuilder = 0;
+        {
+            TransientBuilderFactory module = assembler.module();
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testCompositeCreationWithBuilderPerformance( module, false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForTransientCompositeBuilder += testCompositeCreationWithBuilderPerformance( module, true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForTransientCompositeBuilder = timeForTransientCompositeBuilder / runs;
+        }
+        long timeForValueCompositeBuilder = 0;
+        {
+            ValueBuilderFactory valueBuilderFactory = assembler.module();
+            // Warmup
+            for( int i = 0; i < warmups; i++ )
+            {
+                testValueCreationWithBuilderPerformance( valueBuilderFactory, false );
+            }
+            Thread.sleep( waitBeforeRun );
+            // Run
+            for( int i = 0; i < runs; i++ )
+            {
+                timeForValueCompositeBuilder += testValueCreationWithBuilderPerformance( valueBuilderFactory, true );
+                Thread.sleep( waitBetweenRuns );
+            }
+            timeForValueCompositeBuilder = timeForValueCompositeBuilder / runs;
+        }
+
+        System.out.println( "----" );
+        System.out.println( "Transient: " + ( timeForTransientComposite / timeForJavaObject ) + "x" );
+        System.out.println( "TransientBuilder: " + ( timeForTransientCompositeBuilder / timeForJavaObject ) + "x" );
+        System.out.println( "Value: " + ( timeForValueComposite / timeForJavaObject ) + "x" );
+        System.out.println( "ValueBuilder: " + ( timeForValueCompositeBuilder / timeForJavaObject ) + "x" );
+        System.out.println( "Object: " + ( timeForManagedObject / timeForJavaObject ) + "x" );
+    }
+
+    private long testCompositeCreationPerformance( TransientBuilderFactory module, boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            module.newTransient( AnyComposite.class );
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Composite Creation Time:" + time + " nanoseconds per composite" );
+        }
+        return time;
+    }
+
+    private long testCompositeCreationWithBuilderPerformance( TransientBuilderFactory module, boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            module.newTransientBuilder( AnyComposite.class ).newInstance();
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Composite (builder) Creation Time:" + time + " nanoseconds per composite" );
+        }
+        return time;
+    }
+
+    private long testValueCreationPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            valueBuilderFactory.newValue( AnyValue.class );
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Value Creation Time:" + time + " nanoseconds per composite" );
+        }
+        return time;
+    }
+
+    private long testValueCreationWithBuilderPerformance( ValueBuilderFactory valueBuilderFactory, boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            valueBuilderFactory.newValueBuilder( AnyValue.class ).newInstance();
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Value (builder) Creation Time:" + time + " nanoseconds per composite" );
+        }
+        return time;
+    }
+
+    private long testObjectCreationPerformance( ObjectFactory objectFactory, boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            objectFactory.newObject( AnyObject.class );
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Polygene Object Creation Time:" + time + " nanoseconds per object" );
+        }
+        return time;
+    }
+
+    private long testJavaObjectCreationPerformance( boolean run )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            new AnyObject();
+        }
+
+        long end = System.currentTimeMillis();
+        long time = 1000000L * ( end - start ) / iter;
+        if( run )
+        {
+            System.out.println( "Java Object Creation Time:" + time + " nanoseconds per object" );
+        }
+        return time;
+    }
+
+    public interface AnyComposite
+        extends TransientComposite
+    {
+    }
+
+    public interface AnyValue
+        extends ValueComposite
+    {
+    }
+
+    public static class AnyObject
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/InvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/InvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/InvocationPerformanceTest.java
new file mode 100644
index 0000000..c63e33a
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/InvocationPerformanceTest.java
@@ -0,0 +1,204 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import org.junit.Test;
+import org.apache.polygene.api.composite.TransientBuilder;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.concern.ConcernOf;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+/**
+ * Invocation performance test.
+ * <p>
+ * Don't forget to add VM value "-server" before running this test!
+ * </p>
+ * <p>
+ * These tests are very sensitive to warmup of JVM, hence the duplication. Often the first round
+ * is only for getting the code jitted, and the second round is what you want to look at.
+ * </p>
+ */
+public class InvocationPerformanceTest
+    extends AbstractPolygeneTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.transients( SimpleComposite.class );
+        module.transients( SimpleWithTypedConcernComposite.class );
+        module.transients( SimpleWithGenericConcernComposite.class );
+    }
+
+    @Test
+    public void testInvokeMixin()
+    {
+        // Create instance
+        TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
+        Simple simple = builder.newInstance();
+
+        for( int i = 0; i < 60000; i++ )
+        {
+            simple.test();
+        }
+
+        int rounds = 10;
+        for( int i = 0; i < rounds; i++ )
+        {
+            System.gc();
+            performanceCheck( simple );
+        }
+    }
+
+    @Test
+    public void testInvokeMixinWithTypedConcern()
+    {
+        // Create instance
+        Simple simple = transientBuilderFactory.newTransient( SimpleWithTypedConcernComposite.class );
+
+        for( int i = 0; i < 60000; i++ )
+        {
+            simple.test();
+        }
+
+        int rounds = 3;
+        for( int i = 0; i < rounds; i++ )
+        {
+            performanceCheck( simple );
+        }
+    }
+
+    @Test
+    public void testInvokeMixinWithGenericConcern()
+    {
+        // Create instance
+        Simple simple = transientBuilderFactory.newTransient( SimpleWithGenericConcernComposite.class );
+
+        for( int i = 0; i < 60000; i++ )
+        {
+            simple.test();
+        }
+
+        int rounds = 3;
+        for( int i = 0; i < rounds; i++ )
+        {
+            performanceCheck( simple );
+        }
+    }
+
+    @Test
+    public void testInvokeMixin2()
+    {
+        testInvokeMixin();
+    }
+
+    @Test
+    public void testInvokeMixinWithTypedConcern2()
+    {
+        testInvokeMixinWithTypedConcern();
+    }
+
+    @Test
+    public void testInvokeMixinWithGenericConcern2()
+    {
+        testInvokeMixinWithGenericConcern();
+    }
+
+    private void performanceCheck( Simple simple )
+    {
+        long count = 10000000L;
+
+        long start = System.currentTimeMillis();
+        for( long i = 0; i < count; i++ )
+        {
+            simple.test();
+        }
+        long end = System.currentTimeMillis();
+        long time = end - start;
+        long callsPerSecond = ( count / time ) * 1000;
+        System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
+    }
+
+    @Mixins( SimpleMixin.class )
+    @Concerns( SimpleTypedConcern.class )
+    public interface SimpleWithTypedConcernComposite
+        extends Simple, TransientComposite
+    {
+    }
+
+    @Mixins( SimpleMixin.class )
+    @Concerns( SimpleGenericConcern.class )
+    public interface SimpleWithGenericConcernComposite
+        extends Simple, TransientComposite
+    {
+    }
+
+    @Mixins( SimpleMixin.class )
+    public interface SimpleComposite
+        extends Simple, TransientComposite
+    {
+    }
+
+    public interface Simple
+    {
+        public void test();
+    }
+
+    public static class SimpleMixin
+        implements Simple
+    {
+        long count = 0;
+
+        @Override
+        public void test()
+        {
+            count++; // Do nothing
+        }
+    }
+
+    public static class SimpleTypedConcern
+        extends ConcernOf<Simple>
+        implements Simple
+    {
+        @Override
+        public void test()
+        {
+            next.test();
+        }
+    }
+
+    public static class SimpleGenericConcern
+        extends ConcernOf<InvocationHandler>
+        implements InvocationHandler
+    {
+        @Override
+        public Object invoke( Object o, Method method, Object[] objects )
+            throws Throwable
+        {
+            return next.invoke( o, method, objects );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
new file mode 100644
index 0000000..7508fe2
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/PropertyMixinInvocationPerformanceTest.java
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.runtime.composite;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+import org.junit.Test;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.composite.TransientBuilder;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+/**
+ * PropertyMixin invocation performance test.
+ * <p>
+ * Don't forget to add VM value "-server" before running this test!
+ * </p>
+ */
+public class PropertyMixinInvocationPerformanceTest
+    extends AbstractPolygeneTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.transients( SimpleComposite.class );
+        module.transients( SimpleComposite2.class );
+    }
+
+    @Test
+    public void testNewInstance()
+    {
+        {
+            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
+            SimpleComposite simple = builder.newInstance();
+
+            int rounds = 1;
+            for( int i = 0; i < rounds; i++ )
+            {
+                performanceCheck( simple );
+            }
+        }
+
+        {
+            TransientBuilder<SimpleComposite> builder = transientBuilderFactory.newTransientBuilder( SimpleComposite.class );
+            SimpleComposite simple = builder.newInstance();
+
+            int rounds = 1;
+            for( int i = 0; i < rounds; i++ )
+            {
+                performanceCheck( simple );
+            }
+        }
+    }
+
+    private void performanceCheck( SimpleComposite simple )
+    {
+        long count = 10000000L;
+
+        {
+            long start = System.currentTimeMillis();
+            for( long i = 0; i < count; i++ )
+            {
+                simple.test();
+            }
+            long end = System.currentTimeMillis();
+            long time = end - start;
+            long callsPerSecond = ( count / time ) * 1000;
+            System.out.println( "Accesses per second: "
+                                + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
+        }
+
+        {
+            long start = System.currentTimeMillis();
+            for( long i = 0; i < count; i++ )
+            {
+                simple.test().get();
+            }
+            long end = System.currentTimeMillis();
+            long time = end - start;
+            long callsPerSecond = ( count / time ) * 1000;
+            System.out.println( "Gets per second: "
+                                + NumberFormat.getIntegerInstance( Locale.US ).format( callsPerSecond ) );
+        }
+    }
+
+    public interface SimpleComposite
+        extends TransientComposite
+    {
+        @Optional
+        Property<String> test();
+    }
+
+    @Mixins( SimpleMixin.class )
+    public interface SimpleComposite2
+        extends SimpleComposite
+    {
+    }
+
+    public abstract static class SimpleMixin
+        implements SimpleComposite2
+    {
+        @State
+        Property<String> test;
+
+        @Override
+        public Property<String> test()
+        {
+            return test;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
new file mode 100644
index 0000000..b995770
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.runtime.object;
+
+import org.junit.Test;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+
+/**
+ * Tests performance of new object creation.
+ */
+public class ObjectCreationPerformanceTest
+{
+
+    @Test
+    public void newInstanceForRegisteredObjectPerformance()
+        throws ActivationException, AssemblyException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.objects( AnyObject.class );
+            }
+        };
+        ObjectFactory objectFactory = assembler.module();
+        for( int i = 0; i < 10; i++ )
+        {
+            testPerformance( objectFactory );
+        }
+    }
+
+    private void testPerformance( ObjectFactory objectFactory )
+    {
+        long start = System.currentTimeMillis();
+        int iter = 1000000;
+        for( int i = 0; i < iter; i++ )
+        {
+            objectFactory.newObject( AnyObject.class );
+        }
+
+        long end = System.currentTimeMillis();
+        System.out.println( end - start );
+    }
+
+    public static final class AnyObject
+    {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
new file mode 100644
index 0000000..c599f6e
--- /dev/null
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.performance.runtime.service;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.text.NumberFormat;
+import junit.framework.TestCase;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+
+public class ServiceInvocationPerformanceTest
+    extends TestCase
+{
+    @Service
+    ServiceInvocationPerformanceTest.MyService service;
+
+    public void testInjectService()
+        throws Exception
+    {
+        SingletonAssembler assembly = new SingletonAssembler()
+        {
+            @Override
+            public void assemble( ModuleAssembly module )
+                throws AssemblyException
+            {
+                module.services( ServiceInvocationPerformanceTest.MyServiceComposite.class );
+                module.objects( ServiceInvocationPerformanceTest.class );
+            }
+        };
+
+        assembly.module().injectTo( this );
+
+        // Warmup
+        for( int i = 0; i < 60000; i++ )
+        {
+            service.test();
+        }
+
+        int rounds = 5;
+        for( int i = 0; i < rounds; i++ )
+        {
+            performanceCheck( service );
+        }
+    }
+
+    private void performanceCheck( MyService simple )
+    {
+        long count = 10000000L;
+
+        long start = System.currentTimeMillis();
+        for( long i = 0; i < count; i++ )
+        {
+            simple.test();
+        }
+        long end = System.currentTimeMillis();
+        long time = end - start;
+        long callsPerSecond = ( count / time ) * 1000;
+        System.out.println( "Calls per second: " + NumberFormat.getIntegerInstance().format( callsPerSecond ) );
+    }
+
+    @Mixins( NoopMixin.class )
+    public static interface MyServiceComposite
+        extends ServiceInvocationPerformanceTest.MyService, ServiceComposite
+    {
+    }
+
+    public static interface MyService
+    {
+        void test();
+    }
+
+    public static class MyServiceMixin
+        implements ServiceInvocationPerformanceTest.MyService
+    {
+        @Override
+        public void test()
+        {
+        }
+    }
+
+    public final static class NoopMixin
+        implements InvocationHandler
+    {
+        @Override
+        public Object invoke( Object object, Method method, Object[] objects )
+            throws Throwable
+        {
+            return null;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
deleted file mode 100644
index 047ffef..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/jdbm/JdbmEntityStorePerformanceTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.entitystore.jdbm;
-
-import java.io.File;
-import org.apache.derby.iapi.services.io.FileUtil;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.cache.ehcache.EhCacheConfiguration;
-import org.apache.polygene.cache.ehcache.EhCachePoolService;
-import org.apache.polygene.entitystore.jdbm.JdbmConfiguration;
-import org.apache.polygene.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-/**
- * Performance test for JdbmEntityStoreComposite
- */
-public class JdbmEntityStorePerformanceTest
-    extends AbstractEntityStorePerformanceTest
-{
-    public JdbmEntityStorePerformanceTest()
-    {
-        super( "JdbmEntityStore", createAssembler() );
-    }
-
-    private static Assembler createAssembler()
-    {
-        return new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                new JdbmEntityStoreAssembler().assemble( module );
-                new OrgJsonValueSerializationAssembler().assemble( module );
-                ModuleAssembly configModule = module.layer().module( "Config" );
-                configModule.entities( JdbmConfiguration.class ).visibleIn( Visibility.layer );
-                new EntityTestAssembler().assemble( configModule );
-
-                module.services( EhCachePoolService.class );
-                configModule.entities( EhCacheConfiguration.class ).visibleIn( Visibility.layer );
-            }
-        };
-    }
-
-    @Override
-    public void cleanUp()
-        throws Exception
-    {
-        super.cleanUp();
-        FileUtil.removeDirectory( new File( "build/tmp/jdbm" ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
deleted file mode 100644
index bd664e1..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.entitystore.memory;
-
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
-import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin;
-import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-public class MemoryEntityStorePerformanceTest
-    extends AbstractEntityStorePerformanceTest
-{
-
-    public MemoryEntityStorePerformanceTest()
-    {
-        super( "MemoryEntityStore", createAssembler() );
-    }
-
-    private static Assembler createAssembler()
-    {
-        return new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                new MemoryEntityStoreAssembler().assemble( module );
-                new OrgJsonValueSerializationAssembler().assemble( module );
-            }
-        };
-    }
-
-    // Alternate variant that uses the standard MapEntityStore
-    @Mixins( MapEntityStoreMixin.class )
-    interface MemoryEntityStoreService2
-        extends MemoryEntityStoreService
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
deleted file mode 100644
index d1ea720..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.entitystore.sql;
-
-import java.sql.Connection;
-import java.sql.Statement;
-import javax.sql.DataSource;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.usecase.UsecaseBuilder;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
-import org.apache.polygene.entitystore.sql.internal.SQLs;
-import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
-import org.apache.polygene.library.sql.common.SQLConfiguration;
-import org.apache.polygene.library.sql.common.SQLUtil;
-import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-
-/**
- * Performance test for DerbySQLEntityStore.
- */
-public class DerbySQLEntityStorePerformanceTest
-    extends AbstractEntityStorePerformanceTest
-{
-
-    public DerbySQLEntityStorePerformanceTest()
-    {
-        super( "DerbySQLEntityStore", createAssembler() );
-    }
-
-    private static Assembler createAssembler()
-    {
-        return new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                ModuleAssembly config = module.layer().module( "config" );
-                new EntityTestAssembler().assemble( config );
-
-                new OrgJsonValueSerializationAssembler().assemble( module );
-
-                // DataSourceService
-                new DBCPDataSourceServiceAssembler().
-                    identifiedBy( "derby-datasource-service" ).
-                    visibleIn( Visibility.module ).
-                    withConfig( config, Visibility.layer ).
-                    assemble( module );
-
-                // DataSource
-                new DataSourceAssembler().
-                    withDataSourceServiceIdentity( "derby-datasource-service" ).
-                    identifiedBy( "derby-datasource" ).
-                    withCircuitBreaker().
-                    assemble( module );
-
-                // SQL EntityStore
-                new DerbySQLEntityStoreAssembler().
-                    withConfig( config, Visibility.layer ).
-                    assemble( module );
-            }
-        };
-    }
-
-    @Override
-    protected void cleanUp()
-        throws Exception
-    {
-        if( uowf == null )
-        {
-            return;
-        }
-        UnitOfWork uow = this.uowf.newUnitOfWork( UsecaseBuilder.newUsecase(
-            "Delete " + getClass().getSimpleName() + " test data" ) );
-        try
-        {
-            SQLConfiguration config = uow.get( SQLConfiguration.class,
-                                               DerbySQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
-            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
-            String schemaName = config.schemaName().get();
-            if( schemaName == null )
-            {
-                schemaName = SQLs.DEFAULT_SCHEMA_NAME;
-            }
-
-            Statement stmt = null;
-            try
-            {
-                stmt = connection.createStatement();
-                stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
-                connection.commit();
-            }
-            finally
-            {
-                SQLUtil.closeQuietly( stmt );
-            }
-        }
-        finally
-        {
-            uow.discard();
-            super.cleanUp();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
deleted file mode 100644
index e0c2bcc..0000000
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.performance.entitystore.sql;
-
-import java.sql.Connection;
-import java.sql.Statement;
-import org.junit.Ignore;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler;
-import org.apache.polygene.entitystore.sql.internal.SQLs;
-import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
-import org.apache.polygene.library.sql.common.SQLConfiguration;
-import org.apache.polygene.library.sql.common.SQLUtil;
-import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
-import org.apache.polygene.test.performance.entitystore.AbstractEntityStorePerformanceTest;
-
-/**
- * Performance test for PostgreSQLEntityStore.
- * <p>
- * WARN This test is deactivated on purpose, please do not commit it activated.
- * </p>
- * <p>
- * To run it see PostgreSQLEntityStoreTest.
- * </p>
- */
-@Ignore( "WARN Tearing down this test is broken!" )
-public class PostgreSQLEntityStorePerformanceTest
-    extends AbstractEntityStorePerformanceTest
-{
-
-    public PostgreSQLEntityStorePerformanceTest()
-    {
-        super( "PostgreSQLEntityStore", createAssembler() );
-    }
-
-    private static Assembler createAssembler()
-    {
-        return new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                ModuleAssembly config = module.layer().module( "config" );
-                config.services( MemoryEntityStoreService.class );
-
-                // DataSourceService
-                new DBCPDataSourceServiceAssembler().
-                    identifiedBy( "postgresql-datasource-service" ).
-                    visibleIn( Visibility.module ).
-                    withConfig( config, Visibility.layer ).
-                    assemble( module );
-
-                // DataSource
-                new DataSourceAssembler().
-                    withDataSourceServiceIdentity( "postgresql-datasource-service" ).
-                    identifiedBy( "postgresql-datasource" ).
-                    withCircuitBreaker().
-                    assemble( module );
-
-                // SQL EntityStore
-                new PostgreSQLEntityStoreAssembler().
-                    withConfig( config, Visibility.layer ).
-                    assemble( module );
-            }
-
-        };
-    }
-
-    @Override
-    protected void cleanUp()
-        throws Exception
-    {
-        try
-        {
-            super.cleanUp();
-        }
-        finally
-        {
-
-            Energy4Java polygene = new Energy4Java();
-            Assembler[][][] assemblers = new Assembler[][][]
-            {
-                {
-                    {
-                        createAssembler()
-                    }
-                }
-            };
-            Application application = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
-            {
-            } );
-            application.activate();
-
-            Module moduleInstance = application.findModule( "Layer 1", "config" );
-            UnitOfWorkFactory uowf = moduleInstance.unitOfWorkFactory();
-            UnitOfWork uow = uowf.newUnitOfWork();
-            try
-            {
-                SQLConfiguration config = uow.get( SQLConfiguration.class,
-                                                   PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
-                // TODO fix AbstractEntityStorePerformanceTest to extend from AbstractPolygeneTest
-                Connection connection = null; // SQLUtil.getConnection( this.serviceLocator );
-                String schemaName = config.schemaName().get();
-                if( schemaName == null )
-                {
-                    schemaName = SQLs.DEFAULT_SCHEMA_NAME;
-                }
-
-                Statement stmt = null;
-                try
-                {
-                    stmt = connection.createStatement();
-                    stmt.execute( String.format( "DELETE FROM %s." + SQLs.TABLE_NAME, schemaName ) );
-                    connection.commit();
-                }
-                finally
-                {
-                    SQLUtil.closeQuietly( stmt );
-                }
-            }
-            finally
-            {
-                uow.discard();
-            }
-        }
-    }
-
-}


[71/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiClassUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiClassUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiClassUtil.java
deleted file mode 100644
index 1f7dbb2..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/PsiClassUtil.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.psi;
-
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.lang.reflect.InvocationHandler;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PsiClassUtil
-{
-    @Nullable
-    public static PsiClass getPSIClass( @NotNull PsiElement element )
-    {
-        if( element instanceof PsiClass )
-        {
-            return (PsiClass) element;
-        }
-
-        if( element instanceof PsiTypeElement )
-        {
-            PsiTypeElement psiTypeElement = (PsiTypeElement) element;
-            PsiJavaCodeReferenceElement componentRef = psiTypeElement.getInnermostComponentReferenceElement();
-            if( componentRef == null )
-            {
-                return null;
-            }
-
-            return (PsiClass) componentRef.resolve();
-        }
-
-        PsiElement context = element.getContext();
-        if( context instanceof PsiClass )
-        {
-            return (PsiClass) context;
-        }
-
-        return null;
-    }
-
-    @NotNull
-    public static Set<PsiClass> getExtends( @NotNull PsiClass psiClass )
-    {
-        HashSet<PsiClass> extendsClasses = new HashSet<PsiClass>();
-        PsiClassType[] extendsClassTypes = psiClass.getExtendsListTypes();
-        for( PsiClassType extendClassType : extendsClassTypes )
-        {
-            PsiClass extendClass = extendClassType.resolve();
-            if( extendClass != null )
-            {
-                extendsClasses.add( extendClass );
-            }
-        }
-
-        return extendsClasses;
-    }
-
-    /**
-     * Returns all extends of the specified {@code psiClass}.
-     *
-     * @param psiClass class to process.
-     * @return all extends of the specified {@code psiClass}.
-     * @since 0.1
-     */
-    @NotNull
-    public static Set<PsiClass> getExtendsDeep( @NotNull PsiClass psiClass )
-    {
-        HashSet<PsiClass> extendsClasses = new HashSet<PsiClass>();
-        PsiClassType[] extendsClassTypes = psiClass.getExtendsListTypes();
-        for( PsiClassType extendClassType : extendsClassTypes )
-        {
-            PsiClass extendClass = extendClassType.resolve();
-            if( extendClass != null )
-            {
-                extendsClasses.add( extendClass );
-                extendsClasses.addAll( getExtendsDeep( extendClass ) );
-            }
-        }
-
-        return extendsClasses;
-    }
-
-    /**
-     * @param psiClass Psi class to check.
-     * @return {@code true} if psi class implements {@code InvocationHandler}, {@code false} otherwise.
-     * @see InvocationHandler
-     */
-    public static boolean isImplementsInvocationHandler( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        GlobalSearchScope searchScope = determineSearchScope( psiClass );
-        assert searchScope != null;
-
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( psiClass.getProject() );
-        PsiClass invocationHandler = psiFacade.findClass( "java.lang.reflect.InvocationHandler", searchScope );
-        assert invocationHandler != null;
-
-        return psiClass.isInheritor( invocationHandler, true );
-    }
-
-    private PsiClassUtil()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
deleted file mode 100644
index 4beda1f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.psi.search;
-
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.openapi.module.ModuleUtil.findModuleForPsiElement;
-import static org.apache.polygene.ide.plugin.idea.common.vfs.VirtualFileUtil.getVirtualFile;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class GlobalSearchScopeUtil
-{
-    /**
-     * Determine search scope given a psi element.
-     *
-     * @param psiElement context.
-     * @return Search scope given psi class.
-     * @since 0.1
-     */
-    @Nullable
-    public static GlobalSearchScope determineSearchScope( @NotNull PsiElement psiElement )
-    {
-        VirtualFile classVirtualFile = getVirtualFile( psiElement );
-        if( classVirtualFile == null )
-        {
-            return null;
-        }
-
-        Module module = findModuleForPsiElement( psiElement );
-        if( module == null )
-        {
-            return null;
-        }
-
-        Project project = psiElement.getProject();
-        ProjectRootManager projectRootManager = ProjectRootManager.getInstance( project );
-        boolean includeTestClasses = projectRootManager.getFileIndex().isInTestSourceContent( classVirtualFile );
-        return module.getModuleWithDependenciesAndLibrariesScope( includeTestClasses );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
deleted file mode 100644
index c5f29b4..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.resource;
-
-import com.intellij.CommonBundle;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.PropertyKey;
-
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.util.ResourceBundle;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneResourceBundle
-{
-
-    @NonNls
-    private static final String RESOURCE_BUNDLE_NAME = "org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle";
-
-    private static Reference<ResourceBundle> BUNDLE_REF;
-
-    private PolygeneResourceBundle()
-    {
-    }
-
-    public static String message( @PropertyKey( resourceBundle = RESOURCE_BUNDLE_NAME ) String key,
-                                  Object... params )
-    {
-        ResourceBundle resourceBundle = getBundle();
-        return CommonBundle.message( resourceBundle, key, params );
-    }
-
-    private static ResourceBundle getBundle()
-    {
-        ResourceBundle bundle = null;
-        if( BUNDLE_REF != null )
-        {
-            bundle = BUNDLE_REF.get();
-        }
-
-        if( bundle == null )
-        {
-            bundle = ResourceBundle.getBundle( PolygeneResourceBundle.class.getName() );
-            BUNDLE_REF = new SoftReference<ResourceBundle>( bundle );
-        }
-
-        return bundle;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/vfs/VirtualFileUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/vfs/VirtualFileUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/vfs/VirtualFileUtil.java
deleted file mode 100644
index d5b95b6..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/vfs/VirtualFileUtil.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.vfs;
-
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiFileSystemItem;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class VirtualFileUtil
-{
-    /**
-     * @param element element to process.
-     * @return The containing virtual file of the element.
-     * @since 0.1
-     */
-    @Nullable
-    public static VirtualFile getVirtualFile( @NotNull PsiElement element )
-    {
-        if( element instanceof PsiFileSystemItem )
-        {
-            PsiFileSystemItem fileSystemItem = (PsiFileSystemItem) element;
-            return fileSystemItem.getVirtualFile();
-        }
-
-        // If it's not a file system, assume that this is an element within a file
-        PsiFile containingFile = element.getContainingFile();
-        if( containingFile == null )
-        {
-            return null;
-        }
-
-        VirtualFile virtualFile = containingFile.getVirtualFile();
-        if( virtualFile != null )
-        {
-            return virtualFile;
-        }
-
-        PsiFile originalFile = containingFile.getOriginalFile();
-        if( originalFile == null )
-        {
-            return null;
-        }
-
-        return originalFile.getVirtualFile();
-    }
-
-    private VirtualFileUtil()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
deleted file mode 100644
index b6abdfb..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.polygene.ide.plugin.idea.concerns.actions.create;
-
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiElement;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.actions.AbstractCreateElementActionBase;
-
-/**
- * @author edward.yakop@gmail.com
- */
-public class CreateConcernFromMixinTypeOrCompositeAction extends AbstractCreateElementActionBase
-{
-    public CreateConcernFromMixinTypeOrCompositeAction()
-    {
-        super( "TODO", "TODO" );
-    }
-
-    protected String getCommandName()
-    {
-        return "CreateConcernFromMixinTypeOrCompositeAction";
-    }
-
-    protected String getActionName( PsiDirectory directory, String newName )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    protected String getDialogPrompt()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    protected String getDialogTitle()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @NotNull
-    protected PsiElement[] create( String newName, PsiDirectory directory )
-        throws Exception
-    {
-        return new PsiElement[0];  //To change body of implemented methods use File | Settings | File Templates.
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
deleted file mode 100644
index 402df3e..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.actions.create.inPackage;
-
-import com.intellij.ide.actions.CreateInPackageActionBase;
-import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.Messages;
-import com.intellij.psi.JavaDirectoryService;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-import static com.intellij.openapi.actionSystem.DataKeys.PROJECT;
-import static com.intellij.openapi.actionSystem.DataKeys.PSI_ELEMENT;
-import static com.intellij.util.Icons.CLASS_ICON;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.TEMPLATE_GENERIC_CONCERN_OF;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.getConcernOfClass;
-
-/**
- * JAVADOC: Non generic concern
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class CreateConcernOfInPackageAction extends CreateInPackageActionBase
-{
-    protected CreateConcernOfInPackageAction()
-    {
-        super( message( "createConcernOfInPackage.menu.action.text" ),
-               message( "createConcernOfInPackage.menu.action.description" ),
-               CLASS_ICON );
-    }
-
-    @Override
-    protected final boolean isAvailable( DataContext dataContext )
-    {
-        boolean isAvailable = super.isAvailable( dataContext );
-        if( !isAvailable )
-        {
-            return false;
-        }
-
-        PsiElement psiElement = PSI_ELEMENT.getData( dataContext );
-        if( psiElement == null )
-        {
-            return false;
-        }
-
-        GlobalSearchScope searchScope = determineSearchScope( psiElement );
-        if( searchScope == null )
-        {
-            return false;
-        }
-
-        Project project = PROJECT.getData( dataContext );
-        PsiClass psiClass = getConcernOfClass( project, searchScope );
-        return psiClass != null;
-    }
-
-    @NotNull
-    protected final PsiElement[] invokeDialog( Project project, PsiDirectory directory )
-    {
-        MyInputValidator validator = new MyInputValidator( project, directory );
-        Messages.showInputDialog( project, message( "createConcernOfInPackage.dlg.prompt" ),
-                                  message( "createConcernOfInPackage.dlg.title" ),
-                                  Messages.getQuestionIcon(), "", validator );
-        return validator.getCreatedElements();
-    }
-
-    protected final String getCommandName()
-    {
-        return message( "createConcernOfInPackage.command.name" );
-    }
-
-    protected final String getErrorTitle()
-    {
-        return message( "createConcernOfInPackage.error.title" );
-    }
-
-    protected final String getActionName( PsiDirectory directory, String newName )
-    {
-        return message( "createConcernOfInPackage.progress.text", newName );
-    }
-
-    protected final void doCheckCreate( final PsiDirectory dir, final String className )
-        throws IncorrectOperationException
-    {
-        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
-        javaDirectoryService.checkCreateClass( dir, className );
-    }
-
-    @NotNull
-    protected PsiClass doCreate( final PsiDirectory dir, final String className )
-        throws IncorrectOperationException
-    {
-        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
-        return javaDirectoryService.createClass( dir, className, TEMPLATE_GENERIC_CONCERN_OF );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
deleted file mode 100644
index 0bbe3a1..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.common;
-
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneConcernConstants
-{
-    public static final String QUALIFIED_NAME_CONCERNS = "org.apache.polygene.api.concern.Concerns";
-
-    public static final String QUALIFIED_NAME_CONCERN_OF = "org.apache.polygene.api.concern.ConcernOf";
-    public static final String QUALIFIED_NAME_GENERIC_CONCERN = "org.apache.polygene.api.concern.GenericConcern";
-
-    @NonNls
-    public static final String TEMPLATE_GENERIC_CONCERN_OF = "GenericConcernOf.java";
-
-    private PolygeneConcernConstants()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
deleted file mode 100644
index 4499143..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneConcernUtil
-{
-
-
-    /**
-     * @param searchContext Search context.
-     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericConcernClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getGenericConcernClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericConcernClass( @NotNull Project project,
-                                                   @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_GENERIC_CONCERN, scope ) : null;
-    }
-
-    @Nullable
-    public static PsiClass getConcernOfClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getConcernOfClass( project, searchScope );
-    }
-
-    @Nullable
-    public static PsiClass getConcernOfClass( @NotNull Project project,
-                                              @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_CONCERN_OF, scope ) : null;
-    }
-
-    @Nullable
-    public static PsiAnnotation getConcernsAnnotation( @NotNull PsiElement element )
-    {
-        PsiClass psiClass = getPSIClass( element );
-        return findAnnotation( psiClass, QUALIFIED_NAME_CONCERNS );
-    }
-
-    @NotNull
-    public static PsiAnnotation addOrReplaceConcernAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
-                                                               @NotNull PsiClass concernClassToAdd )
-    {
-        Project project = modifierListOwner.getProject();
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        PsiAnnotation existingConcernsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_CONCERNS );
-
-        boolean isReplace = false;
-        PsiAnnotation newConcernsAnnotation;
-        if( existingConcernsAnnotation != null )
-        {
-            // Check duplicate
-            List<PsiAnnotationMemberValue> concernsValues = getConcernsAnnotationValue( existingConcernsAnnotation );
-            for( PsiAnnotationMemberValue concernValue : concernsValues )
-            {
-                PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernValue );
-                if( concernClassReference == null )
-                {
-                    continue;
-                }
-
-                PsiElement concernClass = concernClassReference.resolve();
-                if( concernClassToAdd.equals( concernClass ) )
-                {
-                    return existingConcernsAnnotation;
-                }
-            }
-
-            isReplace = true;
-        }
-
-        String concernAnnotationText = createConcernAnnotationText( existingConcernsAnnotation, concernClassToAdd );
-        newConcernsAnnotation =
-            factory.createAnnotationFromText( concernAnnotationText, modifierListOwner );
-
-        if( isReplace )
-        {
-            // Replace @Concerns instead
-            existingConcernsAnnotation.replace( newConcernsAnnotation );
-        }
-        else
-        {
-            // @Concerns doesn't exists, add it as first child
-            PsiModifierList modifierList = modifierListOwner.getModifierList();
-            modifierList.addBefore( newConcernsAnnotation, modifierList.getFirstChild() );
-        }
-
-        // Shorten all class references if possible
-        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
-        codeStyleManager.shortenClassReferences( newConcernsAnnotation );
-
-        return newConcernsAnnotation;
-    }
-
-    @NotNull
-    private static String createConcernAnnotationText( @Nullable PsiAnnotation concernAnnotationBase,
-                                                       @NotNull PsiClass concernClassToAdd )
-    {
-        StringBuilder annotationTextBuilder = new StringBuilder();
-        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_CONCERNS ).append( "( {" );
-        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernAnnotationBase );
-        for( PsiAnnotationMemberValue concernValue : concernsAnnotationValue )
-        {
-            annotationTextBuilder.append( concernValue.getText() ).append( ", " );
-        }
-        annotationTextBuilder.append( concernClassToAdd.getQualifiedName() ).append( ".class" );
-        annotationTextBuilder.append( "} )" );
-        return annotationTextBuilder.toString();
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getConcernsAnnotationValue( @Nullable PsiAnnotation concernsAnnotation )
-    {
-        if( concernsAnnotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = concernsAnnotation.getQualifiedName();
-        if( !QUALIFIED_NAME_CONCERNS.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( concernsAnnotation );
-    }
-
-    @Nullable
-    public static PsiJavaCodeReferenceElement getConcernClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} extends {@code ConcernOf}, {@code false} if {@code psiClass} does
-     *         not extends {@code ConcernOf} or {@code ConcernOf} is not found.
-     * @since 0.1
-     */
-    public static boolean isAConcern( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass concernOfClass = getConcernOfClass( psiClass );
-        return concernOfClass != null && psiClass.isInheritor( concernOfClass, true );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} extends {@code GenericConcern}, {@code false} if {@code psiClass} does
-     *         not extends {@code GenericConcern} or {@code GenericConcern} is not found.
-     * @since 0.1
-     */
-    public static boolean isAGenericConcern( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass genericConcern = getGenericConcernClass( psiClass );
-        return genericConcern != null && psiClass.isInheritor( genericConcern, true );
-    }
-
-    private PolygeneConcernUtil()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index 4549efe..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/inspections/ConcernsAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiJavaCodeReferenceElement;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.*;
-
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class ConcernsAnnotationDeclaredCorrectlyInspection extends AbstractInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "concerns.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "ConcernsAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @Override
-    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
-                                                 @NotNull InspectionManager manager,
-                                                 boolean isOnTheFly )
-    {
-        // If class does not have @Concerns, ignore
-        PsiAnnotation concernsAnnotation = getConcernsAnnotation( psiClass );
-        if( concernsAnnotation == null )
-        {
-            return null;
-        }
-
-        // If @Concerns declared in class, suggest remove @Concerns annotation
-        if( !psiClass.isInterface() )
-        {
-            String message = message( "concerns.annotation.declared.correctly.error.annotation.declared.in.class" );
-            RemoveConcernsAnnotationFix fix = new RemoveConcernsAnnotationFix( concernsAnnotation );
-            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( concernsAnnotation, message, fix,
-                                                                                   GENERIC_ERROR_OR_WARNING );
-            return new ProblemDescriptor[]{ problemDescriptor };
-        }
-
-        // If @Concerns annotation is empty, ignore
-        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernsAnnotation );
-        if( concernsAnnotationValue.isEmpty() )
-        {
-            return null;
-        }
-
-        // If ConcernOfClass is not resolved, ignore
-        Project project = psiClass.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( psiClass );
-        PsiClass concernOfClass = getConcernOfClass( project, searchScope );
-        if( concernOfClass == null )
-        {
-            return null;
-        }
-
-        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-        for( PsiAnnotationMemberValue concernClassAnnotationValue : concernsAnnotationValue )
-        {
-            PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernClassAnnotationValue );
-
-            // If it's not a class reference, ignore
-            if( concernClassReference == null )
-            {
-                continue;
-            }
-
-            // If class reference can't be resolved, ignore
-            PsiClass concernClass = (PsiClass) concernClassReference.resolve();
-            if( concernClass == null )
-            {
-                continue;
-            }
-
-            // If concern class does not inherit concern class, suggest remove that reference.
-            if( !concernClass.isInheritor( concernOfClass, true ) )
-            {
-                String message = PolygeneResourceBundle.message(
-                    "concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf",
-                    concernClass.getQualifiedName()
-                );
-
-                RemoveInvalidConcernClassReferenceFix fix = new RemoveInvalidConcernClassReferenceFix(
-                    concernClassAnnotationValue, concernClassReference
-                );
-                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                    concernClassAnnotationValue, message, fix, GENERIC_ERROR_OR_WARNING );
-                problems.add( problemDescriptor );
-            }
-            else
-            {
-                // TODO: Test whether it is a generic concern
-                // TODO: Test whether it is a specific concern
-            }
-        }
-
-        return problems.toArray( new ProblemDescriptor[problems.size()] );
-    }
-
-    private static class RemoveConcernsAnnotationFix extends AbstractFix
-    {
-        private final PsiAnnotation annotationToRemove;
-
-        private RemoveConcernsAnnotationFix( @NotNull PsiAnnotation annotationToRemove )
-        {
-            super( message( "concerns.annotation.declared.correctly.fix.remove.annotation" ) );
-            this.annotationToRemove = annotationToRemove;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            annotationToRemove.delete();
-        }
-    }
-
-    private static class RemoveInvalidConcernClassReferenceFix extends AbstractFix
-    {
-        private final PsiAnnotationMemberValue concernClassAnnotationValue;
-
-        public RemoveInvalidConcernClassReferenceFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
-                                                      @NotNull PsiJavaCodeReferenceElement concernClassReference )
-        {
-            super( message( "concerns.annotation.declared.correctly.fix.remove.concern.class.reference",
-                            concernClassReference.getQualifiedName() ) );
-            this.concernClassAnnotationValue = annotationValueToRemove;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            concernClassAnnotationValue.delete();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
deleted file mode 100644
index 5dc21bf..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/intentions/add/AddConcernOnType.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.intentions.add;
-
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.util.Processor;
-import com.intellij.util.Query;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.apache.polygene.ide.plugin.idea.common.intentions.AbstractIntention;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static com.intellij.psi.search.searches.ClassInheritorsSearch.search;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.addOrReplaceConcernAnnotation;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.getConcernOfClass;
-
-/**
- * JAVADOC: This is disabled in PolygeneApplicationComponent.
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class AddConcernOnType
-    extends AbstractIntention
-{
-    protected boolean isIntentionValidFor( PsiElement element )
-    {
-        if( !( element instanceof PsiClass ) )
-        {
-            return false;
-        }
-
-        // If it's not interface, ignore it
-        PsiClass psiClass = (PsiClass) element;
-        if( !psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        // Is @Concerns accesible within module
-        GlobalSearchScope searchScope = determineSearchScope( psiClass );
-        PsiClass concernOfClass = getConcernOfClass( psiClass.getProject(), searchScope );
-        return concernOfClass != null;
-    }
-
-    protected final String resourceBundlePrefixId()
-    {
-        return "add.concern";
-    }
-
-    @Override
-    public boolean isAvailable( @NotNull Project project, Editor editor, @Nullable PsiElement element )
-    {
-        while( element != null )
-        {
-            if( element instanceof PsiFile ||
-                element instanceof PsiMethod )
-            {
-                break;
-            }
-
-            if( isIntentionValidFor( element ) )
-            {
-                return true;
-            }
-
-            element = element.getParent();
-        }
-
-        return false;
-    }
-
-    @SuppressWarnings( "unchecked" )
-    protected void processIntention( @NotNull Project project, @NotNull Editor editor, @NotNull PsiElement element )
-    {
-        PsiClass psiClass = (PsiClass) element;
-        List<PsiClass> concernCandidates = findConcernsCandidates( psiClass );
-        if( concernCandidates.size() == 1 )
-        {
-            PsiClass concernCandidate = concernCandidates.get( 0 );
-            addOrReplaceConcernAnnotation( psiClass, concernCandidate );
-        }
-    }
-
-    private static List<PsiClass> findConcernsCandidates( final @NotNull PsiClass classToCheck )
-    {
-        GlobalSearchScope searchScope = determineSearchScope( classToCheck );
-        PsiClass concernOfClass = getConcernOfClass( classToCheck.getProject(), searchScope );
-        if( concernOfClass == null )
-        {
-            return emptyList();
-        }
-
-        Query<PsiClass> psiClassQuery = search( concernOfClass, searchScope, true, false );
-        final List<PsiClass> concernCandidates = new ArrayList<PsiClass>();
-        psiClassQuery.forEach( new Processor<PsiClass>()
-        {
-            public boolean process( PsiClass psiClass )
-            {
-                // TODO: Ideally search for all "extends" as well
-                boolean isInheritor = psiClass.isInheritor( classToCheck, true );
-                if( isInheritor )
-                {
-                    concernCandidates.add( psiClass );
-                }
-
-                return true;
-            }
-        } );
-
-        return concernCandidates;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
deleted file mode 100644
index 4b4bb9c..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.common.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiMethod;
-import com.intellij.psi.PsiParameter;
-import com.intellij.psi.PsiParameterList;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static java.util.Arrays.asList;
-
-/**
- * {@code AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection} is a helper method to check whether
- * injection annotation are declared in either constructor or non static field.
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public abstract class AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
-    extends AbstractInjectionAnnotationDeclarationOnFieldInspection
-{
-    @Override
-    public final ProblemDescriptor[] checkMethod( @NotNull PsiMethod method,
-                                                  @NotNull InspectionManager manager,
-                                                  boolean isOnTheFly )
-    {
-        PsiParameterList parameterList = method.getParameterList();
-        PsiParameter[] parameters = parameterList.getParameters();
-        if( method.isConstructor() )
-        {
-            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-            for( PsiParameter parameter : parameters )
-            {
-                PsiAnnotation annotation = getAnnotationToCheck( parameter );
-                if( annotation != null )
-                {
-                    ProblemDescriptor[] descriptors =
-                        verifyAnnotationDeclaredCorrectly( parameter, annotation, manager );
-                    if( descriptors != null )
-                    {
-                        problems.addAll( asList( descriptors ) );
-                    }
-                }
-            }
-
-            return problems.toArray( new ProblemDescriptor[problems.size()] );
-        }
-        else
-        {
-            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-            for( PsiParameter parameter : parameters )
-            {
-                PsiAnnotation annotationToCheck = getAnnotationToCheck( parameter );
-                if( annotationToCheck != null )
-                {
-                    String message = getInjectionAnnotationValidDeclarationMessage();
-                    AbstractFix removeAnnotationFix = createRemoveAnnotationFix( annotationToCheck );
-                    ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                        annotationToCheck, message, removeAnnotationFix, GENERIC_ERROR_OR_WARNING
-                    );
-                    problems.add( problemDescriptor );
-                }
-            }
-
-            return problems.toArray( new ProblemDescriptor[problems.size()] );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
deleted file mode 100644
index f93f396..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/common/inspections/AbstractInjectionAnnotationDeclarationOnFieldInspection.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.common.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiField;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiVariable;
-import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public abstract class AbstractInjectionAnnotationDeclarationOnFieldInspection extends AbstractInspection
-{
-    /**
-     * @return Remove annotation message fix.
-     * @since 0.1
-     */
-    @NotNull
-    protected abstract String getRemoveAnnotationMessageFix();
-
-    /**
-     * @return Annotation to check qualified name.
-     * @since 0.1
-     */
-    @NotNull
-    protected abstract String getAnnotationToCheckQualifiedName();
-
-    /**
-     * Verified that {@link #getAnnotationToCheck(com.intellij.psi.PsiVariable)} is declared correctly.
-     *
-     * @param psiVariable       Variable to check. This could be class field member or constructor parameter.
-     * @param annotationToCheck annotation declared at variable to check.
-     * @param manager           Inspection manager to use to create problem descriptor.
-     * @return {@code null} if annotation is declared correctly, otherwise an array of problem descriptor.
-     * @since 0.1
-     */
-    @Nullable
-    protected abstract ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
-                                                                              @NotNull PsiAnnotation annotationToCheck,
-                                                                              @NotNull InspectionManager manager );
-
-    @Override
-    public final ProblemDescriptor[] checkField( @NotNull PsiField field,
-                                                 @NotNull InspectionManager manager,
-                                                 boolean isOnTheFly )
-    {
-        PsiAnnotation annotationToCheck = getAnnotationToCheck( field );
-        if( annotationToCheck == null )
-        {
-            return null;
-        }
-
-        PsiModifierList modifierList = field.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( com.intellij.psi.PsiModifier.STATIC ) )
-            {
-                String message = getInjectionAnnotationValidDeclarationMessage();
-                AbstractFix removeAnnotationFix = createRemoveAnnotationFix( annotationToCheck );
-                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                    annotationToCheck, message, removeAnnotationFix, com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING
-                );
-
-                return new ProblemDescriptor[]{ problemDescriptor };
-            }
-        }
-
-        return verifyAnnotationDeclaredCorrectly( field, annotationToCheck, manager );
-    }
-
-    /**
-     * @param variable variable to check.
-     * @return Annotation to check.
-     * @see #getAnnotationToCheckQualifiedName()
-     * @since 0.1
-     */
-    @Nullable
-    protected final PsiAnnotation getAnnotationToCheck( @NotNull PsiVariable variable )
-    {
-        String annotationQualifiedName = getAnnotationToCheckQualifiedName();
-        return findAnnotation( variable, annotationQualifiedName );
-    }
-
-    @NotNull protected String getInjectionAnnotationValidDeclarationMessage()
-    {
-        String annotationQualifiedName = getAnnotationToCheckQualifiedName();
-        return PolygeneResourceBundle.message( "abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly",
-                                           annotationQualifiedName );
-    }
-
-    @NotNull
-    protected final AbstractFix createRemoveAnnotationFix( @NotNull PsiAnnotation annotationToRemove )
-    {
-        String fixMessage = getRemoveAnnotationMessageFix();
-        return new RemoveAnnotationFix( fixMessage, annotationToRemove );
-    }
-
-    private static class RemoveAnnotationFix extends AbstractFix
-    {
-        private final PsiAnnotation annotationToRemove;
-
-        public RemoveAnnotationFix( @NotNull String fixMessage, @NotNull PsiAnnotation annotationToRemove )
-        {
-            super( fixMessage );
-            this.annotationToRemove = annotationToRemove;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            annotationToRemove.delete();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
deleted file mode 100644
index 25c1267..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneInvocationAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_INVOCATION_ANNOTATION = "org.apache.polygene.api.injection.scope.Invocation";
-
-    private PolygeneInvocationAnnotationConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
deleted file mode 100644
index 334918d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult.*;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneInvocationAnnotationUtil
-{
-    /**
-     * Returns {@code @Invocation} annotation if exists.
-     *
-     * @param modifierListOwner modifier list owner to process.
-     * @return {@code @Invocation} annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getInvocationAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_INVOCATION_ANNOTATION );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if the specified psiClass is injectable by invocation annotation, {@code false} otherwise.
-     */
-    public static boolean isInjectableByInvocationAnnotation( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isAnnotationType() )
-        {
-            return true;
-        }
-
-        String classQualifiedName = psiClass.getQualifiedName();
-        return "java.lang.reflect.Method".equals( classQualifiedName ) ||
-               "java.lang.reflect.AnnotatedElement".equals( classQualifiedName );
-    }
-
-    /**
-     * Validates whether the variable has {@code @Invocation} annotation declared correctly.
-     *
-     * @param variable variable to check.
-     * @return Look at {@link InvocationAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static InvocationAnnotationDeclarationValidationResult isValidInvocationAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation invocationAnnotation = getInvocationAnnotation( variable );
-        if( invocationAnnotation == null )
-        {
-            return invalidInvocationAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        // TODO: Check whether variable is either an instance of java.lang.reflect.Method or
-        // java.lang.reflect.AnnotatedElement or Annotation
-        PsiTypeElement typeElement = variable.getTypeElement();
-        if( typeElement != null )
-        {
-            PsiClass psiClass = getPSIClass( typeElement );
-            if( psiClass != null )
-            {
-                if( !isInjectableByInvocationAnnotation( psiClass ) )
-                {
-                    // Can't be type that is injected by @Structure
-                    if( isInjecteableByStructureAnnotation( variable ) )
-                    {
-                        return invalidTypeIsInjectedViaStructureAnnotation;
-                    }
-
-                    return invalidType;
-                }
-            }
-        }
-
-        return valid;
-    }
-
-    public enum InvocationAnnotationDeclarationValidationResult
-    {
-        invalidInvocationAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidTypeIsInjectedViaStructureAnnotation,
-        invalidType,
-        valid,
-    }
-
-    private PolygeneInvocationAnnotationUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index e8dc1d4..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/inspections/InvocationAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.invocation.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiVariable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
-import org.apache.polygene.ide.plugin.idea.injections.structure.common.ReplaceWithStructureAnnotation;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.isValidInvocationAnnotationDeclaration;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.getStructureAnnotation;
-
-/**
- * {@code InvocationAnnotationDeclaredCorrectlyInspection} validates {@code @Invocation} injection annotation
- * declaration.
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class InvocationAnnotationDeclaredCorrectlyInspection
-    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "injections.invocation.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "InvocationAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @NotNull
-    protected final String getRemoveAnnotationMessageFix()
-    {
-        return message( "injections.invocation.annotation.declared.correctly.fix.remove.annotation" );
-    }
-
-    @NotNull
-    protected final String getAnnotationToCheckQualifiedName()
-    {
-        return QUALIFIED_NAME_INVOCATION_ANNOTATION;
-    }
-
-    @Nullable
-    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
-                                                                           @NotNull PsiAnnotation invocationAnnotation,
-                                                                           @NotNull InspectionManager manager )
-    {
-        LocalQuickFix fix = null;
-        String message = null;
-
-        String variableTypeQualifiedName = psiVariable.getType().getCanonicalText();
-
-        InvocationAnnotationDeclarationValidationResult validationResult =
-            isValidInvocationAnnotationDeclaration( psiVariable );
-        switch( validationResult )
-        {
-        case invalidTypeIsInjectedViaStructureAnnotation:
-            if( getStructureAnnotation( psiVariable ) == null )
-            {
-                fix = new ReplaceWithStructureAnnotation(
-                    message( "injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation" ),
-                    invocationAnnotation );
-            }
-            message = message(
-                "injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure",
-                variableTypeQualifiedName
-            );
-            break;
-
-        case invalidType:
-            message = message( "injections.invocation.annotation.declared.correctly.error.type.is.not.injectable",
-                               variableTypeQualifiedName );
-            break;
-        }
-
-        // If it's not an error, return null
-        if( message == null )
-        {
-            return null;
-        }
-
-        // If Fix not defined, by default we remove it.
-        if( fix == null )
-        {
-            fix = createRemoveAnnotationFix( invocationAnnotation );
-        }
-
-        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-            invocationAnnotation, message, fix, GENERIC_ERROR_OR_WARNING );
-        return new ProblemDescriptor[]{ problemDescriptor };
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
deleted file mode 100644
index 5a95513..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.service.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneServiceAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_SERVICE_ANNOTATION = "org.apache.polygene.api.injection.scope.Service";
-
-    private PolygeneServiceAnnotationConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
deleted file mode 100644
index 962c1bb..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.service.common;
-
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.psi.PsiVariable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneServiceAnnotationUtil
-{
-    /**
-     * Returns {@code @Service} annotation if exists.
-     *
-     * @param modifierListOwner modifier list owner to process.
-     * @return {@code @Service} annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION );
-    }
-
-    /**
-     * Validates whether the variable has {@code @Service} annotation declared correctly.
-     *
-     * @param variable variable to check.
-     * @return Look at {@link ServiceAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation serviceAnnotation = getServiceAnnotation( variable );
-        if( serviceAnnotation == null )
-        {
-            return invalidServiceAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        // Can't be type that is injected by @Structure
-        if( isInjecteableByStructureAnnotation( variable ) )
-        {
-            return invalidTypeIsInjectedViaStructureAnnotation;
-        }
-
-        return valid;
-    }
-
-    public enum ServiceAnnotationDeclarationValidationResult
-    {
-        invalidServiceAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidTypeIsInjectedViaStructureAnnotation,
-        valid,
-    }
-
-    private PolygeneServiceAnnotationUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index afc43f1..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/inspections/ServiceAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.service.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiVariable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
-import org.apache.polygene.ide.plugin.idea.injections.structure.common.ReplaceWithStructureAnnotation;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.isValidServiceAnnotationDeclaration;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.getStructureAnnotation;
-
-/**
- * {@code ServiceAnnotationDeclaredCorrectly} validates {@code @Service} injection annotation declaration.
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class ServiceAnnotationDeclaredCorrectlyInspection
-    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "injections.service.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "ServiceAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @NotNull
-    protected final String getRemoveAnnotationMessageFix()
-    {
-        return message( "injections.service.annotation.declared.correctly.fix.remove.annotation" );
-    }
-
-    @NotNull
-    protected final String getAnnotationToCheckQualifiedName()
-    {
-        return QUALIFIED_NAME_SERVICE_ANNOTATION;
-    }
-
-    @Nullable
-    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
-                                                                           @NotNull PsiAnnotation serviceAnnotation,
-                                                                           @NotNull InspectionManager manager )
-    {
-        ServiceAnnotationDeclarationValidationResult annotationCheck =
-            isValidServiceAnnotationDeclaration( psiVariable );
-        String message = null;
-        LocalQuickFix fix = null;
-        switch( annotationCheck )
-        {
-        case invalidTypeIsInjectedViaStructureAnnotation:
-            if( getStructureAnnotation( psiVariable ) == null )
-            {
-                fix = new ReplaceWithStructureAnnotation(
-                    message( "injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation" ),
-                    serviceAnnotation );
-            }
-            message = message(
-                "injections.service.annotation.declared.correctly.error.type.is.injected.by.structure",
-                psiVariable.getType().getCanonicalText()
-            );
-            break;
-        }
-
-        // If it's not an error, return null
-        if( message == null )
-        {
-            return null;
-        }
-
-        // Default behavior to remove @Service annotation
-        if( fix == null )
-        {
-            fix = createRemoveAnnotationFix( serviceAnnotation );
-        }
-
-        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-            serviceAnnotation, message, fix, GENERIC_ERROR_OR_WARNING );
-        return new ProblemDescriptor[]{ problemDescriptor };
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
deleted file mode 100644
index 2a5d3bf..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
-
-import static java.util.Arrays.sort;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneStructureAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure";
-
-    public static final String[] VALID_STRUCTURE_INJECTION_TYPE;
-
-    static
-    {
-        VALID_STRUCTURE_INJECTION_TYPE = new String[]
-            {
-                "org.apache.polygene.composite.CompositeBuilderFactory",
-                "org.apache.polygene.object.ObjectBuilderFactory",
-                "org.apache.polygene.entity.UnitOfWorkFactory",
-                "org.apache.polygene.service.ServiceFinder",
-                "org.apache.polygene.structure.Module",
-                "org.apache.polygene.structure.Layer",
-                "org.apache.polygene.structure.Application",
-                "org.apache.polygene.api.PolygeneAPI",
-                "org.apache.polygene.spi.PolygeneSPI"
-            };
-        sort( VALID_STRUCTURE_INJECTION_TYPE );
-    }
-
-    private PolygeneStructureAnnotationConstants()
-    {
-    }
-}


[05/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkInstance.java
new file mode 100644
index 0000000..81e4907
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkInstance.java
@@ -0,0 +1,510 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.time.Instant;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Stack;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.metrics.MetricNames;
+import org.apache.polygene.api.metrics.MetricsCounter;
+import org.apache.polygene.api.metrics.MetricsCounterFactory;
+import org.apache.polygene.api.metrics.MetricsProvider;
+import org.apache.polygene.api.metrics.MetricsTimer;
+import org.apache.polygene.api.metrics.MetricsTimerFactory;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.unitofwork.ConcurrentEntityModificationException;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCallback;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkOptions;
+import org.apache.polygene.api.usecase.Usecase;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.EntityStatus;
+import org.apache.polygene.spi.entitystore.ConcurrentEntityStateModificationException;
+import org.apache.polygene.spi.entitystore.EntityNotFoundException;
+import org.apache.polygene.spi.entitystore.EntityStore;
+import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork;
+import org.apache.polygene.spi.entitystore.StateCommitter;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+import static org.apache.polygene.api.unitofwork.UnitOfWorkCallback.UnitOfWorkStatus.COMPLETED;
+import static org.apache.polygene.api.unitofwork.UnitOfWorkCallback.UnitOfWorkStatus.DISCARDED;
+
+public final class UnitOfWorkInstance
+{
+    private static final ThreadLocal<Stack<UnitOfWorkInstance>> CURRENT = new ThreadLocal<Stack<UnitOfWorkInstance>>()
+    {
+        @Override
+        protected Stack<UnitOfWorkInstance> initialValue()
+        {
+            return new Stack<>();
+        }
+    };
+
+    public static Stack<UnitOfWorkInstance> getCurrent()
+    {
+        return CURRENT.get();
+    }
+
+    private final HashMap<EntityReference, EntityInstance> instanceCache = new HashMap<>();
+    private final HashMap<EntityStore, EntityStoreUnitOfWork> storeUnitOfWork = new HashMap<>();
+    private final ModuleSpi module;
+    private final Usecase usecase;
+    private final Instant currentTime;
+    private final MetricsProvider metrics;
+
+    private boolean open;
+    private boolean paused;
+
+    private MetricsCounter metricsCounter;
+    private MetricsTimer metricsTimer;
+    private MetricsTimer.Context metricsTimerContext;
+    private MetaInfo metaInfo;
+    private List<UnitOfWorkCallback> callbacks;
+
+    public UnitOfWorkInstance(ModuleSpi module, Usecase usecase, Instant currentTime, MetricsProvider metrics )
+    {
+        this.module = module;
+        this.usecase = usecase;
+        this.currentTime = currentTime;
+        this.metrics = metrics;
+
+        this.open = true;
+        getCurrent().push( this );
+        this.paused = false;
+        startCapture();
+    }
+
+    public Instant currentTime()
+    {
+        return currentTime;
+    }
+
+    public EntityStoreUnitOfWork getEntityStoreUnitOfWork( EntityStore store )
+    {
+        EntityStoreUnitOfWork uow = storeUnitOfWork.get( store );
+        if( uow == null )
+        {
+            uow = store.newUnitOfWork( module.descriptor(), usecase, currentTime );
+            storeUnitOfWork.put( store, uow );
+        }
+        return uow;
+    }
+
+    public <T> T get( EntityReference reference,
+                      UnitOfWork uow,
+                      Iterable<? extends EntityDescriptor> potentialModels,
+                      Class<T> mixinType
+    )
+        throws NoSuchEntityTypeException, NoSuchEntityException
+    {
+        checkOpen();
+
+        EntityInstance entityInstance = instanceCache.get( reference );
+        if( entityInstance == null )
+        {   // Not yet in cache
+
+            // Check if this is a root UoW, or if no parent UoW knows about this entity
+            EntityState entityState = null;
+            EntityModel model = null;
+            ModuleDescriptor module = null;
+            // Figure out what EntityStore to use
+            for( EntityDescriptor potentialModel : potentialModels )
+            {
+                EntityStore store = ((ModuleSpi) potentialModel.module().instance()).entityStore();
+                EntityStoreUnitOfWork storeUow = getEntityStoreUnitOfWork( store );
+                try
+                {
+                    entityState = storeUow.entityStateOf( potentialModel.module(), reference );
+                }
+                catch( EntityNotFoundException e )
+                {
+                    continue;
+                }
+
+                // Get the selected model
+                model = (EntityModel) entityState.entityDescriptor();
+                module = potentialModel.module();
+            }
+
+            // Check if model was found
+            if( model == null )
+            {
+                // Check if state was found
+                if( entityState == null )
+                {
+                    throw new NoSuchEntityException( reference, mixinType, usecase );
+                }
+                else
+                {
+                    throw new NoSuchEntityTypeException( mixinType.getName(), module.name(), module.typeLookup() );
+                }
+            }
+            // Create instance
+            entityInstance = new EntityInstance( uow, model, entityState );
+            instanceCache.put( reference, entityInstance );
+        }
+        else
+        {
+            // Check if it has been removed
+            if( entityInstance.status() == EntityStatus.REMOVED )
+            {
+                throw new NoSuchEntityException( reference, mixinType, usecase );
+            }
+        }
+
+        return entityInstance.proxy();
+    }
+
+    public Usecase usecase()
+    {
+        return usecase;
+    }
+
+    public MetaInfo metaInfo()
+    {
+        if( metaInfo == null )
+        {
+            metaInfo = new MetaInfo();
+        }
+
+        return metaInfo;
+    }
+
+    public void pause()
+    {
+        if( !paused )
+        {
+            paused = true;
+            getCurrent().pop();
+
+            UnitOfWorkOptions unitOfWorkOptions = metaInfo().get( UnitOfWorkOptions.class );
+            if( unitOfWorkOptions == null )
+            {
+                unitOfWorkOptions = usecase().metaInfo( UnitOfWorkOptions.class );
+            }
+
+            if( unitOfWorkOptions != null )
+            {
+                if( unitOfWorkOptions.isPruneOnPause() )
+                {
+                    List<EntityReference> prunedInstances = null;
+                    for( EntityInstance entityInstance : instanceCache.values() )
+                    {
+                        if( entityInstance.status() == EntityStatus.LOADED )
+                        {
+                            if( prunedInstances == null )
+                            {
+                                prunedInstances = new ArrayList<>();
+                            }
+                            prunedInstances.add( entityInstance.reference() );
+                        }
+                    }
+                    if( prunedInstances != null )
+                    {
+                        prunedInstances.forEach( instanceCache::remove );
+                    }
+                }
+            }
+        }
+        else
+        {
+            throw new UnitOfWorkException( "Unit of work is not active" );
+        }
+    }
+
+    public void resume()
+    {
+        if( paused )
+        {
+            paused = false;
+            getCurrent().push( this );
+        }
+        else
+        {
+            throw new UnitOfWorkException( "Unit of work has not been paused" );
+        }
+    }
+
+    public void complete()
+        throws UnitOfWorkCompletionException
+    {
+        checkOpen();
+
+        // Copy list so that it cannot be modified during completion
+        List<UnitOfWorkCallback> currentCallbacks = callbacks == null ? null : new ArrayList<>( callbacks );
+
+        // Commit state to EntityStores
+        List<StateCommitter> committers = applyChanges();
+
+        // Check callbacks
+        notifyBeforeCompletion( currentCallbacks );
+
+        // Commit all changes
+        committers.forEach( StateCommitter::commit );
+
+        close();
+
+        // Call callbacks
+        notifyAfterCompletion( currentCallbacks, COMPLETED );
+
+        callbacks = currentCallbacks;
+    }
+
+    public void discard()
+    {
+        if( !isOpen() )
+        {
+            return;
+        }
+        close();
+
+        // Copy list so that it cannot be modified during completion
+        List<UnitOfWorkCallback> currentCallbacks = callbacks == null ? null : new ArrayList<>( callbacks );
+
+        // Call callbacks
+        notifyAfterCompletion( currentCallbacks, DISCARDED );
+        storeUnitOfWork.values().forEach( EntityStoreUnitOfWork::discard );
+        callbacks = currentCallbacks;
+    }
+
+    private void close()
+    {
+        checkOpen();
+
+        if( !isPaused() )
+        {
+            getCurrent().pop();
+        }
+        endCapture();
+        open = false;
+    }
+
+    public boolean isOpen()
+    {
+        return open;
+    }
+
+    public void addUnitOfWorkCallback( UnitOfWorkCallback callback )
+    {
+        if( callbacks == null )
+        {
+            callbacks = new ArrayList<>();
+        }
+
+        callbacks.add( callback );
+    }
+
+    public void removeUnitOfWorkCallback( UnitOfWorkCallback callback )
+    {
+        if( callbacks != null )
+        {
+            callbacks.remove( callback );
+        }
+    }
+
+    public void addEntity( EntityInstance instance )
+    {
+        instanceCache.put( instance.reference(), instance );
+    }
+
+    private List<StateCommitter> applyChanges()
+        throws UnitOfWorkCompletionException
+    {
+        List<StateCommitter> committers = new ArrayList<>();
+        for( EntityStoreUnitOfWork entityStoreUnitOfWork : storeUnitOfWork.values() )
+        {
+            try
+            {
+                StateCommitter committer = entityStoreUnitOfWork.applyChanges();
+                committers.add( committer );
+            }
+            catch( Exception e )
+            {
+                // Cancel all previously prepared stores
+                committers.forEach( StateCommitter::cancel );
+
+                if( e instanceof ConcurrentEntityStateModificationException )
+                {
+                    // If we cancelled due to concurrent modification, then create the proper exception for it!
+                    ConcurrentEntityStateModificationException mee = (ConcurrentEntityStateModificationException) e;
+                    Collection<EntityReference> modifiedEntityIdentities = mee.modifiedEntities();
+                    Map<EntityComposite, HasTypes> modifiedEntities = new HashMap<>();
+                    for( EntityReference modifiedEntityIdentity : modifiedEntityIdentities )
+                    {
+                        instanceCache.values().stream()
+                            .filter( instance -> instance.reference().equals( modifiedEntityIdentity ) )
+                            .forEach( instance -> modifiedEntities.put( instance.<EntityComposite>proxy(), instance ) );
+                    }
+                    throw new ConcurrentEntityModificationException( modifiedEntities, usecase );
+                }
+                else
+                {
+                    throw new UnitOfWorkCompletionException( e );
+                }
+            }
+        }
+        return committers;
+    }
+
+    private void notifyBeforeCompletion( List<UnitOfWorkCallback> callbacks )
+        throws UnitOfWorkCompletionException
+    {
+        // Notify explicitly registered callbacks
+        if( callbacks != null )
+        {
+            callbacks.forEach( UnitOfWorkCallback::beforeCompletion );
+        }
+
+        // Notify entities
+        try
+        {
+            for( EntityInstance instance : instanceCache.values() )
+            {
+                boolean isCallback = instance.proxy() instanceof UnitOfWorkCallback;
+                boolean isNotRemoved = !instance.status().equals( EntityStatus.REMOVED );
+                if( isCallback && isNotRemoved )
+                {
+                    UnitOfWorkCallback callback = UnitOfWorkCallback.class.cast( instance.proxy() );
+                    callback.beforeCompletion();
+                }
+            }
+        }
+        catch( UnitOfWorkCompletionException e )
+        {
+            throw e;
+        }
+        catch( Exception e )
+        {
+            throw new UnitOfWorkCompletionException( e );
+        }
+    }
+
+    private void notifyAfterCompletion( List<UnitOfWorkCallback> callbacks,
+                                        final UnitOfWorkCallback.UnitOfWorkStatus status
+    )
+    {
+        if( callbacks != null )
+        {
+            for( UnitOfWorkCallback callback : callbacks )
+            {
+                try
+                {
+                    callback.afterCompletion( status );
+                }
+                catch( Exception e )
+                {
+                    // Ignore
+                }
+            }
+        }
+
+        // Notify entities
+        try
+        {
+            for( EntityInstance instance : instanceCache.values() )
+            {
+                boolean isCallback = instance.proxy() instanceof UnitOfWorkCallback;
+                boolean isNotRemoved = !instance.status().equals( EntityStatus.REMOVED );
+                if( isCallback && isNotRemoved )
+                {
+                    UnitOfWorkCallback callback = UnitOfWorkCallback.class.cast( instance.proxy() );
+                    callback.afterCompletion( status );
+                }
+            }
+        }
+        catch( Exception e )
+        {
+            // Ignore
+        }
+    }
+
+    public void checkOpen()
+    {
+        if( !isOpen() )
+        {
+            throw new UnitOfWorkException( "Unit of work has been closed" );
+        }
+    }
+
+    public boolean isPaused()
+    {
+        return paused;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "UnitOfWork " + hashCode() + "(" + usecase + "): entities:" + instanceCache.size();
+    }
+
+    public void remove( EntityReference entityReference )
+    {
+        instanceCache.remove( entityReference );
+    }
+
+    private void startCapture()
+    {
+        getMetricsCounter().increment();
+        metricsTimerContext = getMetricsTimer().start();
+    }
+
+    private void endCapture()
+    {
+        getMetricsCounter().decrement();
+        metricsTimerContext.stop();
+        metricsTimerContext = null;
+    }
+
+    private MetricsCounter getMetricsCounter()
+    {
+        if( metricsCounter == null )
+        {
+            MetricsCounterFactory metricsFactory = metrics.createFactory( MetricsCounterFactory.class );
+            metricsCounter = metricsFactory.createCounter( MetricNames.nameFor( module, UnitOfWork.class, "counter" ) );
+        }
+        return metricsCounter;
+    }
+
+    private MetricsTimer getMetricsTimer()
+    {
+        if( metricsTimer == null )
+        {
+            MetricsTimerFactory metricsFactory = metrics.createFactory( MetricsTimerFactory.class );
+            metricsTimer = metricsFactory.createTimer( MetricNames.nameFor( module, UnitOfWork.class, "timer" ) );
+        }
+        return metricsTimer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ManyAssociationValueState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ManyAssociationValueState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ManyAssociationValueState.java
new file mode 100644
index 0000000..c386802
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ManyAssociationValueState.java
@@ -0,0 +1,106 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.util.Iterator;
+import java.util.List;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.spi.entity.ManyAssociationState;
+
+/**
+ * ManyAssociationState implementation for Value composites.
+ */
+public class ManyAssociationValueState
+    implements ManyAssociationState
+{
+    private List<EntityReference> references;
+
+    public ManyAssociationValueState( List<EntityReference> references )
+    {
+        this.references = references;
+    }
+
+    @Override
+    public int count()
+    {
+        return references.size();
+    }
+
+    @Override
+    public boolean contains( EntityReference entityReference )
+    {
+        return references.contains( entityReference );
+    }
+
+    @Override
+    public boolean add( int i, EntityReference entityReference )
+    {
+        if( references.contains( entityReference ) )
+        {
+            return false;
+        }
+
+        references.add( i, entityReference );
+        return true;
+    }
+
+    @Override
+    public boolean remove( EntityReference entity )
+    {
+        boolean removed = references.remove( entity );
+        return removed;
+    }
+
+    @Override
+    public EntityReference get( int i )
+    {
+        return references.get( i );
+    }
+
+    @Override
+    public Iterator<EntityReference> iterator()
+    {
+        final Iterator<EntityReference> iter = references.iterator();
+
+        return new Iterator<EntityReference>()
+        {
+            EntityReference current;
+
+            @Override
+            public boolean hasNext()
+            {
+                return iter.hasNext();
+            }
+
+            @Override
+            public EntityReference next()
+            {
+                current = iter.next();
+                return current;
+            }
+
+            @Override
+            public void remove()
+            {
+                iter.remove();
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/NamedAssociationValueState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/NamedAssociationValueState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/NamedAssociationValueState.java
new file mode 100644
index 0000000..50c20ca
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/NamedAssociationValueState.java
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.spi.entity.NamedAssociationState;
+
+public class NamedAssociationValueState
+    implements NamedAssociationState
+{
+    private final Map<String, EntityReference> references;
+
+    public NamedAssociationValueState( Map<String, EntityReference> references )
+    {
+        this.references = references;
+    }
+
+    @Override
+    public int count()
+    {
+        return references.size();
+    }
+
+    @Override
+    public boolean containsName( String name )
+    {
+        return references.containsKey( name );
+    }
+
+    @Override
+    public boolean put( String name, EntityReference entityReference )
+    {
+        return references.put( name, entityReference ) != null;
+    }
+
+    @Override
+    public boolean remove( String name )
+    {
+        return references.remove( name ) != null;
+    }
+
+    @Override
+    public EntityReference get( String name )
+    {
+        return references.get( name );
+    }
+
+    @Override
+    public String nameOf( EntityReference entityReference )
+    {
+        for( Map.Entry<String, EntityReference> entry : references.entrySet() )
+        {
+            if( entry.getValue().equals( entityReference ) )
+            {
+                return entry.getKey();
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Iterator<String> iterator()
+    {
+        return references.keySet().iterator();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ReferenceProperty.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ReferenceProperty.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ReferenceProperty.java
new file mode 100644
index 0000000..6dd6d18
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ReferenceProperty.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * The reference for an Association
+ */
+public class ReferenceProperty
+    implements Property<EntityReference>
+{
+    EntityReference reference;
+
+    public ReferenceProperty()
+    {
+    }
+
+    public ReferenceProperty( EntityReference reference )
+    {
+        this.reference = reference;
+    }
+
+    @Override
+    public EntityReference get()
+    {
+        return reference;
+    }
+
+    @Override
+    public void set( EntityReference newValue )
+        throws IllegalArgumentException, IllegalStateException
+    {
+        reference = newValue;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderInstance.java
new file mode 100644
index 0000000..7ecb745
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderInstance.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.value.NoSuchValueException;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.composite.StateResolver;
+import org.apache.polygene.runtime.structure.ModuleInstance;
+
+/**
+ * Implementation of ValueBuilder
+ */
+public final class ValueBuilderInstance<T>
+    implements ValueBuilder<T>
+{
+
+    private final ModuleInstance currentModule;
+    private final ValueInstance prototypeInstance;
+
+    public ValueBuilderInstance( ValueDescriptor compositeModel,
+                                 ModuleInstance currentModule,
+                                 StateResolver stateResolver
+    )
+    {
+        ValueStateInstance state = new ValueStateInstance( compositeModel, currentModule, stateResolver );
+        ValueModel model = (ValueModel) compositeModel;
+        prototypeInstance = model.newValueInstance( state );
+        prototypeInstance.prepareToBuild();
+        this.currentModule = currentModule;
+    }
+
+    @Override
+    public T prototype()
+    {
+        return prototypeInstance.<T>proxy();
+    }
+
+    @Override
+    public AssociationStateHolder state()
+    {
+        return prototypeInstance.state();
+    }
+
+    @Override
+    public <K> K prototypeFor( Class<K> mixinType )
+    {
+        return prototypeInstance.newProxy( mixinType );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public T newInstance()
+        throws ConstructionException
+    {
+        Class<Composite> valueType = (Class<Composite>) prototypeInstance.types().findFirst().orElse( null );
+
+        ValueDescriptor valueModel = currentModule.typeLookup().lookupValueModel( valueType );
+
+        if( valueModel == null )
+        {
+            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/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithPrototype.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithPrototype.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithPrototype.java
new file mode 100644
index 0000000..c9a1023
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithPrototype.java
@@ -0,0 +1,202 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.composite.FunctionStateResolver;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.StateResolver;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.structure.ModuleInstance;
+
+/**
+ * Implementation of ValueBuilder with a prototype supplied
+ */
+public class ValueBuilderWithPrototype<T>
+    implements ValueBuilder<T>
+{
+    private ValueInstance prototypeInstance;
+    private final ValueModel valueModel;
+
+    public ValueBuilderWithPrototype( ValueDescriptor compositeModelModule,
+                                      ModuleInstance currentModule,
+                                      T prototype
+    )
+    {
+        valueModel = (ValueModel) compositeModelModule;
+        MixinsModel mixinsModel = valueModel.mixinsModel();
+        Object[] mixins = mixinsModel.newMixinHolder();
+        final ValueStateInstance prototypeState = ValueInstance.valueInstanceOf( (ValueComposite) prototype ).state();
+        StateResolver resolver = new FunctionStateResolver(
+            new PropertyDescriptorFunction( prototypeState ),
+            new AssociationDescriptorEntityReferenceFunction( prototypeState ),
+            new AssociationDescriptorIterableFunction( prototypeState ),
+            new AssociationDescriptorMapFunction( prototypeState )
+        );
+        ValueStateInstance state = new ValueStateInstance( compositeModelModule, currentModule, resolver );
+        ValueInstance valueInstance = new ValueInstance(
+            valueModel,
+            mixins,
+            state
+        );
+
+        int i = 0;
+        InjectionContext injectionContext = new InjectionContext( valueInstance, UsesInstance.EMPTY_USES, state );
+        for( MixinModel mixinModel : mixinsModel.mixinModels() )
+        {
+            mixins[ i++ ] = mixinModel.newInstance( injectionContext );
+        }
+
+        valueInstance.prepareToBuild();
+        this.prototypeInstance = valueInstance;
+    }
+
+    @Override
+    public T prototype()
+    {
+        verifyUnderConstruction();
+        return prototypeInstance.<T>proxy();
+    }
+
+    @Override
+    public AssociationStateHolder state()
+    {
+        verifyUnderConstruction();
+        return prototypeInstance.state();
+    }
+
+    @Override
+    public <K> K prototypeFor( Class<K> mixinType )
+    {
+        verifyUnderConstruction();
+        return prototypeInstance.newProxy( mixinType );
+    }
+
+    @Override
+    public T newInstance()
+        throws ConstructionException
+    {
+        verifyUnderConstruction();
+
+        // Set correct info's (immutable) on the state
+        prototypeInstance.prepareBuilderState();
+
+        // Check that it is valid
+        valueModel.checkConstraints( prototypeInstance.state() );
+
+        try
+        {
+            return prototypeInstance.<T>proxy();
+        }
+        finally
+        {
+            // Invalidate builder
+            prototypeInstance = null;
+        }
+    }
+
+    private void verifyUnderConstruction()
+    {
+        if( prototypeInstance == null )
+        {
+            throw new IllegalStateException( "ValueBuilder instances cannot be reused" );
+        }
+    }
+
+    private static class PropertyDescriptorFunction
+        implements Function<PropertyDescriptor, Object>
+    {
+        private final ValueStateInstance prototypeState;
+
+        public PropertyDescriptorFunction( ValueStateInstance prototypeState )
+        {
+            this.prototypeState = prototypeState;
+        }
+
+        @Override
+        public Object apply( PropertyDescriptor descriptor )
+        {
+            return prototypeState.propertyFor( descriptor.accessor() ).get();
+        }
+    }
+
+    private static class AssociationDescriptorEntityReferenceFunction
+        implements Function<AssociationDescriptor, EntityReference>
+    {
+        private final ValueStateInstance prototypeState;
+
+        public AssociationDescriptorEntityReferenceFunction( ValueStateInstance prototypeState )
+        {
+            this.prototypeState = prototypeState;
+        }
+
+        @Override
+        public EntityReference apply( AssociationDescriptor descriptor )
+        {
+            return prototypeState.associationFor( descriptor.accessor() ).reference();
+        }
+    }
+
+    private static class AssociationDescriptorIterableFunction
+        implements Function<AssociationDescriptor, Stream<EntityReference>>
+    {
+        private final ValueStateInstance prototypeState;
+
+        public AssociationDescriptorIterableFunction( ValueStateInstance prototypeState )
+        {
+            this.prototypeState = prototypeState;
+        }
+
+        @Override
+        public Stream<EntityReference> apply( AssociationDescriptor descriptor )
+        {
+            return prototypeState.manyAssociationFor( descriptor.accessor() ).references();
+        }
+    }
+
+    private static class AssociationDescriptorMapFunction
+        implements Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>>
+    {
+        private final ValueStateInstance prototypeState;
+
+        public AssociationDescriptorMapFunction( ValueStateInstance prototypeState )
+        {
+            this.prototypeState = prototypeState;
+        }
+
+        @Override
+        public Stream<Map.Entry<String, EntityReference>> apply( AssociationDescriptor descriptor )
+        {
+            return prototypeState.namedAssociationFor( descriptor.accessor() ).references();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithState.java
new file mode 100644
index 0000000..236e3b9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueBuilderWithState.java
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.composite.StateResolver;
+import org.apache.polygene.runtime.structure.ModuleInstance;
+
+public class ValueBuilderWithState<T> implements ValueBuilder<T>
+{
+    private final ValueDescriptor model;
+    private ValueInstance prototypeInstance;
+
+    public ValueBuilderWithState( ValueDescriptor compositeModelModule,
+                                  ModuleInstance currentModule,
+                                  StateResolver stateResolver )
+    {
+        ValueStateInstance state = new ValueStateInstance( compositeModelModule, currentModule, stateResolver );
+        ValueInstance instance = ((ValueModel) compositeModelModule).newValueInstance( state );
+        instance.prepareToBuild();
+        this.model = compositeModelModule;
+        this.prototypeInstance = instance;
+    }
+
+    @Override
+    public T prototype()
+    {
+        verifyUnderConstruction();
+        return prototypeInstance.<T>proxy();
+    }
+
+    @Override
+    public AssociationStateHolder state()
+    {
+        verifyUnderConstruction();
+        return prototypeInstance.state();
+    }
+
+    @Override
+    public <K> K prototypeFor( Class<K> mixinType )
+    {
+        verifyUnderConstruction();
+
+        return prototypeInstance.newProxy( mixinType );
+    }
+
+    @Override
+    public T newInstance()
+        throws ConstructionException
+    {
+        verifyUnderConstruction();
+
+        // Set correct info's (immutable) on the state
+        prototypeInstance.prepareBuilderState();
+
+        // Check that it is valid
+        ((ValueModel) model).checkConstraints( prototypeInstance.state() );
+
+        try
+        {
+            return prototypeInstance.<T>proxy();
+        }
+        finally
+        {
+            // Invalidate builder
+            prototypeInstance = null;
+        }
+    }
+
+    private void verifyUnderConstruction()
+    {
+        if( prototypeInstance == null )
+        {
+            throw new IllegalStateException( "ValueBuilder instances cannot be reused" );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
new file mode 100644
index 0000000..12ba7d9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueInstance.java
@@ -0,0 +1,172 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.lang.reflect.Proxy;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.runtime.composite.MixinsInstance;
+import org.apache.polygene.runtime.composite.TransientInstance;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+/**
+ * ValueComposite instance
+ */
+public final class ValueInstance
+    extends TransientInstance
+    implements CompositeInstance, MixinsInstance
+{
+    public static ValueInstance valueInstanceOf( ValueComposite composite )
+    {
+        return (ValueInstance) Proxy.getInvocationHandler( composite );
+    }
+
+    public ValueInstance( ValueModel compositeModel,
+                          Object[] mixins,
+                          ValueStateInstance state
+    )
+    {
+        super( compositeModel, mixins, state );
+    }
+
+    /**
+     * Perform equals with {@code o} argument.
+     * <p>
+     * The definition of equals() for the Value is that if both the state and descriptor are equal,
+     * then the values are equal.
+     * </p>
+     *
+     * @param o The other object to compare.
+     *
+     * @return Returns a {@code boolean} indicator whether this object is equals the other.
+     */
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || !Proxy.isProxyClass( o.getClass() ) )
+        {
+            return false;
+        }
+
+        try
+        {
+            ValueInstance that = (ValueInstance) Proxy.getInvocationHandler( o );
+            // Descriptor equality
+            if( !descriptor().equals( that.descriptor() ) )
+            {
+                return false;
+            }
+            // State equality
+            return state.equals( that.state );
+        }
+        catch( ClassCastException e )
+        {
+            return false;
+        }
+    }
+
+    @Override
+    public ValueStateInstance state()
+    {
+        return (ValueStateInstance) state;
+    }
+
+    @Override
+    public ValueModel descriptor()
+    {
+        return (ValueModel) compositeModel;
+    }
+
+    /**
+     * When a ValueBuilder is about to start, ensure that all state has builder infos, i.e. they are mutable.
+     */
+    public void prepareToBuild()
+    {
+        descriptor().state().properties().forEach( propertyDescriptor -> {
+            PropertyInstance<Object> propertyInstance =
+                (PropertyInstance<Object>) state.propertyFor( propertyDescriptor.accessor() );
+
+            propertyInstance.prepareToBuild( propertyDescriptor );
+        } );
+
+        descriptor().state().associations().forEach( associationDescriptor -> {
+            state().associationFor( associationDescriptor.accessor() )
+                .setAssociationInfo( associationDescriptor.getBuilderInfo() );
+        } );
+
+        descriptor().state().manyAssociations().forEach( associationDescriptor -> {
+            state().manyAssociationFor( associationDescriptor.accessor() )
+                .setAssociationInfo( associationDescriptor.getBuilderInfo() );
+        } );
+
+        descriptor().state().namedAssociations().forEach( associationDescriptor -> {
+            state().namedAssociationFor( associationDescriptor.accessor() )
+                .setAssociationInfo( associationDescriptor.getBuilderInfo() );
+        } );
+    }
+
+    /**
+     * When a ValueBuilder is finished and is about to instantiate a Value, call this to ensure that the state has correct
+     * settings, i.e. is immutable.
+     */
+    public void prepareBuilderState()
+    {
+        descriptor().state().properties().forEach( propertyDescriptor -> {
+            PropertyInstance<Object> propertyInstance =
+                (PropertyInstance<Object>) state.propertyFor( propertyDescriptor.accessor() );
+            propertyInstance.prepareBuilderState( propertyDescriptor );
+        } );
+
+        descriptor().state().associations().forEach( associationDescriptor -> {
+            state().associationFor( associationDescriptor.accessor() ).setAssociationInfo( associationDescriptor );
+        } );
+
+        descriptor().state().manyAssociations().forEach( associationDescriptor -> {
+            state().manyAssociationFor( associationDescriptor.accessor() ).setAssociationInfo( associationDescriptor );
+        } );
+
+        descriptor().state().namedAssociations().forEach( associationDescriptor -> {
+            state().namedAssociationFor( associationDescriptor.accessor() ).setAssociationInfo( associationDescriptor );
+        } );
+    }
+
+    /**
+     * Calculate hash code.
+     *
+     * @return the hashcode of this instance.
+     */
+    @Override
+    public int hashCode()
+    {
+        int hash = compositeModel.hashCode() * 23; // Descriptor
+        return hash + state.hashCode() * 5; // State
+    }
+
+    @Override
+    public String toString()
+    {
+        return ( (ModuleSpi) module().instance() ).valueSerialization().serialize( this.<ValueComposite>proxy() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueModel.java
new file mode 100644
index 0000000..2148095
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueModel.java
@@ -0,0 +1,145 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.ValueCompositeType;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.composite.CompositeMethodsModel;
+import org.apache.polygene.runtime.composite.CompositeModel;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.unitofwork.UnitOfWorkInstance;
+
+/**
+ * Model for ValueComposites
+ */
+public final class ValueModel extends CompositeModel
+    implements ValueDescriptor
+{
+    private ValueCompositeType valueType;
+
+    public ValueModel( final ModuleDescriptor module,
+                       final List<Class<?>> types,
+                       final Visibility visibility,
+                       final MetaInfo metaInfo,
+                       final MixinsModel mixinsModel,
+                       final ValueStateModel stateModel,
+                       final CompositeMethodsModel compositeMethodsModel
+    )
+    {
+        super( module, types, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel );
+
+        valueType = new ValueCompositeType( this );
+    }
+
+    @Override
+    public ValueCompositeType valueType()
+    {
+        return valueType;
+    }
+
+    @Override
+    public ValueStateModel state()
+    {
+        return (ValueStateModel) super.state();
+    }
+
+    // This method is ONLY called by ValueBuilders
+    void checkConstraints( ValueStateInstance state )
+        throws ConstraintViolationException
+    {
+        stateModel.properties().forEach(
+            propertyModel ->
+            {
+                try
+                {
+                    propertyModel.checkConstraints( state.propertyFor( propertyModel.accessor() ).get() );
+                }
+                catch( ConstraintViolationException e )
+                {
+                    throw new ConstraintViolationException( "<builder>", propertyModel.valueType()
+                        .types(), (Member) propertyModel.accessor(), e.constraintViolations() );
+                }
+            }
+        );
+
+        // IF no UnitOfWork is active, then the Association checks shouldn't be done.
+        if( UnitOfWorkInstance.getCurrent().empty() )
+        {
+            return;
+        }
+        ( (ValueStateModel) stateModel ).associations().forEach(
+            associationModel ->
+            {
+                try
+                {
+                    associationModel.checkConstraints( state.associationFor( associationModel.accessor() ).get() );
+                }
+                catch( ConstraintViolationException e )
+                {
+                    Stream<? extends Type> types = Classes.interfacesOf( associationModel.type() );
+                    throw new ConstraintViolationException( "<builder>", types, (Member) associationModel.accessor(), e.constraintViolations() );
+                }
+            }
+        );
+
+        ( (ValueStateModel) stateModel ).manyAssociations().forEach( associationModel ->
+                                                                         associationModel.checkAssociationConstraints( state
+                                                                                                                           .manyAssociationFor( associationModel
+                                                                                                                                                    .accessor() ) )
+        );
+
+        ( (ValueStateModel) stateModel ).namedAssociations().forEach( associationModel ->
+                                                                          associationModel.checkAssociationConstraints( state
+                                                                                                                            .namedAssociationFor( associationModel
+                                                                                                                                                      .accessor() ) )
+        );
+    }
+
+    public ValueInstance newValueInstance( ValueStateInstance state )
+    {
+        Object[] mixins = mixinsModel.newMixinHolder();
+
+        ValueInstance instance = new ValueInstance( this, mixins, state );
+
+        // Instantiate all mixins
+        int i = 0;
+        InjectionContext injectionContext = new InjectionContext( instance, UsesInstance.EMPTY_USES, state );
+        for( MixinModel mixinModel : mixinsModel.mixinModels() )
+        {
+            mixins[ i++ ] = mixinModel.newInstance( injectionContext );
+        }
+
+        // Return
+        return instance;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateInstance.java
new file mode 100644
index 0000000..aab6597
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateInstance.java
@@ -0,0 +1,234 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.runtime.association.AssociationInfo;
+import org.apache.polygene.runtime.association.AssociationInstance;
+import org.apache.polygene.runtime.association.ManyAssociationInstance;
+import org.apache.polygene.runtime.association.NamedAssociationInstance;
+import org.apache.polygene.runtime.composite.StateResolver;
+import org.apache.polygene.runtime.property.PropertyInfo;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.runtime.structure.ModuleInstance;
+import org.apache.polygene.runtime.unitofwork.EntityFunction;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.api.util.Collectors.toMap;
+
+/**
+ * TODO
+ */
+public final class ValueStateInstance
+    implements AssociationStateHolder
+{
+    private final Map<AccessibleObject, PropertyInstance<?>> properties;
+    private final Map<AccessibleObject, AssociationInstance<?>> associations;
+    private final Map<AccessibleObject, ManyAssociationInstance<?>> manyAssociations;
+    private final Map<AccessibleObject, NamedAssociationInstance<?>> namedAssociations;
+
+    public ValueStateInstance( Map<AccessibleObject, PropertyInstance<?>> properties,
+                               Map<AccessibleObject, AssociationInstance<?>> associations,
+                               Map<AccessibleObject, ManyAssociationInstance<?>> manyAssociations,
+                               Map<AccessibleObject, NamedAssociationInstance<?>> namedAssociations
+    )
+    {
+        this.properties = properties;
+        this.associations = associations;
+        this.manyAssociations = manyAssociations;
+        this.namedAssociations = namedAssociations;
+    }
+
+    public ValueStateInstance( ValueDescriptor compositeModelModule,
+                               ModuleInstance currentModule,
+                               StateResolver stateResolver
+    )
+    {
+        EntityFunction entityFunction = new EntityFunction( currentModule.unitOfWorkFactory() );
+
+        ValueModel valueModel = (ValueModel) compositeModelModule;
+        this.properties = new LinkedHashMap<>();
+        valueModel.state().properties().forEach( propertyDescriptor -> {
+            PropertyInfo builderInfo = propertyDescriptor.getBuilderInfo();
+            Object value = stateResolver.getPropertyState( propertyDescriptor );
+            PropertyInstance<Object> propertyInstance = new PropertyInstance<>( builderInfo, value );
+            properties.put( propertyDescriptor.accessor(), propertyInstance );
+        } );
+
+        this.associations = new LinkedHashMap<>();
+        valueModel.state().associations().forEach( associationDescriptor -> {
+            AssociationInfo builderInfo = associationDescriptor.getBuilderInfo();
+            EntityReference value = stateResolver.getAssociationState( associationDescriptor );
+            AssociationInstance<Object> associationInstance1 = new AssociationInstance<>(
+                builderInfo,
+                entityFunction,
+                new ReferenceProperty( value ) );
+            associations.put( associationDescriptor.accessor(), associationInstance1 );
+        } );
+
+        this.manyAssociations = new LinkedHashMap<>();
+        valueModel.state().manyAssociations().forEach( associationDescriptor -> {
+            AssociationInfo builderInfo = associationDescriptor.getBuilderInfo();
+            List<EntityReference> value = stateResolver.getManyAssociationState( associationDescriptor )
+                                                       .collect( toList() );
+            ManyAssociationValueState manyAssociationState = new ManyAssociationValueState( value );
+            ManyAssociationInstance<Object> associationInstance = new ManyAssociationInstance<>(
+                builderInfo,
+                entityFunction,
+                manyAssociationState );
+            manyAssociations.put( associationDescriptor.accessor(), associationInstance );
+        } );
+
+        this.namedAssociations = new LinkedHashMap<>();
+        valueModel.state().namedAssociations().forEach( associationDescriptor -> {
+            AssociationInfo builderInfo = associationDescriptor.getBuilderInfo();
+            Map<String, EntityReference> value = stateResolver.getNamedAssociationState( associationDescriptor )
+                                                              .collect( toMap( LinkedHashMap::new ) );
+            NamedAssociationValueState namedAssociationState = new NamedAssociationValueState( value );
+            NamedAssociationInstance<Object> associationInstance = new NamedAssociationInstance<>(
+                builderInfo,
+                entityFunction,
+                namedAssociationState );
+            namedAssociations.put( associationDescriptor.accessor(), associationInstance );
+        } );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> PropertyInstance<T> propertyFor( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        PropertyInstance<T> property = (PropertyInstance<T>) properties.get( accessor );
+
+        if( property == null )
+        {
+            throw new IllegalArgumentException( "No such property:" + accessor );
+        }
+
+        return property;
+    }
+
+    @Override
+    public Stream<PropertyInstance<?>> properties()
+    {
+        return properties.values().stream();
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> AssociationInstance<T> associationFor( AccessibleObject accessor )
+    {
+        AssociationInstance<T> association = (AssociationInstance<T>) associations.get( accessor );
+
+        if( association == null )
+        {
+            throw new IllegalArgumentException( "No such association:" + accessor );
+        }
+
+        return association;
+    }
+
+    @Override
+    public Stream<AssociationInstance<?>> allAssociations()
+    {
+        return associations.values().stream();
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> ManyAssociationInstance<T> manyAssociationFor( AccessibleObject accessor )
+    {
+        ManyAssociationInstance<T> manyAssociation = (ManyAssociationInstance<T>) manyAssociations.get( accessor );
+
+        if( manyAssociation == null )
+        {
+            throw new IllegalArgumentException( "No such many-association:" + accessor );
+        }
+
+        return manyAssociation;
+    }
+
+    @Override
+    public Stream<ManyAssociationInstance<?>> allManyAssociations()
+    {
+        return manyAssociations.values().stream();
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> NamedAssociationInstance<T> namedAssociationFor( AccessibleObject accessor )
+    {
+        NamedAssociationInstance<T> namedAssociation = (NamedAssociationInstance<T>) namedAssociations.get( accessor );
+
+        if( namedAssociation == null )
+        {
+            throw new IllegalArgumentException( "No such named-association:" + accessor );
+        }
+
+        return namedAssociation;
+    }
+
+    @Override
+    public Stream<? extends NamedAssociationInstance<?>> allNamedAssociations()
+    {
+        return namedAssociations.values().stream();
+    }
+
+    @SuppressWarnings( "SimplifiableIfStatement" )
+    @Override
+    public boolean equals( Object obj )
+    {
+        if( !( obj instanceof ValueStateInstance ) )
+        {
+            return false;
+        }
+        ValueStateInstance state = (ValueStateInstance) obj;
+        if( !properties.equals( state.properties ) )
+        {
+            return false;
+        }
+        if( !associations.equals( state.associations ) )
+        {
+            return false;
+        }
+        if( !manyAssociations.equals( state.manyAssociations ) )
+        {
+            return false;
+        }
+        return namedAssociations.equals( state.namedAssociations );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int result = properties.hashCode();
+        result = 31 * result + associations.hashCode();
+        result = 31 * result + manyAssociations.hashCode();
+        result = 31 * result + namedAssociations.hashCode();
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateModel.java
new file mode 100644
index 0000000..73c6a17
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValueStateModel.java
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.association.AssociationModel;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.property.PropertiesModel;
+
+/**
+ * Model for ValueComposite state.
+ */
+public final class ValueStateModel
+    extends StateModel
+    implements AssociationStateDescriptor
+{
+    private final AssociationsModel associationsModel;
+    private final ManyAssociationsModel manyAssociationsModel;
+    private final NamedAssociationsModel namedAssociationsModel;
+
+    public ValueStateModel( PropertiesModel propertiesModel,
+                            AssociationsModel associationsModel,
+                            ManyAssociationsModel manyAssociationsModel,
+                            NamedAssociationsModel namedAssociationsModel
+    )
+    {
+        super( propertiesModel );
+        this.associationsModel = associationsModel;
+        this.manyAssociationsModel = manyAssociationsModel;
+        this.namedAssociationsModel = namedAssociationsModel;
+    }
+
+    @Override
+    public AssociationDescriptor getAssociationByName( String name )
+    {
+        return associationsModel.getAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
+    {
+        return associationsModel.getAssociationByQualifiedName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getManyAssociationByName( String name )
+    {
+        return manyAssociationsModel.getManyAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
+    {
+        return manyAssociationsModel.getManyAssociationByQualifiedName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getNamedAssociationByName( String name )
+    {
+        return namedAssociationsModel.getNamedAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
+    {
+        return namedAssociationsModel.getNamedAssociationByQualifiedName( name );
+    }
+
+    @Override
+    public Stream<AssociationModel> associations()
+    {
+        return associationsModel.associations();
+    }
+
+    @Override
+    public Stream<ManyAssociationModel> manyAssociations()
+    {
+        return manyAssociationsModel.manyAssociations();
+    }
+
+    @Override
+    public Stream<NamedAssociationModel> namedAssociations()
+    {
+        return namedAssociationsModel.namedAssociations();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( ( (VisitableHierarchy<Object, Object>) propertiesModel ).accept( visitor ) )
+            {
+                if( ( (VisitableHierarchy<AssociationsModel, AssociationModel>) associationsModel ).accept( visitor ) )
+                {
+                    if( ( (VisitableHierarchy<ManyAssociationsModel, ManyAssociationModel>) manyAssociationsModel ).accept( visitor ) )
+                    {
+                        ( (VisitableHierarchy<NamedAssociationsModel, NamedAssociationModel>) namedAssociationsModel ).accept( visitor );
+                    }
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValuesModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValuesModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValuesModel.java
new file mode 100644
index 0000000..caa875b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/value/ValuesModel.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.value;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * JAVADOC
+ */
+public final class ValuesModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<ValueModel> valueModels;
+
+    public ValuesModel( List<ValueModel> valueModels )
+    {
+        this.valueModels = valueModels;
+    }
+
+    public Stream<ValueModel> models()
+    {
+        return valueModels.stream();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ValueModel valueModel : valueModels )
+            {
+                if( !valueModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Stream<? extends ValueDescriptor> stream()
+    {
+        return valueModels.stream();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/ZestRuntimeImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/ZestRuntimeImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/ZestRuntimeImpl.java
deleted file mode 100644
index 269496c..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/ZestRuntimeImpl.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime;
-
-import java.lang.reflect.InvocationHandler;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.association.AbstractAssociation;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.association.AssociationWrapper;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.ManyAssociationWrapper;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.association.NamedAssociationWrapper;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.composite.TransientComposite;
-import org.apache.zest.api.composite.TransientDescriptor;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.property.PropertyWrapper;
-import org.apache.zest.api.property.StateHolder;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.service.ServiceDescriptor;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.api.value.ValueDescriptor;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.ApplicationModelFactory;
-import org.apache.zest.bootstrap.PolygeneRuntime;
-import org.apache.zest.runtime.association.AbstractAssociationInstance;
-import org.apache.zest.runtime.bootstrap.ApplicationAssemblyFactoryImpl;
-import org.apache.zest.runtime.bootstrap.ApplicationModelFactoryImpl;
-import org.apache.zest.runtime.composite.ProxyReferenceInvocationHandler;
-import org.apache.zest.runtime.composite.TransientInstance;
-import org.apache.zest.runtime.entity.EntityInstance;
-import org.apache.zest.runtime.property.PropertyInstance;
-import org.apache.zest.runtime.service.ImportedServiceReferenceInstance;
-import org.apache.zest.runtime.service.ServiceInstance;
-import org.apache.zest.runtime.service.ServiceReferenceInstance;
-import org.apache.zest.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.zest.runtime.value.ValueInstance;
-import org.apache.zest.spi.PolygeneSPI;
-import org.apache.zest.spi.entity.EntityState;
-
-import static java.lang.reflect.Proxy.getInvocationHandler;
-import static org.apache.zest.runtime.composite.TransientInstance.compositeInstanceOf;
-
-/**
- * Incarnation of Polygene.
- */
-public final class PolygeneRuntimeImpl
-    implements PolygeneSPI, PolygeneRuntime
-{
-    private final ApplicationAssemblyFactory applicationAssemblyFactory;
-    private final ApplicationModelFactory applicationModelFactory;
-
-    public PolygeneRuntimeImpl()
-    {
-        applicationAssemblyFactory = new ApplicationAssemblyFactoryImpl();
-        applicationModelFactory = new ApplicationModelFactoryImpl();
-    }
-
-    @Override
-    public ApplicationAssemblyFactory applicationAssemblyFactory()
-    {
-        return applicationAssemblyFactory;
-    }
-
-    @Override
-    public ApplicationModelFactory applicationModelFactory()
-    {
-        return applicationModelFactory;
-    }
-
-    @Override
-    public PolygeneAPI api()
-    {
-        return this;
-    }
-
-    @Override
-    public PolygeneSPI spi()
-    {
-        return this;
-    }
-
-    // API
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public <T> T dereference( T composite )
-    {
-        InvocationHandler handler = getInvocationHandler( composite );
-        if( handler instanceof ProxyReferenceInvocationHandler )
-        {
-            return (T) ( (ProxyReferenceInvocationHandler) handler ).proxy();
-        }
-        if( handler instanceof CompositeInstance )
-        {
-            return composite;
-        }
-        return null;
-    }
-
-    @Override
-    public ModuleDescriptor moduleOf( Object compositeOrServiceReferenceOrUow )
-    {
-        if( compositeOrServiceReferenceOrUow instanceof TransientComposite )
-        {
-            TransientComposite composite = (TransientComposite) compositeOrServiceReferenceOrUow;
-            return TransientInstance.compositeInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof EntityComposite )
-        {
-            EntityComposite composite = (EntityComposite) compositeOrServiceReferenceOrUow;
-            return EntityInstance.entityInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ValueComposite )
-        {
-            ValueComposite composite = (ValueComposite) compositeOrServiceReferenceOrUow;
-            return ValueInstance.valueInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) compositeOrServiceReferenceOrUow;
-            InvocationHandler handler = getInvocationHandler( composite );
-            if( handler instanceof ServiceInstance )
-            {
-                return ( (ServiceInstance) handler ).module();
-            }
-            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof UnitOfWork )
-        {
-            ModuleUnitOfWork unitOfWork = (ModuleUnitOfWork) compositeOrServiceReferenceOrUow;
-            return unitOfWork.module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
-            return reference.module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ImportedServiceReferenceInstance )
-        {
-            ImportedServiceReferenceInstance<?> importedServiceReference
-                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
-            return importedServiceReference.module();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be one of "
-                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
-                                                             ServiceComposite.class, ServiceReference.class,
-                                                             UnitOfWork.class ) );
-    }
-
-    @Override
-    public ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference )
-    {
-        if( compositeOrServiceReference instanceof TransientComposite )
-        {
-            TransientComposite composite = (TransientComposite) compositeOrServiceReference;
-            return TransientInstance.compositeInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof EntityComposite )
-        {
-            EntityComposite composite = (EntityComposite) compositeOrServiceReference;
-            return EntityInstance.entityInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ValueComposite )
-        {
-            ValueComposite composite = (ValueComposite) compositeOrServiceReference;
-            return ValueInstance.valueInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) compositeOrServiceReference;
-            InvocationHandler handler = getInvocationHandler( composite );
-            if( handler instanceof ServiceInstance )
-            {
-                return ( (ServiceInstance) handler ).descriptor();
-            }
-            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReference;
-            return reference.serviceDescriptor();
-        }
-        else if( compositeOrServiceReference instanceof ImportedServiceReferenceInstance )
-        {
-            ImportedServiceReferenceInstance<?> importedServiceReference
-                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReference;
-            return importedServiceReference.serviceDescriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be one of "
-                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
-                                                             ServiceComposite.class, ServiceReference.class ) );
-    }
-
-    @Override
-    public CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference )
-    {
-        return (CompositeDescriptor) modelDescriptorFor( compositeOrServiceReference );
-    }
-
-    // Descriptors
-
-    @Override
-    public TransientDescriptor transientDescriptorFor( Object transsient )
-    {
-        if( transsient instanceof TransientComposite )
-        {
-            TransientInstance transientInstance = compositeInstanceOf( (Composite) transsient );
-            return (TransientDescriptor) transientInstance.descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + TransientComposite.class );
-    }
-
-    @Override
-    public StateHolder stateOf( TransientComposite composite )
-    {
-        return TransientInstance.compositeInstanceOf( composite ).state();
-    }
-
-    @Override
-    public EntityDescriptor entityDescriptorFor( Object entity )
-    {
-        if( entity instanceof EntityComposite )
-        {
-            EntityInstance entityInstance = (EntityInstance) getInvocationHandler( entity );
-            return entityInstance.entityModel();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + EntityComposite.class );
-    }
-
-    @Override
-    public AssociationStateHolder stateOf( EntityComposite composite )
-    {
-        return EntityInstance.entityInstanceOf( composite ).state();
-    }
-
-    @Override
-    public ValueDescriptor valueDescriptorFor( Object value )
-    {
-        if( value instanceof ValueComposite )
-        {
-            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
-            return valueInstance.descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + ValueComposite.class );
-    }
-
-    @Override
-    public AssociationStateHolder stateOf( ValueComposite composite )
-    {
-        return ValueInstance.valueInstanceOf( composite ).state();
-    }
-
-    @Override
-    public ServiceDescriptor serviceDescriptorFor( Object service )
-    {
-        if( service instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> ref = (ServiceReferenceInstance<?>) service;
-            return ref.serviceDescriptor();
-        }
-        if( service instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) service;
-            return (ServiceDescriptor) ServiceInstance.serviceInstanceOf( composite ).descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of "
-                                            + ServiceComposite.class + " or " + ServiceReference.class );
-    }
-
-    @Override
-    public PropertyDescriptor propertyDescriptorFor( Property<?> property )
-    {
-        while( property instanceof PropertyWrapper )
-        {
-            property = ( (PropertyWrapper) property ).next();
-        }
-
-        return (PropertyDescriptor) ( (PropertyInstance<?>) property ).propertyInfo();
-    }
-
-    @Override
-    public AssociationDescriptor associationDescriptorFor( AbstractAssociation association )
-    {
-        while( association instanceof AssociationWrapper )
-        {
-            association = ( (AssociationWrapper) association ).next();
-        }
-
-        while( association instanceof ManyAssociationWrapper )
-        {
-            association = ( (ManyAssociationWrapper) association ).next();
-        }
-
-        while( association instanceof NamedAssociationWrapper )
-        {
-            association = ( (NamedAssociationWrapper) association ).next();
-        }
-
-        return (AssociationDescriptor) ( (AbstractAssociationInstance) association ).associationInfo();
-    }
-
-    // SPI
-    @Override
-    public EntityState entityStateOf( EntityComposite composite )
-    {
-        return EntityInstance.entityInstanceOf( composite ).entityState();
-    }
-
-    @Override
-    public EntityReference entityReferenceOf( Association<?> assoc )
-    {
-        return assoc.reference();
-    }
-
-    @Override
-    public Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc )
-    {
-        return assoc.references();
-    }
-
-    @Override
-    public Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc )
-    {
-        return assoc.references();
-    }
-}


[02/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityDeclarationImpl.java
deleted file mode 100644
index 24f384b..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityDeclarationImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.EntityDeclaration;
-
-import static java.util.Arrays.asList;
-
-/**
- * Declaration of a Composite. Created by {@link org.apache.zest.bootstrap.ModuleAssembly#transients(Class[])}.
- */
-public final class EntityDeclarationImpl
-    implements EntityDeclaration
-{
-    private final Iterable<EntityAssemblyImpl> entities;
-
-    public EntityDeclarationImpl( Iterable<EntityAssemblyImpl> entities )
-    {
-        this.entities = entities;
-    }
-
-    @Override
-    public EntityDeclaration setMetaInfo( Object info )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.metaInfo.set( info );
-        }
-        return this;
-    }
-
-    @Override
-    public EntityDeclaration visibleIn( Visibility visibility )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.visibility = visibility;
-        }
-        return this;
-    }
-
-    @Override
-    public EntityDeclaration withConcerns( Class<?>... concerns )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.concerns.addAll( asList( concerns ) );
-        }
-        return this;
-    }
-
-    @Override
-    public EntityDeclaration withSideEffects( Class<?>... sideEffects )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.sideEffects.addAll( asList( sideEffects ) );
-        }
-        return this;
-    }
-
-    @Override
-    public EntityDeclaration withMixins( Class<?>... mixins )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.mixins.addAll( asList( mixins ) );
-        }
-        return this;
-    }
-
-    @Override
-    public EntityDeclaration withTypes( Class<?>... types )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.types.addAll( asList( types ) );
-        }
-        return this;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImplementsMethodAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
deleted file mode 100644
index 6c55489..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImplementsMethodAppliesToFilter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class ImplementsMethodAppliesToFilter
-    implements AppliesToFilter
-{
-    @Override
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        try
-        {
-            return !Modifier.isAbstract( fragmentClass.getMethod( method.getName(), method.getParameterTypes() )
-                                             .getModifiers() );
-        }
-        catch( NoSuchMethodException e )
-        {
-            return false;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceAssemblyImpl.java
deleted file mode 100644
index 4890a53..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceAssemblyImpl.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.InvalidApplicationException;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.identity.StringIdentity;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.importer.InstanceImporter;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.bootstrap.ImportedServiceAssembly;
-import org.apache.zest.runtime.activation.ActivatorsModel;
-import org.apache.zest.runtime.service.ImportedServiceModel;
-
-/**
- * Declaration of an imported Service.
- *
- * Created by {@link org.apache.zest.runtime.bootstrap.ModuleAssemblyImpl#importedServices(Class[])}.
- */
-public final class ImportedServiceAssemblyImpl
-    implements ImportedServiceAssembly
-{
-    private final Class<?> serviceType;
-    private final ModuleAssemblyImpl moduleAssembly;
-    @SuppressWarnings( "raw" )
-    Class<? extends ServiceImporter> serviceProvider = InstanceImporter.class;
-    String identity;
-    boolean importOnStartup = false;
-    MetaInfo metaInfo = new MetaInfo();
-    Visibility visibility = Visibility.module;
-    List<Class<? extends Activator<?>>> activators = new ArrayList<>();
-
-    public ImportedServiceAssemblyImpl( Class<?> serviceType, ModuleAssemblyImpl moduleAssembly )
-    {
-        this.serviceType = serviceType;
-        this.moduleAssembly = moduleAssembly;
-    }
-
-    @Override
-    public Stream<Class<?>> types()
-    {
-        return Stream.of( serviceType );
-    }
-
-    @SuppressWarnings( { "raw", "unchecked" } )
-    void addImportedServiceModel( ModuleDescriptor module, List<ImportedServiceModel> serviceModels )
-    {
-        try
-        {
-            Identity id;
-            if( identity == null )
-            {
-                id = generateId( serviceModels, serviceType );
-            }
-            else
-            {
-                id = new StringIdentity( identity );
-            }
-
-            ImportedServiceModel serviceModel = new ImportedServiceModel( module,
-                                                                          serviceType,
-                                                                          visibility,
-                                                                          serviceProvider,
-                                                                          id,
-                                                                          importOnStartup,
-                                                                          new MetaInfo( metaInfo ).withAnnotations( serviceType ),
-                                                                          new ActivatorsModel( activators ),
-                                                                          moduleAssembly.name() );
-            serviceModels.add( serviceModel );
-        }
-        catch( Exception e )
-        {
-            throw new InvalidApplicationException( "Could not register " + serviceType.getName(), e );
-        }
-    }
-
-    @SuppressWarnings( "raw" )
-    private Identity generateId( List<ImportedServiceModel> serviceModels, Class serviceType )
-    {
-        // Find reference that is not yet used
-        int idx = 0;
-        Identity id = new StringIdentity( serviceType.getSimpleName() );
-        boolean invalid;
-        do
-        {
-            invalid = false;
-            for( ImportedServiceModel serviceModel : serviceModels )
-            {
-                if( serviceModel.identity().equals( id ) )
-                {
-                    idx++;
-                    id = new StringIdentity( serviceType.getSimpleName() + "_" + idx );
-                    invalid = true;
-                    break;
-                }
-            }
-        }
-        while( invalid );
-        return id;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceDeclarationImpl.java
deleted file mode 100644
index 4aa6b4f..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ImportedServiceDeclarationImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.qualifier.ServiceTags;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-
-/**
- * Declaration of an imported Service.
- */
-public final class ImportedServiceDeclarationImpl
-    implements ImportedServiceDeclaration
-{
-    private final Iterable<ImportedServiceAssemblyImpl> assemblies;
-
-    public ImportedServiceDeclarationImpl( Iterable<ImportedServiceAssemblyImpl> assemblies )
-    {
-        this.assemblies = assemblies;
-    }
-
-    @Override
-    public ImportedServiceDeclaration importOnStartup()
-    {
-        for( ImportedServiceAssemblyImpl assembly : assemblies )
-        {
-            assembly.importOnStartup = true;
-        }
-        return this;
-    }
-
-    @Override
-    public ImportedServiceDeclaration visibleIn( Visibility visibility )
-    {
-        for( ImportedServiceAssemblyImpl assembly : assemblies )
-        {
-            assembly.visibility = visibility;
-        }
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings( "raw" )
-    public ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> sip )
-    {
-        for( ImportedServiceAssemblyImpl assembly : assemblies )
-        {
-            assembly.serviceProvider = sip;
-        }
-        return this;
-    }
-
-    @Override
-    public ImportedServiceDeclaration identifiedBy( String identity )
-    {
-        for( ImportedServiceAssemblyImpl assembly : assemblies )
-        {
-            assembly.identity = identity;
-        }
-        return this;
-    }
-
-    @Override
-    public ImportedServiceDeclaration taggedWith( String... tags )
-    {
-        for( ImportedServiceAssemblyImpl serviceAssembly : assemblies )
-        {
-            ServiceTags previousTags = serviceAssembly.metaInfo.get( ServiceTags.class );
-            if( previousTags != null )
-            {
-                List<String> tagList = new ArrayList<>();
-                Collections.addAll( tagList, previousTags.tags() );
-                Collections.addAll( tagList, tags );
-                serviceAssembly.metaInfo.set( new ServiceTags( tagList.toArray( new String[ tagList.size() ] ) ) );
-            }
-            else
-            {
-                serviceAssembly.metaInfo.set( new ServiceTags( tags ) );
-            }
-        }
-
-        return this;
-    }
-
-    @Override
-    public ImportedServiceDeclaration setMetaInfo( Object serviceAttribute )
-    {
-        for( ImportedServiceAssemblyImpl assembly : assemblies )
-        {
-            assembly.metaInfo.set( serviceAttribute );
-        }
-        return this;
-    }
-
-    @Override
-    @SafeVarargs
-    public final ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
-    {
-        for ( ImportedServiceAssemblyImpl serviceAssembly : assemblies ) {
-            serviceAssembly.activators.addAll( Arrays.asList( activators ) );
-        }
-        return this;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/LayerAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/LayerAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/LayerAssemblyImpl.java
deleted file mode 100644
index e6f0b8c..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/LayerAssemblyImpl.java
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Predicate;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.structure.Layer;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.AssemblyVisitor;
-import org.apache.zest.bootstrap.EntityAssembly;
-import org.apache.zest.bootstrap.EntityDeclaration;
-import org.apache.zest.bootstrap.ImportedServiceAssembly;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.ObjectAssembly;
-import org.apache.zest.bootstrap.ObjectDeclaration;
-import org.apache.zest.bootstrap.ServiceAssembly;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-import org.apache.zest.bootstrap.TransientAssembly;
-import org.apache.zest.bootstrap.TransientDeclaration;
-import org.apache.zest.bootstrap.ValueAssembly;
-import org.apache.zest.bootstrap.ValueDeclaration;
-
-/**
- * Assembly of a Layer. From here you can create more ModuleAssemblies for
- * the Layer that is being assembled. It is also here that you define
- * what other Layers this Layer is using by calling {@link org.apache.zest.runtime.bootstrap.LayerAssemblyImpl#uses()}.
- */
-public final class LayerAssemblyImpl
-    implements LayerAssembly
-{
-    private final ApplicationAssembly applicationAssembly;
-    private final HashMap<String, ModuleAssemblyImpl> moduleAssemblies;
-    private final Set<LayerAssembly> uses;
-
-    private String name;
-    private final MetaInfo metaInfo = new MetaInfo();
-    private final List<Class<? extends Activator<Layer>>> activators = new ArrayList<>();
-
-    public LayerAssemblyImpl( ApplicationAssembly applicationAssembly, String name )
-    {
-        this.applicationAssembly = applicationAssembly;
-        this.name = name;
-
-        moduleAssemblies = new LinkedHashMap<>();
-        uses = new LinkedHashSet<>();
-    }
-
-    @Override
-    public ModuleAssembly module( String name )
-    {
-        if( name != null )
-        {
-            ModuleAssemblyImpl existing = moduleAssemblies.get( name );
-            if( existing != null )
-            {
-                return existing;
-            }
-        }
-        ModuleAssemblyImpl moduleAssembly = new ModuleAssemblyImpl( this, name );
-        moduleAssemblies.put( name, moduleAssembly );
-        return moduleAssembly;
-    }
-
-    @Override
-    public ApplicationAssembly application()
-    {
-        return applicationAssembly;
-    }
-
-    @Override
-    public LayerAssembly setName( String name )
-    {
-        this.name = name;
-        return this;
-    }
-
-    @Override
-    public LayerAssembly setMetaInfo( Object info )
-    {
-        metaInfo.set( info );
-        return this;
-    }
-
-    @Override
-    public LayerAssembly uses( LayerAssembly... layerAssembly )
-        throws IllegalArgumentException
-    {
-        uses.addAll( Arrays.asList( layerAssembly ) );
-        return this;
-    }
-
-    @Override
-    @SafeVarargs
-    public final LayerAssembly withActivators( Class<? extends Activator<Layer>>... activators )
-    {
-        this.activators.addAll( Arrays.asList( activators ) );
-        return this;
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
-        throws ThrowableType
-    {
-        visitor.visitLayer( this );
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            moduleAssembly.visit( visitor );
-        }
-    }
-
-    @Override
-    public EntityDeclaration entities( Predicate<? super EntityAssembly> specification )
-    {
-        final List<EntityDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.entities( specification ) );
-        }
-
-        return new EntityDeclaration()
-        {
-            @Override
-            public EntityDeclaration setMetaInfo( Object info )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( info );
-                }
-                return this;
-            }
-
-            @Override
-            public EntityDeclaration visibleIn( Visibility visibility )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-
-            @Override
-            public EntityDeclaration withConcerns( Class<?>... concerns )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.withConcerns( concerns );
-                }
-                return this;
-            }
-
-            @Override
-            public EntityDeclaration withSideEffects( Class<?>... sideEffects )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.withSideEffects( sideEffects );
-                }
-                return this;
-            }
-
-            @Override
-            public EntityDeclaration withMixins( Class<?>... mixins )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.withMixins( mixins );
-                }
-                return this;
-            }
-
-            @Override
-            public EntityDeclaration withTypes( Class<?>... types )
-            {
-                for( EntityDeclaration declaration : declarations )
-                {
-                    declaration.withTypes( types );
-                }
-                return this;
-            }
-        };
-    }
-
-    @Override
-    public ServiceDeclaration services( Predicate<? super ServiceAssembly> specification )
-    {
-        final List<ServiceDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.services( specification ) );
-        }
-
-        return new ServiceDeclaration()
-        {
-            @Override
-            public ServiceDeclaration setMetaInfo( Object serviceAttribute )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( serviceAttribute );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration visibleIn( Visibility visibility )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration withConcerns( Class<?>... concerns )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.withConcerns( concerns );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration withSideEffects( Class<?>... sideEffects )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.withSideEffects( sideEffects );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration withMixins( Class<?>... mixins )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.withMixins( mixins );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration withTypes( Class<?>... types )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.withTypes( types );
-                }
-                return this;
-            }
-
-            @Override
-            @SafeVarargs
-            public final ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.withActivators( activators );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration identifiedBy( String identity )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.identifiedBy( identity );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration taggedWith( String... tags )
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.taggedWith( tags );
-                }
-                return this;
-            }
-
-            @Override
-            public ServiceDeclaration instantiateOnStartup()
-            {
-                for( ServiceDeclaration declaration : declarations )
-                {
-                    declaration.instantiateOnStartup();
-                }
-
-                return this;
-            }
-        };
-    }
-
-    @Override
-    public TransientDeclaration transients( Predicate<? super TransientAssembly> specification )
-    {
-        final List<TransientDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.transients( specification ) );
-        }
-
-        return new TransientDeclaration()
-        {
-            @Override
-            public TransientDeclaration setMetaInfo( Object info )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( info );
-                }
-                return this;
-            }
-
-            @Override
-            public TransientDeclaration visibleIn( Visibility visibility )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-
-            @Override
-            public TransientDeclaration withConcerns( Class<?>... concerns )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.withConcerns( concerns );
-                }
-                return this;
-            }
-
-            @Override
-            public TransientDeclaration withSideEffects( Class<?>... sideEffects )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.withSideEffects( sideEffects );
-                }
-                return this;
-            }
-
-            @Override
-            public TransientDeclaration withMixins( Class<?>... mixins )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.withMixins( mixins );
-                }
-                return this;
-            }
-
-            @Override
-            public TransientDeclaration withTypes( Class<?>... types )
-            {
-                for( TransientDeclaration declaration : declarations )
-                {
-                    declaration.withTypes( types );
-                }
-                return this;
-            }
-        };
-    }
-
-    @Override
-    public ValueDeclaration values( Predicate<? super ValueAssembly> specification )
-    {
-        final List<ValueDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.values( specification ) );
-        }
-        return new ValueDeclaration()
-        {
-            @Override
-            public ValueDeclaration setMetaInfo( Object info )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( info );
-                }
-                return this;
-            }
-
-            @Override
-            public ValueDeclaration visibleIn( Visibility visibility )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-
-            @Override
-            public ValueDeclaration withConcerns( Class<?>... concerns )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.withConcerns( concerns );
-                }
-                return this;
-            }
-
-            @Override
-            public ValueDeclaration withSideEffects( Class<?>... sideEffects )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.withSideEffects( sideEffects );
-                }
-                return this;
-            }
-
-            @Override
-            public ValueDeclaration withMixins( Class<?>... mixins )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.withMixins( mixins );
-                }
-                return this;
-            }
-
-            @Override
-            public ValueDeclaration withTypes( Class<?>... types )
-            {
-                for( ValueDeclaration declaration : declarations )
-                {
-                    declaration.withTypes( types );
-                }
-                return this;
-            }
-        };
-    }
-
-    @Override
-    public ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification )
-    {
-        final List<ObjectDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.objects( specification ) );
-        }
-        return new ObjectDeclaration()
-        {
-            @Override
-            public ObjectDeclaration setMetaInfo( Object info )
-            {
-                for( ObjectDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( info );
-                }
-                return this;
-            }
-
-            @Override
-            public ObjectDeclaration visibleIn( Visibility visibility )
-                throws IllegalStateException
-            {
-                for( ObjectDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-        };
-    }
-
-    @Override
-    public ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification )
-    {
-        final List<ImportedServiceDeclaration> declarations = new ArrayList<>();
-
-        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
-        {
-            declarations.add( moduleAssembly.importedServices( specification ) );
-        }
-        return new ImportedServiceDeclaration()
-        {
-
-            @Override
-            public ImportedServiceDeclaration importOnStartup()
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.importOnStartup();
-                }
-                return this;
-            }
-
-            @Override
-            public ImportedServiceDeclaration visibleIn( Visibility visibility )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.visibleIn( visibility );
-                }
-                return this;
-            }
-
-            @Override
-            public ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.importedBy( serviceImporterClass );
-                }
-                return this;
-            }
-
-            @Override
-            public ImportedServiceDeclaration identifiedBy( String identity )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.identifiedBy( identity );
-                }
-                return this;
-            }
-
-            @Override
-            public ImportedServiceDeclaration taggedWith( String... tags )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.taggedWith( tags );
-                }
-                return this;
-            }
-
-            @Override
-            public ImportedServiceDeclaration setMetaInfo( Object serviceAttribute )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.setMetaInfo( serviceAttribute );
-                }
-                return this;
-            }
-
-            @Override
-            @SafeVarargs
-            public final ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
-            {
-                for( ImportedServiceDeclaration declaration : declarations )
-                {
-                    declaration.withActivators( activators );
-                }
-                return this;
-            }
-
-        };
-    }
-
-    Collection<ModuleAssemblyImpl> moduleAssemblies()
-    {
-        return moduleAssemblies.values();
-    }
-
-    Set<LayerAssembly> uses()
-    {
-        return uses;
-    }
-
-    public MetaInfo metaInfo()
-    {
-        return metaInfo;
-    }
-
-    @Override
-    public String name()
-    {
-        return name;
-    }
-
-    public List<Class<? extends Activator<Layer>>> activators()
-    {
-        return activators;
-    }
-
-    @Override
-    public final String toString()
-    {
-        return "LayerAssembly [" + name + "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ModuleAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ModuleAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ModuleAssemblyImpl.java
deleted file mode 100644
index a4b6ecf..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ModuleAssemblyImpl.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.UndeclaredThrowableException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.composite.TransientComposite;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.identity.IdentityGenerator;
-import org.apache.zest.api.identity.StringIdentity;
-import org.apache.zest.api.service.DuplicateServiceIdentityException;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.type.HasTypes;
-import org.apache.zest.api.type.MatchTypeSpecification;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.AssemblySpecifications;
-import org.apache.zest.bootstrap.AssemblyVisitor;
-import org.apache.zest.bootstrap.ConfigurationDeclaration;
-import org.apache.zest.bootstrap.EntityAssembly;
-import org.apache.zest.bootstrap.EntityDeclaration;
-import org.apache.zest.bootstrap.ImportedServiceAssembly;
-import org.apache.zest.bootstrap.ImportedServiceDeclaration;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.MetaInfoDeclaration;
-import org.apache.zest.bootstrap.MixinDeclaration;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.ObjectAssembly;
-import org.apache.zest.bootstrap.ObjectDeclaration;
-import org.apache.zest.bootstrap.ServiceAssembly;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-import org.apache.zest.bootstrap.TransientAssembly;
-import org.apache.zest.bootstrap.TransientDeclaration;
-import org.apache.zest.bootstrap.ValueAssembly;
-import org.apache.zest.bootstrap.ValueDeclaration;
-import org.apache.zest.bootstrap.identity.DefaultIdentityGeneratorAssembler;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.runtime.activation.ActivatorsModel;
-import org.apache.zest.runtime.composite.TransientModel;
-import org.apache.zest.runtime.composite.TransientsModel;
-import org.apache.zest.runtime.entity.EntitiesModel;
-import org.apache.zest.runtime.entity.EntityModel;
-import org.apache.zest.runtime.object.ObjectModel;
-import org.apache.zest.runtime.object.ObjectsModel;
-import org.apache.zest.runtime.service.ImportedServiceModel;
-import org.apache.zest.runtime.service.ImportedServicesModel;
-import org.apache.zest.runtime.service.ServiceModel;
-import org.apache.zest.runtime.service.ServicesModel;
-import org.apache.zest.runtime.structure.LayerModel;
-import org.apache.zest.runtime.structure.ModuleModel;
-import org.apache.zest.runtime.value.ValueModel;
-import org.apache.zest.runtime.value.ValuesModel;
-
-import static java.util.Arrays.asList;
-import static java.util.Collections.singleton;
-import static java.util.stream.Collectors.toList;
-
-/**
- * Assembly of a Module. This is where you register all objects, Composites,
- * Services. Each "add" method returns a declaration that you can use to add
- * additional information and metadata. If you call an "add" method with many
- * parameters then the declared metadata will apply to all types in the method
- * call.
- */
-final class ModuleAssemblyImpl
-        implements ModuleAssembly
-{
-    private static HashMap<Class, Assembler> defaultAssemblers;
-
-    private final LayerAssembly layerAssembly;
-    private String name;
-    private final MetaInfo metaInfo = new MetaInfo();
-
-    private final List<Class<? extends Activator<Module>>> activators = new ArrayList<>();
-    private final List<ServiceAssemblyImpl> serviceAssemblies = new ArrayList<>();
-    private final Map<Class<?>, ImportedServiceAssemblyImpl> importedServiceAssemblies = new LinkedHashMap<>();
-    private final Map<Class<? extends EntityComposite>, EntityAssemblyImpl> entityAssemblies = new LinkedHashMap<>();
-    private final Map<Class<? extends ValueComposite>, ValueAssemblyImpl> valueAssemblies = new LinkedHashMap<>();
-    private final Map<Class<? extends TransientComposite>, TransientAssemblyImpl> transientAssemblies = new LinkedHashMap<>();
-
-    private final Map<Class<?>, ObjectAssemblyImpl> objectAssemblies = new LinkedHashMap<>();
-
-    private final MetaInfoDeclaration metaInfoDeclaration = new MetaInfoDeclaration();
-
-    static
-    {
-        defaultAssemblers = new HashMap<>();
-        defaultAssemblers.put(UnitOfWorkFactory.class, new DefaultUnitOfWorkAssembler());
-        defaultAssemblers.put(IdentityGenerator.class, new DefaultIdentityGeneratorAssembler());
-    }
-
-    ModuleAssemblyImpl(LayerAssembly layerAssembly, String name)
-    {
-        this.layerAssembly = layerAssembly;
-        this.name = name;
-    }
-
-    @Override
-    public LayerAssembly layer()
-    {
-        return layerAssembly;
-    }
-
-    @Override
-    public ModuleAssembly module(String layerName, String moduleName)
-    {
-        return layerAssembly.application().module(layerName, moduleName);
-    }
-
-    @Override
-    public ModuleAssembly setName(String name)
-    {
-        this.name = name;
-        return this;
-    }
-
-    @Override
-    public String name()
-    {
-        return name;
-    }
-
-    public ModuleAssembly setMetaInfo(Object info)
-    {
-        metaInfo.set(info);
-        return this;
-    }
-
-    @Override
-    @SafeVarargs
-    public final ModuleAssembly withActivators(Class<? extends Activator<Module>>... activators)
-    {
-        this.activators.addAll( asList( activators ) );
-        return this;
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public ValueDeclaration values(Class<?>... valueTypes)
-    {
-        List<ValueAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class valueType : valueTypes)
-        {
-            if (valueAssemblies.containsKey(valueType))
-            {
-                assemblies.add(valueAssemblies.get(valueType));
-            }
-            else
-            {
-                ValueAssemblyImpl valueAssembly = new ValueAssemblyImpl(valueType);
-                valueAssemblies.put(valueType, valueAssembly);
-                assemblies.add(valueAssembly);
-            }
-        }
-
-        return new ValueDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ValueDeclaration values(Predicate<? super ValueAssembly> specification)
-    {
-        List<ValueAssemblyImpl> assemblies = valueAssemblies.values().stream()
-                .filter(specification::test)
-                .collect(toList());
-        return new ValueDeclarationImpl(assemblies);
-    }
-
-    @Override
-    @SuppressWarnings({"raw", "unchecked"})
-    public TransientDeclaration transients(Class<?>... transientTypes)
-    {
-        List<TransientAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class valueType : transientTypes)
-        {
-            if (transientAssemblies.containsKey(valueType))
-            {
-                assemblies.add(transientAssemblies.get(valueType));
-            }
-            else
-            {
-                TransientAssemblyImpl transientAssembly = new TransientAssemblyImpl(valueType);
-                transientAssemblies.put(valueType, transientAssembly);
-                assemblies.add(transientAssembly);
-            }
-        }
-
-        return new TransientDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public TransientDeclaration transients(Predicate<? super TransientAssembly> specification)
-    {
-        List<TransientAssemblyImpl> assemblies = transientAssemblies.values().stream()
-                .filter(specification::test)
-                .collect(toList());
-
-        return new TransientDeclarationImpl(assemblies);
-    }
-
-    @Override
-    @SuppressWarnings({"raw", "unchecked"})
-    public EntityDeclaration entities(Class<?>... entityTypes)
-    {
-        List<EntityAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class entityType : entityTypes)
-        {
-            if (entityAssemblies.containsKey(entityType))
-            {
-                assemblies.add(entityAssemblies.get(entityType));
-            }
-            else
-            {
-                EntityAssemblyImpl entityAssembly = new EntityAssemblyImpl(entityType);
-                entityAssemblies.put(entityType, entityAssembly);
-                assemblies.add(entityAssembly);
-            }
-        }
-
-        return new EntityDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public EntityDeclaration entities(Predicate<? super EntityAssembly> specification)
-    {
-        List<EntityAssemblyImpl> assemblies = entityAssemblies.values().stream()
-                .filter(specification::test)
-                .collect(toList());
-
-        return new EntityDeclarationImpl(assemblies);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public ConfigurationDeclaration configurations(Class<?>... configurationTypes)
-    {
-        List<EntityAssemblyImpl> entityAssemblyList = new ArrayList<>();
-
-        for (Class entityType : configurationTypes)
-        {
-            if (this.entityAssemblies.containsKey(entityType))
-            {
-                entityAssemblyList.add(this.entityAssemblies.get(entityType));
-            }
-            else
-            {
-                EntityAssemblyImpl entityAssembly = new EntityAssemblyImpl(entityType);
-                this.entityAssemblies.put(entityType, entityAssembly);
-                entityAssemblyList.add(entityAssembly);
-            }
-        }
-
-        List<ValueAssemblyImpl> valueAssemblyList = new ArrayList<>();
-
-        for (Class valueType : configurationTypes)
-        {
-            if (valueAssemblies.containsKey(valueType))
-            {
-                valueAssemblyList.add(valueAssemblies.get(valueType));
-            }
-            else
-            {
-                ValueAssemblyImpl valueAssembly = new ValueAssemblyImpl(valueType);
-                valueAssemblies.put(valueType, valueAssembly);
-                valueAssemblyList.add(valueAssembly);
-                valueAssembly.types.add(HasIdentity.class);
-            }
-        }
-
-        return new ConfigurationDeclarationImpl(entityAssemblyList, valueAssemblyList);
-    }
-
-    @Override
-    public ConfigurationDeclaration configurations(Predicate<HasTypes> specification)
-    {
-        Predicate<HasTypes> isConfigurationComposite = new MatchTypeSpecification(HasIdentity.class);
-        specification = specification.and(isConfigurationComposite);
-        List<EntityAssemblyImpl> entityAssmblyList = new ArrayList<>();
-        for (EntityAssemblyImpl entityAssembly : entityAssemblies.values())
-        {
-            if (specification.test(entityAssembly))
-            {
-                entityAssmblyList.add(entityAssembly);
-            }
-        }
-        List<ValueAssemblyImpl> valueAssemblyList = new ArrayList<>();
-        for (ValueAssemblyImpl transientAssembly : valueAssemblies.values())
-        {
-            if (specification.test(transientAssembly))
-            {
-                valueAssemblyList.add(transientAssembly);
-            }
-        }
-        return new ConfigurationDeclarationImpl(entityAssmblyList, valueAssemblyList);
-    }
-
-    @Override
-    public ObjectDeclaration objects(Class<?>... objectTypes)
-            throws AssemblyException
-    {
-        List<ObjectAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class<?> objectType : objectTypes)
-        {
-            if (objectType.isInterface())
-            {
-                throw new AssemblyException("Interfaces can not be Polygene Objects.");
-            }
-            if (objectAssemblies.containsKey(objectType))
-            {
-                assemblies.add(objectAssemblies.get(objectType));
-            }
-            else
-            {
-                ObjectAssemblyImpl objectAssembly = new ObjectAssemblyImpl(objectType);
-                objectAssemblies.put(objectType, objectAssembly);
-                assemblies.add(objectAssembly);
-            }
-        }
-
-        return new ObjectDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ObjectDeclaration objects(Predicate<? super ObjectAssembly> specification)
-    {
-        List<ObjectAssemblyImpl> assemblies = objectAssemblies.values().stream()
-                .filter(specification::test)
-                .collect(toList());
-
-        return new ObjectDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ServiceDeclaration addServices(Class<?>... serviceTypes)
-    {
-        List<ServiceAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class<?> serviceType : serviceTypes)
-        {
-            ServiceAssemblyImpl serviceAssembly = new ServiceAssemblyImpl(serviceType);
-            serviceAssemblies.add(serviceAssembly);
-            assemblies.add(serviceAssembly);
-        }
-
-        return new ServiceDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ServiceDeclaration services(Class<?>... serviceTypes)
-    {
-        List<ServiceAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class<?> serviceType : serviceTypes)
-        {
-            if( serviceAssemblies.stream().anyMatch( AssemblySpecifications.ofAnyType( serviceType ) ) )
-            {
-                serviceAssemblies.stream().filter( AssemblySpecifications.ofAnyType( serviceType ) )
-                                 .forEach( assemblies::add );
-            }
-            else
-            {
-                ServiceAssemblyImpl serviceAssembly = new ServiceAssemblyImpl(serviceType);
-                serviceAssemblies.add(serviceAssembly);
-                assemblies.add(serviceAssembly);
-            }
-        }
-
-        return new ServiceDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ServiceDeclaration services(Predicate<? super ServiceAssembly> specification)
-    {
-        List<ServiceAssemblyImpl> assemblies = serviceAssemblies.stream()
-                .filter(specification::test)
-                .collect(toList());
-        return new ServiceDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ImportedServiceDeclaration importedServices(Class<?>... serviceTypes)
-    {
-        List<ImportedServiceAssemblyImpl> assemblies = new ArrayList<>();
-
-        for (Class<?> serviceType : serviceTypes)
-        {
-            if (importedServiceAssemblies.containsKey(serviceType))
-            {
-                assemblies.add(importedServiceAssemblies.get(serviceType));
-            }
-            else
-            {
-                ImportedServiceAssemblyImpl serviceAssembly = new ImportedServiceAssemblyImpl(serviceType, this);
-                importedServiceAssemblies.put(serviceType, serviceAssembly);
-                assemblies.add(serviceAssembly);
-            }
-        }
-
-        return new ImportedServiceDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public ImportedServiceDeclaration importedServices(Predicate<? super ImportedServiceAssembly> specification)
-    {
-        List<ImportedServiceAssemblyImpl> assemblies = importedServiceAssemblies.values().stream()
-                .filter(specification::test)
-                .collect(toList());
-
-        return new ImportedServiceDeclarationImpl(assemblies);
-    }
-
-    @Override
-    public <T> MixinDeclaration<T> forMixin(Class<T> mixinType)
-    {
-        return metaInfoDeclaration.on(mixinType);
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> void visit(AssemblyVisitor<ThrowableType> visitor)
-            throws ThrowableType
-    {
-        visitor.visitModule( this );
-
-        for( TransientAssemblyImpl compositeDeclaration : transientAssemblies.values() )
-        {
-            visitor.visitComposite( new TransientDeclarationImpl( singleton( compositeDeclaration ) ) );
-        }
-
-        for( EntityAssemblyImpl entityDeclaration : entityAssemblies.values() )
-        {
-            visitor.visitEntity( new EntityDeclarationImpl( singleton( entityDeclaration ) ) );
-        }
-
-        for( ObjectAssemblyImpl objectDeclaration : objectAssemblies.values() )
-        {
-            visitor.visitObject( new ObjectDeclarationImpl( singleton( objectDeclaration ) ) );
-        }
-
-        for( ServiceAssemblyImpl serviceDeclaration : serviceAssemblies )
-        {
-            visitor.visitService( new ServiceDeclarationImpl( singleton( serviceDeclaration ) ) );
-        }
-
-        for( ImportedServiceAssemblyImpl importedServiceDeclaration : importedServiceAssemblies.values() )
-        {
-            visitor.visitImportedService( new ImportedServiceDeclarationImpl( singleton( importedServiceDeclaration ) ) );
-        }
-
-        for( ValueAssemblyImpl valueDeclaration : valueAssemblies.values() )
-        {
-            visitor.visitValue( new ValueDeclarationImpl( singleton( valueDeclaration ) ) );
-        }
-    }
-
-    @SuppressWarnings("OptionalGetWithoutIsPresent")
-    ModuleModel assembleModule(LayerModel layerModel, AssemblyHelper helper)
-            throws AssemblyException
-    {
-        addDefaultAssemblers();
-        List<TransientModel> transientModels = new ArrayList<>();
-        List<ObjectModel> objectModels = new ArrayList<>();
-        List<ValueModel> valueModels = new ArrayList<>();
-        List<ServiceModel> serviceModels = new ArrayList<>();
-        List<ImportedServiceModel> importedServiceModels = new ArrayList<>();
-        List<EntityModel> entityModels = new ArrayList<>();
-        ModuleModel moduleModel = new ModuleModel(name,
-                metaInfo,
-                layerModel,
-                new ActivatorsModel<>(activators),
-                new TransientsModel(transientModels),
-                new EntitiesModel(entityModels),
-                new ObjectsModel(objectModels),
-                new ValuesModel(valueModels),
-                new ServicesModel(serviceModels),
-                new ImportedServicesModel(importedServiceModels));
-
-        if (name == null)
-        {
-            throw new AssemblyException("Module must have name set");
-        }
-
-        transientModels.addAll(transientAssemblies.values().stream()
-                .map(composite -> composite.newTransientModel(moduleModel, metaInfoDeclaration, helper))
-                .collect(toList()));
-
-        valueModels.addAll(valueAssemblies.values().stream()
-                .map(value -> value.newValueModel(moduleModel, metaInfoDeclaration, helper))
-                .collect(toList()));
-
-        entityModels.addAll(entityAssemblies.values().stream()
-                .map(entityDeclaration -> entityDeclaration.newEntityModel(moduleModel,
-                        metaInfoDeclaration,
-                        metaInfoDeclaration,
-                        metaInfoDeclaration,
-                        metaInfoDeclaration,
-                        helper))
-                .collect(Collectors.toList()));
-
-        for (ObjectAssemblyImpl objectDeclaration : objectAssemblies.values())
-        {
-            objectDeclaration.addObjectModel(moduleModel, objectModels);
-        }
-
-        for (ServiceAssemblyImpl serviceDeclaration : serviceAssemblies)
-        {
-            if (serviceDeclaration.identity == null)
-            {
-                serviceDeclaration.identity = generateId(serviceDeclaration.types());
-            }
-
-            serviceModels.add(serviceDeclaration.newServiceModel(moduleModel, metaInfoDeclaration, helper));
-        }
-
-        for (ImportedServiceAssemblyImpl importedServiceDeclaration : importedServiceAssemblies.values())
-        {
-            importedServiceDeclaration.addImportedServiceModel(moduleModel, importedServiceModels);
-        }
-
-        // Check for duplicate service identities
-        Set<String> identities = new HashSet<>();
-        for (ServiceModel serviceModel : serviceModels)
-        {
-            String identity = serviceModel.identity().toString();
-            if (identities.contains(identity))
-            {
-                throw new DuplicateServiceIdentityException(
-                        "Duplicated service reference: " + identity + " in module " + moduleModel.name()
-                );
-            }
-            identities.add(identity);
-        }
-        for (ImportedServiceModel serviceModel : importedServiceModels)
-        {
-            String identity = serviceModel.identity().toString();
-            if (identities.contains(identity))
-            {
-                throw new DuplicateServiceIdentityException(
-                        "Duplicated service reference: " + identity + " in module " + moduleModel.name()
-                );
-            }
-            identities.add(identity);
-        }
-
-        importedServiceModels
-            .stream()
-            .filter(
-                importedServiceModel ->
-                    objectModels.stream().noneMatch( model -> model.types().findFirst().get()
-                                                                   .equals( importedServiceModel.serviceImporter() ) ) )
-            .forEach(
-                importedServiceModel ->
-                    objectModels.add( new ObjectModel( moduleModel, importedServiceModel.serviceImporter(),
-                                                       Visibility.module, new MetaInfo() ) ) );
-
-        return moduleModel;
-    }
-
-    private void addDefaultAssemblers()
-            throws AssemblyException
-    {
-        try
-        {
-            defaultAssemblers.entrySet().stream()
-                    .filter(entry -> serviceAssemblies.stream().noneMatch(serviceAssembly -> serviceAssembly.hasType(entry.getKey())))
-                    .forEach(entry ->
-                    {
-                        try
-                        {
-                            entry.getValue().assemble(this);
-                        }
-                        catch (AssemblyException e)
-                        {
-                            throw new UndeclaredThrowableException(e);
-                        }
-                    });
-        }
-        catch (UndeclaredThrowableException e)
-        {
-            throw (AssemblyException) e.getUndeclaredThrowable();
-        }
-    }
-
-    private Identity generateId(Stream<Class<?>> serviceTypes)
-    {
-        // Find service reference that is not yet used
-        Class<?> serviceType = serviceTypes.findFirst()
-                .orElse(null); // Use the first, which *SHOULD* be the main serviceType
-        int idx = 0;
-        Identity id = new StringIdentity(serviceType.getSimpleName());
-        boolean invalid;
-        do
-        {
-            invalid = false;
-            for (ServiceAssemblyImpl serviceAssembly : serviceAssemblies)
-            {
-                if (serviceAssembly.identity() != null && serviceAssembly.identity().equals(id))
-                {
-                    idx++;
-                    id = new StringIdentity(serviceType.getSimpleName() + "_" + idx);
-                    invalid = true;
-                    break;
-                }
-            }
-        }
-        while (invalid);
-        return id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectAssemblyImpl.java
deleted file mode 100644
index f562696..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectAssemblyImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Modifier;
-import java.util.List;
-import java.util.stream.Stream;
-import org.apache.zest.api.common.InvalidApplicationException;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.bootstrap.ObjectAssembly;
-import org.apache.zest.runtime.object.ObjectModel;
-
-/**
- * Assembly of an Object.
- */
-public final class ObjectAssemblyImpl
-    implements ObjectAssembly
-{
-    private Class<?> objectType;
-    MetaInfo metaInfo = new MetaInfo();
-    Visibility visibility = Visibility.module;
-
-    public ObjectAssemblyImpl( Class<?> clazz )
-    {
-        // best try to find out if the class is a concrete class
-        if( clazz.isEnum() ||
-            ( !Composite.class.isAssignableFrom( clazz ) && Modifier.isAbstract( clazz.getModifiers() ) ) )
-        {
-            throw new IllegalArgumentException( "Declared objects must be concrete classes: " + clazz );
-        }
-        this.objectType = clazz;
-    }
-
-    @Override
-    public Stream<Class<?>> types()
-    {
-        return Stream.of( objectType );
-    }
-
-    void addObjectModel( ModuleDescriptor module, List<ObjectModel> objectModels )
-    {
-        try
-        {
-            ObjectModel objectModel = new ObjectModel( module, objectType, visibility, metaInfo );
-            objectModels.add( objectModel );
-        }
-        catch( Throwable e )
-        {
-            throw new InvalidApplicationException( "Could not register " + objectType.getName(), e );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectDeclarationImpl.java
deleted file mode 100644
index a339006..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ObjectDeclarationImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.ObjectDeclaration;
-
-/**
- * Declaration of an Object. Created by {@link org.apache.zest.runtime.bootstrap.ModuleAssemblyImpl#objects(Class[])}.
- */
-public final class ObjectDeclarationImpl
-    implements ObjectDeclaration
-{
-    private final Iterable<ObjectAssemblyImpl> assemblies;
-
-    public ObjectDeclarationImpl( Iterable<ObjectAssemblyImpl> assemblies )
-    {
-        this.assemblies = assemblies;
-    }
-
-    @Override
-    public ObjectDeclaration setMetaInfo( Object info )
-    {
-        for( ObjectAssemblyImpl assembly : assemblies )
-        {
-            assembly.metaInfo.set( info );
-        }
-        return this;
-    }
-
-    @Override
-    public ObjectDeclaration visibleIn( Visibility visibility )
-        throws IllegalStateException
-    {
-        for( ObjectAssemblyImpl assembly : assemblies )
-        {
-            assembly.visibility = visibility;
-        }
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/OrAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/OrAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/OrAppliesToFilter.java
deleted file mode 100644
index 6cdaed7..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/OrAppliesToFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class OrAppliesToFilter
-    implements AppliesToFilter
-{
-    private final AppliesToFilter left;
-    private final AppliesToFilter right;
-
-    OrAppliesToFilter( AppliesToFilter left, AppliesToFilter right )
-    {
-        this.left = left;
-        this.right = right;
-    }
-
-    @Override
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return left.appliesTo( method, mixin, compositeType, fragmentClass ) ||
-               right.appliesTo( method, mixin, compositeType, fragmentClass );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceAssemblyImpl.java
deleted file mode 100644
index 5d5b2e8..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceAssemblyImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.common.InvalidApplicationException;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.util.Annotations;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.bootstrap.ServiceAssembly;
-import org.apache.zest.bootstrap.StateDeclarations;
-import org.apache.zest.runtime.activation.ActivatorsModel;
-import org.apache.zest.runtime.service.ServiceModel;
-import org.apache.zest.runtime.structure.ModuleModel;
-
-/**
- * Assembly of a Service.
- */
-public final class ServiceAssemblyImpl extends CompositeAssemblyImpl
-    implements ServiceAssembly
-{
-    Identity identity;
-    boolean instantiateOnStartup = false;
-    List<Class<? extends Activator<?>>> activators = new ArrayList<>();
-
-    public ServiceAssemblyImpl( Class<?> serviceType )
-    {
-        super( serviceType );
-        // The composite must always implement ServiceComposite, as a marker interface
-        if( !ServiceComposite.class.isAssignableFrom( serviceType ) )
-        {
-            types.add( ServiceComposite.class );
-        }
-    }
-
-    @Override
-    public Identity identity()
-    {
-        return identity;
-    }
-
-    @SuppressWarnings( { "raw", "unchecked" } )
-    ServiceModel newServiceModel( ModuleModel module, StateDeclarations stateDeclarations, AssemblyHelper helper )
-    {
-        try
-        {
-            buildComposite( helper, stateDeclarations );
-            List<Class<? extends Activator<?>>> activatorClasses = Stream
-                .concat( activators.stream(), activatorsDeclarations( types ) )
-                .collect( Collectors.toList() );
-            return new ServiceModel( module, types, visibility, metaInfo,
-                                     new ActivatorsModel( activatorClasses ),
-                                     mixinsModel, stateModel, compositeMethodsModel,
-                                     identity, instantiateOnStartup );
-        }
-        catch( Exception e )
-        {
-            throw new InvalidApplicationException( "Could not register " + types, e );
-        }
-    }
-
-    private Stream<Class<? extends Activator<?>>> activatorsDeclarations( List<? extends Class<?>> types )
-    {
-        return types.stream()
-                    .flatMap( Classes::typesOf )
-                    //.filter( type -> Annotations.annotationOn( type, Activators.class ) == null )
-                    .flatMap( this::getAnnotations );
-    }
-
-    private Stream<? extends Class<? extends Activator<?>>> getAnnotations( Type type )
-    {
-        Activators activators = Annotations.annotationOn( type, Activators.class );
-        if( activators == null )
-        {
-            return Stream.empty();
-        }
-        return Arrays.stream( activators.value() );
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceDeclarationImpl.java
deleted file mode 100644
index 0b015ba..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ServiceDeclarationImpl.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.identity.StringIdentity;
-import org.apache.zest.api.service.qualifier.ServiceTags;
-import org.apache.zest.bootstrap.ServiceDeclaration;
-
-import static java.util.Arrays.asList;
-
-/**
- * Declaration of a Service. Created by {@link org.apache.zest.runtime.bootstrap.ModuleAssemblyImpl#services(Class[])}.
- */
-public final class ServiceDeclarationImpl
-    implements ServiceDeclaration
-{
-    private final Iterable<ServiceAssemblyImpl> serviceAssemblies;
-
-    public ServiceDeclarationImpl( Iterable<ServiceAssemblyImpl> serviceAssemblies )
-    {
-        this.serviceAssemblies = serviceAssemblies;
-    }
-
-    @Override
-    public ServiceDeclaration visibleIn( Visibility visibility )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.visibility = visibility;
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration identifiedBy( String identity )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.identity = new StringIdentity( identity );
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration taggedWith( String... tags )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            ServiceTags previousTags = serviceAssembly.metaInfo.get( ServiceTags.class );
-            if( previousTags != null )
-            {
-                List<String> tagList = new ArrayList<>();
-                tagList.addAll( asList( previousTags.tags() ) );
-                tagList.addAll( asList( tags ) );
-                serviceAssembly.metaInfo.set( new ServiceTags( tagList.toArray( new String[ tagList.size() ] ) ) );
-            }
-            else
-            {
-                serviceAssembly.metaInfo.set( new ServiceTags( tags ) );
-            }
-        }
-
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration instantiateOnStartup()
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.instantiateOnStartup = true;
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration setMetaInfo( Object serviceAttribute )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.metaInfo.set( serviceAttribute );
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration withConcerns( Class<?>... concerns )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.concerns.addAll( asList( concerns ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration withSideEffects( Class<?>... sideEffects )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.sideEffects.addAll( asList( sideEffects ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration withMixins( Class<?>... mixins )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.mixins.addAll( asList( mixins ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ServiceDeclaration withTypes( Class<?>... types )
-    {
-        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
-        {
-            serviceAssembly.types.addAll( asList( types ) );
-        }
-        return this;
-    }
-
-    @Override
-    @SafeVarargs
-    public final ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
-    {
-        for ( ServiceAssemblyImpl serviceAssembly : serviceAssemblies ) {
-            serviceAssembly.activators.addAll( asList( activators ) );
-        }
-        return this;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientAssemblyImpl.java
deleted file mode 100644
index f2b531d..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientAssemblyImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.InvalidApplicationException;
-import org.apache.zest.api.composite.TransientComposite;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.bootstrap.StateDeclarations;
-import org.apache.zest.bootstrap.TransientAssembly;
-import org.apache.zest.runtime.association.AssociationsModel;
-import org.apache.zest.runtime.association.ManyAssociationsModel;
-import org.apache.zest.runtime.association.NamedAssociationsModel;
-import org.apache.zest.runtime.composite.TransientModel;
-
-/**
- * Declaration of a TransientComposite.
- */
-public final class TransientAssemblyImpl extends CompositeAssemblyImpl
-    implements TransientAssembly
-{
-    public TransientAssemblyImpl( Class<?> transientType )
-    {
-        super( transientType );
-
-        // The composite must always implement TransientComposite, as a marker interface
-        if( !TransientComposite.class.isAssignableFrom( transientType ) )
-        {
-            types.add( TransientComposite.class );
-        }
-
-        // If type is a class, register it as a mixin
-        if( !transientType.isInterface() )
-        {
-            mixins.add( transientType );
-        }
-    }
-
-    TransientModel newTransientModel( ModuleDescriptor module,
-                                      StateDeclarations stateDeclarations,
-                                      AssemblyHelper helper
-    )
-    {
-        try
-        {
-            buildComposite( helper, stateDeclarations );
-            return new TransientModel(
-                module, types, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel );
-        }
-        catch( Exception e )
-        {
-            throw new InvalidApplicationException( "Could not register " + types, e );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientDeclarationImpl.java
deleted file mode 100644
index 640f906..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TransientDeclarationImpl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.TransientDeclaration;
-
-import static java.util.Arrays.asList;
-
-/**
- * Declaration of a Composite. Created by {@link org.apache.zest.bootstrap.ModuleAssembly#transients(Class[])}.
- */
-public final class TransientDeclarationImpl
-    implements TransientDeclaration
-{
-    private final Iterable<TransientAssemblyImpl> assemblies;
-
-    public TransientDeclarationImpl( Iterable<TransientAssemblyImpl> assemblies )
-    {
-        this.assemblies = assemblies;
-    }
-
-    @Override
-    public TransientDeclaration setMetaInfo( Object info )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.metaInfo.set( info );
-        }
-        return this;
-    }
-
-    @Override
-    public TransientDeclaration visibleIn( Visibility visibility )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.visibility = visibility;
-        }
-        return this;
-    }
-
-    @Override
-    public TransientDeclaration withConcerns( Class<?>... concerns )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.concerns.addAll( asList( concerns ) );
-        }
-        return this;
-    }
-
-    @Override
-    public TransientDeclaration withSideEffects( Class<?>... sideEffects )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.sideEffects.addAll( asList( sideEffects ) );
-        }
-        return this;
-    }
-
-    @Override
-    public TransientDeclaration withMixins( Class<?>... mixins )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.mixins.addAll( asList( mixins ) );
-        }
-        return this;
-    }
-
-    @Override
-    public TransientDeclaration withTypes( Class<?>... types )
-    {
-        for( TransientAssemblyImpl assembly : assemblies )
-        {
-            assembly.types.addAll( asList( types ) );
-        }
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypeCheckAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypeCheckAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypeCheckAppliesToFilter.java
deleted file mode 100644
index a934803..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/TypeCheckAppliesToFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class TypeCheckAppliesToFilter
-    implements AppliesToFilter
-{
-    @SuppressWarnings( "raw" )
-    private final Class type;
-
-    @SuppressWarnings( "raw" )
-    TypeCheckAppliesToFilter( Class type )
-    {
-        this.type = type;
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return type.isAssignableFrom( compositeType );
-    }
-}


[77/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/bootstrap.tmpl b/tools/generator-polygene/app/templates/Heroes/bootstrap.tmpl
new file mode 100644
index 0000000..e3a9d06
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/bootstrap.tmpl
@@ -0,0 +1,68 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.function.Function;
+
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler;
+
+import <%= packageName %>.bootstrap.connectivity.ConnectivityLayer;
+import <%= packageName %>.bootstrap.domain.DomainLayer;
+import <%= packageName %>.bootstrap.config.ConfigurationLayer;
+import <%= packageName %>.bootstrap.infrastructure.InfrastructureLayer;
+
+public class HeroesApplicationAssembler extends LayeredApplicationAssembler
+{
+    private static final String NAME = "Heroes";
+    private static final String VERSION = "1.0.alpha";
+
+    public HeroesApplicationAssembler( Application.Mode mode )
+    throws AssemblyException
+    {
+        super( NAME, VERSION, mode );
+    }
+
+    @Override
+    protected void assembleLayers( ApplicationAssembly assembly )
+        throws AssemblyException
+    {
+        LayerAssembly configLayer = createLayer( ConfigurationLayer.class );
+        ModuleAssembly configModule = assemblerOf( ConfigurationLayer.class ).configModule();
+        LayerAssembly domainLayer = createLayer( DomainLayer.class );
+        Function<Application, Module> typeFinder = DomainLayer.typeFinder();
+        LayerAssembly infraLayer = new InfrastructureLayer( configModule, typeFinder ).assemble( assembly.layer( InfrastructureLayer.NAME ) );
+        LayerAssembly connectivityLayer = createLayer( ConnectivityLayer.class );
+        connectivityLayer.uses( domainLayer );
+        domainLayer.uses( infraLayer );
+        infraLayer.uses( configLayer );
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/web.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/web.tmpl b/tools/generator-polygene/app/templates/Heroes/web.tmpl
new file mode 100644
index 0000000..dda4f37
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/web.tmpl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<%#
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+%>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         version="2.5">
+
+  <display-name><%= polygene.name %></display-name>
+
+
+  <servlet>
+    <servlet-name>Restlet</servlet-name>
+    <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
+    <init-param>
+      <param-name>org.apache.polygene.runtime.mode</param-name>
+      <param-value>development</param-value>
+    </init-param>
+    <init-param>
+      <!-- Application class name -->
+      <param-name>org.restlet.application</param-name>
+      <param-value><%= packageName %>.app.Heroes</param-value>
+    </init-param>
+    <init-param>
+      <!-- Protocols to be bound to-->
+      <param-name>org.restlet.clients</param-name>
+      <param-value>HTTP HTTPS</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>Restlet</servlet-name>
+    <url-pattern>/api/1/*</url-pattern>
+  </servlet-mapping>
+
+</web-app>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.css b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.css
new file mode 100644
index 0000000..cb651f5
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.css
@@ -0,0 +1,34 @@
+nav a {
+  padding: 5px 10px;
+  text-decoration: none;
+  margin-top: 10px;
+  display: inline-block;
+  background-color: #eee;
+  border-radius: 4px;
+}
+nav a:visited, a:link {
+  color: #607D8B;
+}
+nav a:hover {
+  color: #039be5;
+  background-color: #CFD8DC;
+}
+nav a.router-link-active {
+  color: #039be5;
+}
+h1 {
+  font-size: 1.2em;
+  color: #999;
+  margin-bottom: 0;
+}
+h2 {
+  font-size: 2em;
+  margin-top: 0;
+  padding-top: 0;
+}
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js
new file mode 100644
index 0000000..18aeea4
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js
@@ -0,0 +1,41 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var core_1 = require('angular2/core');
+var router_1 = require('angular2/router');
+var heroes_component_1 = require('./heroes.component');
+var hero_detail_component_1 = require('./hero-detail.component');
+var dashboard_component_1 = require('./dashboard.component');
+var hero_service_1 = require('./hero.service');
+var AppComponent = (function () {
+    function AppComponent() {
+        this.title = 'Tour of Heroes';
+    }
+    AppComponent = __decorate([
+        core_1.Component({
+            selector: 'my-app',
+            template: "\n    <h1>{{title}}</h1>\n    <nav>\n      <a [routerLink]=\"['Dashboard']\">Dashboard</a>\n      <a [routerLink]=\"['Heroes']\">Heroes</a>\n    </nav>\n    <router-outlet></router-outlet>\n  ",
+            styleUrls: ['app/app.component.css'],
+            directives: [router_1.ROUTER_DIRECTIVES],
+            providers: [hero_service_1.HeroService]
+        }),
+        router_1.RouteConfig([
+            // {path: '/', redirectTo: ['Dashboard'] },
+            { path: '/dashboard', name: 'Dashboard', component: dashboard_component_1.DashboardComponent, useAsDefault: true },
+            { path: '/heroes', name: 'Heroes', component: heroes_component_1.HeroesComponent },
+            { path: '/detail/:id', name: 'HeroDetail', component: hero_detail_component_1.HeroDetailComponent }
+        ])
+    ], AppComponent);
+    return AppComponent;
+}());
+exports.AppComponent = AppComponent;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=app.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js.map
new file mode 100644
index 0000000..bade57d
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAwB,eAAe,CAAC,CAAA;AACxC,uBAA6C,iBAAiB,CAAC,CAAA;AAC/D,iCAA8B,oBAAoB,CAAC,CAAA;AACnD,sCAAkC,yBAAyB,CAAC,CAAA;AAC5D,oCAAiC,uBAAuB,CAAC,CAAA;AACzD,6BAA0B,gBAAgB,CAAC,CAAA;AAsB3C;IAAA;QACE,UAAK,GAAG,gBAAgB,CAAC;IAC3B,CAAC;IAtBD;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,kMAOT;YACD,SAAS,EAAE,CAAC,uBAAuB,CAAC;YACpC,UAAU,EAAE,CAAC,0BAAiB,CAAC;YAC/B,SAAS,EAAE,CAAC,0BAAW,CAAC;SACzB,CAAC;QACD,oBAAW,CAAC;YACX,2CAA2C;YAC3C,EAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,wCAAkB,EAAE,YAAY,EAAE,IAAI,EAAC;YAC1F,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,kCAAe,EAAC;YAC7D,EAAC,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,2CAAmB,EAAC;SAC1E,CAAC;oBAAA;IAGF,mBAAC;AAAD,CAAC,AAFD,IAEC;AAFY,oBAAY,eAExB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.ts
new file mode 100644
index 0000000..222874b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/app.component.ts
@@ -0,0 +1,37 @@
+import {Component} from 'angular2/core';
+import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
+import {HeroesComponent} from './heroes.component';
+import {HeroDetailComponent} from './hero-detail.component';
+import {DashboardComponent} from './dashboard.component';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-app',
+  template: `
+    <h1>{{title}}</h1>
+    <nav>
+      <a [routerLink]="['Dashboard']">Dashboard</a>
+      <a [routerLink]="['Heroes']">Heroes</a>
+    </nav>
+    <router-outlet></router-outlet>
+  `,
+  styleUrls: ['app/app.component.css'],
+  directives: [ROUTER_DIRECTIVES],
+  providers: [HeroService]
+})
+@RouteConfig([
+  // {path: '/', redirectTo: ['Dashboard'] },
+  {path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true},
+  {path: '/heroes', name: 'Heroes', component: HeroesComponent},
+  {path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent}
+])
+export class AppComponent {
+  title = 'Tour of Heroes';
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.css b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.css
new file mode 100644
index 0000000..b9d3215
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.css
@@ -0,0 +1,67 @@
+[class*='col-'] {
+  float: left;
+}
+*, *:after, *:before {
+	-webkit-box-sizing: border-box;
+	-moz-box-sizing: border-box;
+	box-sizing: border-box;
+}
+h3 {
+  text-align: center; margin-bottom: 0;
+}
+[class*='col-'] {
+  padding-right: 20px;
+  padding-bottom: 20px;
+}
+[class*='col-']:last-of-type {
+  padding-right: 0;
+}
+.grid {
+  margin: 0;
+}
+.col-1-4 {
+  width: 25%;
+}
+.module {
+	padding: 20px;
+	text-align: center;
+	color: #eee;
+	max-height: 120px;
+	min-width: 120px;
+	background-color: #607D8B;
+	border-radius: 2px;
+}
+h4 {
+  position: relative;
+}
+.module:hover {
+  background-color: #EEE;
+  cursor: pointer;
+  color: #607d8b;
+}
+.grid-pad {
+  padding: 10px 0;
+}
+.grid-pad > [class*='col-']:last-of-type {
+  padding-right: 20px;
+}
+@media (max-width: 600px) {
+	.module {
+	  font-size: 10px;
+	  max-height: 75px; }
+}
+@media (max-width: 1024px) {
+	.grid {
+	  margin: 0;
+	}
+	.module {
+	  min-width: 60px;
+	}
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.html b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.html
new file mode 100644
index 0000000..3fc7517
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.html
@@ -0,0 +1,15 @@
+<h3>Top Heroes</h3>
+<div class="grid grid-pad">
+  <div *ngFor="#hero of heroes" class="col-1-4" (click)="gotoDetail(hero)">
+    <div class="module hero">
+      <h4>{{hero.name}}</h4>
+    </div>
+  </div>
+</div>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js
new file mode 100644
index 0000000..9c69780
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js
@@ -0,0 +1,38 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var core_1 = require('angular2/core');
+var DashboardComponent = (function () {
+    function DashboardComponent(_heroService, _router) {
+        this._heroService = _heroService;
+        this._router = _router;
+        this.heroes = [];
+    }
+    DashboardComponent.prototype.ngOnInit = function () {
+        var _this = this;
+        this._heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes.slice(1, 5); });
+    };
+    DashboardComponent.prototype.gotoDetail = function (hero) {
+        var link = ['HeroDetail', { id: hero.id }];
+        this._router.navigate(link);
+    };
+    DashboardComponent = __decorate([
+        core_1.Component({
+            selector: 'my-dashboard',
+            templateUrl: 'app/dashboard.component.html',
+            styleUrls: ['app/dashboard.component.css']
+        })
+    ], DashboardComponent);
+    return DashboardComponent;
+}());
+exports.DashboardComponent = DashboardComponent;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=dashboard.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js.map
new file mode 100644
index 0000000..5bc16f0
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"dashboard.component.js","sourceRoot":"","sources":["dashboard.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAUhD;IAGE,4BAAoB,YAAyB,EAAU,OAAe;QAAlD,iBAAY,GAAZ,YAAY,CAAa;QAAU,YAAO,GAAP,OAAO,CAAQ;QAFtE,WAAM,GAAW,EAAE,CAAC;IAEsD,CAAC;IAE3E,qCAAQ,GAAR;QAAA,iBAEC;QADC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAC,CAAC,CAAC,EAA/B,CAA+B,CAAC,CAAC;IAChF,CAAC;IAED,uCAAU,GAAV,UAAW,IAAU;QACnB,IAAI,IAAI,GAAG,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAjBH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,cAAc;YACxB,WAAW,EAAE,8BAA8B;YAC3C,SAAS,EAAE,CAAC,6BAA6B,CAAC;SAC3C,CAAC;0BAAA;IAcF,yBAAC;AAAD,CAAC,AAbD,IAaC;AAbY,0BAAkB,qBAa9B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.ts
new file mode 100644
index 0000000..c8160d1
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/dashboard.component.ts
@@ -0,0 +1,31 @@
+import {Component, OnInit} from 'angular2/core';
+import {Router} from 'angular2/router';
+import {Hero} from './hero';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-dashboard',
+  templateUrl: 'app/dashboard.component.html',
+  styleUrls: ['app/dashboard.component.css']
+})
+export class DashboardComponent implements OnInit {
+  heroes: Hero[] = [];
+
+  constructor(private _heroService: HeroService, private _router: Router) { }
+
+  ngOnInit() {
+    this._heroService.getHeroes().then(heroes => this.heroes = heroes.slice(1,5));
+  }
+
+  gotoDetail(hero: Hero) {
+    let link = ['HeroDetail', { id: hero.id }];
+    this._router.navigate(link);
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.css b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.css
new file mode 100644
index 0000000..2a0e285
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.css
@@ -0,0 +1,36 @@
+label {
+  display: inline-block;
+  width: 3em;
+  margin: .5em 0;
+  color: #607D8B;
+  font-weight: bold;
+}
+input {
+  height: 2em;
+  font-size: 1em;
+  padding-left: .4em;
+}
+button {
+  margin-top: 20px;
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer; cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+button:disabled {
+  background-color: #eee;
+  color: #ccc; 
+  cursor: auto;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.html b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.html
new file mode 100644
index 0000000..1e85e75
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.html
@@ -0,0 +1,16 @@
+<div *ngIf="hero">
+	<h2>{{hero.name}} details!</h2>
+	<div>
+		<label>id: </label>{{hero.id}}</div>
+	<div>
+		<label>name: </label>
+		<input [(ngModel)]="hero.name" placeholder="name"/>
+	</div>
+	<button (click)="goBack()">Back</button>
+</div>
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js
new file mode 100644
index 0000000..56d5fa5
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js
@@ -0,0 +1,37 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var core_1 = require('angular2/core');
+var HeroDetailComponent = (function () {
+    function HeroDetailComponent(_heroService, _routeParams) {
+        this._heroService = _heroService;
+        this._routeParams = _routeParams;
+    }
+    HeroDetailComponent.prototype.ngOnInit = function () {
+        var _this = this;
+        var id = +this._routeParams.get('id');
+        this._heroService.getHero(id).then(function (hero) { return _this.hero = hero; });
+    };
+    HeroDetailComponent.prototype.goBack = function () {
+        window.history.back();
+    };
+    HeroDetailComponent = __decorate([
+        core_1.Component({
+            selector: 'my-hero-detail',
+            templateUrl: 'app/hero-detail.component.html',
+            styleUrls: ['app/hero-detail.component.css']
+        })
+    ], HeroDetailComponent);
+    return HeroDetailComponent;
+}());
+exports.HeroDetailComponent = HeroDetailComponent;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=hero-detail.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js.map
new file mode 100644
index 0000000..3928563
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAWhD;IAGE,6BAAoB,YAAyB,EACnC,YAAyB;QADf,iBAAY,GAAZ,YAAY,CAAa;QACnC,iBAAY,GAAZ,YAAY,CAAa;IACnC,CAAC;IAED,sCAAQ,GAAR;QAAA,iBAGC;QAFC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,KAAI,CAAC,IAAI,GAAG,IAAI,EAAhB,CAAgB,CAAC,CAAC;IAC/D,CAAC;IAED,oCAAM,GAAN;QACE,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;IAnBH;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,gBAAgB;YAC1B,WAAW,EAAE,gCAAgC;YAC7C,SAAS,EAAE,CAAC,+BAA+B,CAAC;SAC7C,CAAC;2BAAA;IAgBF,0BAAC;AAAD,CAAC,AAfD,IAeC;AAfY,2BAAmB,sBAe/B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.ts
new file mode 100644
index 0000000..0181847
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero-detail.component.ts
@@ -0,0 +1,34 @@
+import {Component, OnInit} from 'angular2/core';
+import {RouteParams} from 'angular2/router';
+
+import {Hero} from './hero';
+import {HeroService} from './hero.service';
+
+@Component({
+  selector: 'my-hero-detail',
+  templateUrl: 'app/hero-detail.component.html',
+  styleUrls: ['app/hero-detail.component.css']
+})
+export class HeroDetailComponent implements OnInit {
+  hero: Hero;
+
+  constructor(private _heroService: HeroService,
+    private _routeParams: RouteParams) {
+  }
+
+  ngOnInit() {
+    let id = +this._routeParams.get('id');
+    this._heroService.getHero(id).then(hero => this.hero = hero);
+  }
+
+  goBack() {
+    window.history.back();
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js
new file mode 100644
index 0000000..0c6fe2e
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js
@@ -0,0 +1,13 @@
+"use strict";
+var Hero = (function () {
+    function Hero() {
+    }
+    return Hero;
+}());
+exports.Hero = Hero;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=hero.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js.map
new file mode 100644
index 0000000..4a29533
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"hero.js","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":";AAAA;IAAA;IAGA,CAAC;IAAD,WAAC;AAAD,CAAC,AAHD,IAGC;AAHY,YAAI,OAGhB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js
new file mode 100644
index 0000000..3f92669
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js
@@ -0,0 +1,30 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var core_1 = require('angular2/core');
+var mock_heroes_1 = require('./mock-heroes');
+var HeroService = (function () {
+    function HeroService() {
+    }
+    HeroService.prototype.getHeroes = function () {
+        return Promise.resolve(mock_heroes_1.HEROES);
+    };
+    HeroService.prototype.getHero = function (id) {
+        return Promise.resolve(mock_heroes_1.HEROES).then(function (heroes) { return heroes.filter(function (hero) { return hero.id === id; })[0]; });
+    };
+    HeroService = __decorate([
+        core_1.Injectable()
+    ], HeroService);
+    return HeroService;
+}());
+exports.HeroService = HeroService;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=hero.service.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js.map
new file mode 100644
index 0000000..2485ba7
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"hero.service.js","sourceRoot":"","sources":["hero.service.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAyB,eAAe,CAAC,CAAA;AACzC,4BAAyB,eAAe,CAAC,CAAA;AAGzC;IAAA;IAUA,CAAC;IATC,+BAAS,GAAT;QACE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAM,CAAC,CAAC;IACjC,CAAC;IAEF,6BAAO,GAAP,UAAQ,EAAU;QACf,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAM,CAAC,CAAC,IAAI,CACjC,UAAA,MAAM,IAAI,OAAA,MAAM,CAAC,MAAM,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC,CAAC,CAAC,EAAxC,CAAwC,CACnD,CAAC;IACJ,CAAC;IAVH;QAAC,iBAAU,EAAE;mBAAA;IAWb,kBAAC;AAAD,CAAC,AAVD,IAUC;AAVY,mBAAW,cAUvB,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.ts
new file mode 100644
index 0000000..aee78a1
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.service.ts
@@ -0,0 +1,22 @@
+import {Injectable} from 'angular2/core';
+import {HEROES}     from './mock-heroes';
+
+@Injectable()
+export class HeroService {
+  getHeroes() {
+    return Promise.resolve(HEROES);
+  }
+
+	getHero(id: number) {
+    return Promise.resolve(HEROES).then(
+      heroes => heroes.filter(hero => hero.id === id)[0]
+    );
+  }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.ts
new file mode 100644
index 0000000..812726c
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/hero.ts
@@ -0,0 +1,11 @@
+export class Hero {
+	id: number;
+	name: string;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.css
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.css b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.css
new file mode 100644
index 0000000..98e7ecc
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.css
@@ -0,0 +1,66 @@
+.selected {
+  background-color: #CFD8DC !important;
+  color: white;
+}
+.heroes {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 15em;
+}
+.heroes li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.heroes li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.heroes li.selected:hover {
+  background-color: #BBD8DC !important;
+  color: white;
+}
+.heroes .text {
+  position: relative;
+  top: -3px;
+}
+.heroes .badge {
+  display: inline-block;
+  font-size: small;
+  color: white;
+  padding: 0.8em 0.7em 0 0.7em;
+  background-color: #607D8B;
+  line-height: 1em;
+  position: relative;
+  left: -1px;
+  top: -4px;
+  height: 1.8em;
+  margin-right: .8em;
+  border-radius: 4px 0 0 4px;
+}
+button {
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer;
+  cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.html
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.html b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.html
new file mode 100644
index 0000000..0688e6a
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.html
@@ -0,0 +1,21 @@
+<div>
+  <h2>My Heroes</h2>
+  <ul class="heroes">
+    <li *ngFor="#hero of heroes"
+      [class.selected]="hero === selectedHero"
+      (click)="onSelect(hero)">
+      <span class="badge">{{hero.id}}</span> {{hero.name}}
+    </li>
+  </ul>
+  <div *ngIf="selectedHero">
+    <h2>{{selectedHero.name | uppercase}} is my hero</h2>
+    <button (click)="gotoDetail()">View Details</button>
+  </div>
+</div>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js
new file mode 100644
index 0000000..a4c1363
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js
@@ -0,0 +1,42 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var core_1 = require('angular2/core');
+var hero_detail_component_1 = require('./hero-detail.component');
+var HeroesComponent = (function () {
+    function HeroesComponent(_heroService, _router) {
+        this._heroService = _heroService;
+        this._router = _router;
+    }
+    HeroesComponent.prototype.getHeroes = function () {
+        var _this = this;
+        this._heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes; });
+    };
+    HeroesComponent.prototype.gotoDetail = function () {
+        this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
+    };
+    HeroesComponent.prototype.ngOnInit = function () {
+        this.getHeroes();
+    };
+    HeroesComponent.prototype.onSelect = function (hero) { this.selectedHero = hero; };
+    HeroesComponent = __decorate([
+        core_1.Component({
+            selector: 'my-heroes',
+            templateUrl: 'app/heroes.component.html',
+            styleUrls: ['app/heroes.component.css'],
+            directives: [hero_detail_component_1.HeroDetailComponent]
+        })
+    ], HeroesComponent);
+    return HeroesComponent;
+}());
+exports.HeroesComponent = HeroesComponent;
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=heroes.component.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js.map
new file mode 100644
index 0000000..ca03d9d
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"heroes.component.js","sourceRoot":"","sources":["heroes.component.ts"],"names":[],"mappings":";;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAGhD,sCAAkC,yBAAyB,CAAC,CAAA;AAS5D;IAIE,yBAAoB,YAAyB,EAAU,OAAe;QAAlD,iBAAY,GAAZ,YAAY,CAAa;QAAU,YAAO,GAAP,OAAO,CAAQ;IAAI,CAAC;IAE3E,mCAAS,GAAT;QAAA,iBAEC;QADC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,CAAC,CAAC;IACrE,CAAC;IAED,oCAAU,GAAV;QACE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,kCAAQ,GAAR;QACE,IAAI,CAAC,SAAS,EAAE,CAAC;IACnB,CAAC;IAED,kCAAQ,GAAR,UAAS,IAAU,IAAI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAxBpD;QAAC,gBAAS,CAAC;YACT,QAAQ,EAAE,WAAW;YACrB,WAAW,EAAE,2BAA2B;YACxC,SAAS,EAAE,CAAC,0BAA0B,CAAC;YACvC,UAAU,EAAE,CAAC,2CAAmB,CAAC;SAClC,CAAC;uBAAA;IAoBF,sBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,uBAAe,kBAmB3B,CAAA;AAGD;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.ts
new file mode 100644
index 0000000..0002025
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/heroes.component.ts
@@ -0,0 +1,39 @@
+import {Component, OnInit} from 'angular2/core';
+import {Router} from 'angular2/router';
+import {HeroService} from './hero.service';
+import {HeroDetailComponent} from './hero-detail.component';
+import {Hero} from './hero';
+
+@Component({
+  selector: 'my-heroes',
+  templateUrl: 'app/heroes.component.html',
+  styleUrls: ['app/heroes.component.css'],
+  directives: [HeroDetailComponent]
+})
+export class HeroesComponent implements OnInit {
+  heroes: Hero[];
+  selectedHero: Hero;
+
+  constructor(private _heroService: HeroService, private _router: Router) { }
+
+  getHeroes() {
+    this._heroService.getHeroes().then(heroes => this.heroes = heroes);
+  }
+
+  gotoDetail() {
+    this._router.navigate(['HeroDetail', { id: this.selectedHero.id }]);
+  }
+
+  ngOnInit() {
+    this.getHeroes();
+  }
+
+  onSelect(hero: Hero) { this.selectedHero = hero; }
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js
new file mode 100644
index 0000000..9b4c297
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js
@@ -0,0 +1,15 @@
+"use strict";
+var browser_1 = require('angular2/platform/browser');
+var router_1 = require('angular2/router');
+var hero_service_1 = require('./hero.service');
+var app_component_1 = require('./app.component');
+browser_1.bootstrap(app_component_1.AppComponent, [
+    router_1.ROUTER_PROVIDERS,
+    hero_service_1.HeroService
+]);
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=main.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js.map
new file mode 100644
index 0000000..c830f42
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,wBAAwB,2BAA2B,CAAC,CAAA;AACpD,uBAA+B,iBAAiB,CAAC,CAAA;AACjD,6BAA0B,gBAAgB,CAAC,CAAA;AAC3C,8BAA2B,iBAAiB,CAAC,CAAA;AAE7C,mBAAS,CAAC,4BAAY,EAAE;IACtB,yBAAgB;IAChB,0BAAW;CACZ,CAAC,CAAC;AAGH;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/main.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/main.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.ts
new file mode 100644
index 0000000..95e2d0b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/main.ts
@@ -0,0 +1,16 @@
+import {bootstrap} from 'angular2/platform/browser';
+import {ROUTER_PROVIDERS} from 'angular2/router';
+import {HeroService} from './hero.service';
+import {AppComponent} from './app.component';
+
+bootstrap(AppComponent, [
+  ROUTER_PROVIDERS,
+  HeroService
+]);
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js
new file mode 100644
index 0000000..9fe1f8a
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js
@@ -0,0 +1,19 @@
+"use strict";
+exports.HEROES = [
+    { "id": 11, "name": "Mr. Nice" },
+    { "id": 12, "name": "Narco" },
+    { "id": 13, "name": "Bombasto" },
+    { "id": 14, "name": "Celeritas" },
+    { "id": 15, "name": "Magneta" },
+    { "id": 16, "name": "RubberMan" },
+    { "id": 17, "name": "Dynama" },
+    { "id": 18, "name": "Dr IQ" },
+    { "id": 19, "name": "Magma" },
+    { "id": 20, "name": "Tornado" }
+];
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/ 
+//# sourceMappingURL=mock-heroes.js.map
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js.map
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js.map b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js.map
new file mode 100644
index 0000000..dc81a97
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"mock-heroes.js","sourceRoot":"","sources":["mock-heroes.ts"],"names":[],"mappings":";AAEW,cAAM,GAAW;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAC;IAC9B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAC;IAC9B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAC;IAC/B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC;IAC7B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAC;IAC/B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAC;IAC5B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAC;IAC3B,EAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAC;CAC7B,CAAC;AAGF;;;;EAIE"}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.ts
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.ts b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.ts
new file mode 100644
index 0000000..673cf53
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/app/mock-heroes.ts
@@ -0,0 +1,21 @@
+import { Hero } from './hero';
+
+export var HEROES: Hero[] = [
+	{"id": 11, "name": "Mr. Nice"},
+	{"id": 12, "name": "Narco"},
+	{"id": 13, "name": "Bombasto"},
+	{"id": 14, "name": "Celeritas"},
+	{"id": 15, "name": "Magneta"},
+	{"id": 16, "name": "RubberMan"},
+	{"id": 17, "name": "Dynama"},
+	{"id": 18, "name": "Dr IQ"},
+	{"id": 19, "name": "Magma"},
+	{"id": 20, "name": "Tornado"}
+];
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/index.html
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/index.html b/tools/generator-polygene/app/templates/Heroes/webapp/index.html
new file mode 100644
index 0000000..753dd48
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/index.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <script>document.write('<base href="' + document.location + '" />');</script>
+    <title>Angular 2 Tour of Heroes</title>
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link rel="stylesheet" href="styles.css">
+
+    <!-- IE required polyfills, in this exact order -->
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.0/es6-shim.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system-polyfills.js"></script>
+    <script src="https://npmcdn.com/angular2@2.0.0-beta.15/es6/dev/src/testing/shims_for_IE.js"></script>
+   
+    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2-polyfills.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.26/system.js"></script>
+    <script src="https://npmcdn.com/typescript@1.8.10/lib/typescript.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/Rx.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/angular2.dev.js"></script>
+    <script src="https://code.angularjs.org/2.0.0-beta.15/router.dev.js"></script>
+    <script>
+      System.config({
+        transpiler: 'typescript', 
+        typescriptOptions: { emitDecoratorMetadata: true }, 
+        packages: {'app': {defaultExtension: 'ts'}} 
+      });
+        System.import('app/main')
+              .then(null, console.error.bind(console));
+    </script>
+  </head>
+
+  <body>
+    <my-app>Loading...</my-app>
+  </body>
+</html>
+
+
+<!-- 
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+-->
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/Heroes/webapp/styles.css
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/Heroes/webapp/styles.css b/tools/generator-polygene/app/templates/Heroes/webapp/styles.css
new file mode 100644
index 0000000..1774fd6
--- /dev/null
+++ b/tools/generator-polygene/app/templates/Heroes/webapp/styles.css
@@ -0,0 +1,149 @@
+/* Master Styles */
+h1 {
+  color: #369; 
+  font-family: Arial, Helvetica, sans-serif;   
+  font-size: 250%;
+}
+h2, h3 { 
+  color: #444;
+  font-family: Arial, Helvetica, sans-serif;   
+  font-weight: lighter;
+}
+body { 
+  margin: 2em; 
+}
+body, input[text], button { 
+  color: #888; 
+  font-family: Cambria, Georgia; 
+}
+a {
+  cursor: pointer;
+  cursor: hand;
+}
+button {
+  font-family: Arial;
+  background-color: #eee;
+  border: none;
+  padding: 5px 10px;
+  border-radius: 4px;
+  cursor: pointer;
+  cursor: hand;
+}
+button:hover {
+  background-color: #cfd8dc;
+}
+button:disabled {
+  background-color: #eee;
+  color: #aaa; 
+  cursor: auto;
+}
+
+/* Navigation link styles */
+nav a {
+  padding: 5px 10px;
+  text-decoration: none;
+  margin-top: 10px;
+  display: inline-block;
+  background-color: #eee;
+  border-radius: 4px;
+}
+nav a:visited, a:link {
+  color: #607D8B;
+}
+nav a:hover {
+  color: #039be5;
+  background-color: #CFD8DC;
+}
+nav a.router-link-active {
+  color: #039be5;
+}
+
+/* items class */
+.items {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 24em;
+}
+.items li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.items li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.items li.selected:hover {
+  background-color: #BBD8DC;
+  color: white;
+}
+.items .text {
+  position: relative;
+  top: -3px;
+}
+.items {
+  margin: 0 0 2em 0;
+  list-style-type: none;
+  padding: 0;
+  width: 24em;
+}
+.items li {
+  cursor: pointer;
+  position: relative;
+  left: 0;
+  background-color: #EEE;
+  margin: .5em;
+  padding: .3em 0;
+  height: 1.6em;
+  border-radius: 4px;
+}
+.items li:hover {
+  color: #607D8B;
+  background-color: #DDD;
+  left: .1em;
+}
+.items li.selected {
+  background-color: #CFD8DC;
+  color: white;
+}
+
+.items li.selected:hover {
+  background-color: #BBD8DC;
+}
+.items .text {
+  position: relative;
+  top: -3px;
+}
+.items .badge {
+  display: inline-block;
+  font-size: small;
+  color: white;
+  padding: 0.8em 0.7em 0 0.7em;
+  background-color: #607D8B;
+  line-height: 1em;
+  position: relative;
+  left: -1px;
+  top: -4px;
+  height: 1.8em;
+  margin-right: .8em;
+  border-radius: 4px 0 0 4px;
+}
+
+/* everywhere else */
+* { 
+  font-family: Arial, Helvetica, sans-serif; 
+}
+
+
+/*
+Copyright 2016 Google Inc. All Rights Reserved.
+Use of this source code is governed by an MIT-style license that
+can be found in the LICENSE file at http://angular.io/license
+*/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
new file mode 100644
index 0000000..a1206a9
--- /dev/null
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/bootstrap.tmpl
@@ -0,0 +1,55 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import java.util.function.Function;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.LayerAssembler;
+import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
+
+public class InfrastructureLayer extends LayeredLayerAssembler
+    implements LayerAssembler
+{
+    public static final String NAME = "Infrastructure Layer";
+    private final ModuleAssembly configModule;
+    private final Function<Application, Module> typeFinder;
+
+    public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )
+    {
+        this.configModule = configModule;
+        this.typeFinder = typeFinder;
+    }
+
+    @Override
+    public LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException
+    {
+        createModule( layer, FileConfigurationModule.class );
+
+        new <%= polygene.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= polygene.entitystore %>StorageModule.NAME ) );
+        new <%= polygene.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= polygene.indexing %>IndexingModule.NAME ) );
+        new <%= polygene.serialization %>SerializationModule( typeFinder ).assemble( layer, layer.module( <%= polygene.serialization %>SerializationModule.NAME ) );
+        return layer;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl
new file mode 100644
index 0000000..dd1d17c
--- /dev/null
+++ b/tools/generator-polygene/app/templates/JacksonSerializationModule/bootstrap.tmpl
@@ -0,0 +1,53 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import java.util.function.Function;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+
+public class JacksonSerializationModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Jackson Serialization Module";
+    private final Function<Application, Module> typeFinder;
+
+    public JacksonSerializationModule( Function<Application, Module> typeFinder )
+    {
+        this.typeFinder = typeFinder;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new JacksonValueSerializationAssembler()
+            .visibleIn( Visibility.application )
+            .withValuesModuleFinder( typeFinder )
+            .assemble( module );
+        return module;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl
new file mode 100644
index 0000000..b5ebe24
--- /dev/null
+++ b/tools/generator-polygene/app/templates/NoCachingModule/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.file.assembly.FileEntityStoreAssembler;
+
+public class NoCachingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "No Caching Module";
+    private final ModuleAssembly configModule;
+
+    public NoCachingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
new file mode 100644
index 0000000..8376a2b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RDFIndexingModule/bootstrap.tmpl
@@ -0,0 +1,50 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
+import org.apache.polygene.library.rdf.repository.NativeConfiguration;
+
+public class RdfIndexingModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "Rdf Indexing Module";
+    private final ModuleAssembly configModule;
+
+    public RdfIndexingModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        configModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
+        new RdfNativeSesameStoreAssembler(Visibility.application, Visibility.module).assemble( module );
+        return module;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
new file mode 100644
index 0000000..fc73bf6
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestApiModule/HardcodedSecurityRepositoryMixin.tmpl
@@ -0,0 +1,54 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.model.security;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+
+public class HardcodedSecurityRepositoryMixin
+    implements SecurityRepository
+{
+
+    @Override
+    public boolean verifyPassword( String userName, String password )
+    {
+        if( userName.equals("admin") && password.equals("secret") )
+        {
+            return true;
+        }
+        if( userName.equals("user") && password.equals("123") )
+        {
+            return true;
+        }
+        return false;
+    }
+
+    @UnitOfWorkPropagation
+    public List<String> findRoleNamesOfUser( String name )
+    {
+        if( "admin".equals( name ) )
+        {
+            return Collections.singletonList("admin");
+        }
+        return Collections.singletonList("user");
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl
new file mode 100644
index 0000000..f007485
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestApiModule/SecurityRepository.tmpl
@@ -0,0 +1,36 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.model.security;
+
+import java.util.List;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+
+@Concerns( UnitOfWorkConcern.class )
+public interface SecurityRepository
+{
+    @UnitOfWorkPropagation
+    boolean verifyPassword( String user, String password );
+
+    @UnitOfWorkPropagation
+    List<String> findRoleNamesOfUser( String name );
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl
new file mode 100644
index 0000000..3b21a9d
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestApiModule/SimpleEnroler.tmpl
@@ -0,0 +1,52 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.rest.security;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.restlet.Application;
+import org.restlet.data.ClientInfo;
+import org.restlet.security.Enroler;
+import org.restlet.security.Role;
+import <%= packageName %>.model.security.SecurityRepository;
+
+
+public class SimpleEnroler
+    implements Enroler
+{
+    @Service
+    private SecurityRepository repository;
+
+    @Uses
+    private Application application;
+
+    @Override
+    public void enrole( ClientInfo clientInfo )
+    {
+        org.restlet.security.User user = clientInfo.getUser();
+        String name = user.getName();
+        List<String> roleList = repository.findRoleNamesOfUser( name );
+        List<Role> restletRoles = new ArrayList<>();
+        roleList.stream().map( roleName -> Role.get( application, roleName ) );
+        clientInfo.setRoles( restletRoles );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl b/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl
new file mode 100644
index 0000000..e8b7e11
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestApiModule/SimpleVerifier.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.rest.security;
+
+import org.apache.polygene.api.injection.scope.Service;
+import org.restlet.security.SecretVerifier;
+import org.restlet.security.Verifier;
+import <%= packageName %>.model.security.SecurityRepository;
+
+public class SimpleVerifier extends SecretVerifier
+    implements Verifier
+{
+    @Service
+    private SecurityRepository repository;
+
+    @Override
+    public int verify( String user, char[] secret )
+    {
+        if( user == null || secret == null )
+        {
+            return RESULT_UNKNOWN;
+        }
+        if( repository.verifyPassword( user, String.valueOf( secret ) ) )
+        {
+            return RESULT_VALID;
+        }
+        return RESULT_INVALID;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl
new file mode 100644
index 0000000..202776d
--- /dev/null
+++ b/tools/generator-polygene/app/templates/RestApiModule/bootstrap.tmpl
@@ -0,0 +1,56 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.connectivity;
+
+import <%= packageName %>.rest.security.SimpleEnroler;
+import <%= packageName %>.rest.security.SimpleVerifier;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.library.restlet.assembly.RestletCrudConnectivityAssembler;
+import org.apache.polygene.library.restlet.resource.EntryPoint;
+<% if( hasFeature('sample (heroes) web application') ) { %>
+import <%= packageName %>.model.heroes.Hero;
+<% } -%>
+
+public class RestApiModule
+    implements ModuleAssembler
+{
+    public static String NAME;
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.objects( SimpleVerifier.class, SimpleEnroler.class);
+
+        new RestletCrudConnectivityAssembler().assemble( module );
+        module.values( EntryPoint.class );
+<% if( hasFeature('sample (heroes) web application') ) { -%>
+        module.values( Hero.class );
+        module.services( Hero.class );
+<% } else { -%>
+        module.values( /* add value types */   );
+        module.services(  /* add services */  );
+<% } -%>
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl b/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
new file mode 100644
index 0000000..91c66e6
--- /dev/null
+++ b/tools/generator-polygene/app/templates/SecurityModule/HardcodedSecurityRepositoryMixin.tmpl
@@ -0,0 +1,51 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.model.security;
+
+import java.util.Collections;
+import java.util.List;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+
+public class HardcodedSecurityRepositoryMixin
+    implements SecurityRepository
+{
+
+    @Override
+    public boolean verifyPassword( String userName, String password )
+    {
+        if( userName.equals("admin") && password.equals("secret") )        {
+            return true;
+        }
+        if( userName.equals("user") && password.equals("123") )        {
+            return true;
+        }
+        return false;
+    }
+
+    @UnitOfWorkPropagation
+    public List<String> findRoleNamesOfUser( String name )
+    {
+        if( "admin".equals( name ) )
+        {
+            return Collections.singletonList("admin");
+        }
+        return Collections.singletonList("user");
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl b/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl
new file mode 100644
index 0000000..c503999
--- /dev/null
+++ b/tools/generator-polygene/app/templates/SecurityModule/SecurityRepository.tmpl
@@ -0,0 +1,35 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.model.security;
+
+import java.util.List;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+
+@Concerns( UnitOfWorkConcern.class )
+public interface SecurityRepository
+{
+    @UnitOfWorkPropagation
+    boolean verifyPassword( String user, String password );
+
+    @UnitOfWorkPropagation
+    List<String> findRoleNamesOfUser( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl
new file mode 100644
index 0000000..b944612
--- /dev/null
+++ b/tools/generator-polygene/app/templates/SecurityModule/bootstrap.tmpl
@@ -0,0 +1,46 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.domain;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import <%= packageName %>.model.security.SecurityRepository;
+import <%= packageName %>.model.security.HardcodedSecurityRepositoryMixin;
+
+public class SecurityModule
+    implements ModuleAssembler
+{
+    public static String NAME;
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.services( SecurityRepository.class )
+            .withMixins( HardcodedSecurityRepositoryMixin.class )
+            .visibleIn( Visibility.application )
+            .instantiateOnStartup();
+
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl
new file mode 100644
index 0000000..467fadd
--- /dev/null
+++ b/tools/generator-polygene/app/templates/StorageModule/bootstrap.tmpl
@@ -0,0 +1,51 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 <%= packageName %>.bootstrap.infrastructure;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+import org.apache.polygene.entitystore.<%- polygene.entitystore.toLowerCase() %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler;
+
+public class <%- polygene.entitystore %>StorageModule
+    implements ModuleAssembler
+{
+    public static final String NAME = "<%- polygene.entitystore %> Storage Module";
+    private final ModuleAssembly configModule;
+
+    public <%- polygene.entitystore %>StorageModule( ModuleAssembly configModule )
+    {
+        this.configModule = configModule;
+    }
+
+    @Override
+    public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException
+    {
+        new <%- polygene.entitystore %>EntityStoreAssembler()
+            .visibleIn( Visibility.application  )
+            .withConfig( configModule, Visibility.application )
+            .identifiedBy( "<%- polygene.entitystore %>store" )
+            .assemble( module );
+        return module;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
new file mode 100644
index 0000000..f307e8b
--- /dev/null
+++ b/tools/generator-polygene/app/templates/buildtool/gradle-app.tmpl
@@ -0,0 +1,41 @@
+<%#
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ *
+ *
+-%>
+
+plugins {
+  id 'war'
+  id "org.akhikhl.gretty" version "1.4.0"
+}
+
+dependencies {
+  compile project( ":bootstrap" )
+  compile project( ":model" )
+  compile project( ":rest" )
+
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
+
+  compile "javax.servlet:servlet-api:2.5"
+  compile "org.restlet.jee:org.restlet:2.3.4"
+
+  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
+  runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
+
+}


[55/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/osgi/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/osgi/build.gradle b/libraries/osgi/build.gradle
index f6d1a32..4cad02e 100644
--- a/libraries/osgi/build.gradle
+++ b/libraries/osgi/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 OSGi Library provides integration of OSGi and
 jar { manifest { name = "Apache Polygene\u2122 Library - OSGi Integration" } }
 
 dependencies {
-  compile zest.core.api
+  compile polygene.core.api
   compile libraries.osgi_core
   compile libraries.osgi_compendium
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.mockito
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/osgi/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/osgi/dev-status.xml b/libraries/osgi/dev-status.xml
index 5b78a6d..e4cf124 100644
--- a/libraries/osgi/dev-status.xml
+++ b/libraries/osgi/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/osgi/src/docs/osgi.txt
----------------------------------------------------------------------
diff --git a/libraries/osgi/src/docs/osgi.txt b/libraries/osgi/src/docs/osgi.txt
index 0906d31..7ebaaee 100644
--- a/libraries/osgi/src/docs/osgi.txt
+++ b/libraries/osgi/src/docs/osgi.txt
@@ -34,7 +34,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
 
 [snippet,java]
 ----
-source=libraries/osgi/src/test/java/org/apache/zest/library/osgi/DocumentationSupport.java
+source=libraries/osgi/src/test/java/org/apache/polygene/library/osgi/DocumentationSupport.java
 tag=export
 ----
 
@@ -43,7 +43,7 @@ tag=export
 
 [snippet,java]
 ----
-source=libraries/osgi/src/test/java/org/apache/zest/library/osgi/DocumentationSupport.java
+source=libraries/osgi/src/test/java/org/apache/polygene/library/osgi/DocumentationSupport.java
 tag=import
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rdf/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/rdf/build.gradle b/libraries/rdf/build.gradle
index 620f0cb..276dd10 100644
--- a/libraries/rdf/build.gradle
+++ b/libraries/rdf/build.gradle
@@ -23,15 +23,15 @@ description = "Apache Polygene\u2122 RDF Library provides commonalities of various
 jar { manifest { name = "Apache Polygene\u2122 Library - RDF" } }
 
 dependencies {
-  compile zest.core.spi
-  compile zest.library( 'constraints' )
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.spi
+  compile polygene.library( 'constraints' )
+  compile polygene.library( 'fileconfig' )
   compile libraries.sesame
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rdf/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rdf/dev-status.xml b/libraries/rdf/dev-status.xml
index 9100f39..33d5d9e 100644
--- a/libraries/rdf/dev-status.xml
+++ b/libraries/rdf/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/test2.xml
----------------------------------------------------------------------
diff --git a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/test2.xml b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/test2.xml
index 3a21393..c8df825 100644
--- a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/test2.xml
+++ b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/entity/test2.xml
@@ -23,23 +23,23 @@
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:ns1="http://www.w3.org/2001/vcard-rdf/3.0#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
-  <org.apache.zest.library.rdf.entity.TestEntity xmlns="urn:zest:persistent:Wvgf5vdB2OuC8JfcNmUqJLEPSYM:"
-                                          rdf:about="urn:zest:entity:test2">
-    <value xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#">{test1:5,test2:null,test3:{data:"Habba"}}</value>
-    <identity xmlns="urn:zest:persistent:org.apache.zest.api.identity.HasIdentity#">test2</identity>
-    <name xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#">Niclas</name>
-    <title xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#">Mr</title>
-    <association xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#" rdf:resource="urn:zest:entity:test1"/>
-    <group xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#">
+  <org.apache.polygene.library.rdf.entity.TestEntity xmlns="urn:polygene:persistent:Wvgf5vdB2OuC8JfcNmUqJLEPSYM:"
+                                          rdf:about="urn:polygene:entity:test2">
+    <value xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#">{test1:5,test2:null,test3:{data:"Habba"}}</value>
+    <identity xmlns="urn:polygene:persistent:org.apache.polygene.api.identity.HasIdentity#">test2</identity>
+    <name xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#">Niclas</name>
+    <title xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#">Mr</title>
+    <association xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#" rdf:resource="urn:polygene:entity:test1"/>
+    <group xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#">
       <rdf:Seq>
-        <rdf:li rdf:resource="urn:zest:entity:test1"/>
+        <rdf:li rdf:resource="urn:polygene:entity:test1"/>
       </rdf:Seq>
     </group>
-    <manyAssoc xmlns="urn:zest:persistent:org.apache.zest.library.rdf.entity.TestEntity#">
+    <manyAssoc xmlns="urn:polygene:persistent:org.apache.polygene.library.rdf.entity.TestEntity#">
       <rdf:Seq>
-        <rdf:li rdf:resource="urn:zest:entity:test1"/>
+        <rdf:li rdf:resource="urn:polygene:entity:test1"/>
       </rdf:Seq>
     </manyAssoc>
-  </org.apache.zest.library.rdf.entity.TestEntity>
+  </org.apache.polygene.library.rdf.entity.TestEntity>
 
 </rdf:RDF>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/rest-client/build.gradle b/libraries/rest-client/build.gradle
index 0362578..934d7f5 100644
--- a/libraries/rest-client/build.gradle
+++ b/libraries/rest-client/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 REST Client Library provides a client library
 jar { manifest { name = "Apache Polygene\u2122 Library - REST Client" } }
 
 dependencies {
-  compile zest.library( 'rest-common' )
+  compile polygene.library( 'rest-common' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'rest-server' )
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'rest-server' )
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rest-client/dev-status.xml b/libraries/rest-client/dev-status.xml
index 156f63e..8a68435 100644
--- a/libraries/rest-client/dev-status.xml
+++ b/libraries/rest-client/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/src/docs/primer.txt
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/docs/primer.txt b/libraries/rest-client/src/docs/primer.txt
index f643aac..6497dba 100644
--- a/libraries/rest-client/src/docs/primer.txt
+++ b/libraries/rest-client/src/docs/primer.txt
@@ -51,7 +51,7 @@ requests, or it may abort. "refresh" does not return any value, and usually does
 Example:
 [snippet,java]
 -----------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/docsupport/RestPrimerDocs.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/docsupport/RestPrimerDocs.java
 tag=1
 -----------
 
@@ -68,7 +68,7 @@ handlers. Here is the setup of crc:
 
 [snippet,java]
 -----------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/docsupport/RestPrimerDocs.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/docsupport/RestPrimerDocs.java
 tag=2
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/src/docs/rest-client.txt
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/docs/rest-client.txt b/libraries/rest-client/src/docs/rest-client.txt
index a783281..0e46d53 100644
--- a/libraries/rest-client/src/docs/rest-client.txt
+++ b/libraries/rest-client/src/docs/rest-client.txt
@@ -46,7 +46,7 @@ Let's walk through the different steps typically needed.
 
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=client-create1
 -------------
 
@@ -57,7 +57,7 @@ We then create the global handler, which will be set to all ContextResourceClien
 
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=client-create2
 -------------
 
@@ -74,7 +74,7 @@ ReST API.
 
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=client-create3
 -------------
 
@@ -89,28 +89,28 @@ The general approach is to register handlers for potential results when invoking
 === Query without Value ===
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=query-without-value
 -------------
 
 === Query and Command ===
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=query-and-command
 -------------
 
 === Query List and Command ===
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=query-list-and-command
 -------------
 
 === Query List and Command Progressive ===
 [snippet,java]
 -------------
-source=libraries/rest-client/src/test/java/org/apache/zest/library/rest/client/ContextResourceClientFactoryTest.java
+source=libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
 tag=query-list-and-command-progressive
 -------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
index 5b75e19..771cbd6 100644
--- a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContextResourceClientFactoryTest.java
@@ -209,7 +209,7 @@ public class ContextResourceClientFactoryTest
     @Override
     protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
     {
-        return applicationModel.newInstance( zest.api(), new MetadataService() );
+        return applicationModel.newInstance( polygene.api(), new MetadataService() );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
index 69a5480..3da87d1 100644
--- a/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
+++ b/libraries/rest-client/src/test/java/org/apache/polygene/library/rest/client/ContinuousIntegrationTest.java
@@ -183,7 +183,7 @@ public class ContinuousIntegrationTest
     @Override
     protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
     {
-        return applicationModel.newInstance( zest.api(), new MetadataService() );
+        return applicationModel.newInstance( polygene.api(), new MetadataService() );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-common/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/rest-common/build.gradle b/libraries/rest-common/build.gradle
index 1bb1ab4..4d5616e 100644
--- a/libraries/rest-common/build.gradle
+++ b/libraries/rest-common/build.gradle
@@ -23,7 +23,7 @@ description = "Apache Polygene\u2122 REST Library provides various Restlet resource
 jar { manifest { name = "Apache Polygene\u2122 Library - REST" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.restlet
   compile libraries.velocity
   compile libraries.servlet_api

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-common/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rest-common/dev-status.xml b/libraries/rest-common/dev-status.xml
index 2466302..d3c6f4f 100644
--- a/libraries/rest-common/dev-status.xml
+++ b/libraries/rest-common/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-server/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/rest-server/build.gradle b/libraries/rest-server/build.gradle
index cecd3f8..4e186aa 100644
--- a/libraries/rest-server/build.gradle
+++ b/libraries/rest-server/build.gradle
@@ -23,16 +23,16 @@ description = "Apache Polygene\u2122 REST Server Library provides a server componen
 jar { manifest { name = "Apache Polygene\u2122 Library - REST server" } }
 
 dependencies {
-  compile zest.library( 'rest-common' )
+  compile polygene.library( 'rest-common' )
   compile libraries.servlet_api
   compile libraries.slf4j_api
   compile libraries.velocity
   compile libraries.restlet
   compile libraries.freemarker
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest-server/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rest-server/dev-status.xml b/libraries/rest-server/dev-status.xml
index 2466302..d3c6f4f 100644
--- a/libraries/rest-server/dev-status.xml
+++ b/libraries/rest-server/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/rest/build.gradle b/libraries/rest/build.gradle
index e9db684..109d7f3 100644
--- a/libraries/rest/build.gradle
+++ b/libraries/rest/build.gradle
@@ -23,17 +23,17 @@ description = "Apache Polygene\u2122 REST Library provides various Restlet resource
 jar { manifest { name = "Apache Polygene\u2122 Library - REST" } }
 
 dependencies {
-  compile zest.extension( 'indexing-rdf' )
+  compile polygene.extension( 'indexing-rdf' )
   compile libraries.restlet
   compile libraries.sparql
   compile libraries.velocity
   compile libraries.servlet_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'http' )
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'http' )
+  testCompile polygene.extension( 'valueserialization-orgjson' )
   testCompile libraries.http_client
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/rest/dev-status.xml b/libraries/rest/dev-status.xml
index 2466302..d3c6f4f 100644
--- a/libraries/rest/dev-status.xml
+++ b/libraries/rest/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest/src/main/resources/org/apache/polygene/library/rest/admin/sparqlform.html
----------------------------------------------------------------------
diff --git a/libraries/rest/src/main/resources/org/apache/polygene/library/rest/admin/sparqlform.html b/libraries/rest/src/main/resources/org/apache/polygene/library/rest/admin/sparqlform.html
index b91eaa7..53cf259 100644
--- a/libraries/rest/src/main/resources/org/apache/polygene/library/rest/admin/sparqlform.html
+++ b/libraries/rest/src/main/resources/org/apache/polygene/library/rest/admin/sparqlform.html
@@ -43,12 +43,12 @@
 <body>
 <form method="GET" action="">
     <label>Query:</label><br/>
-    <textarea rows="20" cols="80" name="query">PREFIX ns0: &lt;urn:zest:type:org.apache.zest.api.identity.HasIdentity#&gt;
+    <textarea rows="20" cols="80" name="query">PREFIX ns0: &lt;urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#&gt;
         PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
         PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
         SELECT DISTINCT ?entityType ?identity
         WHERE {
-        ?entityType rdfs:subClassOf &lt;urn:zest:type:org.apache.zest.api.entity.Entity&gt;.
+        ?entityType rdfs:subClassOf &lt;urn:polygene:type:org.apache.polygene.api.entity.Entity&gt;.
         ?entity rdf:type ?entityType.
         ?entity ns0:identity ?identity.
         }
@@ -60,12 +60,12 @@
 
 <h3>Get all entities</h3>
 <pre>
-PREFIX ns0: &lt;urn:zest:type:org.apache.zest.api.identity.HasIdentity#&gt;
+PREFIX ns0: &lt;urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#&gt;
         PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
         PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
         SELECT DISTINCT ?entityType ?identity
         WHERE {
-        ?entityType rdfs:subClassOf &lt;urn:zest:type:org.apache.zest.api.entity.Entity&gt;.
+        ?entityType rdfs:subClassOf &lt;urn:polygene:type:org.apache.polygene.api.entity.Entity&gt;.
         ?entity rdf:type ?entityType.
         ?entity ns0:identity ?identity.
         }
@@ -73,26 +73,26 @@ PREFIX ns0: &lt;urn:zest:type:org.apache.zest.api.identity.HasIdentity#&gt;
 </pre>
 <h3>Get entities of a given type</h3>
 <pre>
-PREFIX ns0: &lt;urn:zest:type:org.apache.zest.api.identity.HasIdentity#&gt;
+PREFIX ns0: &lt;urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#&gt;
         PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
         PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
         SELECT DISTINCT ?identity
         WHERE {
-        ?entity rdf:type &lt;urn:zest:type:org.apache.zest.rest.TestEntity&gt;.
+        ?entity rdf:type &lt;urn:polygene:type:org.apache.polygene.rest.TestEntity&gt;.
         ?entity ns0:identity ?identity.
         }
 </pre>
 
 <h3>Get entities with a given property value</h3>
 <pre>
-PREFIX ns0: &lt;urn:zest:type:org.apache.zest.api.identity.HasIdentity#&gt;
+PREFIX ns0: &lt;urn:polygene:type:org.apache.polygene.api.identity.HasIdentity#&gt;
         PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
         PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
         SELECT DISTINCT ?identity
         WHERE {
-        ?entity rdf:type &lt;urn:zest:type:org.apache.zest.rest.TestEntity&gt;.
+        ?entity rdf:type &lt;urn:polygene:type:org.apache.polygene.rest.TestEntity&gt;.
         ?entity ns0:identity ?identity.
-        ?entity &lt;urn:zest:type:org.apache.zest.rest.Named#name&gt; "Foo bar"
+        ?entity &lt;urn:polygene:type:org.apache.polygene.rest.Named#name&gt; "Foo bar"
         }
 </pre>
 </body>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/Main.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/Main.java b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/Main.java
index afc9da0..1e1f429 100644
--- a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/Main.java
+++ b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/Main.java
@@ -39,8 +39,8 @@ public class Main
     public Main()
         throws Exception
     {
-        Energy4Java zest = new Energy4Java();
-        application = zest.newApplication( new MainAssembler() );
+        Energy4Java polygene = new Energy4Java();
+        application = polygene.newApplication( new MainAssembler() );
         application.activate();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
index eb2a6ba..e320c99 100644
--- a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
+++ b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
@@ -73,7 +73,7 @@ public class RestTest extends AbstractPolygeneTest
     protected ApplicationDescriptor newApplication()
         throws AssemblyException
     {
-        return zest.newApplicationModel( new ApplicationAssemblerAdapter(
+        return polygene.newApplicationModel( new ApplicationAssemblerAdapter(
             new Assembler[][][]
                 {
                     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/restlet/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/restlet/build.gradle b/libraries/restlet/build.gradle
index abb98fb..f8f6a6e 100644
--- a/libraries/restlet/build.gradle
+++ b/libraries/restlet/build.gradle
@@ -26,17 +26,17 @@ jar { manifest { name = "Apache Polygene\u2122 Library - Restlet" } }
 
 dependencies {
 
-  compile zest.core.bootstrap
-  compile zest.extension( 'valueserialization-jackson' )
-  compile zest.extension( 'indexing-rdf' )
-  compile zest.extension( 'entitystore-file' )
+  compile polygene.core.bootstrap
+  compile polygene.extension( 'valueserialization-jackson' )
+  compile polygene.extension( 'indexing-rdf' )
+  compile polygene.extension( 'entitystore-file' )
   compile libraries.restlet
   compile libraries.servlet_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'http' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'http' )
   testCompile libraries.http_client
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/restlet/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/restlet/dev-status.xml b/libraries/restlet/dev-status.xml
index 251a898..c581dfc 100644
--- a/libraries/restlet/dev-status.xml
+++ b/libraries/restlet/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZrestApplication.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZrestApplication.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZrestApplication.java
index 5c89102..662ef6f 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZrestApplication.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZrestApplication.java
@@ -57,7 +57,7 @@ import org.restlet.util.Series;
  */
 public abstract class ZrestApplication extends org.restlet.Application
 {
-    protected org.apache.polygene.api.structure.Application zestApplication;
+    protected org.apache.polygene.api.structure.Application polygeneApplication;
     protected ServiceFinder serviceFinder;
     protected ObjectFactory objectFactory;
     protected TransientBuilderFactory transientBuilderFactory;
@@ -88,8 +88,8 @@ public abstract class ZrestApplication extends org.restlet.Application
         Series<Parameter> parameters = getContext().getParameters();
         String mode = parameters.getFirstValue( "org.apache.polygene.runtime.mode" );
         createApplication( mode );
-        zestApplication.activate();
-        Module module = zestApplication.findModule( getConnectivityLayer(), getConnectivityModule() );
+        polygeneApplication.activate();
+        Module module = polygeneApplication.findModule( getConnectivityLayer(), getConnectivityModule() );
         serviceFinder = module;
         objectFactory = module;
         transientBuilderFactory = module;
@@ -104,8 +104,8 @@ public abstract class ZrestApplication extends org.restlet.Application
         {
             LayeredApplicationAssembler assembler = createApplicationAssembler(mode);
             assembler.initialize();
-            zestApplication = assembler.application();
-            setName( zestApplication.name() );
+            polygeneApplication = assembler.application();
+            setName( polygeneApplication.name() );
         }
         catch( Throwable e )
         {
@@ -121,7 +121,7 @@ public abstract class ZrestApplication extends org.restlet.Application
         throws Exception
     {
         super.stop();
-        zestApplication.passivate();
+        polygeneApplication.passivate();
     }
 
     @Override
@@ -130,7 +130,7 @@ public abstract class ZrestApplication extends org.restlet.Application
         Context context = getContext();
         Engine.getInstance().getRegisteredConverters().add( new PolygeneConverter( objectFactory ) );
 
-        if( zestApplication.mode() == Application.Mode.development )
+        if( polygeneApplication.mode() == Application.Mode.development )
         {
             setDebugging( true );
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/scripting/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/scripting/build.gradle b/libraries/scripting/build.gradle
index e7a19c6..9e61c0a 100644
--- a/libraries/scripting/build.gradle
+++ b/libraries/scripting/build.gradle
@@ -23,9 +23,9 @@ description = "Apache Polygene\u2122 Common Scripting Library contains common class
 jar { manifest { name = "Apache Polygene\u2122 Library - Scripting - Common" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/scripting/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/scripting/dev-status.xml b/libraries/scripting/dev-status.xml
index 2593c38..5ce55f5 100644
--- a/libraries/scripting/dev-status.xml
+++ b/libraries/scripting/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/servlet/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/servlet/build.gradle b/libraries/servlet/build.gradle
index 69a3b17..cba7aa4 100644
--- a/libraries/servlet/build.gradle
+++ b/libraries/servlet/build.gradle
@@ -23,13 +23,13 @@ description = "Apache Polygene\u2122 Servlet Library provides integration of Apache
 jar { manifest { name = "Apache Polygene\u2122 Library - Servlet" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.servlet_api
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.jetty_webapp
   testCompile libraries.http_client
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/servlet/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/servlet/dev-status.xml b/libraries/servlet/dev-status.xml
index 63f6a72..34f74ea 100644
--- a/libraries/servlet/dev-status.xml
+++ b/libraries/servlet/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
     <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/servlet/src/docs/servlet.txt
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/docs/servlet.txt b/libraries/servlet/src/docs/servlet.txt
index 89916ba..1a66235 100644
--- a/libraries/servlet/src/docs/servlet.txt
+++ b/libraries/servlet/src/docs/servlet.txt
@@ -44,7 +44,7 @@ Here is an example ServletContextListener:
 
 [snippet,java]
 ----
-source=libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java
+source=libraries/servlet/src/test/java/org/apache/polygene/library/servlet/ServletTest.java
 tag=bootstrap
 ----
 
@@ -58,7 +58,7 @@ Here is a sample servlet that simply output the assembled Application name:
 
 [snippet,java]
 ----
-source=libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java
+source=libraries/servlet/src/test/java/org/apache/polygene/library/servlet/ServletTest.java
 tag=usage
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
index d739daf..3a0ee39 100644
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/lifecycle/AbstractZestServletBootstrap.java
@@ -70,7 +70,7 @@ public abstract class AbstractPolygeneServletBootstrap
     private static final Logger LOGGER = LoggerFactory.getLogger( PolygeneServlet.class.getPackage().getName() );
     // Polygene Runtime
     protected PolygeneAPI api;
-    protected Energy4Java zest;
+    protected Energy4Java polygene;
     // Polygene Application
     protected ApplicationDescriptor applicationModel;
     protected Application application;
@@ -83,12 +83,12 @@ public abstract class AbstractPolygeneServletBootstrap
             ServletContext context = sce.getServletContext();
 
             LOGGER.trace( "Assembling Application" );
-            zest = new Energy4Java();
-            applicationModel = zest.newApplicationModel( this );
+            polygene = new Energy4Java();
+            applicationModel = polygene.newApplicationModel( this );
 
             LOGGER.trace( "Instanciating and activating Application" );
-            application = applicationModel.newInstance( zest.api() );
-            api = zest.api();
+            application = applicationModel.newInstance( polygene.api() );
+            api = polygene.api();
             beforeApplicationActivation( application );
             application.activate();
             afterApplicationActivation( application );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/package.html
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/package.html b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/package.html
index 37a90c8..74456b5 100644
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/package.html
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/package.html
@@ -27,23 +27,23 @@
 
         <h3>Logging</h3>
         <p>
-            The SLF4J logger used by this library is named "org.apache.zest.library.servlet".
+            The SLF4J logger used by this library is named "org.apache.polygene.library.servlet".
         </p>
 
         <h3>Application Bootstrap</h3>
         <p>
-            Extends {@link org.apache.zest.library.servlet.lifecycle.AbstractPolygeneServletBootstrap} to easily bind a Polygene\u2122
-            {@link org.apache.zest.api.structure.Application} activation/passivation to your webapp lifecycle.
+            Extends {@link org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap} to easily bind a Polygene\u2122
+            {@link org.apache.polygene.api.structure.Application} activation/passivation to your webapp lifecycle.
         </p>
         <p>
-            Use {@link org.apache.zest.library.servlet.PolygeneServletSupport#application(javax.servlet.ServletContext)} to get
-            a handle on the {@link org.apache.zest.api.structure.Application} from the {@link javax.servlet.ServletContext}.
+            Use {@link org.apache.polygene.library.servlet.PolygeneServletSupport#application(javax.servlet.ServletContext)} to get
+            a handle on the {@link org.apache.polygene.api.structure.Application} from the {@link javax.servlet.ServletContext}.
         </p>
 
         <h3>Facilities</h3>
         <p>
-            {@link org.apache.zest.library.servlet.PolygeneServlet} and {@link org.apache.zest.library.servlet.PolygeneFilter} respectively
-            provide base class for easy access to the {@link org.apache.zest.api.structure.Application}} from the
+            {@link org.apache.polygene.library.servlet.PolygeneServlet} and {@link org.apache.polygene.library.servlet.PolygeneFilter} respectively
+            provide base class for easy access to the {@link org.apache.polygene.api.structure.Application}} from the
             {@link javax.servlet.ServletContext}.
         </p>
     </body>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-core/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/build.gradle b/libraries/shiro-core/build.gradle
index f1d4052..eb6ac1a 100644
--- a/libraries/shiro-core/build.gradle
+++ b/libraries/shiro-core/build.gradle
@@ -23,16 +23,16 @@ description = "Apache Polygene\u2122 Shiro Library integrates Apache Shiro security
 jar { manifest { name = "Apache Polygene\u2122 Library - Shiro Core" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.shiro
   compile libraries.bouncy_castle
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'shiro-web' )
-  testCompile zest.library( 'servlet' )
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'shiro-web' )
+  testCompile polygene.library( 'servlet' )
+  testCompile polygene.extension( 'indexing-rdf' )
   testCompile libraries.jetty_webapp
   testCompile libraries.http_client
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-core/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/dev-status.xml b/libraries/shiro-core/dev-status.xml
index 63f6a72..34f74ea 100644
--- a/libraries/shiro-core/dev-status.xml
+++ b/libraries/shiro-core/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
     <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-core/src/docs/shiro.txt
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/docs/shiro.txt b/libraries/shiro-core/src/docs/shiro.txt
index 1a9163c..38c826f 100644
--- a/libraries/shiro-core/src/docs/shiro.txt
+++ b/libraries/shiro-core/src/docs/shiro.txt
@@ -53,7 +53,7 @@ SecurityManager when activating your Polygene\u2122 Application. It can be done out
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
 tag=before
 ----
 
@@ -64,7 +64,7 @@ the SecurityManager when passivated:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
 tag=assembly
 ----
 
@@ -72,7 +72,7 @@ You can change the INI resource path through the ShiroIniConfiguration:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/main/java/org/apache/zest/library/shiro/ini/ShiroIniConfiguration.java
+source=libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/ini/ShiroIniConfiguration.java
 tag=config
 ----
 
@@ -85,7 +85,7 @@ Once started you must remember to register the SecurityManager in Shiro's Thread
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
 tag=thread-context
 ----
 
@@ -126,7 +126,7 @@ credientials and configuring it ;
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java
 tag=realm-service
 ----
 
@@ -164,7 +164,7 @@ UserFactory too. Note that the factory uses the PasswordService implemented by t
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
 tag=domain
 ----
 
@@ -173,7 +173,7 @@ entity and its factory:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
 tag=assembly
 ----
 
@@ -181,7 +181,7 @@ And finally here is how to create a new user and below how to perform a login:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
 tag=usage
 ----
 
@@ -190,7 +190,7 @@ change this you can do it using PasswordRealmConfiguration properties:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/main/java/org/apache/zest/library/shiro/domain/passwords/PasswordRealmConfiguration.java
+source=libraries/shiro-core/src/main/java/org/apache/polygene/library/shiro/domain/passwords/PasswordRealmConfiguration.java
 tag=config
 ----
 
@@ -206,7 +206,7 @@ First you need to add the RoleAssignee type to your account:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
 tag=domain
 ----
 
@@ -214,7 +214,7 @@ Assembly is straight forward:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
 tag=assembly
 ----
 
@@ -222,7 +222,7 @@ And here is how to use all this:
 
 [snippet,java]
 ----
-source=libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java
+source=libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
 tag=usage
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-web/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/shiro-web/build.gradle b/libraries/shiro-web/build.gradle
index ff9f2e1..e8048e1 100644
--- a/libraries/shiro-web/build.gradle
+++ b/libraries/shiro-web/build.gradle
@@ -24,19 +24,19 @@ jar { manifest { name = "Apache Polygene\u2122 Library - Shiro Web" } }
 
 dependencies {
 
-  compile zest.core.bootstrap
-  compile zest.library( 'shiro-core' )
-  compile zest.library( 'servlet' )
-  compile zest.library( 'http' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'shiro-core' )
+  compile polygene.library( 'servlet' )
+  compile polygene.library( 'http' )
   compile libraries.shiro_web
   compile libraries.servlet_api
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'shiro-web' )
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'shiro-web' )
+  testCompile polygene.extension( 'indexing-rdf' )
   testCompile libraries.jetty_webapp
   testCompile libraries.http_client
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-web/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/shiro-web/dev-status.xml b/libraries/shiro-web/dev-status.xml
index 63f6a72..34f74ea 100644
--- a/libraries/shiro-web/dev-status.xml
+++ b/libraries/shiro-web/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
     <status>
         <!--none,early,beta,stable,mature-->
         <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/shiro-web/src/docs/shiro-web.txt
----------------------------------------------------------------------
diff --git a/libraries/shiro-web/src/docs/shiro-web.txt b/libraries/shiro-web/src/docs/shiro-web.txt
index bd82f8f..c54bf29 100644
--- a/libraries/shiro-web/src/docs/shiro-web.txt
+++ b/libraries/shiro-web/src/docs/shiro-web.txt
@@ -53,7 +53,7 @@ If you use the <<library-http>> you can either directly use Shiro classes or use
 
 [snippet,java]
 ----
-source=libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java
+source=libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java
 tag=assembly
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/spring/build.gradle b/libraries/spring/build.gradle
index 2f42d57..7f0062a 100644
--- a/libraries/spring/build.gradle
+++ b/libraries/spring/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Spring Library allows for tight integration of
 jar { manifest { name = "Apache Polygene\u2122 Library - Spring" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.spring_core
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
   testCompile libraries.spring_testsupport
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/dev-status.xml b/libraries/spring/dev-status.xml
index ceee3a0..7a96a31 100644
--- a/libraries/spring/dev-status.xml
+++ b/libraries/spring/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/docs/spring.txt
----------------------------------------------------------------------
diff --git a/libraries/spring/src/docs/spring.txt b/libraries/spring/src/docs/spring.txt
index 7f5eb0a..ccd050c 100644
--- a/libraries/spring/src/docs/spring.txt
+++ b/libraries/spring/src/docs/spring.txt
@@ -38,7 +38,7 @@ beans will be available as Polygene\u2122 services. The most important things to re
 
 [snippet,java]
 ----
-source=libraries/spring/src/test/java/org/apache/zest/library/spring/importer/PolygeneImportServiceTest.java
+source=libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest.java
 tag=import
 ----
 
@@ -58,7 +58,7 @@ To bootstrap the Polygene\u2122 runtime in Spring, you should have a bootstrap bean
 +org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap+ and implement the
 +org.springframework.context.ApplicationContextAware+.
 
-A new bean will appear in the application context, called +"zestApplication"+ which is only
+A new bean will appear in the application context, called +"polygeneApplication"+ which is only
 intended for internal use of this library.
 
 Example application context;
@@ -68,24 +68,24 @@ Example application context;
 
  <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:zest="http://zest.apache.org/schema/zest/spring"
+  xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
   xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-  http://zest.apache.org/schema/zest/spring http://zest.apache.org/schema/zest/spring/spring-0.5.xsd">
+  http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd">
 
   <!-- class that implements PolygeneApplicationBootstrap -->
 
-  <zest:bootstrap class="org.hedhman.niclas.MyPolygeneBootstrapper"/>
+  <polygene:bootstrap class="org.hedhman.niclas.MyPolygeneBootstrapper"/>
 
   <bean id="someService" class="org.hedhman.niclas.SomeService">
 
-  <constructor-arg ref="someService"/> <!-- Reference zest comment service -->
+  <constructor-arg ref="someService"/> <!-- Reference polygene comment service -->
 
  </bean>
 ----
 
 [snippet,java]
 ----
-source=libraries/spring/src/test/java/org/apache/zest/library/spring/MyPolygeneBootstrapper.java
+source=libraries/spring/src/test/java/org/apache/polygene/library/spring/MyPolygeneBootstrapper.java
 tag=code
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
index 010cdbd..503fa98 100644
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
@@ -21,7 +21,7 @@ package org.apache.polygene.library.spring.bootstrap;
 
 public final class Constants
 {
-    public static final String BEAN_ID_ZEST_APPLICATION = "zestApplication";
+    public static final String BEAN_ID_ZEST_APPLICATION = "polygeneApplication";
 
     private Constants()
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
index bd9e327..2b33e22 100644
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
@@ -42,10 +42,10 @@ import org.springframework.context.ApplicationContextAware;
  *
  * &lt;beans xmlns="http://www.springframework.org/schema/beans"
  * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- * xmlns:polygene="http://zest.apache.org/schema/zest/spring"
+ * xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
  * xsi:schemaLocation="
  * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- * http://zest.apache.org/schema/zest/spring http://zest.apache.org/schema/zest/spring/spring-0.5.xsd"&gt;
+ * http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd"&gt;
  *
  * &lt;!-- class that implements PolygeneApplicationBootstrap --&gt;
  *

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/main/resources/META-INF/spring.handlers
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/resources/META-INF/spring.handlers b/libraries/spring/src/main/resources/META-INF/spring.handlers
index 11f6d4d..c948664 100644
--- a/libraries/spring/src/main/resources/META-INF/spring.handlers
+++ b/libraries/spring/src/main/resources/META-INF/spring.handlers
@@ -18,4 +18,4 @@
 #
 #
 
-http\://zest.apache.org/schema/zest/spring=org.apache.polygene.library.spring.bootstrap.internal.PolygeneNamespaceHandler
\ No newline at end of file
+http\://polygene.apache.org/schema/polygene/spring=org.apache.polygene.library.spring.bootstrap.internal.PolygeneNamespaceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/main/resources/META-INF/spring.schemas
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/resources/META-INF/spring.schemas b/libraries/spring/src/main/resources/META-INF/spring.schemas
index 84f7b7a..d04fe55 100644
--- a/libraries/spring/src/main/resources/META-INF/spring.schemas
+++ b/libraries/spring/src/main/resources/META-INF/spring.schemas
@@ -18,4 +18,4 @@
 #
 #
 
-http\://zest.apache.org/schema/zest/spring/spring-0.5.xsd=org/apache/zest/library/spring/spring-0.5.xsd
\ No newline at end of file
+http\://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd=org/apache/polygene/library/spring/spring-0.5.xsd
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/main/resources/org/apache/polygene/library/spring/spring-0.5.xsd
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/resources/org/apache/polygene/library/spring/spring-0.5.xsd b/libraries/spring/src/main/resources/org/apache/polygene/library/spring/spring-0.5.xsd
index 03407d1..e6cfcae 100644
--- a/libraries/spring/src/main/resources/org/apache/polygene/library/spring/spring-0.5.xsd
+++ b/libraries/spring/src/main/resources/org/apache/polygene/library/spring/spring-0.5.xsd
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<xsd:schema xmlns="http://zest.apache.org/schema/zest/spring"
+<xsd:schema xmlns="http://polygene.apache.org/schema/polygene/spring"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:beans="http://www.springframework.org/schema/beans"
-            targetNamespace="http://zest.apache.org/schema/zest/spring"
+            targetNamespace="http://polygene.apache.org/schema/polygene/spring"
             elementFormDefault="qualified"
             attributeFormDefault="unqualified">
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
index a3f1132..1e29446 100644
--- a/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
+++ b/libraries/spring/src/test/resources/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest-context.xml
@@ -18,13 +18,13 @@
   ~
   ~
   -->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zest="http://zest.apache.org/schema/zest/spring"
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
     xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-       http://zest.apache.org/schema/zest/spring http://zest.apache.org/schema/zest/spring/spring-0.5.xsd">
+       http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd">
 
-    <zest:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap" />
-    <zest:service id="commentService" />
+    <polygene:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap" />
+    <polygene:service id="commentService" />
 
     <bean id="commentServiceHolder" class="org.apache.polygene.library.spring.bootstrap.CommentServiceHolder">
         <constructor-arg ref="commentService" />

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-bonecp/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/sql-bonecp/build.gradle b/libraries/sql-bonecp/build.gradle
index 47e46ce..66db83b 100644
--- a/libraries/sql-bonecp/build.gradle
+++ b/libraries/sql-bonecp/build.gradle
@@ -23,7 +23,7 @@ description = "Apache Polygene\u2122 SQL BoneCP Library provides BoneCP support."
 jar { manifest { name = "Apache Polygene\u2122 Library - SQL BoneCP" } }
 
 dependencies {
-  compile zest.library( 'sql' )
+  compile polygene.library( 'sql' )
   compile libraries.bonecp
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-bonecp/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/sql-bonecp/dev-status.xml b/libraries/sql-bonecp/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/sql-bonecp/dev-status.xml
+++ b/libraries/sql-bonecp/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-dbcp/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/sql-dbcp/build.gradle b/libraries/sql-dbcp/build.gradle
index 9ae1fea..73c9cce 100644
--- a/libraries/sql-dbcp/build.gradle
+++ b/libraries/sql-dbcp/build.gradle
@@ -23,7 +23,7 @@ description = "Apache Polygene\u2122 SQL DBCP Library provides DBCP support."
 jar { manifest { name = "Apache Polygene\u2122 Library - SQL DBCP" } }
 
 dependencies {
-  compile zest.library( 'sql' )
+  compile polygene.library( 'sql' )
   compile libraries.commons_dbcp
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-dbcp/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/sql-dbcp/dev-status.xml b/libraries/sql-dbcp/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/sql-dbcp/dev-status.xml
+++ b/libraries/sql-dbcp/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-liquibase/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/sql-liquibase/build.gradle b/libraries/sql-liquibase/build.gradle
index 62ad120..55f6789 100644
--- a/libraries/sql-liquibase/build.gradle
+++ b/libraries/sql-liquibase/build.gradle
@@ -23,14 +23,14 @@ description = "Apache Polygene\u2122 SQL Liquibase Library provides Liquibase suppo
 jar { manifest { name = "Apache Polygene\u2122 Library - SQL Liquibase" } }
 
 dependencies {
-  compile zest.library( 'sql' )
+  compile polygene.library( 'sql' )
   compile libraries.liquibase
   compile libraries.slf4j_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'sql-dbcp' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'sql-dbcp' )
 
   testRuntime libraries.derby
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql-liquibase/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/sql-liquibase/dev-status.xml b/libraries/sql-liquibase/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/sql-liquibase/dev-status.xml
+++ b/libraries/sql-liquibase/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/sql/build.gradle b/libraries/sql/build.gradle
index 61fb6f5..9e52d2d 100644
--- a/libraries/sql/build.gradle
+++ b/libraries/sql/build.gradle
@@ -23,17 +23,17 @@ description = "Apache Polygene\u2122 SQL Library provides SQL support."
 jar { manifest { name = "Apache Polygene\u2122 Library - SQL" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'circuitbreaker' )
-  compile zest.library( 'jmx' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'circuitbreaker' )
+  compile polygene.library( 'jmx' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'sql-bonecp' )
-  testCompile zest.library( 'sql-dbcp' )
-  testCompile zest.library( 'sql-liquibase' )
-  testCompile zest.extension( 'entitystore-preferences' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'sql-bonecp' )
+  testCompile polygene.library( 'sql-dbcp' )
+  testCompile polygene.library( 'sql-liquibase' )
+  testCompile polygene.extension( 'entitystore-preferences' )
 
   testRuntime libraries.logback
   testRuntime libraries.derby

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/sql/dev-status.xml b/libraries/sql/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/sql/dev-status.xml
+++ b/libraries/sql/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/sql/src/docs/sql.txt
----------------------------------------------------------------------
diff --git a/libraries/sql/src/docs/sql.txt b/libraries/sql/src/docs/sql.txt
index ce35ca0..1021c6a 100644
--- a/libraries/sql/src/docs/sql.txt
+++ b/libraries/sql/src/docs/sql.txt
@@ -69,7 +69,7 @@ BoneCP support resides in the *sql-bonecp* module.
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/DocumentationSupport.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/DocumentationSupport.java
 tag=bonecp
 ----
 
@@ -84,7 +84,7 @@ include::../../../sql-dbcp/build/docs/buildinfo/artifact.txt[]
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/DocumentationSupport.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/DocumentationSupport.java
 tag=dbcp
 ----
 
@@ -98,7 +98,7 @@ tag=dbcp
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/DocumentationSupport.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/DocumentationSupport.java
 tag=datasource
 ----
 
@@ -111,7 +111,7 @@ See <<howto-configure-service>>.
 
 [snippet,java]
 ----
-source=libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/DataSourceConfigurationState.java
+source=libraries/sql/src/main/java/org/apache/polygene/library/sql/datasource/DataSourceConfigurationState.java
 tag=config
 ----
 
@@ -131,7 +131,7 @@ Application runs in an environment where DataSource are already provided.
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/datasource/ExternalDataSourceTest.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java
 tag=assembly
 ----
 
@@ -149,7 +149,7 @@ CircuitBreaker and set it as <<def-metainfo>> of the DataSource.
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/DocumentationSupport.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/DocumentationSupport.java
 tag=cb-assembly
 ----
 
@@ -158,7 +158,7 @@ by a CircuitBreaker proxy.
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/DocumentationSupport.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/DocumentationSupport.java
 tag=cb-datasource
 ----
 
@@ -171,7 +171,7 @@ through JMX.
 
 [snippet,java]
 ----
-source=libraries/sql/src/test/java/org/apache/zest/library/sql/jmx/DataSourceConfigurationManagerServiceTest.java
+source=libraries/sql/src/test/java/org/apache/polygene/library/sql/jmx/DataSourceConfigurationManagerServiceTest.java
 tag=jmx
 ----
 
@@ -199,7 +199,7 @@ include::../../../sql-liquibase/build/docs/buildinfo/artifact.txt[]
 
 [snippet,java]
 ----
-source=libraries/sql-liquibase/src/test/java/org/apache/zest/library/sql/liquibase/LiquibaseServiceTest.java
+source=libraries/sql-liquibase/src/test/java/org/apache/polygene/library/sql/liquibase/LiquibaseServiceTest.java
 tag=assembly
 ----
 
@@ -210,7 +210,7 @@ applies the configured changelog.
 
 [snippet,java]
 ----
-source=libraries/sql-liquibase/src/main/java/org/apache/zest/library/sql/liquibase/LiquibaseConfiguration.java
+source=libraries/sql-liquibase/src/main/java/org/apache/polygene/library/sql/liquibase/LiquibaseConfiguration.java
 tag=config
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uid/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/uid/build.gradle b/libraries/uid/build.gradle
index c6651b7..807703b 100644
--- a/libraries/uid/build.gradle
+++ b/libraries/uid/build.gradle
@@ -23,11 +23,11 @@ description = "Apache Polygene\u2122 UID Library contains various Identity generati
 jar { manifest { name = "Apache Polygene\u2122 Library - UID" } }
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uid/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/uid/dev-status.xml b/libraries/uid/dev-status.xml
index a4a8f91..0914c52 100644
--- a/libraries/uid/dev-status.xml
+++ b/libraries/uid/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uid/src/docs/uid.txt
----------------------------------------------------------------------
diff --git a/libraries/uid/src/docs/uid.txt b/libraries/uid/src/docs/uid.txt
index 84d2e13..6ebf216 100644
--- a/libraries/uid/src/docs/uid.txt
+++ b/libraries/uid/src/docs/uid.txt
@@ -35,7 +35,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=uuid-assembly
 ----
 
@@ -43,7 +43,7 @@ Usage is quite simple:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=uuid-usage
 ----
 
@@ -64,7 +64,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=seq-assembly
 ----
 
@@ -72,7 +72,7 @@ Usage is quite simple:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=seq-usage
 ----
 
@@ -82,7 +82,7 @@ Assembly is done using the provided Assembler:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=perseq-assembly
 ----
 
@@ -90,7 +90,7 @@ Usage is quite simple:
 
 [snippet,java]
 ----
-source=libraries/uid/src/test/java/org/apache/zest/library/uid/DocumentationSupport.java
+source=libraries/uid/src/test/java/org/apache/polygene/library/uid/DocumentationSupport.java
 tag=seq-usage
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uowfile/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/uowfile/build.gradle b/libraries/uowfile/build.gradle
index 7309e1e..0a5524a 100644
--- a/libraries/uowfile/build.gradle
+++ b/libraries/uowfile/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 UoWFile Library provides file operations bindi
 jar { manifest { name = "Apache Polygene\u2122 Library - UoWFile" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'fileconfig' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'fileconfig' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uowfile/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/uowfile/dev-status.xml b/libraries/uowfile/dev-status.xml
index 0e12881..476db6d 100644
--- a/libraries/uowfile/dev-status.xml
+++ b/libraries/uowfile/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/libraries/uowfile/src/docs/uowfile.txt
----------------------------------------------------------------------
diff --git a/libraries/uowfile/src/docs/uowfile.txt b/libraries/uowfile/src/docs/uowfile.txt
index be93694..9ad65c3 100644
--- a/libraries/uowfile/src/docs/uowfile.txt
+++ b/libraries/uowfile/src/docs/uowfile.txt
@@ -52,7 +52,7 @@ Let's say you have the following Entity:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFileTest.java
 tag=entity
 ----
 
@@ -60,7 +60,7 @@ To add an attached file to it you first need to extends HasUoWFileLifecycle:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFileTest.java
 tag=uowfile
 ----
 
@@ -68,7 +68,7 @@ This provides you with the following contract:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/main/java/org/apache/zest/library/uowfile/singular/HasUoWFile.java
+source=libraries/uowfile/src/main/java/org/apache/polygene/library/uowfile/singular/HasUoWFile.java
 tag=contract
 ----
 
@@ -76,7 +76,7 @@ Next you need to write the UoWFileLocator mixin:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFileTest.java
 tag=locator
 ----
 
@@ -84,7 +84,7 @@ Assemble all this as follow:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFileTest.java
 tag=assembly
 ----
 
@@ -92,7 +92,7 @@ You can now use the following methods on your EntityComposite:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFileTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFileTest.java
 tag=api
 ----
 
@@ -106,7 +106,7 @@ Let's say you have the following Entity:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFilesTest.java
 tag=entity
 ----
 
@@ -118,7 +118,7 @@ HasUoWFilesLifecycle:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFilesTest.java
 tag=uowfile
 ----
 
@@ -126,7 +126,7 @@ This provides you with the following contract:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/main/java/org/apache/zest/library/uowfile/plural/HasUoWFiles.java
+source=libraries/uowfile/src/main/java/org/apache/polygene/library/uowfile/plural/HasUoWFiles.java
 tag=contract
 ----
 
@@ -134,7 +134,7 @@ Next you need to write the UoWFileLocator mixin:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFilesTest.java
 tag=locator
 ----
 
@@ -142,7 +142,7 @@ Assemble all this as follow:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFilesTest.java
 tag=assembly
 ----
 
@@ -150,7 +150,7 @@ You can now use the following methods on your EntityComposite:
 
 [snippet,java]
 ----
-source=libraries/uowfile/src/test/java/org/apache/zest/library/uowfile/HasUoWFilesTest.java
+source=libraries/uowfile/src/test/java/org/apache/polygene/library/uowfile/HasUoWFilesTest.java
 tag=api
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/build.gradle
----------------------------------------------------------------------
diff --git a/manual/build.gradle b/manual/build.gradle
index 77c35cb..fed0e29 100644
--- a/manual/build.gradle
+++ b/manual/build.gradle
@@ -22,11 +22,11 @@ apply plugin: ManualPlugin
 description = "Apache Polygene\u2122 Manuals and Website."
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'constraints' )
-  compile zest.library( 'logging' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'constraints' )
+  compile polygene.library( 'logging' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
   runtime( libraries.logback )
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/reference/index.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/reference/index.txt b/manual/src/docs/reference/index.txt
index 83c2ad3..04963d8 100644
--- a/manual/src/docs/reference/index.txt
+++ b/manual/src/docs/reference/index.txt
@@ -20,9 +20,9 @@
 [[reference-documentation,Reference Manual]]
 = Apache Polygene\u2122 v{revnumber} Reference Manual =
 
-:zest-version: {revnumber}
-:zest-buildnumber: {revnumber}
-:zest-git-tag: {gitversion}
+:polygene-version: {revnumber}
+:polygene-buildnumber: {revnumber}
+:polygene-git-tag: {gitversion}
 
 
 :leveloffset: 2

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-assembly-application.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-assembly-application.txt b/manual/src/docs/tutorials/howto-assembly-application.txt
index 2cdc289..200f662 100644
--- a/manual/src/docs/tutorials/howto-assembly-application.txt
+++ b/manual/src/docs/tutorials/howto-assembly-application.txt
@@ -26,7 +26,7 @@ If you want to reproduce what's explained in this tutorial, remember to depend o
 
 include::../../../../core/bootstrap/build/docs/buildinfo/artifact.txt[]
 
-At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-zest>> tutorial for details.
+At runtime you will need the Core Runtime artifact too. See the <<howto-depend-on-polygene>> tutorial for details.
 
 == Basics ==
 
@@ -73,7 +73,7 @@ is either a direct reference, such as
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Docs.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Docs.java
 tag=direct
 -----------
 
@@ -81,7 +81,7 @@ or an indirect lookup, such as
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Docs.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Docs.java
 tag=indirect
 -----------
 
@@ -125,7 +125,7 @@ So, lets see how we code up this bit in the actual code first.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
 tag=main
 -----------
 
@@ -138,7 +138,7 @@ it could be to create the Domain Layer.
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
 tag=domainLayer
 -----------
 
@@ -148,7 +148,7 @@ we need to declare which Composites, Entities, Services and Objects that is in e
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
 tag=accountModule
 -----------
 
@@ -157,7 +157,7 @@ actually very, very simple;
 
 [snippet,java]
 -----------
-source=manual/src/main/java/org/apache/zest/manual/recipes/assemble/Main.java
+source=manual/src/main/java/org/apache/polygene/manual/recipes/assemble/Main.java
 tag=shutdown
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/manual/src/docs/tutorials/howto-build-system.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-build-system.txt b/manual/src/docs/tutorials/howto-build-system.txt
index 1e5193b..0d4240c 100644
--- a/manual/src/docs/tutorials/howto-build-system.txt
+++ b/manual/src/docs/tutorials/howto-build-system.txt
@@ -25,7 +25,7 @@ It describe the Polygene\u2122 SDK Build System from compilation to publication of
 applications.
 
 If instead you want to setup your project build system to depend on modules of the Polygene\u2122 SDK see the
-<<howto-depend-on-zest,dedicated tutorial>>.
+<<howto-depend-on-polygene,dedicated tutorial>>.
 
 
 == Gradle ==


[28/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/usecase/Usecase.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/usecase/Usecase.java b/core/api/src/main/java/org/apache/zest/api/usecase/Usecase.java
deleted file mode 100644
index eb41619..0000000
--- a/core/api/src/main/java/org/apache/zest/api/usecase/Usecase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.usecase;
-
-import java.io.Serializable;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.structure.MetaInfoHolder;
-
-/**
- * A Usecase. A Usecase is used as a model for UnitOfWork, and helps
- * implementations decide what to do in certain circumstances.
- */
-public final class Usecase
-    implements Serializable, MetaInfoHolder
-{
-    public static final Usecase DEFAULT = new Usecase( "Default", new MetaInfo() );
-
-    private static final long serialVersionUID = 1L;
-    private final String name;
-    private final MetaInfo metaInfo;
-
-    Usecase( String name, MetaInfo metaInfo )
-    {
-        this.name = name;
-        this.metaInfo = metaInfo;
-    }
-
-    /**
-     * Name of the usecase.
-     *
-     * @return the name
-     */
-    public String name()
-    {
-        return name;
-    }
-
-    /**
-     * Meta-info for the usecase. This can be of any type, and is typically set when creating the usecase
-     * and read during the execution of the usecase.
-     *
-     * @param infoType the MetaInfo type to retrieve.
-     *
-     * @return the previously stored metaInfo of the given type for the usecase.
-     */
-    @Override
-    public <T> T metaInfo( Class<T> infoType )
-    {
-        return metaInfo.get( infoType );
-    }
-
-    @Override
-    public String toString()
-    {
-        return name + ", meta info:" + metaInfo;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/usecase/UsecaseBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/usecase/UsecaseBuilder.java b/core/api/src/main/java/org/apache/zest/api/usecase/UsecaseBuilder.java
deleted file mode 100644
index 884157c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/usecase/UsecaseBuilder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.usecase;
-
-import org.apache.zest.api.common.MetaInfo;
-
-/**
- * Builder for Usecases.
- */
-public final class UsecaseBuilder
-{
-    public static UsecaseBuilder buildUsecase( String aName )
-    {
-        return new UsecaseBuilder( aName );
-    }
-
-    public static Usecase newUsecase( String aName )
-    {
-        return new UsecaseBuilder( aName ).newUsecase();
-    }
-
-    private MetaInfo metaInfo = new MetaInfo();
-
-    private String name;
-
-    private UsecaseBuilder( String name )
-    {
-        this.name = name;
-    }
-
-    public UsecaseBuilder withMetaInfo( Object metaInfo )
-    {
-        this.metaInfo.set( metaInfo );
-        return this;
-    }
-
-    public Usecase newUsecase()
-    {
-        return new Usecase( name, metaInfo );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/usecase/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/usecase/package.html b/core/api/src/main/java/org/apache/zest/api/usecase/package.html
deleted file mode 100644
index 1d55001..0000000
--- a/core/api/src/main/java/org/apache/zest/api/usecase/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Usecase API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Annotations.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Annotations.java b/core/api/src/main/java/org/apache/zest/api/util/Annotations.java
deleted file mode 100644
index a5598d7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Annotations.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collector;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.apache.zest.api.util.Classes.interfacesOf;
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Useful methods for handling Annotations.
- */
-public final class Annotations
-{
-    public static final Function<Type, Stream<Annotation>> ANNOTATIONS_OF =
-        Classes.forTypes( type -> Arrays.stream( Classes.RAW_CLASS.apply( type ).getAnnotations() ) );
-
-    public static Predicate<Annotation> typeHasAnnotation( Class<? extends Annotation> annotationType )
-    {
-        return element -> hasAnnotation( annotationType ).test( type().apply( element ) );
-    }
-
-    public static Predicate<AnnotatedElement> hasAnnotation( final Class<? extends Annotation> annotationType )
-    {
-        return element -> element.getAnnotation( annotationType ) != null;
-    }
-
-    public static Function<Annotation, Class<? extends Annotation>> type()
-    {
-        return Annotation::annotationType;
-    }
-
-    public static Predicate<Annotation> isType( final Class<? extends Annotation> annotationType )
-    {
-        return annotation -> annotation.annotationType().equals( annotationType );
-    }
-
-    public static <T extends Annotation> T annotationOn( Type type, Class<T> annotationType )
-    {
-        return annotationType.cast( Classes.RAW_CLASS.apply( type ).getAnnotation( annotationType ) );
-    }
-
-    public static List<Annotation> findAccessorAndTypeAnnotationsIn(AccessibleObject accessor) {
-        Stream<Annotation> stream = Stream.concat(
-                Arrays.stream(accessor.getAnnotations()),
-                interfacesOf(typeOf(accessor)).flatMap(ANNOTATIONS_OF)
-        );
-        Collector<Annotation, ?, List<Annotation>> collector = Collectors.toList();
-        return stream.collect(collector);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Classes.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Classes.java b/core/api/src/main/java/org/apache/zest/api/util/Classes.java
deleted file mode 100644
index ed215e7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Classes.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.composite.ModelDescriptor;
-
-import static java.util.stream.Stream.concat;
-import static java.util.stream.StreamSupport.stream;
-
-/**
- * Useful methods for handling Classes.
- */
-public final class Classes
-{
-    private final static Map<Type, Type> wrapperClasses = new HashMap<>();
-
-    static
-    {
-        wrapperClasses.put( boolean.class, Boolean.class );
-        wrapperClasses.put( byte.class, Byte.class );
-        wrapperClasses.put( short.class, Short.class );
-        wrapperClasses.put( char.class, Character.class );
-        wrapperClasses.put( int.class, Integer.class );
-        wrapperClasses.put( long.class, Long.class );
-        wrapperClasses.put( float.class, Float.class );
-        wrapperClasses.put( double.class, Double.class );
-    }
-
-    private final static Map<Type, Type> primitiveClasses = new HashMap<>();
-
-    static
-    {
-        primitiveClasses.put( boolean.class, Boolean.class );
-        primitiveClasses.put( byte.class, Byte.class );
-        primitiveClasses.put( short.class, Short.class );
-        primitiveClasses.put( char.class, Character.class );
-        primitiveClasses.put( int.class, Integer.class );
-        primitiveClasses.put( long.class, Long.class );
-        primitiveClasses.put( float.class, Float.class );
-        primitiveClasses.put( double.class, Double.class );
-    }
-
-    /**
-     * Convert from primitive class (int, short, double, etc.) to wrapper class (Integer, Short, Double, etc.).
-     * Return the same class if it's not a primitive class. This can therefore safely be used on all types
-     * to ensure that they are not primitives.
-     */
-    private static final Function<Type, Type> WRAPPER_CLASS = clazz -> {
-        Type wrapperClass = wrapperClasses.get( clazz );
-        return wrapperClass == null ? clazz : wrapperClass;
-    };
-
-    /**
-     * Convert from wrapper class (Integer, Short, Double, etc.) to primitive class (int, short, double, etc.).
-     * Return the same class if it's not a wrapper class. This can therefore safely be used on all types
-     * to ensure that they are primitives if possible.
-     */
-    @SuppressWarnings( "UnusedDeclaration" )
-    private static final Function<Type, Type> PRIMITIVE_CLASS = aClass -> {
-        Type primitiveClass = primitiveClasses.get( aClass );
-        return primitiveClass == null ? aClass : primitiveClass;
-    };
-
-    /**
-     * Function that extract the raw class of a type.
-     */
-    public static final Function<Type, Class<?>> RAW_CLASS = genericType -> {
-        // Calculate raw type
-        if( genericType instanceof Class )
-        {
-            return (Class<?>) genericType;
-        }
-        else if( genericType instanceof ParameterizedType )
-        {
-            return (Class<?>) ( (ParameterizedType) genericType ).getRawType();
-        }
-        else if( genericType instanceof TypeVariable )
-        {
-            return (Class<?>) ( (TypeVariable) genericType ).getGenericDeclaration();
-        }
-        else if( genericType instanceof WildcardType )
-        {
-            return (Class<?>) ( (WildcardType) genericType ).getUpperBounds()[ 0 ];
-        }
-        else if( genericType instanceof GenericArrayType )
-        {
-            Object temp = Array.newInstance( (Class<?>) ( (GenericArrayType) genericType ).getGenericComponentType(), 0 );
-            return temp.getClass();
-        }
-        throw new IllegalArgumentException( "Could not extract the raw class of " + genericType );
-    };
-
-    private static final Function<AccessibleObject, Type> TYPE_OF = accessor -> {
-        if( accessor instanceof Method )
-        {
-            return ( (Method) accessor ).getGenericReturnType();
-        }
-        return ( (Field) accessor ).getGenericType();
-    };
-
-    private static final Function<Type, Stream<Class<?>>> CLASS_HIERARCHY = new Function<Type, Stream<Class<?>>>()
-    {
-        @Override
-        public Stream<Class<?>> apply( Type type )
-        {
-            if( type == null )
-            {
-                return Stream.empty();
-            }
-            if( type.equals( Object.class ) )
-            {
-                return Stream.of( (Class<?>) type );
-            }
-            else
-            {
-                type = RAW_CLASS.apply( type );
-                Class superclass = ( (Class) type ).getSuperclass();
-                return concat( Stream.of( (Class<?>) type ), apply( superclass ) );
-            }
-        }
-    };
-
-    @SuppressWarnings( "raw" )
-    private static final Function<Type, Stream<? extends Type>> INTERFACES_OF = new Function<Type, Stream<? extends Type>>()
-    {
-        @Override
-        public Stream<? extends Type> apply( Type type )
-        {
-            Class clazz = RAW_CLASS.apply( type );
-
-            if( clazz.isInterface() )
-            {
-                Stream<? extends Type> genericInterfaces = Arrays.stream( clazz.getGenericInterfaces() );
-                Stream<? extends Type> intfaces = genericInterfaces.flatMap( INTERFACES_OF );
-                return concat( Stream.of( type ), intfaces );
-            }
-            else
-            {
-                if( type.equals( Object.class ) )
-                {
-                    return Arrays.stream( clazz.getGenericInterfaces() );
-                }
-                else
-                {
-                    return concat( Stream.of( clazz.getGenericInterfaces() ).flatMap( INTERFACES_OF ),
-                                   Stream.of( clazz.getSuperclass() ).flatMap( INTERFACES_OF ) );
-
-                }
-            }
-        }
-    };
-
-    private static final Function<Type, Stream<? extends Type>> TYPES_OF = type -> {
-        Class clazz = RAW_CLASS.apply( type );
-
-        if( clazz.isInterface() )
-        {
-            Stream<Type> intfaces = Arrays.stream( clazz.getGenericInterfaces() ).flatMap( INTERFACES_OF );
-            return concat( Stream.of( clazz ), intfaces );
-        }
-        else
-        {
-            return concat( Stream.of( clazz ),
-                           Stream.of( type ).flatMap( CLASS_HIERARCHY ).flatMap( INTERFACES_OF ) );
-        }
-    };
-
-    public static Type typeOf( AccessibleObject from )
-    {
-        return TYPE_OF.apply( from );
-    }
-
-    public static Stream<Type> typesOf( Stream<? extends Type> types )
-    {
-        return types.flatMap( TYPES_OF );
-    }
-
-    public static Stream<? extends Type> typesOf( Type type )
-    {
-        return TYPES_OF.apply( type );
-    }
-
-    public static Stream<? extends Type> interfacesOf( Stream<? extends Type> types )
-    {
-        return types.flatMap( INTERFACES_OF );
-    }
-
-    public static Stream<? extends Type> interfacesOf( Type type )
-    {
-        return Stream.of( type ).flatMap( INTERFACES_OF );
-    }
-
-    public static Stream<Class<?>> classHierarchy( Class<?> type )
-    {
-        return Stream.of( type ).flatMap( CLASS_HIERARCHY );
-    }
-
-    public static Type wrapperClass( Type type )
-    {
-        return WRAPPER_CLASS.apply( type );
-    }
-
-    public static Predicate<Class<?>> isAssignableFrom( final Class<?> clazz )
-    {
-        return clazz::isAssignableFrom;
-    }
-
-    public static Predicate<Object> instanceOf( final Class<?> clazz )
-    {
-        return clazz::isInstance;
-    }
-
-    public static Predicate<Class<?>> hasModifier( final int classModifier )
-    {
-        return item -> ( item.getModifiers() & classModifier ) != 0;
-    }
-
-    public static <T> Function<Type, Stream<T>> forClassHierarchy( final Function<Class<?>, Stream<T>> function )
-    {
-        return type -> Stream.of( type ).flatMap( CLASS_HIERARCHY ).flatMap( function );
-    }
-
-    public static <T> Function<Type, Stream<T>> forTypes( final Function<Type, Stream<T>> function )
-    {
-        return type -> Stream.of( type ).flatMap( TYPES_OF ).flatMap( function );
-    }
-
-    @SuppressWarnings( "raw" )
-    public static Set<Class<?>> interfacesWithMethods( Set<Class<?>> interfaces )
-    {
-        Set<Class<?>> newSet = new LinkedHashSet<>();
-        for( Class type : interfaces )
-        {
-            if( type.isInterface() && type.getDeclaredMethods().length > 0 )
-            {
-                newSet.add( type );
-            }
-        }
-
-        return newSet;
-    }
-
-    public static String simpleGenericNameOf( Type type )
-    {
-        StringBuilder sb = new StringBuilder();
-        simpleGenericNameOf( sb, type );
-        return sb.toString();
-    }
-
-    @SuppressWarnings( "raw" )
-    private static void simpleGenericNameOf( StringBuilder sb, Type type )
-    {
-        if( type instanceof Class )
-        {
-            sb.append( ( (Class) type ).getSimpleName() );
-        }
-        else if( type instanceof ParameterizedType )
-        {
-            ParameterizedType pt = (ParameterizedType) type;
-            simpleGenericNameOf( sb, pt.getRawType() );
-            sb.append( "<" );
-            boolean atLeastOne = false;
-            for( Type typeArgument : pt.getActualTypeArguments() )
-            {
-                if( atLeastOne )
-                {
-                    sb.append( ", " );
-                }
-                simpleGenericNameOf( sb, typeArgument );
-                atLeastOne = true;
-            }
-            sb.append( ">" );
-        }
-        else if( type instanceof GenericArrayType )
-        {
-            GenericArrayType gat = (GenericArrayType) type;
-            simpleGenericNameOf( sb, gat.getGenericComponentType() );
-            sb.append( "[]" );
-        }
-        else if( type instanceof TypeVariable )
-        {
-            TypeVariable tv = (TypeVariable) type;
-            sb.append( tv.getName() );
-        }
-        else if( type instanceof WildcardType )
-        {
-            WildcardType wt = (WildcardType) type;
-            sb.append( "? extends " );
-            boolean atLeastOne = false;
-            for( Type typeArgument : wt.getUpperBounds() )
-            {
-                if( atLeastOne )
-                {
-                    sb.append( ", " );
-                }
-                simpleGenericNameOf( sb, typeArgument );
-                atLeastOne = true;
-            }
-        }
-        else
-        {
-            throw new IllegalArgumentException( "Don't know how to deal with type:" + type );
-        }
-    }
-
-    @SuppressWarnings( "UnusedDeclaration" )
-    public static <AnnotationType extends Annotation>
-    AnnotationType findAnnotationOfTypeOrAnyOfSuperTypes( Class<?> type, Class<AnnotationType> annotationClass )
-    {
-        return Stream.of( type )
-            .flatMap( TYPES_OF )
-            .map( RAW_CLASS )
-            .map( clazz -> clazz.getAnnotation( annotationClass ) )
-            .filter( Objects::nonNull )
-            .findAny().orElse( null );
-    }
-
-    public static Predicate<Member> memberNamed( final String name )
-    {
-        return item -> item.getName().equals( name );
-    }
-
-    /**
-     * Given a type variable, find what it resolves to given the declaring class where type
-     * variable was found and a top class that extends the declaring class.
-     *
-     * @param name           The TypeVariable name.
-     * @param declaringClass The class where the TypeVariable is declared.
-     * @param topClass       The top class that extends the declaringClass
-     *
-     * @return The Type instance of the given TypeVariable
-     */
-    @SuppressWarnings( "raw" )
-    public static Type resolveTypeVariable( TypeVariable name, Class declaringClass, Class topClass )
-    {
-        Type type = resolveTypeVariable( name, declaringClass, new HashMap<>(), topClass );
-        if( type == null )
-        {
-            type = Object.class;
-        }
-        return type;
-    }
-
-    private static Type resolveTypeVariable( TypeVariable name,
-                                             Class declaringClass,
-                                             Map<TypeVariable, Type> mappings,
-                                             Class current
-    )
-    {
-        if( current.equals( declaringClass ) )
-        {
-            Type resolvedType = name;
-            while( resolvedType instanceof TypeVariable )
-            {
-                resolvedType = mappings.get( resolvedType );
-            }
-            return resolvedType;
-        }
-
-        Stream<? extends Type> stream = Arrays.stream( current.getGenericInterfaces() )
-            .flatMap( INTERFACES_OF )
-            .distinct();
-
-        Type genericSuperclass = current.getGenericSuperclass();
-        if( genericSuperclass != null )
-        {
-            stream = concat( stream, Stream.of( genericSuperclass ) );
-        }
-        return stream.map( type -> {
-            Class subClass;
-            if( type instanceof ParameterizedType )
-            {
-                subClass = extractTypeVariables( mappings, (ParameterizedType) type );
-            }
-            else
-            {
-                subClass = (Class) type;
-            }
-            return subClass;
-        } )
-            .map( subClass -> resolveTypeVariable( name, declaringClass, mappings, subClass ) )
-            .filter( type -> type != null )
-            .findAny().orElse( null );
-    }
-
-    private static Class extractTypeVariables( Map<TypeVariable, Type> mappings, ParameterizedType type )
-    {
-        Class subClass;
-        Type[] args = type.getActualTypeArguments();
-        Class clazz = (Class) type.getRawType();
-        TypeVariable[] vars = clazz.getTypeParameters();
-        for( int i = 0; i < vars.length; i++ )
-        {
-            TypeVariable var = vars[ i ];
-            Type mappedType = args[ i ];
-            mappings.put( var, mappedType );
-        }
-        subClass = (Class) type.getRawType();
-        return subClass;
-    }
-
-    /**
-     * Get URI for a class.
-     *
-     * @param clazz class
-     *
-     * @return URI
-     *
-     * @throws NullPointerException if clazz is null
-     */
-    @SuppressWarnings( "raw" )
-    public static String toURI( final Class clazz )
-        throws NullPointerException
-    {
-        return toURI( clazz.getName() );
-    }
-
-    /**
-     * Get URI for a class name.
-     * <p>
-     * Example:
-     * </p>
-     * <p>
-     * Class name com.example.Foo$Bar is converted to URI urn:zest:com.example.Foo-Bar
-     * </p>
-     *
-     * @param className class name
-     *
-     * @return URI
-     *
-     * @throws NullPointerException if className is null
-     */
-    public static String toURI( String className )
-        throws NullPointerException
-    {
-        className = normalizeClassToURI( className );
-        return "urn:zest:type:" + className;
-    }
-
-    /**
-     * Get class name from a URI
-     *
-     * @param uri URI
-     *
-     * @return class name
-     *
-     * @throws NullPointerException if uri is null
-     */
-    public static String toClassName( String uri )
-        throws NullPointerException
-    {
-        uri = uri.substring( "urn:zest:type:".length() );
-        uri = denormalizeURIToClass( uri );
-        return uri;
-    }
-
-    public static String normalizeClassToURI( String className )
-    {
-        return className.replace( '$', '-' );
-    }
-
-    public static String denormalizeURIToClass( String uriPart )
-    {
-        return uriPart.replace( '-', '$' );
-    }
-
-    public static Predicate<ModelDescriptor> modelTypeSpecification( final String className )
-    {
-        return item ->
-            stream( item.types().spliterator(), false )
-                .map( Class::getName ).anyMatch( typeName -> typeName.equals( className ) );
-    }
-
-    @SuppressWarnings( "raw" )
-    public static Predicate<ModelDescriptor> exactTypeSpecification( final Class type )
-    {
-        return item -> item.types().anyMatch( clazz -> clazz.equals( type ) );
-    }
-
-    @SuppressWarnings( "raw" )
-    public static Predicate<ModelDescriptor> assignableTypeSpecification( final Class<?> type )
-    {
-        return item ->
-            item.types().anyMatch(
-                itemType -> !type.equals( itemType ) && type.isAssignableFrom( itemType )
-            );
-    }
-
-    @SuppressWarnings( "raw" )
-    public static String toString( Stream<? extends Class> types )
-    {
-        return "[" + types.map( Class::getSimpleName ).collect( Collectors.joining( "," ) ) + "]";
-    }
-
-    public static Function<Type, String> toClassName()
-    {
-        return type -> RAW_CLASS.apply( type ).getName();
-    }
-
-    private Classes()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Collectors.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Collectors.java b/core/api/src/main/java/org/apache/zest/api/util/Collectors.java
deleted file mode 100644
index d77bc0d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Collectors.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.BinaryOperator;
-import java.util.function.Function;
-import java.util.function.Supplier;
-import java.util.stream.Collector;
-
-public class Collectors
-{
-    /**
-     * Collect a single element.
-     * @param <T> Element type
-     * @return The single element
-     * @throws IllegalArgumentException if no or more than one element
-     */
-    public static <T>
-    Collector<T, ?, T> single()
-        throws IllegalArgumentException
-    {
-        Supplier<T> thrower = () ->
-        {
-            throw new IllegalArgumentException( "No or more than one element in stream" );
-        };
-        return java.util.stream.Collectors.collectingAndThen( java.util.stream.Collectors.reducing( ( a, b ) -> null ),
-                                                              optional -> optional.orElseGet( thrower ) );
-    }
-
-    /**
-     * Eventually collect a single element.
-     * @param <T> Element type
-     * @return The single element, optional
-     * @throws IllegalArgumentException if more than one element
-     */
-    public static <T>
-    Collector<T, ?, Optional<T>> singleOrEmpty()
-        throws IllegalArgumentException
-    {
-        return java.util.stream.Collectors.reducing(
-            ( left, right ) ->
-            {
-                if( left != null && right != null )
-                {
-                    throw new IllegalArgumentException( "More than one element in stream" );
-                }
-                if( left != null )
-                {
-                    return left;
-                }
-                return right;
-            } );
-    }
-
-    public static <T, K, U, M extends Map<K, U>>
-    Collector<T, ?, M> toMap( Function<? super T, ? extends K> keyMapper,
-                              Function<? super T, ? extends U> valueMapper,
-                              Supplier<M> mapSupplier )
-    {
-        return java.util.stream.Collectors.toMap( keyMapper,
-                                                  valueMapper,
-                                                  throwingMerger(),
-                                                  mapSupplier );
-    }
-
-
-    public static <T extends Map.Entry<K, U>, K, U>
-    Collector<T, ?, Map<K, U>> toMap()
-    {
-        return java.util.stream.Collectors.toMap( Map.Entry::getKey, Map.Entry::getValue );
-    }
-
-    public static <T extends Map.Entry<K, U>, K, U, M extends Map<K, U>>
-    Collector<T, ?, M> toMap( Supplier<M> mapSupplier )
-    {
-        return toMap( Map.Entry::getKey, Map.Entry::getValue, mapSupplier );
-    }
-
-    private static <T> BinaryOperator<T> throwingMerger()
-    {
-        return ( left, right ) ->
-        {
-            throw new IllegalStateException( String.format( "Duplicate key %s", left ) );
-        };
-    }
-
-    private Collectors() {}
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Constructors.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Constructors.java b/core/api/src/main/java/org/apache/zest/api/util/Constructors.java
deleted file mode 100644
index f26ee4c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Constructors.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
-/**
- * Useful methods for handling Constructors.
- */
-public final class Constructors
-{
-    public static final Function<Type, Stream<Constructor<?>>> CONSTRUCTORS_OF =
-        Classes.forClassHierarchy( type -> Arrays.stream( type.getDeclaredConstructors() ) );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Fields.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Fields.java b/core/api/src/main/java/org/apache/zest/api/util/Fields.java
deleted file mode 100644
index a5a6a53..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Fields.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.stream.Stream;
-
-/**
- * Useful methods for handling Fields.
- */
-public final class Fields
-{
-    public static final Function<Type, Stream<Field>> FIELDS_OF =
-        Classes.forClassHierarchy( type -> Arrays.stream( type.getDeclaredFields() ) );
-
-    public static final BiFunction<Class<?>, String, Field> FIELD_NAMED = ( clazz, name ) ->
-        FIELDS_OF.apply( clazz ).filter( Classes.memberNamed( name ) ).findFirst().orElse( null );
-
-    public static Stream<Field> fieldsOf( Type type )
-    {
-        return Stream.of( type ).flatMap( FIELDS_OF );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitor.java b/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitor.java
deleted file mode 100644
index 8a1c53e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Visitor to visit hierarchies.
- */
-public interface HierarchicalVisitor<NODE, LEAF, ThrowableType extends Throwable> extends Visitor<LEAF, ThrowableType>
-{
-    /**
-     * Enter an instance of T
-     *
-     * @param visited the visited instance which is now entered
-     *
-     * @return true if the visitor pattern should continue, false if it should be aborted for this level
-     *
-     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
-     *                       get the exception in order to handle it properly.
-     */
-    boolean visitEnter( NODE visited )
-        throws ThrowableType;
-
-    /**
-     * Leave an instance of T
-     *
-     * @param visited the visited instance which is now left
-     *
-     * @return true if the visitor pattern should continue, false if it should be aborted for the level of this node
-     *
-     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
-     *                       get the exception in order to handle it properly.
-     */
-    boolean visitLeave( NODE visited )
-        throws ThrowableType;
-
-    @Override
-    boolean visit( LEAF visited )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitorAdapter.java b/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitorAdapter.java
deleted file mode 100644
index 1a2357b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/HierarchicalVisitorAdapter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Generic Hierarchical Visitor interface.
- */
-public class HierarchicalVisitorAdapter<NODE, LEAF, ThrowableType extends Throwable>
-    implements HierarchicalVisitor<NODE, LEAF, ThrowableType>
-{
-    @Override
-    public boolean visitEnter( NODE visited )
-        throws ThrowableType
-    {
-        return true;
-    }
-
-    @Override
-    public boolean visitLeave( NODE visited )
-        throws ThrowableType
-    {
-        return true;
-    }
-
-    @Override
-    public boolean visit( LEAF visited )
-        throws ThrowableType
-    {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/ListMap.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/ListMap.java b/core/api/src/main/java/org/apache/zest/api/util/ListMap.java
deleted file mode 100644
index ffd687a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/ListMap.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * Map whose values are Lists of things. Create
- * one ArrayList for each key that is added. The list does not allow
- * duplicates.
- */
-public final class ListMap<K, V>
-    extends HashMap<K, List<V>>
-{
-    public void add( K key, V value )
-    {
-        List<V> list = get( key );
-        if( list == null )
-        {
-            list = new ArrayList<V>();
-            put( key, list );
-        }
-        if( !list.contains( value ) )
-        {
-            list.add( value );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Methods.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Methods.java b/core/api/src/main/java/org/apache/zest/api/util/Methods.java
deleted file mode 100644
index 182caba..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Methods.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-
-/**
- * Useful methods for handling Methods.
- */
-public class Methods
-{
-    public static final Predicate<Type> HAS_METHODS =
-        item -> Classes.RAW_CLASS.apply( item ).getDeclaredMethods().length > 0;
-
-    public static final Function<Type, Stream<Method>> METHODS_OF = Classes.forTypes( type ->
-        Stream.of( type ).map( Classes.RAW_CLASS ).flatMap( clazz -> Arrays.stream( clazz.getDeclaredMethods() ) )
-    );
-
-    public static final BiFunction<Class<?>, String, Method> METHOD_NAMED = ( clazz, name ) ->
-        METHODS_OF.apply( clazz ).filter( Classes.memberNamed( name ) ).findFirst().orElse( null );
-
-
-    public static Stream<Method> methodsOf( Type type )
-    {
-        return Stream.of(type).flatMap( METHODS_OF );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/NullArgumentException.java b/core/api/src/main/java/org/apache/zest/api/util/NullArgumentException.java
deleted file mode 100644
index 1a16395..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/NullArgumentException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Thrown if an argument to a method was null, and the method required
- * it to be non-null.
- */
-public class NullArgumentException
-    extends IllegalArgumentException
-{
-    private static final long serialVersionUID = 4815431779868729780L;
-
-    private NullArgumentException( String message )
-    {
-        super( message );
-    }
-
-    public static void validateNotNull( String parameterName, Object value )
-    {
-        if( value != null )
-        {
-            return;
-        }
-        String message = parameterName + " was null.";
-        throw new NullArgumentException( message );
-    }
-
-    public static void validateNotEmpty( String parameterName, String value )
-    {
-        if( value == null )
-        {
-            String message = parameterName + " was null.";
-            throw new NullArgumentException( message );
-        }
-        if( value.length() == 0 )
-        {
-            String message = parameterName + " was empty.";
-            throw new NullArgumentException( message );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Visitable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Visitable.java b/core/api/src/main/java/org/apache/zest/api/util/Visitable.java
deleted file mode 100644
index 49cceec..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Visitable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Interface that visitable objects should implement.
- */
-public interface Visitable<T>
-{
-    <ThrowableType extends Throwable> boolean accept( Visitor<? super T, ThrowableType> visitor )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/VisitableHierarchy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/VisitableHierarchy.java b/core/api/src/main/java/org/apache/zest/api/util/VisitableHierarchy.java
deleted file mode 100644
index 642c32e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/VisitableHierarchy.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Interface that visitable hierarchies of objects should implement.
- */
-public interface VisitableHierarchy<NODE, LEAF>
-{
-    <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super NODE, ? super LEAF, ThrowableType> visitor )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/Visitor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/Visitor.java b/core/api/src/main/java/org/apache/zest/api/util/Visitor.java
deleted file mode 100644
index dff2309..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/Visitor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-/**
- * Generic Visitor interface.
- */
-public interface Visitor<T, ThrowableType extends Throwable>
-{
-    /**
-     * Visit an instance of T
-     *
-     * @param visited the visited instance
-     *
-     * @return true if the visitor pattern should continue, false if it should be aborted
-     *
-     * @throws ThrowableType if an exception occurred during processing. Any client call that initiated the visiting should
-     *                       get the exception in order to handle it properly.
-     */
-    boolean visit( T visited )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/util/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/util/package.html b/core/api/src/main/java/org/apache/zest/api/util/package.html
deleted file mode 100644
index cc0b40b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/util/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>API Utilities.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/MissingValueSerializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/MissingValueSerializationException.java b/core/api/src/main/java/org/apache/zest/api/value/MissingValueSerializationException.java
deleted file mode 100644
index c5507ac..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/MissingValueSerializationException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-public class MissingValueSerializationException extends ValueSerializationException
-{
-    public MissingValueSerializationException()
-    {
-    }
-
-    public MissingValueSerializationException( String message )
-    {
-        super( message );
-    }
-
-    public MissingValueSerializationException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-    public MissingValueSerializationException( Throwable cause )
-    {
-        super( cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index e88b61f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/NoSuchValueException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.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.
- */
-public class NoSuchValueException
-    extends NoSuchCompositeException
-{
-    public NoSuchValueException( String valueType, String moduleName, TypeLookup typeLookup )
-    {
-        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/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilder.java b/core/api/src/main/java/org/apache/zest/api/value/ValueBuilder.java
deleted file mode 100644
index 91972e1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilder.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * Builder for Values.
- */
-public interface ValueBuilder<T>
-{
-    AssociationStateHolder state();
-
-    /**
-     * Get a representation of the state for the new Value.
-     * It is possible to access and update properties and associations,
-     * even immutable ones since the builder represents the initial state.
-     *
-     * @return a mutable instance of the Value type
-     */
-    T prototype();
-
-    /**
-     * Get a representation of the state of the given type for the new ValueComposite.
-     * This is primarily used if you want to provide state for a private mixin type.
-     *
-     * @param mixinType the mixin which you want to provide state for
-     *
-     * @return a proxy implementing the given mixin type
-     */
-    <K> K prototypeFor( Class<K> mixinType );
-
-    /**
-     * Create a new Composite instance.
-     *
-     * @return a new Composite instance
-     *
-     * @throws org.apache.zest.api.common.ConstructionException
-     *          thrown if it was not possible to instantiate the Composite
-     */
-    T newInstance()
-        throws ConstructionException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderFactory.java b/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderFactory.java
deleted file mode 100644
index 3a61b1a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.common.ConstructionException;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.property.PropertyDescriptor;
-
-/**
- * Factory for Values and ValueBuilders.
- */
-public interface ValueBuilderFactory
-{
-
-    /**
-     * Instantiate a Value of the given type.
-     *
-     * @param valueType the Value type to instantiate
-     *
-     * @return a new Value instance
-     *
-     * @throws NoSuchValueException if no value extending the mixinType has been registered
-     * @throws ConstructionException if the value could not be instantiated
-     */
-    <T> T newValue( Class<T> valueType )
-        throws NoSuchValueException, ConstructionException;
-
-    /**
-     * Create a builder for creating new Values that implements the given Value type.
-     * <p>The returned ValueBuilder can be reused to create several Values instances.</p>
-     *
-     * @param valueType an interface that describes the Composite to be instantiated
-     *
-     * @return a ValueBuilder for creation of ValueComposites implementing the interface
-     *
-     * @throws NoSuchValueException if no value extending the mixinType has been registered
-     */
-    <T> ValueBuilder<T> newValueBuilder( Class<T> valueType )
-        throws NoSuchValueException;
-
-    /**
-     * Create a builder for creating a new Value starting with the given prototype.
-     * <p>The returned ValueBuilder can only be used ONCE.</p>
-     *
-     * @param prototype a prototype the builder will use
-     *
-     * @return a ValueBuilder for creation of ValueComposites implementing the interface of the prototype
-     *
-     * @throws NoSuchValueException if no value extending the mixinType has been registered
-     */
-    <T> ValueBuilder<T> newValueBuilderWithPrototype( T prototype );
-
-    /**
-     * Create a builder for creating a new Value starting with the given state.
-     * <p>The returned ValueBuilder can only be used ONCE.</p>
-     *
-     * @param mixinType an interface that describes the Composite to be instantiated
-     * @param propertyFunction a function providing the state of properties
-     * @param associationFunction a function providing the state of associations
-     * @param manyAssociationFunction a function providing the state of many associations
-     * @param namedAssociationFunction a function providing the state of named associations
-     *
-     * @return a ValueBuilder for creation of ValueComposites implementing the interface
-     *
-     * @throws NoSuchValueException if no value extending the mixinType has been registered
-     */
-    <T> ValueBuilder<T> newValueBuilderWithState( Class<T> mixinType,
-                                                  Function<PropertyDescriptor, Object> propertyFunction,
-                                                  Function<AssociationDescriptor, EntityReference> associationFunction,
-                                                  Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
-                                                  Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction );
-
-    /**
-     * Instantiate a Value of the given type using the serialized state given as String.
-     *
-     * @param valueType the Value type to instantiate
-     * @param serializedState  the state of the Value
-     *
-     * @return a new Value instance
-     *
-     * @throws NoSuchValueException if no value extending the mixinType has been registered
-     * @throws ConstructionException if the value could not be instantiated
-     */
-    <T> T newValueFromSerializedState( Class<T> valueType, String serializedState );
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderTemplate.java b/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderTemplate.java
deleted file mode 100644
index 2d9106b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueBuilderTemplate.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.structure.ModuleDescriptor;
-
-/**
- * Builder template for Values.
- */
-public abstract class ValueBuilderTemplate<T>
-{
-    Class<T> type;
-
-    protected ValueBuilderTemplate( Class<T> type )
-    {
-        this.type = type;
-    }
-
-    protected abstract void build( T prototype );
-
-    public T newInstance( ModuleDescriptor module )
-    {
-        ValueBuilder<T> builder = module.instance().newValueBuilder( type );
-        build( builder.prototype() );
-        return builder.newInstance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueComposite.java b/core/api/src/main/java/org/apache/zest/api/value/ValueComposite.java
deleted file mode 100644
index 4ea2ef3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueComposite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import org.apache.zest.api.association.AssociationMixin;
-import org.apache.zest.api.association.ManyAssociationMixin;
-import org.apache.zest.api.association.NamedAssociationMixin;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Immutable;
-
-/**
- * ValueComposites are Composites that has state, and equality is defined from its values and not any reference nor
- * instance references.
- *
- * <ul>
- * <li>No Identity</li>
- * <li>No Lifecycle</li>
- * <li>Immutable</li>
- * <li>equals()/hashCode() operates on the Properties</li>
- * <li>Can have property and associations methods.</li>
- * <li>Can not reference Services</li>
- * <li>Can not have @Uses</li>
- * </ul>
- */
-@Immutable
-@Mixins( { AssociationMixin.class, ManyAssociationMixin.class, NamedAssociationMixin.class } )
-public interface ValueComposite
-    extends Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueDescriptor.java b/core/api/src/main/java/org/apache/zest/api/value/ValueDescriptor.java
deleted file mode 100644
index 3051ce5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import org.apache.zest.api.association.AssociationStateDescriptor;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.StatefulCompositeDescriptor;
-import org.apache.zest.api.type.ValueCompositeType;
-
-/**
- * Descriptor for ValueComposites.
- */
-public interface ValueDescriptor
-    extends CompositeDescriptor, StatefulCompositeDescriptor
-{
-    ValueCompositeType valueType();
-
-    @Override
-    AssociationStateDescriptor state();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueDeserializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueDeserializer.java b/core/api/src/main/java/org/apache/zest/api/value/ValueDeserializer.java
deleted file mode 100644
index 8eca001..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueDeserializer.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import java.io.InputStream;
-import java.util.function.Function;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.ValueType;
-
-/**
- * Use a ValueDeserializer to create new values instances from serialized state.
- *
- * <p>
- * Serialized state must be one of:
- * </p>
- * <ul>
- * <li>a ValueComposite,</li>
- * <li>an EntityReference,</li>
- * <li>a Collection,</li>
- * <li>a Map,</li>
- * <li>a Plain Value.</li>
- * </ul>
- * <p>
- * Nested plain values, EntityReferences, Collections, Maps, ValueComposites are supported.
- * EntityReferences are deserialized as their reference string.
- * </p>
- * <p>
- * Plain values can be one of:
- * </p>
- * <ul>
- * <li>String,</li>
- * <li>Character or char,</li>
- * <li>Boolean or boolean,</li>
- * <li>Integer or int,</li>
- * <li>Long or long,</li>
- * <li>Short or short,</li>
- * <li>Byte or byte,</li>
- * <li>Float or float,</li>
- * <li>Double or double,</li>
- * <li>BigInteger,</li>
- * <li>BigDecimal,</li>
- * <li>Date,</li>
- * <li>DateTime (JodaTime),</li>
- * <li>LocalDateTime (JodaTime),</li>
- * <li>LocalDate (JodaTime).</li>
- * </ul>
- * <p>
- * Values of unknown types and all arrays are considered as {@link java.io.Serializable} and by so are deserialized
- * from base64 encoded bytes using pure Java serialization. If it happens that the input is invalid, a
- * ValueSerializationException is thrown.
- * </p>
- * <p>
- * Having type information in the serialized payload allows to keep actual ValueComposite types and by so
- * circumvent {@link org.apache.zest.api.composite.AmbiguousTypeException} when deserializing.
- * </p>
- */
-public interface ValueDeserializer
-{
-
-    /**
-     * Factory method for a typed deserialize function.
-     *
-     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
-     *
-     * @param type the value type
-     * @param <T>  the parametrized function return type
-     *
-     * @return a deserialization function
-     */
-    <T> Function<String, T> deserialize( ModuleDescriptor module, Class<T> type );
-
-    /**
-     * Factory method for a typed deserialize function.
-     *
-     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
-     *
-     * @param valueType the value type
-     * @param <T>       the parametrized function return type
-     *
-     * @return a deserialization function
-     */
-    <T> Function<String, T> deserialize( ModuleDescriptor module, ValueType valueType );
-
-    /**
-     * Factory method for an untyped deserialize function.
-     *
-     * <p>The returned Function may throw {@link ValueSerializationException}.</p>
-     *
-     * @param <T> the parametrized function return type
-     * @return a deserialization function
-     */
-//    <T> BiFunction<ValueType, String, T> deserialize();
-
-    /**
-     * Deserialize a value from a state.
-     *
-     * @param <T>   the parametrized returned type
-     * @param type  the value type
-     * @param input the state
-     *
-     * @return the value
-     *
-     * @throws ValueSerializationException if the deserialization failed
-     */
-    <T> T deserialize( ModuleDescriptor module, Class<?> type, String input )
-        throws ValueSerializationException;
-
-    /**
-     * Deserialize a value from a state.
-     *
-     * @param <T>       the parametrized returned type
-     * @param valueType the value type
-     * @param input     the state
-     *
-     * @return the value
-     *
-     * @throws ValueSerializationException if the deserialization failed
-     */
-    <T> T deserialize( ModuleDescriptor module, ValueType valueType, String input )
-        throws ValueSerializationException;
-
-    /**
-     * Deserialize a value from a state.
-     *
-     * @param <T>   the parametrized returned type
-     * @param type  the value type
-     * @param input the state stream
-     *
-     * @return the value
-     *
-     * @throws ValueSerializationException if the deserialization failed
-     */
-    <T> T deserialize( ModuleDescriptor module, Class<?> type, InputStream input )
-        throws ValueSerializationException;
-
-    /**
-     * Deserialize a value from a state.
-     *
-     * @param <T>       the parametrized returned type
-     * @param valueType the value type
-     * @param input     the state stream
-     *
-     * @return the value
-     *
-     * @throws ValueSerializationException if the deserialization failed
-     */
-    <T> T deserialize( ModuleDescriptor module, ValueType valueType, InputStream input )
-        throws ValueSerializationException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueSerialization.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueSerialization.java b/core/api/src/main/java/org/apache/zest/api/value/ValueSerialization.java
deleted file mode 100644
index edfc601..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueSerialization.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-/**
- * ValueSerialization API.
- *
- * See {@link ValueSerializer} and {@link ValueDeserializer}.
- */
-public interface ValueSerialization
-    extends ValueSerializer, ValueDeserializer
-{
-
-    /**
-     * Serialization format @Service tags.
-     *
-     * <p>
-     *     ValueSerialization implementations should be tagged with theses at assembly time so that consumers can
-     *     specify which format they need.
-     * </p>
-     */
-    interface Formats
-    {
-
-        /**
-         * Tag a ValueSerialization service that support the JSON format.
-         */
-        String JSON = "json";
-        /**
-         * Tag a ValueSerialization service that support the XML format.
-         */
-        String XML = "xml";
-        /**
-         * Tag a ValueSerialization service that support the YAML format.
-         */
-        String YAML = "yaml";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/value/ValueSerializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializationException.java b/core/api/src/main/java/org/apache/zest/api/value/ValueSerializationException.java
deleted file mode 100644
index e04dc07..0000000
--- a/core/api/src/main/java/org/apache/zest/api/value/ValueSerializationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-/**
- * Thrown when an error occur during value state (de)serialization.
- */
-public class ValueSerializationException
-    extends RuntimeException
-{
-
-    private static final long serialVersionUID = 1L;
-
-    public ValueSerializationException()
-    {
-        super();
-    }
-
-    public ValueSerializationException( String message )
-    {
-        super( message );
-    }
-
-    public ValueSerializationException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-    public ValueSerializationException( Throwable cause )
-    {
-        super( cause.getClass().getName() + ": " + cause.getMessage(), cause );
-    }
-}


[62/81] [abbrv] zest-java git commit: ZEST-195 ; Clean up the mistakes in the rename.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java
new file mode 100644
index 0000000..7c60d87
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneSPITest.java
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime;
+
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+import static org.junit.Assert.assertThat;
+
+/**
+ * JAVADOC
+ */
+public class PolygeneSPITest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        new EntityTestAssembler().assemble( module );
+        module.entities( TestEntity.class, TestEntity2.class );
+    }
+
+    @Test
+    public void givenEntityWhenGettingStateThenGetCorrectState()
+        throws Exception
+    {
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        TestEntity testEntity;
+        try
+        {
+            EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );
+
+            testEntity = builder.newInstance();
+
+            AssociationStateHolder state = spi.stateOf( testEntity );
+
+            validateState( state, spi.entityDescriptorFor( testEntity ) );
+
+            unitOfWork.complete();
+        }
+        finally
+        {
+            unitOfWork.discard();
+        }
+
+        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
+        try
+        {
+            testEntity = uow.get( testEntity );
+            validateState( spi.stateOf( testEntity ), spi.entityDescriptorFor( testEntity ) );
+            uow.complete();
+        }
+        finally
+        {
+            uow.discard();
+        }
+    }
+
+    private void validateState( AssociationStateHolder state, EntityDescriptor entityDescriptor )
+    {
+        entityDescriptor.state().properties().forEach( propertyDescriptor -> {
+            Property<?> prop = state.propertyFor( propertyDescriptor.accessor() );
+            assertThat( "Properties could be listed", prop, CoreMatchers.notNullValue() );
+        } );
+
+        AssociationStateDescriptor descriptor = entityDescriptor.state();
+        descriptor.associations().forEach( associationDescriptor -> {
+            AbstractAssociation assoc = state.associationFor( associationDescriptor.accessor() );
+            assertThat( "Assocs could be listed", assoc, CoreMatchers.notNullValue() );
+        } );
+    }
+
+    public interface TestEntity
+        extends EntityComposite
+    {
+        @Optional
+        Property<String> property();
+
+        @Optional
+        Association<TestEntity> association();
+
+        ManyAssociation<TestEntity> manyAssociation();
+    }
+
+    public interface TestEntity2
+        extends EntityComposite
+    {
+        @Optional
+        Property<String> property();
+
+        @Optional
+        Association<TestEntity> association();
+
+        ManyAssociation<TestEntity> manyAssociation();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java
deleted file mode 100644
index 24419d6..0000000
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestAPITest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.runtime;
-
-import org.junit.Test;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.apache.polygene.test.EntityTestAssembler;
-
-/**
- * JAVADOC
- */
-public class PolygeneAPITest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        new EntityTestAssembler().assemble( module );
-        module.transients( TestTransient.class );
-        module.entities( TestEntity.class );
-        module.values( TestValue.class );
-        module.services( TestService.class );
-    }
-
-    @Test
-    public void testGetModuleOfComposite()
-        throws Exception
-    {
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        TestEntity testEntity = unitOfWork.newEntity( TestEntity.class );
-
-        api.moduleOf( testEntity );
-
-        unitOfWork.discard();
-
-        api.moduleOf( valueBuilderFactory.newValue( TestValue.class ) );
-
-        api.moduleOf( transientBuilderFactory.newTransient( TestTransient.class ) );
-
-        api.moduleOf( serviceFinder.findService( TestService.class ).get() );
-    }
-
-    public interface TestTransient
-        extends TransientComposite
-    {
-    }
-
-    public interface TestEntity
-        extends EntityComposite
-    {
-    }
-
-    public interface TestValue
-        extends ValueComposite
-    {
-    }
-
-    public interface TestService
-        extends ServiceComposite
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java
deleted file mode 100644
index 7c60d87..0000000
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/ZestSPITest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.runtime;
-
-import org.hamcrest.CoreMatchers;
-import org.junit.Test;
-import org.apache.polygene.api.association.AbstractAssociation;
-import org.apache.polygene.api.association.Association;
-import org.apache.polygene.api.association.AssociationStateDescriptor;
-import org.apache.polygene.api.association.AssociationStateHolder;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.entity.EntityDescriptor;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.apache.polygene.test.EntityTestAssembler;
-
-import static org.junit.Assert.assertThat;
-
-/**
- * JAVADOC
- */
-public class PolygeneSPITest
-    extends AbstractPolygeneTest
-{
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        new EntityTestAssembler().assemble( module );
-        module.entities( TestEntity.class, TestEntity2.class );
-    }
-
-    @Test
-    public void givenEntityWhenGettingStateThenGetCorrectState()
-        throws Exception
-    {
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        TestEntity testEntity;
-        try
-        {
-            EntityBuilder<TestEntity> builder = unitOfWork.newEntityBuilder( TestEntity.class );
-
-            testEntity = builder.newInstance();
-
-            AssociationStateHolder state = spi.stateOf( testEntity );
-
-            validateState( state, spi.entityDescriptorFor( testEntity ) );
-
-            unitOfWork.complete();
-        }
-        finally
-        {
-            unitOfWork.discard();
-        }
-
-        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
-        try
-        {
-            testEntity = uow.get( testEntity );
-            validateState( spi.stateOf( testEntity ), spi.entityDescriptorFor( testEntity ) );
-            uow.complete();
-        }
-        finally
-        {
-            uow.discard();
-        }
-    }
-
-    private void validateState( AssociationStateHolder state, EntityDescriptor entityDescriptor )
-    {
-        entityDescriptor.state().properties().forEach( propertyDescriptor -> {
-            Property<?> prop = state.propertyFor( propertyDescriptor.accessor() );
-            assertThat( "Properties could be listed", prop, CoreMatchers.notNullValue() );
-        } );
-
-        AssociationStateDescriptor descriptor = entityDescriptor.state();
-        descriptor.associations().forEach( associationDescriptor -> {
-            AbstractAssociation assoc = state.associationFor( associationDescriptor.accessor() );
-            assertThat( "Assocs could be listed", assoc, CoreMatchers.notNullValue() );
-        } );
-    }
-
-    public interface TestEntity
-        extends EntityComposite
-    {
-        @Optional
-        Property<String> property();
-
-        @Optional
-        Association<TestEntity> association();
-
-        ManyAssociation<TestEntity> manyAssociation();
-    }
-
-    public interface TestEntity2
-        extends EntityComposite
-    {
-        @Optional
-        Property<String> property();
-
-        @Optional
-        Association<TestEntity> association();
-
-        ManyAssociation<TestEntity> manyAssociation();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java
index 62b89d2..4fe8ba0 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToFilterTest.java
@@ -20,6 +20,7 @@
 package org.apache.polygene.runtime.appliesto;
 
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.concern.GenericConcern;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * Test of the AppliesToFilter

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java
index ebb86d9..6a01c0c 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/appliesto/AppliesToOrConditionQI241Test.java
@@ -25,6 +25,7 @@ import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
 import org.apache.polygene.api.common.Optional;
@@ -39,7 +40,6 @@ import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertTrue;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
index 8f1e294..9d968f0 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.association;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.association.AssociationDescriptor;
@@ -29,7 +30,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java
index 3c5bd1a..f7afdee 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/DereferenceForBootstrappedConcernsTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.bootstrap;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.PolygeneAPI;
 import org.apache.polygene.api.composite.Composite;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.mixin.NoopMixin;
 import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java
index e12c8f1..1575f50 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/AbstractMixinTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.runtime.composite;
 
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.common.Optional;
@@ -34,7 +35,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java
index e40ae6e..f13c0b0 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/CompositeFactoryImplTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.runtime.composite;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.util.Properties;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
 import org.apache.polygene.api.common.AppliesToFilter;
@@ -31,7 +32,6 @@ import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.fail;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
index 840ffa8..06fc1e4 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.apache.polygene.api.composite.Composite;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java
index 689f238..d39ed6e 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/QI247Test2.java
@@ -21,12 +21,12 @@ package org.apache.polygene.runtime.composite;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java
index 767d626..f189593 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/TransientAsClassTest.java
@@ -23,10 +23,10 @@ import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import org.apache.polygene.api.concern.ConcernOf;
 import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java
index 7463f82..2de631a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/GenericConcernTest.java
@@ -24,13 +24,13 @@ import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * Tests for GenericConcern

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
index 7a2dd06..12550f2 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.runtime.concerns;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.InvalidApplicationException;
 import org.apache.polygene.api.common.UseDefaults;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.property.InvalidPropertyTypeException;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java
index 8ae4ebd..f560439 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.java
@@ -23,6 +23,7 @@ import java.lang.annotation.Retention;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.Optional;
 import org.apache.polygene.api.composite.TransientComposite;
@@ -35,7 +36,6 @@ import org.apache.polygene.api.constraint.Name;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java
index e7a7536..f648549 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/AggregatedTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.entity;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.association.ManyAssociation;
@@ -32,7 +33,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.usecase.UsecaseBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.fail;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java
index 9d2ca9b..c2ca024 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCompositeEqualityTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.entity;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -29,7 +30,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java
index e79326b..4766868 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityCreationTest.java
@@ -37,7 +37,7 @@ import org.junit.Test;
  * Test case for http://team.ops4j.org/browse/QI-274
  */
 public class EntityCreationTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     @Mixins( SomeEntityMixin.class )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java
index 728bfcf..c5ef312 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityTypeTest.java
@@ -21,13 +21,13 @@
 package org.apache.polygene.runtime.entity;
 
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityBuilder;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 public class EntityTypeTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java
index a5f9f68..97627ba 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/QI273Test.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.entity;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.injection.scope.This;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
index 05a61b6..f049c40 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/AssociationTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.runtime.entity.associations;
 
 import java.io.Serializable;
 import javax.swing.Icon;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java
index f659997..57c02dc 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/associations/ImmutableAssociationTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.entity.associations;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.association.ManyAssociation;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.property.Immutable;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java
index 07056d8..ca41d50 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/IllegalUnitOfWorkInjectionTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.injection;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.State;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.fail;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java
index a4aa796..2b94d47 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGenericClassTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.injection;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.composite.TransientComposite;
@@ -26,7 +27,6 @@ import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java
index 360309d..d42c846 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/UsesGraphTest.java
@@ -20,12 +20,12 @@
 
 package org.apache.polygene.runtime.injection;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java b/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java
index f8ddbd4..214c4bc 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/instantiation/ServiceInstantiationTests.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.instantiation;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.configuration.Configuration;
@@ -28,7 +29,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 public class ServiceInstantiationTests

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java
index 814ec42..e0ed2ba 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/AssemblyMixinTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.runtime.mixin;
 
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.entity.EntityComposite;
@@ -28,7 +29,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java
index 694c3a6..36d7f2a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/InvokeServiceFromModuleAssemblyTest.java
@@ -20,13 +20,13 @@
 
 package org.apache.polygene.runtime.mixin;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.mixin.NoopMixin;
 import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.fail;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java
index a0a0e49..8885e8a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/MethodInterceptionMixinTest.java
@@ -23,6 +23,7 @@ package org.apache.polygene.runtime.mixin;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.concern.ConcernOf;
 import org.apache.polygene.api.concern.Concerns;
@@ -32,7 +33,6 @@ import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java
index a51b2d3..438089a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/PrivateMixinTest.java
@@ -19,13 +19,13 @@
  */
 package org.apache.polygene.runtime.mixin;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java
index d6d4d41..e2d2b5a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/mixin/Qi228Test.java
@@ -23,12 +23,12 @@ package org.apache.polygene.runtime.mixin;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 public class Qi228Test
     extends AbstractPolygeneTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java
index e2d5a61..c3518dc 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/ImmutablePropertyTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.property;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java
index 357d53f..179e2eb 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyStringArrayTest.java
@@ -20,13 +20,13 @@
 
 package org.apache.polygene.runtime.property;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java
index def5256..530cd71 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/property/PropertyTest.java
@@ -23,6 +23,7 @@ package org.apache.polygene.runtime.property;
 import java.io.Serializable;
 import java.lang.reflect.Method;
 import javax.swing.Icon;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
 import org.apache.polygene.api.composite.TransientBuilder;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.property.PropertyMixin;
 import org.apache.polygene.api.property.PropertyWrapper;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java
index 2755239..3549165 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/query/QueryBuilderFactoryImplTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.runtime.query;
 
 import java.util.ArrayList;
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
@@ -31,7 +32,6 @@ import org.apache.polygene.api.query.Query;
 import org.apache.polygene.api.query.QueryBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java
index 918ec92..baef5c0 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ComplexActivatableTest.java
@@ -34,7 +34,7 @@ import org.apache.polygene.test.AbstractPolygeneTest;
 import static org.junit.Assert.assertEquals;
 
 public class ComplexActivatableTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     public void assemble( ModuleAssembly module )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java
index 7fcb04c..9bddd31 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/service/ServiceFinderTest.java
@@ -20,12 +20,12 @@
 
 package org.apache.polygene.runtime.service;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.hamcrest.core.IsNull.notNullValue;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
index dc0a3e5..4ff5e2b 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/GenericSideEffectTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.runtime.sideeffects;
 
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.AppliesTo;
 import org.apache.polygene.api.common.AppliesToFilter;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.sideeffect.GenericSideEffect;
 import org.apache.polygene.api.sideeffect.SideEffects;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.not;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
index ed7b5f6..022f1f0 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/sideeffects/SampleTransientTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.runtime.sideeffects;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.sideeffect.SideEffectOf;
 import org.apache.polygene.api.sideeffect.SideEffects;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
index e8394f1..fcc0ee8 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/threaded/ContextCompositeTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.threaded;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.composite.CompositeContext;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java
index f29cba4..3c10c1f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/unitofwork/AutoCloseableUoWTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.unitofwork;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.After;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
@@ -28,7 +29,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java
index 23e74aa..2ad6db4 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/value/ValueCompositeBasicsTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.runtime.value;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 import org.junit.Test;
 import org.apache.polygene.api.injection.scope.This;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java
index 1dd72a3..c863dc2 100644
--- a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/NewObjectImporterTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.spi.service.importer;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Test;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java
index ed4ea9b..6a891c4 100644
--- a/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/spi/service/importer/ServiceInstanceImporterTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.spi.service.importer;
 
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.service.ServiceImporterException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 /**
  * JAVADOC

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java b/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java
index 92b517c..c504baf 100644
--- a/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/test/composite/CleanStackTraceTest.java
@@ -24,6 +24,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.apache.polygene.api.concern.Concerns;
@@ -31,7 +32,6 @@ import org.apache.polygene.api.concern.GenericConcern;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsNull.notNullValue;
 import static org.junit.Assert.assertEquals;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java b/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java
new file mode 100644
index 0000000..b8571aa
--- /dev/null
+++ b/core/spi/src/main/java/org/apache/polygene/spi/PolygeneSPI.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.spi;
+
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * Encapsulation of the Polygene SPI. This is implemented by the runtime.
+ */
+public interface PolygeneSPI
+    extends PolygeneAPI
+{
+    StateHolder stateOf( TransientComposite composite );
+
+    AssociationStateHolder stateOf( EntityComposite composite );
+
+    AssociationStateHolder stateOf( ValueComposite composite );
+
+    // Entities
+    EntityState entityStateOf( EntityComposite composite );
+
+    /**
+     * Fetches the EntityReference without loading the referenced entity.
+     *
+     * @param assoc The Association for which we want to obtain the EntityReference
+     * @return The EntityReference of the given Association.
+     */
+    EntityReference entityReferenceOf( Association<?> assoc );
+
+    /**
+     * Fetches the EntityReferences without loading the referenced entities.
+     *
+     * @param assoc The ManyAssociation for which we want to obtain the EntityReferences.
+     * @return A stream of all the EntityReferences of the given ManyAssociation.
+     */
+    Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc );
+
+    /**
+     * Fetches the EntityReferences without loading the referenced entities.
+     *
+     * @param assoc The NamedAssociation for which we want to obtain the EntityReference
+     * @return A stream of Map.Entry with the names and EntityReferences of the given NamedAssociation.
+     */
+    Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java
----------------------------------------------------------------------
diff --git a/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java b/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java
deleted file mode 100644
index b8571aa..0000000
--- a/core/spi/src/main/java/org/apache/polygene/spi/ZestSPI.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.spi;
-
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.api.association.Association;
-import org.apache.polygene.api.association.AssociationStateHolder;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.association.NamedAssociation;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.entity.EntityReference;
-import org.apache.polygene.api.property.StateHolder;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.spi.entity.EntityState;
-
-/**
- * Encapsulation of the Polygene SPI. This is implemented by the runtime.
- */
-public interface PolygeneSPI
-    extends PolygeneAPI
-{
-    StateHolder stateOf( TransientComposite composite );
-
-    AssociationStateHolder stateOf( EntityComposite composite );
-
-    AssociationStateHolder stateOf( ValueComposite composite );
-
-    // Entities
-    EntityState entityStateOf( EntityComposite composite );
-
-    /**
-     * Fetches the EntityReference without loading the referenced entity.
-     *
-     * @param assoc The Association for which we want to obtain the EntityReference
-     * @return The EntityReference of the given Association.
-     */
-    EntityReference entityReferenceOf( Association<?> assoc );
-
-    /**
-     * Fetches the EntityReferences without loading the referenced entities.
-     *
-     * @param assoc The ManyAssociation for which we want to obtain the EntityReferences.
-     * @return A stream of all the EntityReferences of the given ManyAssociation.
-     */
-    Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc );
-
-    /**
-     * Fetches the EntityReferences without loading the referenced entities.
-     *
-     * @param assoc The NamedAssociation for which we want to obtain the EntityReference
-     * @return A stream of Map.Entry with the names and EntityReferences of the given NamedAssociation.
-     */
-    Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
new file mode 100644
index 0000000..18e1c24
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
@@ -0,0 +1,135 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test;
+
+import org.apache.polygene.test.util.NotYetImplemented;
+import org.junit.After;
+import org.junit.Before;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.junit.Rule;
+
+public abstract class AbstractPolygeneBaseTest
+{
+    @Rule public NotYetImplemented.Rule notYetImplementedRule = new NotYetImplemented.Rule();
+
+    protected PolygeneAPI api;
+    protected PolygeneSPI spi;
+
+    protected Energy4Java polygene;
+    protected ApplicationDescriptor applicationModel;
+    protected Application application;
+
+    @Before
+    public void setUp()
+        throws Exception
+    {
+        polygene = new Energy4Java();
+        applicationModel = newApplication();
+        if( applicationModel == null )
+        {
+            // An AssemblyException has occurred that the Test wants to check for.
+            return;
+        }
+        application = newApplicationInstance( applicationModel );
+        initApplication( application );
+        api = spi = polygene.spi();
+        application.activate();
+    }
+
+    /** Called by the superclass for the test to define the entire application, every layer, every module and all
+     * the contents of each module.
+     *
+     * @param applicationAssembly the {@link org.apache.polygene.bootstrap.ApplicationAssembly} to be populated.
+     *
+     * @throws AssemblyException on invalid assembly
+     */
+    protected abstract void defineApplication( ApplicationAssembly applicationAssembly )
+        throws AssemblyException;
+
+    protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
+    {
+        return applicationModel.newInstance( polygene.api() );
+    }
+
+    protected ApplicationDescriptor newApplication()
+        throws AssemblyException
+    {
+        ApplicationAssembler assembler = new ApplicationAssembler()
+        {
+            @Override
+            public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+                throws AssemblyException
+            {
+                ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
+                applicationAssembly.setMode( Application.Mode.test );
+                defineApplication( applicationAssembly );
+                return applicationAssembly;
+            }
+        };
+
+        try
+        {
+            return polygene.newApplicationModel( assembler );
+        }
+        catch( AssemblyException e )
+        {
+            assemblyException( e );
+            return null;
+        }
+    }
+
+    /**
+     * This method is called when there was an AssemblyException in the creation of the Polygene application model.
+     * <p>
+     * Override this method to catch valid failures to place into satisfiedBy suites.
+     * </p>
+     * @param exception the exception thrown.
+     *
+     * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception.
+     */
+    protected void assemblyException( AssemblyException exception )
+        throws AssemblyException
+    {
+        throw exception;
+    }
+
+    protected void initApplication( Application app )
+        throws Exception
+    {
+    }
+
+    @After
+    public void tearDown()
+        throws Exception
+    {
+        if( application != null )
+        {
+            application.passivate();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java
new file mode 100644
index 0000000..4f85962
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneScenarioTest.java
@@ -0,0 +1,142 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * Base class for Polygene scenario tests. This will create one Polygene application per class instead of per test.
+ */
+public abstract class AbstractPolygeneScenarioTest
+    implements Assembler
+{
+    static protected PolygeneAPI api;
+    static protected PolygeneSPI spi;
+
+    static protected Energy4Java polygene;
+    static protected ApplicationDescriptor applicationModel;
+    static protected Application application;
+
+    static protected Module module;
+
+    static protected Assembler assembler; // Initialize this in static block of subclass
+    private static UnitOfWorkFactory uowf;
+
+    @BeforeClass
+    public static void setUp()
+        throws Exception
+    {
+        polygene = new Energy4Java();
+        applicationModel = newApplication();
+        if( applicationModel == null )
+        {
+            // An AssemblyException has occurred that the Test wants to check for.
+            return;
+        }
+        application = applicationModel.newInstance( polygene.spi() );
+        initApplication( application );
+        api = spi = polygene.spi();
+        application.activate();
+
+        // Assume only one module
+        module = application.findModule( "Layer 1", "Module 1" );
+        uowf = module.unitOfWorkFactory();
+    }
+
+    static protected ApplicationDescriptor newApplication()
+        throws AssemblyException
+    {
+        final Assembler asm = assembler;
+
+        ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm );
+        try
+        {
+            return polygene.newApplicationModel( assembler );
+        }
+        catch( AssemblyException e )
+        {
+            assemblyException( e );
+            return null;
+        }
+    }
+
+    /**
+     * This method is called when there was an AssemblyException in the creation of the Polygene application model.
+     * <p>
+     * Override this method to catch valid failures to place into satisfiedBy suites.
+     * </p>
+     *
+     * @param exception the exception thrown.
+     *
+     * @throws org.apache.polygene.bootstrap.AssemblyException The default implementation of this method will simply re-throw the exception.
+     */
+    static protected void assemblyException( AssemblyException exception )
+        throws AssemblyException
+    {
+        throw exception;
+    }
+
+    static protected void initApplication( Application app )
+        throws Exception
+    {
+    }
+
+    @AfterClass
+    public void tearDown()
+        throws Exception
+    {
+        if( uowf != null && uowf.isUnitOfWorkActive() )
+        {
+            while( uowf.isUnitOfWorkActive() )
+            {
+                UnitOfWork uow = uowf.currentUnitOfWork();
+                if( uow.isOpen() )
+                {
+                    uow.discard();
+                }
+                else
+                {
+                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is" + uow
+                        .usecase()
+                        .name() );
+                }
+            }
+            new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace();
+        }
+
+        if( application != null )
+        {
+            application.passivate();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java
new file mode 100644
index 0000000..db3c8d8
--- /dev/null
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneTest.java
@@ -0,0 +1,120 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test;
+
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * Base class for Composite tests.
+ */
+public abstract class AbstractPolygeneTest extends AbstractPolygeneBaseTest
+    implements Assembler
+{
+    @Structure
+    protected UnitOfWorkFactory unitOfWorkFactory;
+
+    @Structure
+    protected TransientBuilderFactory transientBuilderFactory;
+
+    @Structure
+    protected ValueBuilderFactory valueBuilderFactory;
+
+    @Structure
+    protected ServiceFinder serviceFinder;
+
+    @Structure
+    protected ObjectFactory objectFactory;
+
+    @Structure
+    protected QueryBuilderFactory queryBuilderFactory;
+
+    @Structure
+    protected ModuleDescriptor module;
+
+    @Before
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        if( application == null )
+        {
+            return; // failure in Assembly.
+        }
+        Module module = application.findModule( "Layer 1", "Module 1" );
+        module.injectTo( this );
+    }
+
+    @Override
+    protected void defineApplication( ApplicationAssembly applicationAssembly )
+        throws AssemblyException
+    {
+        LayerAssembly layer = applicationAssembly.layer( "Layer 1" );
+        ModuleAssembly module = layer.module( "Module 1" );
+        new DefaultUnitOfWorkAssembler().assemble( module );
+        module.objects( AbstractPolygeneTest.this.getClass() );
+        assemble( module );
+    }
+
+    @After
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        if( unitOfWorkFactory != null && unitOfWorkFactory.isUnitOfWorkActive() )
+        {
+            while( unitOfWorkFactory.isUnitOfWorkActive() )
+            {
+                UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
+                if( uow.isOpen() )
+                {
+                    System.err.println( "UnitOfWork not cleaned up:" + uow.usecase().name() );
+                    uow.discard();
+                }
+                else
+                {
+                    throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is: " + uow
+                        .usecase()
+                        .name() );
+                }
+            }
+            new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace();
+        }
+        super.tearDown();
+    }
+}
\ No newline at end of file


[21/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueAssembly.java
new file mode 100644
index 0000000..83352d0
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueAssembly.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * This represents the assembly information of a single ValueComposite in a Module.
+ */
+public interface ValueAssembly
+    extends HasTypes
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueDeclaration.java
new file mode 100644
index 0000000..415335d
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ValueDeclaration.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+
+/**
+ * Fluent API for declaring values
+ */
+public interface ValueDeclaration
+{
+    ValueDeclaration setMetaInfo( Object info );
+
+    ValueDeclaration visibleIn( Visibility visibility );
+
+    ValueDeclaration withConcerns( Class<?>... concerns );
+
+    ValueDeclaration withSideEffects( Class<?>... sideEffects );
+
+    ValueDeclaration withMixins( Class<?>... mixins );
+
+    ValueDeclaration withTypes( Class<?>... roles );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
new file mode 100644
index 0000000..c5c5386
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.spi.PolygeneSPI;
+
+/**
+ * This interface has to be implemented by Polygene runtimes.
+ */
+public interface PolygeneRuntime
+{
+    ApplicationAssemblyFactory applicationAssemblyFactory();
+
+    ApplicationModelFactory applicationModelFactory();
+
+    PolygeneAPI api();
+
+    PolygeneSPI spi();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
new file mode 100644
index 0000000..313be1e
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
@@ -0,0 +1,303 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.builder;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.apache.polygene.api.activation.ActivationEventListener;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.ApplicationPassivationThread;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+/**
+ * Application Builder.
+ */
+public class ApplicationBuilder
+    implements ActivationEventListenerRegistration
+{
+    private final String applicationName;
+    private String applicationVersion;
+    private Application.Mode applicationMode;
+    private final List<Object> metaInfos = new ArrayList<>();
+    private boolean passivationShutdownHook;
+    private final Map<String, LayerDeclaration> layers = new HashMap<>();
+    private final List<ActivationEventListener> activationListeners = new ArrayList<>();
+
+    public ApplicationBuilder( String applicationName )
+    {
+        this.applicationName = applicationName;
+    }
+
+    public ApplicationBuilder version( String version )
+    {
+        applicationVersion = version;
+        return this;
+    }
+
+    public ApplicationBuilder mode( Application.Mode mode )
+    {
+        applicationMode = mode;
+        return this;
+    }
+
+    public ApplicationBuilder metaInfo( Object... metaInfos )
+    {
+        for( Object metaInfo : metaInfos )
+        {
+            this.metaInfos.add( metaInfo );
+        }
+        return this;
+    }
+
+    /**
+     * Register a JVM shutdown hook that passivate the Application.
+     *
+     * The hook is registered after activating the Application and before {@link #afterActivation()}.
+     *
+     * @return This builder
+     */
+    public ApplicationBuilder withPassivationShutdownHook()
+    {
+        this.passivationShutdownHook = true;
+        return this;
+    }
+
+    /**
+     * Create and activate a new Application.
+     * @return Activated Application
+     * @throws AssemblyException if the assembly failed
+     * @throws ActivationException if the activation failed
+     */
+    public Application newApplication()
+        throws AssemblyException, ActivationException
+    {
+        Energy4Java zest = new Energy4Java();
+        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
+        {
+            @Override
+            public ApplicationAssembly assemble( ApplicationAssemblyFactory factory )
+                throws AssemblyException
+            {
+                ApplicationAssembly assembly = factory.newApplicationAssembly();
+                assembly.setName( applicationName );
+                if( applicationVersion != null )
+                {
+                    assembly.setVersion( applicationVersion );
+                }
+                if( applicationMode != null )
+                {
+                    assembly.setMode( applicationMode );
+                }
+                for( Object metaInfo : metaInfos )
+                {
+                    assembly.setMetaInfo( metaInfo );
+                }
+                HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
+                for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() )
+                {
+                    LayerAssembly layer = entry.getValue().createLayer( assembly );
+                    createdLayers.put( entry.getKey(), layer );
+                }
+                for( LayerDeclaration layer : layers.values() )
+                {
+                    layer.initialize( createdLayers );
+                }
+                return assembly;
+            }
+        } );
+        Application application = model.newInstance( zest.api() );
+        for( ActivationEventListener activationListener : activationListeners )
+        {
+            application.registerActivationEventListener( activationListener );
+        }
+        beforeActivation();
+        application.activate();
+        if( passivationShutdownHook )
+        {
+            Runtime.getRuntime().addShutdownHook( new ApplicationPassivationThread( application ) );
+        }
+        afterActivation();
+        return application;
+    }
+
+    /**
+     * Called before application activation.
+     */
+    protected void beforeActivation()
+    {
+    }
+
+    /**
+     * Called after application activation.
+     */
+    protected void afterActivation()
+    {
+    }
+
+    @Override
+    public void registerActivationEventListener( ActivationEventListener listener )
+    {
+        activationListeners.add( listener );
+    }
+
+    @Override
+    public void deregisterActivationEventListener( ActivationEventListener listener )
+    {
+        activationListeners.remove( listener );
+    }
+
+    /**
+     * Declare Layer.
+     * @param layerName Name of the Layer
+     * @return Layer declaration for the given name, new if did not already exists
+     */
+    public LayerDeclaration withLayer( String layerName )
+    {
+        LayerDeclaration layerDeclaration = layers.get( layerName );
+        if( layerDeclaration != null )
+        {
+            return layerDeclaration;
+        }
+        layerDeclaration = new LayerDeclaration( layerName );
+        layers.put( layerName, layerDeclaration );
+        return layerDeclaration;
+    }
+
+    /**
+     * Load an ApplicationBuilder from a JSON String.
+     * @param json JSON String
+     * @return Application Builder loaded from JSON
+     * @throws JSONException if unable to read JSON
+     * @throws AssemblyException if unable to declare the assembly
+     */
+    public static ApplicationBuilder fromJson( String json )
+        throws JSONException, AssemblyException
+    {
+        JSONObject root = new JSONObject( json );
+        return fromJson( root );
+    }
+
+    /**
+     * Load an ApplicationBuilder from a JSON InputStream.
+     * @param json JSON input
+     * @return Application Builder loaded from JSON
+     * @throws JSONException if unable to read JSON
+     * @throws AssemblyException if unable to declare the assembly
+     */
+    public static ApplicationBuilder fromJson( InputStream json )
+        throws JSONException, AssemblyException
+    {
+        String jsonString = new Scanner( json, "UTF-8" ).useDelimiter( "\\A" ).next();
+        return fromJson( jsonString );
+    }
+
+    /**
+     * Load an ApplicationBuilder from a JSONObject.
+     * @param root JSON object
+     * @return Application Builder loaded from JSON
+     * @throws JSONException if unable to read JSON
+     * @throws AssemblyException if unable to declare the assembly
+     */
+    public static ApplicationBuilder fromJson( JSONObject root )
+        throws JSONException, AssemblyException
+    {
+        String applicationName = root.getString( "name" );
+        ApplicationBuilder builder = new ApplicationBuilder( applicationName );
+        builder.configureWithJson( root );
+        return builder;
+    }
+
+    /** Configures the application struucture from a JSON document.
+     *
+     * @param root The JSON document root.
+     * @throws JSONException if the JSON document isn't valid.
+     * @throws AssemblyException if probelms in the Assemblers provided in the JSON document.
+     */
+    protected void configureWithJson( JSONObject root )
+        throws JSONException, AssemblyException
+    {
+        JSONArray layers = root.optJSONArray( "layers" );
+        if( layers != null )
+        {
+            for( int i = 0; i < layers.length(); i++ )
+            {
+                JSONObject layerObject = layers.getJSONObject( i );
+                String layerName = layerObject.getString( "name" );
+                LayerDeclaration layerDeclaration = withLayer( layerName );
+                JSONArray using = layerObject.optJSONArray( "uses" );
+                if( using != null )
+                {
+                    for( int j = 0; j < using.length(); j++ )
+                    {
+                        layerDeclaration.using( using.getString( j ) );
+                    }
+                }
+                JSONArray modules = layerObject.optJSONArray( "modules" );
+                if( modules != null )
+                {
+                    for( int k = 0; k < modules.length(); k++ )
+                    {
+                        JSONObject moduleObject = modules.getJSONObject( k );
+                        String moduleName = moduleObject.getString( "name" );
+                        ModuleDeclaration moduleDeclaration = layerDeclaration.withModule( moduleName );
+                        JSONArray assemblers = moduleObject.optJSONArray( "assemblers" );
+                        if( assemblers != null )
+                        {
+                            for( int m = 0; m < assemblers.length(); m++ )
+                            {
+                                String string = assemblers.getString( m );
+                                moduleDeclaration.withAssembler( string );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * {@literal main} method that read JSON from STDIN.
+     * <p>Passivation exceptions are written to STDERR if any.</p>
+     * @param args Unused
+     * @throws JSONException if unable to read JSON
+     * @throws AssemblyException if the assembly failed
+     * @throws ActivationException if the activation failed
+     */
+    public static void main( String[] args )
+        throws JSONException, ActivationException, AssemblyException
+    {
+        fromJson( System.in ).withPassivationShutdownHook().newApplication();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/LayerDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/LayerDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/LayerDeclaration.java
new file mode 100644
index 0000000..2bc14f0
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/LayerDeclaration.java
@@ -0,0 +1,111 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.builder;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.StreamSupport;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+/**
+ * Provides declared {@link org.apache.polygene.api.structure.Layer} information that the {@link ApplicationBuilder} can use.
+ */
+public class LayerDeclaration
+{
+    private final String layerName;
+    private final List<String> using = new ArrayList<>();
+    private final Map<String, ModuleDeclaration> modules = new HashMap<>();
+    private LayerAssembly layer;
+
+    LayerDeclaration( String layerName )
+    {
+        this.layerName = layerName;
+    }
+
+    /**
+     * Declare using layer.
+     * @param layerName Used layer name
+     * @return This Layer declaration
+     */
+    public LayerDeclaration using( String layerName )
+    {
+        this.using.add( layerName );
+        return this;
+    }
+
+    /**
+     * Declare using layers.
+     * @param layerNames Used layers names
+     * @return This Layer declaration
+     */
+    public LayerDeclaration using( Iterable<String> layerNames )
+    {
+        StreamSupport.stream( layerNames.spliterator(), false )
+                     .forEach( using::add );
+        return this;
+    }
+
+    /**
+     * Declare Module.
+     * @param moduleName Name of the Module
+     * @return Module declaration for the given name, new if did not already exists
+     */
+    public ModuleDeclaration withModule( String moduleName )
+    {
+        ModuleDeclaration module = modules.get( moduleName );
+        if( module != null )
+        {
+            return module;
+        }
+        module = new ModuleDeclaration( moduleName );
+        modules.put( moduleName, module );
+        return module;
+    }
+
+    LayerAssembly createLayer( ApplicationAssembly application )
+    {
+        layer = application.layer( layerName );
+        layer.setName( layerName );
+        for( ModuleDeclaration module : modules.values() )
+        {
+            ModuleAssembly assembly = module.createModule( layer );
+        }
+        return layer;
+    }
+
+    void initialize( HashMap<String, LayerAssembly> createdLayers )
+        throws AssemblyException
+    {
+        for( String uses : using )
+        {
+            LayerAssembly usedLayer = createdLayers.get( uses );
+            layer.uses( usedLayer );
+        }
+        for( ModuleDeclaration module : modules.values() )
+        {
+            module.initialize();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ModuleDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ModuleDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ModuleDeclaration.java
new file mode 100644
index 0000000..fb20c26
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ModuleDeclaration.java
@@ -0,0 +1,168 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.builder;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.StreamSupport;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.api.util.Classes.isAssignableFrom;
+
+/**
+ * Provides declared {@link org.apache.polygene.api.structure.Module} information that the {@link ApplicationBuilder} can use.
+ */
+public class ModuleDeclaration
+{
+    private final String moduleName;
+    private final List<Assembler> assemblers = new ArrayList<>();
+    private ModuleAssembly module;
+
+    public ModuleDeclaration( String moduleName )
+    {
+        this.moduleName = moduleName;
+    }
+
+    /**
+     * Declare Assembler.
+     * @param assembler Assembler instance
+     * @return This Module declaration
+     */
+    public ModuleDeclaration withAssembler( Assembler assembler )
+    {
+        assemblers.add( assembler );
+        return this;
+    }
+
+    /**
+     * Declare Assembler.
+     * @param classname Assembler class name
+     * @return This Module declaration
+     * @throws AssemblyException if unable to load class, not an Assembler or unable to instanciate
+     */
+    public ModuleDeclaration withAssembler( String classname )
+        throws AssemblyException
+    {
+        Class<? extends Assembler> clazz = loadClass( classname );
+        return withAssembler( clazz );
+    }
+
+    /**
+     * Declare Assembler.
+     * @param assemblerClass Assembler class
+     * @return This Module declaration
+     * @throws AssemblyException not an Assembler or if unable to instanciate
+     */
+    public ModuleDeclaration withAssembler( Class<?> assemblerClass )
+        throws AssemblyException
+    {
+        Assembler assembler = createAssemblerInstance( assemblerClass );
+        assemblers.add( assembler );
+        return this;
+    }
+
+    /**
+     * Declare Assemblers.
+     * <p>Declare several Assemblers from an Iterable of Class objects.</p>
+     * <p>Typically used along {@link org.apache.polygene.bootstrap.ClassScanner}.</p>
+     * @param assemblerClasses Assembler classes
+     * @return This Module declaration
+     * @throws AssemblyException if one of the Class is not an Assembler or unable to instantiate
+     */
+    public ModuleDeclaration withAssemblers( Iterable<Class<?>> assemblerClasses )
+        throws AssemblyException
+    {
+        List<Class<?>> notAssemblers = StreamSupport.stream( assemblerClasses.spliterator(), false )
+                                                    .filter( isAssignableFrom( Assembler.class ).negate() )
+                                                    .collect( toList() );
+        if( !notAssemblers.isEmpty() )
+        {
+            throw new AssemblyException(
+                "Classes " + notAssemblers + " are not implementing " + Assembler.class.getName()
+            );
+        }
+        for( Class<?> assemblerClass : assemblerClasses )
+        {
+            withAssembler( assemblerClass );
+        }
+        return this;
+    }
+
+    ModuleAssembly createModule( LayerAssembly layer )
+    {
+        module = layer.module( moduleName );
+        return module;
+    }
+
+    void initialize()
+        throws AssemblyException
+    {
+        for( Assembler assembler : assemblers )
+        {
+            assembler.assemble( module );
+        }
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private Class<? extends Assembler> loadClass( String classname )
+        throws AssemblyException
+    {
+        Class<?> clazz;
+        try
+        {
+            clazz = getClass().getClassLoader().loadClass( classname );
+        }
+        catch( Exception e )
+        {
+            throw new AssemblyException( "Unable to load class " + classname, e );
+        }
+        if( !Assembler.class.isAssignableFrom( clazz ) )
+        {
+            throw new AssemblyException(
+                "Class " + classname + " is not implementing " + Assembler.class.getName()
+            );
+        }
+        //noinspection unchecked
+        return (Class<? extends Assembler>) clazz;
+    }
+
+    private Assembler createAssemblerInstance( Class<?> assemblerClass )
+        throws AssemblyException
+    {
+        if( !Assembler.class.isAssignableFrom( assemblerClass ) )
+        {
+            throw new AssemblyException(
+                "Class " + assemblerClass + " is not implementing " + Assembler.class.getName()
+            );
+        }
+        try
+        {
+            return (Assembler) assemblerClass.newInstance();
+        }
+        catch( Exception e )
+        {
+            throw new AssemblyException( "Unable to instantiate " + assemblerClass, e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/package.html b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/package.html
new file mode 100644
index 0000000..6c1ff92
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/package.html
@@ -0,0 +1,28 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Application Builder.</h2>
+        <p>
+            Generic ApplicationBuilder, which simplifies the creation of Application Structure, either by a fluid DSL
+            or from a JSON file.
+        </p>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/identity/DefaultIdentityGeneratorAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
new file mode 100644
index 0000000..e50ec45
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/identity/DefaultIdentityGeneratorAssembler.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.identity;
+
+import org.apache.polygene.api.identity.IdentityGenerator;
+import org.apache.polygene.api.identity.UuidGeneratorMixin;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+public class DefaultIdentityGeneratorAssembler
+    implements Assembler
+{
+
+    @Override
+    public void assemble(ModuleAssembly module)
+            throws AssemblyException
+    {
+        module.services(IdentityGenerator.class).withMixins(UuidGeneratorMixin.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/IllegalLayerAssemblerException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/IllegalLayerAssemblerException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/IllegalLayerAssemblerException.java
new file mode 100644
index 0000000..9c843d1
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/IllegalLayerAssemblerException.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.layered;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+
+public class IllegalLayerAssemblerException extends AssemblyException
+{
+    public IllegalLayerAssemblerException( String message )
+    {
+        super( message );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
new file mode 100644
index 0000000..1d91d88
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayerAssembler.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.layered;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+public interface LayerAssembler
+{
+    LayerAssembly assemble( LayerAssembly layer )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
new file mode 100644
index 0000000..58e5a9e
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
@@ -0,0 +1,297 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.layered;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.LayerAssembly;
+
+public abstract class LayeredApplicationAssembler
+    implements ApplicationAssembler
+{
+    protected final Energy4Java zest;
+    protected final String name;
+    protected final String version;
+
+    private final Application.Mode mode;
+    private final HashMap<Class<? extends LayerAssembler>, LayerAssembler> assemblers = new HashMap<>();
+
+    private ApplicationAssembly assembly;
+    protected ApplicationDescriptor model;
+    protected Application application;
+
+    public LayeredApplicationAssembler( String name, String version, Application.Mode mode )
+        throws AssemblyException
+    {
+        this.name = name;
+        this.version = version;
+        this.mode = mode;
+        zest = new Energy4Java();
+    }
+
+    public void initialize()
+        throws AssemblyException
+    {
+        model = zest.newApplicationModel( this );
+        onModelCreated( model );
+        instantiateApplication( zest, model );
+    }
+
+    public ApplicationAssembly assembly()
+    {
+        return assembly;
+    }
+
+    /**
+     * This method is called from the <code>initialize</code> method to instantiate the Polygene application from the
+     * application model.
+     *
+     * <p>
+     * The default implementation simply calls;
+     * </p>
+     * <pre><code>
+     *   application = model.newInstance( polygene.spi() );
+     * </code></pre>
+     *
+     * @param zest  The Polygene runtime engine.
+     * @param model The application model descriptor.
+     */
+    protected void instantiateApplication( Energy4Java zest, ApplicationDescriptor model )
+    {
+        application = model.newInstance( zest.spi() );
+    }
+
+    /**
+     * This method is called after the Application Model has been created, before the instantiation of the Polygene
+     * application.
+     *
+     * <p>
+     * The default implementation does nothing. Applications may have advanced features to inspect or
+     * modify the model prior to instantiation, and this is the place where such advanced manipulation is
+     * expected to take place.
+     * </p>
+     *
+     * @param model The model that has just been created.
+     */
+    protected void onModelCreated( ApplicationDescriptor model )
+    {
+    }
+
+    public ApplicationDescriptor model()
+    {
+        return model;
+    }
+
+    public Application application()
+    {
+        return application;
+    }
+
+    public void start()
+        throws ActivationException
+    {
+        application.activate();
+    }
+
+    public void stop()
+        throws PassivationException
+    {
+        application.passivate();
+    }
+
+    @Override
+    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException
+    {
+        assembly = applicationFactory.newApplicationAssembly();
+        assembly.setName( name );
+        assembly.setVersion( version );
+        assembly.setMode( mode );
+        assembleLayers( assembly );
+        return assembly;
+    }
+
+    protected LayerAssembly createLayer( Class<? extends LayerAssembler> layerAssemblerClass )
+        throws IllegalArgumentException
+    {
+        try
+        {
+            String classname = layerAssemblerClass.getSimpleName();
+            if( classname.endsWith( "Layer" ) )
+            {
+                classname = classname.substring( 0, classname.length() - 5 ) + " Layer";
+            }
+            setNameIfPresent( layerAssemblerClass, classname );
+            LayerAssembly layer = assembly.layer( classname );
+
+            LayerAssembler layerAssembler = instantiateLayerAssembler( layerAssemblerClass, layer );
+            assemblers.put( layerAssemblerClass, layerAssembler );
+            assembleLayer( layerAssembler, layer );
+            return layer;
+        }
+        catch( Exception e )
+        {
+            throw new IllegalArgumentException( "Unable to instantiate layer with " + layerAssemblerClass.getSimpleName(), e );
+        }
+    }
+
+    protected void assembleLayer( LayerAssembler layerAssembler, LayerAssembly layer )
+        throws AssemblyException
+    {
+        layerAssembler.assemble( layer );
+    }
+
+    protected <T extends LayerAssembler> LayerAssembler instantiateLayerAssembler( Class<T> layerAssemblerClass,
+                                                                                   LayerAssembly layer
+    )
+        throws InstantiationException, IllegalAccessException, InvocationTargetException, IllegalLayerAssemblerException
+    {
+        LayerAssembler assembler = createWithFactoryMethod( layerAssemblerClass, layer );
+        if( assembler != null )
+        {
+            return assembler;
+        }
+        assembler = createWithConstructor( layerAssemblerClass, layer );
+        if( assembler != null )
+        {
+            return assembler;
+        }
+        throw new IllegalLayerAssemblerException( "No matching factory method nor constructor found in " + layerAssemblerClass );
+    }
+
+    private LayerAssembler createWithFactoryMethod( Class<? extends LayerAssembler> layerAssemblerClass,
+                                                    LayerAssembly layer
+    )
+        throws InvocationTargetException, IllegalAccessException
+    {
+        try
+        {
+            Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create", LayerAssembly.class );
+            factoryMethod.setAccessible( true );
+            int modifiers = factoryMethod.getModifiers();
+            if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
+            {
+                return (LayerAssembler) factoryMethod.invoke( null, layer );
+            }
+        }
+        catch( NoSuchMethodException e )
+        {
+            try
+            {
+                Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create" );
+                factoryMethod.setAccessible( true );
+                int modifiers = factoryMethod.getModifiers();
+                if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
+                {
+                    return (LayerAssembler) factoryMethod.invoke( null );
+                }
+            }
+            catch( NoSuchMethodException e1 )
+            {
+            }
+        }
+        return null;
+    }
+
+    private LayerAssembler createWithConstructor( Class<? extends LayerAssembler> layerAssemblerClass,
+                                                  LayerAssembly assembly
+    )
+        throws IllegalAccessException, InvocationTargetException, InstantiationException
+    {
+        try
+        {
+            Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getConstructor( LayerAssembly.class );
+            if( constructor != null )
+            {
+                constructor.setAccessible( true );
+                return constructor.newInstance( assembly );
+            }
+        }
+        catch( NoSuchMethodException e )
+        {
+            try
+            {
+                Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getDeclaredConstructor();
+                if( constructor != null )
+                {
+                    constructor.setAccessible( true );
+                    System.out.println(constructor);
+                    return constructor.newInstance();
+                }
+            }
+            catch( NoSuchMethodException e1 )
+            {
+                return null;
+            }
+        }
+        return null;
+    }
+
+    static void setNameIfPresent( Class<?> clazz, String classname )
+        throws IllegalAccessException
+    {
+        try
+        {
+            Field field = clazz.getDeclaredField( "NAME" );
+            if( Modifier.isStatic( field.getModifiers() ) )
+            {
+                field.setAccessible( true );
+                field.set( null, classname );
+            }
+        }
+        catch( Exception e )
+        {
+            // Ignore and consider normal.
+        }
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected <T extends LayerAssembler> T assemblerOf( Class<T> layerAssemblerClass )
+    {
+        return (T) assemblers.get( layerAssemblerClass );
+    }
+
+    /**
+     * Called from the <code>assemble</code> method to assemble the layers in the application.
+     *
+     * <p>
+     * This method must be implemented, and is typically a list of LayerAssembler instantiations, followed
+     * by {@link LayerAssembly#uses(LayerAssembly...)} declarations.
+     * </p>
+     *
+     * @param assembly Application assembly
+     * @throws AssemblyException on invalid assembly
+     */
+    protected abstract void assembleLayers( ApplicationAssembly assembly )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
new file mode 100644
index 0000000..9783de5
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.layered;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+public abstract class LayeredLayerAssembler
+    implements LayerAssembler
+{
+    private HashMap<Class<? extends ModuleAssembler>, ModuleAssembler> assemblers = new HashMap<>();
+
+    protected ModuleAssembly createModule( LayerAssembly layer, Class<? extends ModuleAssembler> moduleAssemblerClass )
+    {
+        try
+        {
+            ModuleAssembler moduleAssembler = instantiateAssembler( layer, moduleAssemblerClass );
+            String moduleName = createModuleName( moduleAssemblerClass );
+            LayeredApplicationAssembler.setNameIfPresent( moduleAssemblerClass, moduleName );
+            ModuleAssembly module = layer.module( moduleName );
+            assemblers.put( moduleAssemblerClass, moduleAssembler );
+            ModuleAssembly assembly = moduleAssembler.assemble( layer, module );
+            if( assembly == null )
+            {
+                return module;
+            }
+            return assembly;
+        }
+        catch( Exception e )
+        {
+            throw new IllegalArgumentException( "Unable to instantiate module with " + moduleAssemblerClass.getSimpleName(), e );
+        }
+    }
+
+    protected String createModuleName( Class<? extends ModuleAssembler> modulerAssemblerClass )
+    {
+        String moduleName = modulerAssemblerClass.getSimpleName();
+        if( moduleName.endsWith( "Module" ) )
+        {
+            moduleName = moduleName.substring( 0, moduleName.length() - 6 ) + " Module";
+        }
+        return moduleName;
+    }
+
+    protected ModuleAssembler instantiateAssembler( LayerAssembly layer,
+                                                  Class<? extends ModuleAssembler> modulerAssemblerClass
+    )
+        throws InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, NoSuchMethodException
+    {
+        ModuleAssembler moduleAssembler;
+        try
+        {
+            Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor( ModuleAssembly.class );
+            assemblyConstructor.setAccessible( true );
+            moduleAssembler = assemblyConstructor.newInstance( layer );
+        }
+        catch( NoSuchMethodException e )
+        {
+            Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor();
+            assemblyConstructor.setAccessible( true );
+            moduleAssembler = assemblyConstructor.newInstance();
+        }
+        return moduleAssembler;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected <T extends ModuleAssembler> T assemblerOf( Class<T> moduleAssemblerType )
+    {
+        return (T) assemblers.get( moduleAssemblerType );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
new file mode 100644
index 0000000..739c3ad
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/ModuleAssembler.java
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.layered;
+
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+public interface ModuleAssembler
+{
+    ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/package.html b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/package.html
new file mode 100644
index 0000000..0b8300b
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Layered Assembly.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/package.html
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/package.html b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/package.html
new file mode 100644
index 0000000..7c867b8
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Assembly and Bootstrap API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
new file mode 100644
index 0000000..6383b75
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/unitofwork/DefaultUnitOfWorkAssembler.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap.unitofwork;
+
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+public class DefaultUnitOfWorkAssembler
+    implements Assembler
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        Class factoryMixin = loadMixinClass( "org.apache.polygene.runtime.unitofwork.UnitOfWorkFactoryMixin" );
+        module.services( UnitOfWorkFactory.class ).withMixins( factoryMixin );
+
+        Class uowMixin = loadMixinClass( "org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork" );
+        module.transients( UnitOfWork.class ).withMixins( uowMixin );
+    }
+
+    private Class<?> loadMixinClass( String name )
+        throws AssemblyException
+    {
+        try
+        {
+            return getClass().getClassLoader().loadClass( name );
+        }
+        catch( ClassNotFoundException e )
+        {
+            throw new AssemblyException( "Default UnitOfWorkFactory mixin is not present in the system." );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
deleted file mode 100644
index a2dbb67..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Implement this interface to create the root class that
- * is responsible for assembling your entire application.
- *
- * Model introspectors will instantiate this class and call assemble
- * to create the application, which will then be visited to get
- * information about its structure.
- *
- * Application deployment servers will instantiate this, call assemble,
- * and then activate the created application, which will be the runtime
- * instance that forms your application.
- */
-public interface ApplicationAssembler
-{
-    ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
deleted file mode 100644
index 519f47b..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblerAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Helper base class for application assemblers that
- * want to either create applications using only one layer/module,
- * or that wants to create pancake-layered applications.
- */
-public class ApplicationAssemblerAdapter
-    implements ApplicationAssembler
-{
-    private final Assembler[][][] assemblers;
-
-    protected ApplicationAssemblerAdapter( Assembler assembler )
-    {
-        this.assemblers = new Assembler[][][]{ { { assembler } } };
-    }
-
-    protected ApplicationAssemblerAdapter( Assembler[][][] assemblers )
-    {
-        this.assemblers = assemblers;
-    }
-
-    @Override
-    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-        throws AssemblyException
-    {
-        return applicationFactory.newApplicationAssembly( assemblers );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
deleted file mode 100644
index 8219f0e..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssembly.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.structure.Application;
-
-/**
- * An application assembly. This can be used by Assemblers to programmatically
- * set the name of the application and create new layers.
- */
-public interface ApplicationAssembly
-{
-    /**
-     * Create a new layer assembly
-     *
-     * @param name of the new layer
-     *
-     * @return a LayerAssembly instance
-     */
-    LayerAssembly layer( String name );
-
-    /**
-     * Get an assembly for a particular Module. If this is called many times with the same names, then the same module
-     * is affected.
-     *
-     * @param layerName The name of the Layer
-     * @param moduleName The name of the Module to retrieve or create.
-     * @return The ModuleAssembly for the Module.
-     */
-    ModuleAssembly module( String layerName, String moduleName );
-    
-    /**
-     * Get the currently set name of the application
-     *
-     * @return the name of the application
-     */
-    String name();
-
-    /**
-     * Get the currently set mode of the application
-     *
-     * @return the application mode
-     */
-    Application.Mode mode();
-
-    /**
-     * Set the name of the application
-     *
-     * @param name of the application
-     *
-     * @return the assembly
-     */
-    ApplicationAssembly setName( String name );
-
-    /**
-     * Set the version of the application. This can be in any format, but
-     * most likely will follow the Dewey format, i.e. x.y.z.
-     *
-     * @param version of the application
-     *
-     * @return the assembly
-     */
-    ApplicationAssembly setVersion( String version );
-
-    /**
-     * Set the application mode. This will be set to "production" by default. You can
-     * set the system property "mode" to either "development", "satisfiedBy" or "production"
-     * to explicitly set the mode. If that is not an option, then call this method
-     * during assembly to set the mode. The mode may then be queried by assemblers,
-     * and they may assemble the application differentlly depending on this setting.
-     *
-     * @param mode the application mode
-     *
-     * @return the assembly
-     */
-    ApplicationAssembly setMode( Application.Mode mode );
-
-    ApplicationAssembly setMetaInfo( Object info );
-
-    /**
-     * Set the application activators. Activators are executed in order around the
-     * Application activation and passivation.
-     *
-     * @param activators the application activators
-     * @return the assembly
-     */
-    @SuppressWarnings( { "unchecked","varargs" } )
-    ApplicationAssembly withActivators( Class<? extends Activator<Application>>... activators );
-
-    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
deleted file mode 100644
index 0b9a3d5..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationAssemblyFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Factory for creating new Polygene application assemblies. Typically
- * you will implement one or more Assemblers, wrap them in an ApplicationAssembler,
- * which then uses this factory to assemble and create applications.
- */
-public interface ApplicationAssemblyFactory
-{
-    /**
-     * Create a new application with one layer and one module.
-     *
-     * @param assembler the assembler for the single module
-     *
-     * @return the application instance
-     *
-     * @throws AssemblyException if the application could not be assembled
-     */
-    ApplicationAssembly newApplicationAssembly( Assembler assembler )
-        throws AssemblyException;
-
-    /**
-     * Create a new application with the same amount of layers
-     * as the first array size, with modules according to the second array size,
-     * and then use the third array for assemblers of each module. This gives you
-     * a simple way to create "pancake" layered applications.
-     *
-     * @param assemblers the set of assemblers for the application
-     *
-     * @return the application instance
-     *
-     * @throws AssemblyException if the application could not be assembled
-     */
-    ApplicationAssembly newApplicationAssembly( Assembler[][][] assemblers )
-        throws AssemblyException;
-
-    /**
-     * Create a new ApplicationAssembly that can be used for the above method.
-     *
-     * @return a new ApplicationAssembly
-     */
-    ApplicationAssembly newApplicationAssembly();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
deleted file mode 100644
index a8d72be..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationModelFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.structure.ApplicationDescriptor;
-
-/**
- * Factory for ApplicationModelSPI's. Takes an ApplicationAssembly, executes it,
- * and builds an application model from it, which can then be instantiated and activated.
- */
-public interface ApplicationModelFactory
-{
-    ApplicationDescriptor newApplicationModel( ApplicationAssembly assembly )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
deleted file mode 100644
index a045eb3..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ApplicationName.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Set the name of the application
- */
-public final class ApplicationName
-    implements Assembler
-{
-    private String name;
-
-    public ApplicationName( String name )
-    {
-        this.name = name;
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.layer().application().setName( name );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
deleted file mode 100644
index f7809f0..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assembler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * ModuleAssemblies are configured by Assemblers. This
- * is the interface you would implement in order to provide
- * all configuration and additional metainfo that is needed
- * to instantiate a Polygene application.
- */
-public interface Assembler
-{
-    /**
-     * Assemblers receive a callback to the ModuleAssembly
-     * they are supposed to configure. They can use this
-     * to register objects, composites, services etc. and
-     * the additional metadata that may exist for these
-     * artifacts.
-     * <p>
-     * An Assembler may create new Modules by calling
-     * {@link org.apache.zest.bootstrap.ModuleAssembly#layer()} and
-     * then {@link LayerAssembly#module(String)} (String)}.
-     * This allows an Assembler to bootstrap an entire Layer with
-     * more Modules.
-     * </p>
-     * @param module the Module to assemble
-     *
-     * @throws AssemblyException thrown if the assembler tries to do something illegal
-     */
-    void assemble( ModuleAssembly module )
-        throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
deleted file mode 100644
index e222efb..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblerCollection.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * Assembler that delegates to a collection of Assemblers.
- * <p>
- * Makes it easy to collect and compose assemblers into bigger assemblers.
- * </p>
- */
-public final class AssemblerCollection
-    implements Assembler
-{
-    Collection<Assembler> assemblers;
-
-    public AssemblerCollection( Assembler... assemblers )
-    {
-        this.assemblers = Arrays.asList( assemblers );
-    }
-
-    @SafeVarargs
-    public AssemblerCollection( Class<? extends Assembler>... assemblyClasses )
-        throws AssemblyException
-    {
-        assemblers = new ArrayList<>();
-        for( Class<? extends Assembler> assemblyClass : assemblyClasses )
-        {
-            try
-            {
-                Assembler assembler = assemblyClass.newInstance();
-                assemblers.add( assembler );
-            }
-            catch( Exception e )
-            {
-                throw new AssemblyException( "Could not instantiate assembly with class " + assemblyClass.getName(), e );
-            }
-        }
-    }
-
-    public AssemblerCollection( Collection<Assembler> assemblers )
-    {
-        this.assemblers = assemblers;
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        for( Assembler assembler : assemblers )
-        {
-            assembler.assemble( module );
-        }
-    }
-}


[74/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
new file mode 100644
index 0000000..b64d762
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/appliesTo/inspections/AppliesToAnnotationDeclaredCorrectlyInspection.java
@@ -0,0 +1,294 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.appliesTo.inspections;
+
+import com.intellij.codeInspection.InspectionManager;
+import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
+import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
+import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToUtil.*;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.isImplementsInvocationHandler;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAGenericConcern;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isAGenericSideEffect;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class AppliesToAnnotationDeclaredCorrectlyInspection extends AbstractInspection
+{
+    @NotNull
+    protected final String resourceBundlePrefixId()
+    {
+        return "applies.to.annotation.declared.correctly";
+    }
+
+    @NotNull
+    public final String getShortName()
+    {
+        return "AppliesToAnnotationDeclaredCorrectlyInspection";
+    }
+
+    @Override
+    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
+                                                 @NotNull InspectionManager manager,
+                                                 boolean isOnTheFly )
+    {
+        PsiAnnotation appliesToAnnotation = getAppliesToAnnotation( psiClass );
+        if( appliesToAnnotation == null )
+        {
+            // If class does not have @AppliesTo, ignore
+            return null;
+        }
+
+        String classQualifiedName = psiClass.getQualifiedName();
+        // @AppliesTo can only be declared on class
+        if( psiClass.isInterface() )
+        {
+            // Suggest remove applies to
+            String message = message(
+                "applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class"
+            );
+            ProblemDescriptor problemDescriptor = createRemoveAppliesToFilterProblemDescriptor(
+                manager, message, appliesToAnnotation );
+            return new ProblemDescriptor[]{ problemDescriptor };
+        }
+
+        // If @AppliesTo annotation is empty, ignore
+        List<PsiAnnotationMemberValue> appliesToAnnotationValues = getAppliesToAnnotationValue( appliesToAnnotation );
+        if( appliesToAnnotationValues.isEmpty() )
+        {
+            return null;
+        }
+
+        // If AppliesToFilter is not resolved, ignore
+        Project project = psiClass.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( psiClass );
+        PsiClass appliesToFilterClass = getAppliesToFilterClass( project, searchScope );
+        if( appliesToFilterClass == null )
+        {
+            return null;
+        }
+
+        boolean classIsAConcern = isAConcern( psiClass );
+        boolean classIsASideEffect = isASideEffect( psiClass );
+        boolean classIsAGenericConcern = classIsAConcern && isAGenericConcern( psiClass );
+        boolean classIsAGenericSideEffect = classIsASideEffect && isAGenericSideEffect( psiClass );
+        boolean classIsAMixin = !classIsAConcern && !classIsASideEffect;
+        boolean classIsAGenericMixin = classIsAMixin && isImplementsInvocationHandler( psiClass );
+
+        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
+        for( PsiAnnotationMemberValue appliesToAnnotationValue : appliesToAnnotationValues )
+        {
+            PsiJavaCodeReferenceElement appliesToValueClassReference =
+                getAppliesToValueClassReference( appliesToAnnotationValue );
+
+            // If it's not a class reference, ignore
+            if( appliesToValueClassReference == null )
+            {
+                continue;
+            }
+
+            // If class reference can't be resolved, ignore
+            PsiClass appliesToValueClass = (PsiClass) appliesToValueClassReference.resolve();
+            if( appliesToValueClass == null )
+            {
+                continue;
+            }
+
+            String appliesToValueQualifiedName = appliesToValueClass.getQualifiedName();
+            boolean appliesToValueIsAnAnnotation = appliesToValueClass.isAnnotationType();
+            boolean appliesToValueIsImplementingAppliesToFilter =
+                appliesToValueClass.isInheritor( appliesToFilterClass, true );
+
+            String message = null;
+            if( appliesToValueIsAnAnnotation && classIsAMixin )
+            {
+                // If Class is a mixin and appliesToValueClass is an annotation
+                message = message(
+                    "applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin",
+                    appliesToValueQualifiedName
+                );
+            }
+            else if( appliesToValueIsAnAnnotation || appliesToValueIsImplementingAppliesToFilter )
+            {
+                if( classIsAConcern && !classIsAGenericConcern )
+                {
+                    // If psiClass is a concern but not generic concern
+                    message = message(
+                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern",
+                        appliesToValueQualifiedName, classQualifiedName
+                    );
+                }
+                else if( classIsASideEffect && !classIsAGenericSideEffect )
+                {
+                    // If psiClass a side effect but not a generic side effect
+                    message = message(
+                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect",
+                        appliesToValueQualifiedName, classQualifiedName
+                    );
+                }
+                else if( appliesToValueIsImplementingAppliesToFilter && !classIsAGenericMixin )
+                {
+                    message = message(
+                        "applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler",
+                        appliesToValueQualifiedName, classQualifiedName
+                    );
+                }
+            }
+            else if( appliesToValueClass.isInterface() )
+            {
+                if( !psiClass.isInheritor( appliesToValueClass, true ) &&
+                    !( classIsAGenericConcern || classIsAGenericSideEffect ) )
+                {
+                    // If psiClass does not implement that interface and it's not a generic concern or generic side effect
+                    if( classIsAConcern )
+                    {
+                        message = message(
+                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern",
+                            appliesToValueQualifiedName, classQualifiedName );
+                    }
+                    else if( classIsASideEffect )
+                    {
+                        message = message(
+                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect",
+                            appliesToValueQualifiedName, classQualifiedName );
+                    }
+                    else
+                    {
+                        message = message(
+                            "applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler",
+                            appliesToValueQualifiedName, classQualifiedName );
+                    }
+                }
+            }
+            else
+            {
+                if( classIsAMixin )
+                {
+                    message = message(
+                        "applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin",
+                        appliesToValueQualifiedName
+                    );
+                }
+                else
+                {
+                    message = message(
+                        "applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin",
+                        appliesToValueQualifiedName
+                    );
+                }
+            }
+
+            if( message != null )
+            {
+                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
+                    appliesToAnnotationValue,
+                    message,
+                    new RemoveAnnotationValueFix( appliesToAnnotationValue, appliesToValueClassReference ),
+                    GENERIC_ERROR_OR_WARNING );
+                problems.add( problemDescriptor );
+            }
+        }
+
+        return problems.toArray( new ProblemDescriptor[problems.size()] );
+    }
+
+    @NotNull
+    private ProblemDescriptor createRemoveAppliesToFilterProblemDescriptor( @NotNull InspectionManager manager,
+                                                                            @NotNull String problemMessage,
+                                                                            @NotNull PsiAnnotation appliesToAnnotation )
+    {
+        RemoveAppliesToFilterAnnotationFix fix = new RemoveAppliesToFilterAnnotationFix( appliesToAnnotation );
+        return manager.createProblemDescriptor( appliesToAnnotation, problemMessage, fix, GENERIC_ERROR_OR_WARNING );
+    }
+
+    private static class RemoveAppliesToFilterAnnotationFix extends AbstractFix
+    {
+        private final PsiAnnotation appliesToFilterAnnotation;
+
+        private RemoveAppliesToFilterAnnotationFix( @NotNull PsiAnnotation appliesToFilterAnnotation )
+        {
+            super( message( "applies.to.annotation.declared.correctly.fix.remove.annotation" ) );
+            this.appliesToFilterAnnotation = appliesToFilterAnnotation;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            appliesToFilterAnnotation.delete();
+        }
+    }
+
+    private static class RemoveAnnotationValueFix extends AbstractFix
+    {
+        private final PsiAnnotationMemberValue annotationValueToRemove;
+
+        private RemoveAnnotationValueFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
+                                          @NotNull PsiJavaCodeReferenceElement appliesToValueClassReference )
+        {
+            super( message( "applies.to.annotation.declared.correctly.fix.remove.class.reference",
+                            appliesToValueClassReference.getQualifiedName() ) );
+            this.annotationValueToRemove = annotationValueToRemove;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            annotationValueToRemove.delete();
+        }
+    }
+
+    private static class ClassImplementInterfaceFix extends AbstractFix
+    {
+        private final PsiClass psiClass;
+        private final PsiClass interfaceToImplement;
+
+        private ClassImplementInterfaceFix( @NotNull PsiClass psiClass,
+                                            @NotNull PsiClass interfaceToImplement )
+        {
+            super( message( "applies.to.annotation.declared.correctly.fix.remove.class.reference",
+                            interfaceToImplement.getQualifiedName() ) );
+            this.psiClass = psiClass;
+            this.interfaceToImplement = interfaceToImplement;
+        }
+
+        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
+        {
+            PsiReferenceList implementList = psiClass.getImplementsList();
+            if( implementList != null )
+            {
+
+                implementList.add( interfaceToImplement );
+            }
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
new file mode 100644
index 0000000..b47a045
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/AbstractCreateElementActionBase.java
@@ -0,0 +1,153 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.actions;
+
+import com.intellij.CommonBundle;
+import com.intellij.ide.actions.CreateElementActionBase;
+import com.intellij.ide.fileTemplates.FileTemplate;
+import com.intellij.ide.fileTemplates.FileTemplateManager;
+import com.intellij.ide.fileTemplates.JavaTemplateUtil;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.CodeStyleManager;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Properties;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public abstract class AbstractCreateElementActionBase extends CreateElementActionBase
+{
+    @NonNls
+    private static final String NAME_TEMPLATE_PROPERTY = "NAME";
+
+    protected AbstractCreateElementActionBase( String text, String description )
+    {
+        super( text, description, null );
+    }
+
+    @NotNull
+    protected final PsiElement[] invokeDialog( Project project, PsiDirectory directory )
+    {
+        Module module = ModuleUtil.findModuleForFile( directory.getVirtualFile(), project );
+        if( module == null )
+        {
+            return PsiElement.EMPTY_ARRAY;
+        }
+
+        MyInputValidator validator = doInvokeDialog( project, directory );
+        return validator.getCreatedElements();
+    }
+
+    protected MyInputValidator doInvokeDialog( Project project, PsiDirectory directory )
+    {
+        MyInputValidator validator = new MyInputValidator( project, directory );
+        Messages.showInputDialog( project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator );
+        return validator;
+    }
+
+    /**
+     * @return Dialog prompt.
+     */
+    protected abstract String getDialogPrompt();
+
+    /**
+     * @return Dialog title.
+     */
+    protected abstract String getDialogTitle();
+
+    protected String getErrorTitle()
+    {
+        return CommonBundle.getErrorTitle();
+    }
+
+    protected final void checkBeforeCreate( String newName, PsiDirectory directory )
+        throws IncorrectOperationException
+    {
+        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
+        javaDirectoryService.checkCreateClass( directory, newName );
+    }
+
+    protected static PsiClass createClassFromTemplate( @NotNull PsiDirectory directory,
+                                                       @NotNull String className,
+                                                       @NotNull String templateName,
+                                                       @NonNls String... parameters )
+        throws IncorrectOperationException
+    {
+        String classFileName = className + "." + StdFileTypes.JAVA.getDefaultExtension();
+        PsiFile file = createFromTemplateInternal( directory, className, classFileName, templateName, parameters );
+        return ( (PsiJavaFile) file ).getClasses()[ 0 ];
+    }
+
+    protected static PsiFile createFromTemplateInternal( @NotNull PsiDirectory directory,
+                                                         @NotNull String name,
+                                                         @NotNull String fileName,
+                                                         @NotNull String templateName,
+                                                         @NonNls String... parameters )
+        throws IncorrectOperationException
+    {
+        // Load template
+        FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance();
+        FileTemplate template = fileTemplateManager.getJ2eeTemplate( templateName );
+
+        // Process template properties
+        Properties properties = new Properties( fileTemplateManager.getDefaultProperties() );
+        JavaTemplateUtil.setPackageNameAttribute( properties, directory );
+        properties.setProperty( NAME_TEMPLATE_PROPERTY, name );
+
+        // Add parameters
+        for( int i = 0; i < parameters.length; i += 2 )
+        {
+            properties.setProperty( parameters[ i ], parameters[ i + 1 ] );
+        }
+
+        // Create text from template with specified properties
+        String text;
+        try
+        {
+            text = template.getText( properties );
+        }
+        catch( Exception e )
+        {
+            String message = "Unable to load template for " +
+                             fileTemplateManager.internalTemplateToSubject( templateName );
+            throw new RuntimeException( message, e );
+        }
+
+        // Serialized text to file
+        PsiManager psiManager = PsiManager.getInstance( directory.getProject() );
+        PsiFileFactory fileFactory = PsiFileFactory.getInstance( directory.getProject() );
+        PsiFile file = fileFactory.createFileFromText( fileName, text );
+
+        // Reformat the file according to project/default style
+        CodeStyleManager codeStyleManager = CodeStyleManager.getInstance( psiManager );
+        codeStyleManager.reformat( file );
+
+        // Add newly created file to directory
+        return (PsiFile) directory.add( file );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
new file mode 100644
index 0000000..d53e0e1
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.actions;
+
+import com.intellij.ide.IdeView;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.psi.JavaDirectoryService;
+import com.intellij.psi.PsiDirectory;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneCreateActionGroup extends DefaultActionGroup
+{
+    public PolygeneCreateActionGroup()
+    {
+        super( message( "polygene.action.group.title" ), true );
+        getTemplatePresentation().setDescription( message( "polygene.action.group.description" ) );
+    }
+
+    public void update( AnActionEvent e )
+    {
+        Presentation presentation = e.getPresentation();
+        presentation.setVisible( shouldActionGroupVisible( e ) );
+    }
+
+    private boolean shouldActionGroupVisible( AnActionEvent e )
+    {
+        Module module = e.getData( LangDataKeys.MODULE );
+        if( module == null )
+        {
+            return false;
+        }
+
+        // TODO: Enable this once PolygeneFacet can be automatically added/removed
+//        if( PolygeneFacet.getInstance( module ) == null )
+//        {
+//            return false;
+//        }
+
+        // Are we on IDE View and under project source folder?
+        Project project = e.getData( PlatformDataKeys.PROJECT );
+        IdeView view = e.getData( LangDataKeys.IDE_VIEW );
+        if( view != null && project != null )
+        {
+            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance( project ).getFileIndex();
+            PsiDirectory[] dirs = view.getDirectories();
+            for( PsiDirectory dir : dirs )
+            {
+                if( projectFileIndex.isInSourceContent( dir.getVirtualFile() ) && JavaDirectoryService.getInstance().getPackage( dir ) != null )
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacet.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacet.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacet.java
new file mode 100644
index 0000000..7342707
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacet.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.Facet;
+import com.intellij.facet.FacetManager;
+import com.intellij.facet.FacetType;
+import com.intellij.openapi.module.Module;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacet extends Facet<PolygeneFacetConfiguration>
+{
+    public PolygeneFacet( @NotNull FacetType facetType,
+                      @NotNull Module module,
+                      String name,
+                      @NotNull PolygeneFacetConfiguration configuration,
+                      Facet underlyingFacet
+    )
+    {
+        super( facetType, module, name, configuration, underlyingFacet );
+    }
+
+    @Nullable
+    public static PolygeneFacet getInstance( @NotNull Module module )
+    {
+        return FacetManager.getInstance( module ).getFacetByType( PolygeneFacetType.ID );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
new file mode 100644
index 0000000..6a6f28e
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.FacetConfiguration;
+import com.intellij.facet.ui.FacetEditorContext;
+import com.intellij.facet.ui.FacetEditorTab;
+import com.intellij.facet.ui.FacetValidatorsManager;
+import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.WriteExternalException;
+import org.jdom.Element;
+import org.apache.polygene.ide.plugin.idea.common.facet.ui.PolygeneFacetEditorTab;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetConfiguration
+    implements FacetConfiguration
+{
+    public FacetEditorTab[] createEditorTabs( FacetEditorContext editorContext,
+                                              FacetValidatorsManager validatorsManager )
+    {
+        return new FacetEditorTab[]{
+            new PolygeneFacetEditorTab( editorContext )
+        };
+    }
+
+    public final void readExternal( Element element )
+        throws InvalidDataException
+    {
+        // Do nothing
+    }
+
+    public final void writeExternal( Element element )
+        throws WriteExternalException
+    {
+        // Do nothing
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetType.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetType.java
new file mode 100644
index 0000000..b45de9f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/PolygeneFacetType.java
@@ -0,0 +1,122 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.Facet;
+import com.intellij.facet.FacetType;
+import com.intellij.facet.FacetTypeId;
+import com.intellij.facet.autodetecting.FacetDetector;
+import com.intellij.facet.autodetecting.FacetDetectorRegistry;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.module.JavaModuleType;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleType;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFileFilter;
+import com.intellij.psi.JavaElementVisitor;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiImportStatement;
+import com.intellij.psi.PsiReferenceExpression;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetType extends FacetType<PolygeneFacet, PolygeneFacetConfiguration>
+{
+    public static final FacetTypeId<PolygeneFacet> ID = new FacetTypeId<PolygeneFacet>();
+
+    public PolygeneFacetType()
+    {
+        super( ID, "PolygeneFacet", "Polygene Facet" );
+    }
+
+    public final PolygeneFacetConfiguration createDefaultConfiguration()
+    {
+        return new PolygeneFacetConfiguration();
+    }
+
+    public final PolygeneFacet createFacet( @NotNull Module module,
+                                        String name,
+                                        @NotNull PolygeneFacetConfiguration configuration,
+                                        @Nullable Facet underlyingFacet )
+    {
+        return new PolygeneFacet( this, module, name, configuration, underlyingFacet );
+    }
+
+    public final boolean isSuitableModuleType( ModuleType moduleType )
+    {
+        return moduleType instanceof JavaModuleType;
+    }
+
+    @Override
+    public final void registerDetectors( FacetDetectorRegistry<PolygeneFacetConfiguration> registry )
+    {
+        registry.registerOnTheFlyDetector(
+            StdFileTypes.JAVA, VirtualFileFilter.ALL, new HasPolygeneImportPackageCondition(),
+            new FacetDetector<PsiFile, PolygeneFacetConfiguration>( "PolygeneFacetDetector" )
+            {
+                @Override
+                public PolygeneFacetConfiguration detectFacet( PsiFile source,
+                                                           Collection<PolygeneFacetConfiguration> existingConfigurations )
+                {
+                    if( !existingConfigurations.isEmpty() )
+                    {
+                        return existingConfigurations.iterator().next();
+                    }
+
+                    return createDefaultConfiguration();
+                }
+            }
+        );
+    }
+
+    private static class HasPolygeneImportPackageCondition
+        implements Condition<PsiFile>
+    {
+        public final boolean value( PsiFile psiFile )
+        {
+            final boolean[] hasPolygeneImportPackage = new boolean[]{ false };
+
+            psiFile.accept( new JavaElementVisitor()
+            {
+                @Override
+                public final void visitImportStatement( PsiImportStatement statement )
+                {
+                    String packageName = statement.getQualifiedName();
+                    if( packageName != null && packageName.startsWith( "org.apache.polygene" ) )
+                    {
+                        hasPolygeneImportPackage[ 0 ] = true;
+                    }
+                }
+
+                @Override
+                public void visitReferenceExpression( PsiReferenceExpression expression )
+                {
+                    // Ignore
+                }
+            } );
+            return hasPolygeneImportPackage[ 0 ];
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
new file mode 100644
index 0000000..dc4b121
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet.ui;
+
+import com.intellij.facet.ui.FacetEditorContext;
+import com.intellij.facet.ui.FacetEditorTab;
+import com.intellij.openapi.options.ConfigurationException;
+import org.jetbrains.annotations.Nls;
+
+import javax.swing.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetEditorTab extends FacetEditorTab
+{
+    private final FacetEditorContext editorContext;
+
+    public PolygeneFacetEditorTab( FacetEditorContext aContext )
+    {
+        editorContext = aContext;
+    }
+
+    @Nls
+    public final String getDisplayName()
+    {
+        return "Polygene";
+    }
+
+    public JComponent createComponent()
+    {
+        return new JPanel();
+    }
+
+    public final boolean isModified()
+    {
+        return false;
+    }
+
+    public final void apply()
+        throws ConfigurationException
+    {
+        // From UI to configuration
+    }
+
+    public final void reset()
+    {
+        // From Configuration to UI
+    }
+
+    public final void disposeUIResources()
+    {
+        // Do nothing for now
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractFix.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractFix.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractFix.java
new file mode 100644
index 0000000..1369766
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractFix.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.inspections;
+
+import com.intellij.codeInspection.LocalQuickFix;
+import org.jetbrains.annotations.NotNull;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public abstract class AbstractFix
+    implements LocalQuickFix
+{
+    private String fixName;
+
+    protected AbstractFix( @NotNull String name )
+    {
+        fixName = name;
+    }
+
+    @NotNull
+    public final String getName()
+    {
+        return fixName;
+    }
+
+    @NotNull
+    public final String getFamilyName()
+    {
+        return message( "polygene.quick.fixes.family.name" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractInspection.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractInspection.java
new file mode 100644
index 0000000..a6d0a38
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/inspections/AbstractInspection.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.inspections;
+
+import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
+
+import static com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public abstract class AbstractInspection extends BaseJavaLocalInspectionTool
+{
+    private static final String POLYGENE_IDEA_INSPECTIONS_NAME = "polygene.inspections.name";
+
+    @Nls @NotNull public String getGroupDisplayName()
+    {
+        return PolygeneResourceBundle.message( POLYGENE_IDEA_INSPECTIONS_NAME );
+    }
+
+    @NotNull
+    protected abstract String resourceBundlePrefixId();
+
+    @Nls @NotNull
+    public final String getDisplayName()
+    {
+        return PolygeneResourceBundle.message( resourceBundlePrefixId() + ".name.display" );
+    }
+
+    @NotNull @Override
+    public HighlightDisplayLevel getDefaultLevel()
+    {
+        return ERROR;
+    }
+
+    @Override
+    public boolean isEnabledByDefault()
+    {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/intentions/AbstractIntention.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/intentions/AbstractIntention.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/intentions/AbstractIntention.java
new file mode 100644
index 0000000..d50693f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/intentions/AbstractIntention.java
@@ -0,0 +1,132 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.intentions;
+
+import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
+import com.intellij.openapi.editor.CaretModel;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.ReadonlyStatusHandler;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * This class is based from {@code com.siyeh.ipp.base.Intention}
+ *
+ * @author edward.yakop@gmail.com
+ */
+public abstract class AbstractIntention extends PsiElementBaseIntentionAction
+{
+    protected abstract boolean isIntentionValidFor( PsiElement element );
+
+    protected abstract String resourceBundlePrefixId();
+
+    /**
+     * Implement this method to process intention.
+     *
+     * @param project The project in which the availability is checked.
+     * @param editor  The editor in which the intention will be invoked.
+     * @param element The element under caret.
+     */
+    protected abstract void processIntention( @NotNull Project project,
+                                              @NotNull Editor editor,
+                                              @NotNull PsiElement element );
+
+    public void invoke( @NotNull Project project, Editor editor, PsiFile file )
+        throws IncorrectOperationException
+    {
+        if( isFileReadOnly( project, file ) )
+        {
+            return;
+        }
+
+        final PsiElement element = findMatchingElement( file, editor );
+        if( element == null )
+        {
+            return;
+        }
+
+        processIntention( project, editor, element );
+    }
+
+    protected static boolean isFileReadOnly( @NotNull Project project, @NotNull PsiFile file )
+    {
+        VirtualFile virtualFile = file.getVirtualFile();
+        ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance( project );
+        ReadonlyStatusHandler.OperationStatus operationStatus =
+            readonlyStatusHandler.ensureFilesWritable( virtualFile );
+        return operationStatus.hasReadonlyFiles();
+    }
+
+    @Nullable
+    private PsiElement findMatchingElement( @NotNull PsiFile file, @NotNull Editor editor )
+    {
+        CaretModel caretModel = editor.getCaretModel();
+        int position = caretModel.getOffset();
+        PsiElement element = file.findElementAt( position );
+        return findMatchingElement( element );
+    }
+
+    @Nullable
+    private PsiElement findMatchingElement( @Nullable PsiElement element )
+    {
+        while( element != null )
+        {
+            if( isIntentionValidFor( element ) )
+            {
+                return element;
+            }
+            else
+            {
+                element = element.getParent();
+                if( element instanceof PsiFile )
+                {
+                    break;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public boolean isAvailable( @NotNull Project project, Editor editor, @Nullable PsiElement element )
+    {
+        return isIntentionValidFor( element );
+    }
+
+    @NotNull
+    public final String getFamilyName()
+    {
+        return message( resourceBundlePrefixId() + ".family.name" );
+    }
+
+    @NotNull
+    @Override
+    public final String getText()
+    {
+        return message( resourceBundlePrefixId() + ".name" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
new file mode 100644
index 0000000..4840a04
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiAnnotationUtil.java
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.psi;
+
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import static java.util.Collections.emptyList;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class PsiAnnotationUtil
+{
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getAnnotationDefaultParameterValue( @Nullable PsiAnnotation annotation )
+    {
+        if( annotation == null )
+        {
+            return emptyList();
+        }
+
+        List<PsiAnnotationMemberValue> defaultParameterValues = new LinkedList<PsiAnnotationMemberValue>();
+
+        PsiAnnotationParameterList list = annotation.getParameterList();
+        PsiNameValuePair[] attributes = list.getAttributes();
+        for( PsiNameValuePair valuePair : attributes )
+        {
+            String parameterName = valuePair.getName();
+            if( parameterName == null || PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME.equals( parameterName ) )
+            {
+                PsiAnnotationMemberValue value = valuePair.getValue();
+                if( value == null )
+                {
+                    continue;
+                }
+
+                if( value instanceof PsiArrayInitializerMemberValue )
+                {
+                    // If It's an array
+                    PsiArrayInitializerMemberValue valueWrapper = (PsiArrayInitializerMemberValue) value;
+                    PsiAnnotationMemberValue[] values = valueWrapper.getInitializers();
+                    for( PsiAnnotationMemberValue psiAnnotationMemberValue : values )
+                    {
+                        if( psiAnnotationMemberValue != null )
+                        {
+                            defaultParameterValues.add( psiAnnotationMemberValue );
+                        }
+                    }
+                }
+                else
+                {
+                    // If there's only one value
+                    defaultParameterValues.add( value );
+                }
+
+                break;
+            }
+        }
+
+        return defaultParameterValues;
+    }
+
+    @Nullable
+    public static PsiJavaCodeReferenceElement getClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        if( value instanceof PsiClassObjectAccessExpression )
+        {
+            PsiClassObjectAccessExpression objectAccessExpression = (PsiClassObjectAccessExpression) value;
+            PsiTypeElement typeElement = objectAccessExpression.getOperand();
+            return typeElement.getInnermostComponentReferenceElement();
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiClassUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiClassUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiClassUtil.java
new file mode 100644
index 0000000..1f7dbb2
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/PsiClassUtil.java
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.psi;
+
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PsiClassUtil
+{
+    @Nullable
+    public static PsiClass getPSIClass( @NotNull PsiElement element )
+    {
+        if( element instanceof PsiClass )
+        {
+            return (PsiClass) element;
+        }
+
+        if( element instanceof PsiTypeElement )
+        {
+            PsiTypeElement psiTypeElement = (PsiTypeElement) element;
+            PsiJavaCodeReferenceElement componentRef = psiTypeElement.getInnermostComponentReferenceElement();
+            if( componentRef == null )
+            {
+                return null;
+            }
+
+            return (PsiClass) componentRef.resolve();
+        }
+
+        PsiElement context = element.getContext();
+        if( context instanceof PsiClass )
+        {
+            return (PsiClass) context;
+        }
+
+        return null;
+    }
+
+    @NotNull
+    public static Set<PsiClass> getExtends( @NotNull PsiClass psiClass )
+    {
+        HashSet<PsiClass> extendsClasses = new HashSet<PsiClass>();
+        PsiClassType[] extendsClassTypes = psiClass.getExtendsListTypes();
+        for( PsiClassType extendClassType : extendsClassTypes )
+        {
+            PsiClass extendClass = extendClassType.resolve();
+            if( extendClass != null )
+            {
+                extendsClasses.add( extendClass );
+            }
+        }
+
+        return extendsClasses;
+    }
+
+    /**
+     * Returns all extends of the specified {@code psiClass}.
+     *
+     * @param psiClass class to process.
+     * @return all extends of the specified {@code psiClass}.
+     * @since 0.1
+     */
+    @NotNull
+    public static Set<PsiClass> getExtendsDeep( @NotNull PsiClass psiClass )
+    {
+        HashSet<PsiClass> extendsClasses = new HashSet<PsiClass>();
+        PsiClassType[] extendsClassTypes = psiClass.getExtendsListTypes();
+        for( PsiClassType extendClassType : extendsClassTypes )
+        {
+            PsiClass extendClass = extendClassType.resolve();
+            if( extendClass != null )
+            {
+                extendsClasses.add( extendClass );
+                extendsClasses.addAll( getExtendsDeep( extendClass ) );
+            }
+        }
+
+        return extendsClasses;
+    }
+
+    /**
+     * @param psiClass Psi class to check.
+     * @return {@code true} if psi class implements {@code InvocationHandler}, {@code false} otherwise.
+     * @see InvocationHandler
+     */
+    public static boolean isImplementsInvocationHandler( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        GlobalSearchScope searchScope = determineSearchScope( psiClass );
+        assert searchScope != null;
+
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( psiClass.getProject() );
+        PsiClass invocationHandler = psiFacade.findClass( "java.lang.reflect.InvocationHandler", searchScope );
+        assert invocationHandler != null;
+
+        return psiClass.isInheritor( invocationHandler, true );
+    }
+
+    private PsiClassUtil()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
new file mode 100644
index 0000000..4beda1f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/psi/search/GlobalSearchScopeUtil.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.psi.search;
+
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.openapi.module.ModuleUtil.findModuleForPsiElement;
+import static org.apache.polygene.ide.plugin.idea.common.vfs.VirtualFileUtil.getVirtualFile;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class GlobalSearchScopeUtil
+{
+    /**
+     * Determine search scope given a psi element.
+     *
+     * @param psiElement context.
+     * @return Search scope given psi class.
+     * @since 0.1
+     */
+    @Nullable
+    public static GlobalSearchScope determineSearchScope( @NotNull PsiElement psiElement )
+    {
+        VirtualFile classVirtualFile = getVirtualFile( psiElement );
+        if( classVirtualFile == null )
+        {
+            return null;
+        }
+
+        Module module = findModuleForPsiElement( psiElement );
+        if( module == null )
+        {
+            return null;
+        }
+
+        Project project = psiElement.getProject();
+        ProjectRootManager projectRootManager = ProjectRootManager.getInstance( project );
+        boolean includeTestClasses = projectRootManager.getFileIndex().isInTestSourceContent( classVirtualFile );
+        return module.getModuleWithDependenciesAndLibrariesScope( includeTestClasses );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
new file mode 100644
index 0000000..c5f29b4
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.resource;
+
+import com.intellij.CommonBundle;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.PropertyKey;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.util.ResourceBundle;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneResourceBundle
+{
+
+    @NonNls
+    private static final String RESOURCE_BUNDLE_NAME = "org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle";
+
+    private static Reference<ResourceBundle> BUNDLE_REF;
+
+    private PolygeneResourceBundle()
+    {
+    }
+
+    public static String message( @PropertyKey( resourceBundle = RESOURCE_BUNDLE_NAME ) String key,
+                                  Object... params )
+    {
+        ResourceBundle resourceBundle = getBundle();
+        return CommonBundle.message( resourceBundle, key, params );
+    }
+
+    private static ResourceBundle getBundle()
+    {
+        ResourceBundle bundle = null;
+        if( BUNDLE_REF != null )
+        {
+            bundle = BUNDLE_REF.get();
+        }
+
+        if( bundle == null )
+        {
+            bundle = ResourceBundle.getBundle( PolygeneResourceBundle.class.getName() );
+            BUNDLE_REF = new SoftReference<ResourceBundle>( bundle );
+        }
+
+        return bundle;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/vfs/VirtualFileUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/vfs/VirtualFileUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/vfs/VirtualFileUtil.java
new file mode 100644
index 0000000..d5b95b6
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/common/vfs/VirtualFileUtil.java
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.vfs;
+
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiFileSystemItem;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class VirtualFileUtil
+{
+    /**
+     * @param element element to process.
+     * @return The containing virtual file of the element.
+     * @since 0.1
+     */
+    @Nullable
+    public static VirtualFile getVirtualFile( @NotNull PsiElement element )
+    {
+        if( element instanceof PsiFileSystemItem )
+        {
+            PsiFileSystemItem fileSystemItem = (PsiFileSystemItem) element;
+            return fileSystemItem.getVirtualFile();
+        }
+
+        // If it's not a file system, assume that this is an element within a file
+        PsiFile containingFile = element.getContainingFile();
+        if( containingFile == null )
+        {
+            return null;
+        }
+
+        VirtualFile virtualFile = containingFile.getVirtualFile();
+        if( virtualFile != null )
+        {
+            return virtualFile;
+        }
+
+        PsiFile originalFile = containingFile.getOriginalFile();
+        if( originalFile == null )
+        {
+            return null;
+        }
+
+        return originalFile.getVirtualFile();
+    }
+
+    private VirtualFileUtil()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
new file mode 100644
index 0000000..b6abdfb
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/CreateConcernFromMixinTypeOrCompositeAction.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.polygene.ide.plugin.idea.concerns.actions.create;
+
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.common.actions.AbstractCreateElementActionBase;
+
+/**
+ * @author edward.yakop@gmail.com
+ */
+public class CreateConcernFromMixinTypeOrCompositeAction extends AbstractCreateElementActionBase
+{
+    public CreateConcernFromMixinTypeOrCompositeAction()
+    {
+        super( "TODO", "TODO" );
+    }
+
+    protected String getCommandName()
+    {
+        return "CreateConcernFromMixinTypeOrCompositeAction";
+    }
+
+    protected String getActionName( PsiDirectory directory, String newName )
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    protected String getDialogPrompt()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    protected String getDialogTitle()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    @NotNull
+    protected PsiElement[] create( String newName, PsiDirectory directory )
+        throws Exception
+    {
+        return new PsiElement[0];  //To change body of implemented methods use File | Settings | File Templates.
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
new file mode 100644
index 0000000..402df3e
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/actions/create/inPackage/CreateConcernOfInPackageAction.java
@@ -0,0 +1,121 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.actions.create.inPackage;
+
+import com.intellij.ide.actions.CreateInPackageActionBase;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.Messages;
+import com.intellij.psi.JavaDirectoryService;
+import com.intellij.psi.PsiClass;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.util.IncorrectOperationException;
+import org.jetbrains.annotations.NotNull;
+
+import static com.intellij.openapi.actionSystem.DataKeys.PROJECT;
+import static com.intellij.openapi.actionSystem.DataKeys.PSI_ELEMENT;
+import static com.intellij.util.Icons.CLASS_ICON;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.TEMPLATE_GENERIC_CONCERN_OF;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.getConcernOfClass;
+
+/**
+ * JAVADOC: Non generic concern
+ *
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public class CreateConcernOfInPackageAction extends CreateInPackageActionBase
+{
+    protected CreateConcernOfInPackageAction()
+    {
+        super( message( "createConcernOfInPackage.menu.action.text" ),
+               message( "createConcernOfInPackage.menu.action.description" ),
+               CLASS_ICON );
+    }
+
+    @Override
+    protected final boolean isAvailable( DataContext dataContext )
+    {
+        boolean isAvailable = super.isAvailable( dataContext );
+        if( !isAvailable )
+        {
+            return false;
+        }
+
+        PsiElement psiElement = PSI_ELEMENT.getData( dataContext );
+        if( psiElement == null )
+        {
+            return false;
+        }
+
+        GlobalSearchScope searchScope = determineSearchScope( psiElement );
+        if( searchScope == null )
+        {
+            return false;
+        }
+
+        Project project = PROJECT.getData( dataContext );
+        PsiClass psiClass = getConcernOfClass( project, searchScope );
+        return psiClass != null;
+    }
+
+    @NotNull
+    protected final PsiElement[] invokeDialog( Project project, PsiDirectory directory )
+    {
+        MyInputValidator validator = new MyInputValidator( project, directory );
+        Messages.showInputDialog( project, message( "createConcernOfInPackage.dlg.prompt" ),
+                                  message( "createConcernOfInPackage.dlg.title" ),
+                                  Messages.getQuestionIcon(), "", validator );
+        return validator.getCreatedElements();
+    }
+
+    protected final String getCommandName()
+    {
+        return message( "createConcernOfInPackage.command.name" );
+    }
+
+    protected final String getErrorTitle()
+    {
+        return message( "createConcernOfInPackage.error.title" );
+    }
+
+    protected final String getActionName( PsiDirectory directory, String newName )
+    {
+        return message( "createConcernOfInPackage.progress.text", newName );
+    }
+
+    protected final void doCheckCreate( final PsiDirectory dir, final String className )
+        throws IncorrectOperationException
+    {
+        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
+        javaDirectoryService.checkCreateClass( dir, className );
+    }
+
+    @NotNull
+    protected PsiClass doCreate( final PsiDirectory dir, final String className )
+        throws IncorrectOperationException
+    {
+        JavaDirectoryService javaDirectoryService = JavaDirectoryService.getInstance();
+        return javaDirectoryService.createClass( dir, className, TEMPLATE_GENERIC_CONCERN_OF );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
new file mode 100644
index 0000000..0bbe3a1
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.common;
+
+import org.jetbrains.annotations.NonNls;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneConcernConstants
+{
+    public static final String QUALIFIED_NAME_CONCERNS = "org.apache.polygene.api.concern.Concerns";
+
+    public static final String QUALIFIED_NAME_CONCERN_OF = "org.apache.polygene.api.concern.ConcernOf";
+    public static final String QUALIFIED_NAME_GENERIC_CONCERN = "org.apache.polygene.api.concern.GenericConcern";
+
+    @NonNls
+    public static final String TEMPLATE_GENERIC_CONCERN_OF = "GenericConcernOf.java";
+
+    private PolygeneConcernConstants()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
new file mode 100644
index 0000000..4499143
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/polygene/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
@@ -0,0 +1,228 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneConcernUtil
+{
+
+
+    /**
+     * @param searchContext Search context.
+     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericConcernClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getGenericConcernClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericConcernClass( @NotNull Project project,
+                                                   @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_GENERIC_CONCERN, scope ) : null;
+    }
+
+    @Nullable
+    public static PsiClass getConcernOfClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getConcernOfClass( project, searchScope );
+    }
+
+    @Nullable
+    public static PsiClass getConcernOfClass( @NotNull Project project,
+                                              @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_CONCERN_OF, scope ) : null;
+    }
+
+    @Nullable
+    public static PsiAnnotation getConcernsAnnotation( @NotNull PsiElement element )
+    {
+        PsiClass psiClass = getPSIClass( element );
+        return findAnnotation( psiClass, QUALIFIED_NAME_CONCERNS );
+    }
+
+    @NotNull
+    public static PsiAnnotation addOrReplaceConcernAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
+                                                               @NotNull PsiClass concernClassToAdd )
+    {
+        Project project = modifierListOwner.getProject();
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        PsiAnnotation existingConcernsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_CONCERNS );
+
+        boolean isReplace = false;
+        PsiAnnotation newConcernsAnnotation;
+        if( existingConcernsAnnotation != null )
+        {
+            // Check duplicate
+            List<PsiAnnotationMemberValue> concernsValues = getConcernsAnnotationValue( existingConcernsAnnotation );
+            for( PsiAnnotationMemberValue concernValue : concernsValues )
+            {
+                PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernValue );
+                if( concernClassReference == null )
+                {
+                    continue;
+                }
+
+                PsiElement concernClass = concernClassReference.resolve();
+                if( concernClassToAdd.equals( concernClass ) )
+                {
+                    return existingConcernsAnnotation;
+                }
+            }
+
+            isReplace = true;
+        }
+
+        String concernAnnotationText = createConcernAnnotationText( existingConcernsAnnotation, concernClassToAdd );
+        newConcernsAnnotation =
+            factory.createAnnotationFromText( concernAnnotationText, modifierListOwner );
+
+        if( isReplace )
+        {
+            // Replace @Concerns instead
+            existingConcernsAnnotation.replace( newConcernsAnnotation );
+        }
+        else
+        {
+            // @Concerns doesn't exists, add it as first child
+            PsiModifierList modifierList = modifierListOwner.getModifierList();
+            modifierList.addBefore( newConcernsAnnotation, modifierList.getFirstChild() );
+        }
+
+        // Shorten all class references if possible
+        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
+        codeStyleManager.shortenClassReferences( newConcernsAnnotation );
+
+        return newConcernsAnnotation;
+    }
+
+    @NotNull
+    private static String createConcernAnnotationText( @Nullable PsiAnnotation concernAnnotationBase,
+                                                       @NotNull PsiClass concernClassToAdd )
+    {
+        StringBuilder annotationTextBuilder = new StringBuilder();
+        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_CONCERNS ).append( "( {" );
+        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernAnnotationBase );
+        for( PsiAnnotationMemberValue concernValue : concernsAnnotationValue )
+        {
+            annotationTextBuilder.append( concernValue.getText() ).append( ", " );
+        }
+        annotationTextBuilder.append( concernClassToAdd.getQualifiedName() ).append( ".class" );
+        annotationTextBuilder.append( "} )" );
+        return annotationTextBuilder.toString();
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getConcernsAnnotationValue( @Nullable PsiAnnotation concernsAnnotation )
+    {
+        if( concernsAnnotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = concernsAnnotation.getQualifiedName();
+        if( !QUALIFIED_NAME_CONCERNS.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( concernsAnnotation );
+    }
+
+    @Nullable
+    public static PsiJavaCodeReferenceElement getConcernClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} extends {@code ConcernOf}, {@code false} if {@code psiClass} does
+     *         not extends {@code ConcernOf} or {@code ConcernOf} is not found.
+     * @since 0.1
+     */
+    public static boolean isAConcern( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass concernOfClass = getConcernOfClass( psiClass );
+        return concernOfClass != null && psiClass.isInheritor( concernOfClass, true );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} extends {@code GenericConcern}, {@code false} if {@code psiClass} does
+     *         not extends {@code GenericConcern} or {@code GenericConcern} is not found.
+     * @since 0.1
+     */
+    public static boolean isAGenericConcern( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass genericConcern = getGenericConcernClass( psiClass );
+        return genericConcern != null && psiClass.isInheritor( genericConcern, true );
+    }
+
+    private PolygeneConcernUtil()
+    {
+    }
+}


[31/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationFunction.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationFunction.java
deleted file mode 100644
index 1c63840..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/ManyAssociationFunction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.lang.reflect.Proxy;
-import java.util.function.Function;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeInstance;
-
-/**
- * Function to get Entity ManyAssociations.
- */
-public class ManyAssociationFunction<T>
-    implements Function<Composite, ManyAssociation<T>>
-{
-    private final AssociationFunction<?> traversedAssociation;
-    private final ManyAssociationFunction<?> traversedManyAssociation;
-    private final NamedAssociationFunction<?> traversedNamedAssociation;
-    private final AccessibleObject accessor;
-
-    public ManyAssociationFunction( AssociationFunction<?> traversedAssociation,
-                                    ManyAssociationFunction<?> traversedManyAssociation,
-                                    NamedAssociationFunction<?> traversedNamedAssociation,
-                                    AccessibleObject accessor
-    )
-    {
-        this.traversedAssociation = traversedAssociation;
-        this.traversedManyAssociation = traversedManyAssociation;
-        this.traversedNamedAssociation = traversedNamedAssociation;
-        this.accessor = accessor;
-    }
-
-    public AssociationFunction<?> traversedAssociation()
-    {
-        return traversedAssociation;
-    }
-
-    public ManyAssociationFunction<?> traversedManyAssociation()
-    {
-        return traversedManyAssociation;
-    }
-
-    public NamedAssociationFunction<?> traversedNamedAssociation()
-    {
-        return traversedNamedAssociation;
-    }
-
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public ManyAssociation<T> apply( Composite entity )
-    {
-        try
-        {
-            Object target = entity;
-            if( traversedAssociation != null )
-            {
-                target = traversedAssociation.apply( entity ).get();
-            }
-            if( traversedManyAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot traverse ManyAssociations" );
-            }
-            if( traversedNamedAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot traverse NamedAssociations" );
-            }
-
-            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
-            return ( (AssociationStateHolder) handler.state() ).manyAssociationFor( accessor );
-        }
-        catch( IllegalArgumentException e )
-        {
-            throw e;
-        }
-        catch( Throwable e )
-        {
-            throw new IllegalArgumentException( e );
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        if( traversedAssociation != null )
-        {
-            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
-        }
-        else
-        {
-            return ( (Member) accessor ).getName();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/MatchesPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/MatchesPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/MatchesPredicate.java
deleted file mode 100644
index ce8f7b3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/MatchesPredicate.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Regular expression match Specification.
- */
-public class MatchesPredicate
-    extends ExpressionPredicate
-{
-    private PropertyFunction<String> property;
-    private Object value;
-
-    public MatchesPredicate( PropertyFunction<String> property, String regexp )
-    {
-        this.property = property;
-        this.value = regexp;
-    }
-
-    public MatchesPredicate( PropertyFunction<String> property, Variable variable )
-    {
-        this.property = property;
-        this.value = variable;
-    }
-
-    public PropertyFunction<String> property()
-    {
-        return property;
-    }
-
-    public Object value()
-    {
-        return value;
-    }
-
-    public String regexp()
-    {
-        return ( String ) value;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Property<String> prop = property.apply( item );
-
-        if( prop == null )
-        {
-            return false;
-        }
-
-        String val = prop.get();
-
-        if( val == null )
-        {
-            return false;
-        }
-
-        return val.matches( ( String ) value );
-    }
-
-    @Override
-    public String toString()
-    {
-        return "( " + property + " matches " + "\"" + value + "\"" + " )";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsNamePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsNamePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsNamePredicate.java
deleted file mode 100644
index 400b9eb..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsNamePredicate.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * NamedAssociation Contains Specification.
- */
-public class NamedAssociationContainsNamePredicate<T>
-    extends ExpressionPredicate
-{
-    private final NamedAssociationFunction<T> namedAssociationFunction;
-    private final String name;
-
-    public NamedAssociationContainsNamePredicate( NamedAssociationFunction<T> namedAssociationFunction, String name )
-    {
-        this.namedAssociationFunction = namedAssociationFunction;
-        this.name = name;
-    }
-
-    public NamedAssociationFunction<T> namedAssociation()
-    {
-        return namedAssociationFunction;
-    }
-
-    public String name()
-    {
-        return name;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        NamedAssociation<T> collection = namedAssociationFunction.apply( item );
-        if( collection == null )
-        {
-            return false;
-        }
-        return collection.containsName( name );
-    }
-
-    @Override
-    public String toString()
-    {
-        return namedAssociationFunction + " contains name:" + name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsPredicate.java
deleted file mode 100644
index e901471..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationContainsPredicate.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * NamedAssociation Contains Specification.
- */
-public class NamedAssociationContainsPredicate<T>
-    extends ExpressionPredicate
-{
-    private final NamedAssociationFunction<T> namedAssociationFunction;
-    private final T value;
-
-    public NamedAssociationContainsPredicate( NamedAssociationFunction<T> namedAssociationFunction, T value )
-    {
-        this.namedAssociationFunction = namedAssociationFunction;
-        this.value = value;
-    }
-
-    public NamedAssociationFunction<T> namedAssociation()
-    {
-        return namedAssociationFunction;
-    }
-
-    public T value()
-    {
-        return value;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        NamedAssociation<T> collection = namedAssociationFunction.apply( item );
-        if( collection == null )
-        {
-            return false;
-        }
-        return collection.nameOf( value ) != null;
-    }
-
-    @Override
-    public String toString()
-    {
-        return namedAssociationFunction + " contains:" + value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationFunction.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationFunction.java
deleted file mode 100644
index 8f0b3de..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/NamedAssociationFunction.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.lang.reflect.Proxy;
-import java.util.function.Function;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeInstance;
-
-/**
- * Function to get Entity NamedAssociations.
- */
-public class NamedAssociationFunction<T>
-    implements Function<Composite, NamedAssociation<T>>
-{
-    private final AssociationFunction<?> traversedAssociation;
-    private final ManyAssociationFunction<?> traversedManyAssociation;
-    private final NamedAssociationFunction<?> traversedNamedAssociation;
-    private final AccessibleObject accessor;
-
-    public NamedAssociationFunction( AssociationFunction<?> traversedAssociation,
-                                     ManyAssociationFunction<?> traversedManyAssociation,
-                                     NamedAssociationFunction<?> traversedNamedAssociation,
-                                     AccessibleObject accessor
-    )
-    {
-        this.traversedAssociation = traversedAssociation;
-        this.traversedManyAssociation = traversedManyAssociation;
-        this.traversedNamedAssociation = traversedNamedAssociation;
-        this.accessor = accessor;
-    }
-
-    public AssociationFunction<?> traversedAssociation()
-    {
-        return traversedAssociation;
-    }
-
-    public ManyAssociationFunction<?> traversedManyAssociation()
-    {
-        return traversedManyAssociation;
-    }
-
-    public NamedAssociationFunction<?> traversedNamedAssociation()
-    {
-        return traversedNamedAssociation;
-    }
-
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public NamedAssociation<T> apply( Composite entity )
-    {
-        try
-        {
-            Object target = entity;
-            if( traversedAssociation != null )
-            {
-                target = traversedAssociation.apply( entity ).get();
-            }
-            if( traversedManyAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot traverse ManyAssociations" );
-            }
-            if( traversedNamedAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot traverse NamedAssociations" );
-            }
-
-            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
-            return ( (AssociationStateHolder) handler.state() ).namedAssociationFor( accessor );
-        }
-        catch( IllegalArgumentException e )
-        {
-            throw e;
-        }
-        catch( Throwable e )
-        {
-            throw new IllegalArgumentException( e );
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        if( traversedAssociation != null )
-        {
-            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
-        }
-        else
-        {
-            return ( (Member) accessor ).getName();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/NePredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/NePredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/NePredicate.java
deleted file mode 100644
index 4e77686..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/NePredicate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Not equals Specification.
- */
-public class NePredicate<T>
-    extends ComparisonPredicate<T>
-{
-    public NePredicate( PropertyFunction<T> property, T value )
-    {
-        super( property, value );
-    }
-
-    @Override
-    protected boolean compare( T value )
-    {
-        return !value.equals( this.value );
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "!=" + value.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/Notpredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/Notpredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/Notpredicate.java
deleted file mode 100644
index 8a2005e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/Notpredicate.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * NOT Specification.
- */
-public class Notpredicate implements Predicate<Composite>
-{
-    private Predicate<Composite> operand;
-
-    public Notpredicate( Predicate<Composite> operand )
-    {
-        this.operand = operand;
-    }
-
-    public Predicate<Composite> operand()
-    {
-        return operand;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        return operand.negate().test( item );
-    }
-
-    @Override
-    public String toString()
-    {
-        return "!" + operand.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/OrPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/OrPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/OrPredicate.java
deleted file mode 100644
index 70cb7a0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/OrPredicate.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.Collection;
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * OR Specification.
- */
-public class OrPredicate
-    extends BinaryPredicate
-{
-
-    public OrPredicate( Collection<Predicate<Composite>> operands )
-    {
-        super( operands );
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Predicate<Composite> master = t -> false;
-        for( Predicate<Composite> p : operands )
-        {
-            master = master.or( p );
-        }
-        return master.test( item );
-    }
-
-    @Override
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder( "(" );
-        String or = "";
-        for( Predicate<Composite> operand : operands )
-        {
-            sb.append( or ).append( operand );
-            or = " or ";
-        }
-        return sb.append( ")" ).toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/OrderBy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/OrderBy.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/OrderBy.java
deleted file mode 100644
index 9426980..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/OrderBy.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Query sorting segment.
- */
-public class OrderBy
-{
-    /**
-     * Order direction.
-     */
-    public enum Order
-    {
-        ASCENDING, DESCENDING
-    }
-
-    /**
-     * Order.
-     */
-    private final PropertyFunction<?> propertyReference;
-    /**
-     * Direction.
-     */
-    private final Order order;
-
-    /**
-     * Constructor.
-     *
-     * @param propertyReference property that determines the order; cannot be null
-     * @param order             direction
-     *
-     * @throws IllegalArgumentException - If property is null
-     */
-    public OrderBy( final PropertyFunction<?> propertyReference,
-                    final Order order
-    )
-    {
-        if( propertyReference == null )
-        {
-            throw new IllegalArgumentException( "Ordering property cannot be null" );
-        }
-        this.propertyReference = propertyReference;
-        this.order = order;
-    }
-
-    /**
-     * Getter.
-     *
-     * @return property; cannot be null
-     */
-    public PropertyFunction<?> property()
-    {
-        return propertyReference;
-    }
-
-    /**
-     * Getter.
-     *
-     * @return direction; cannot be null
-     */
-    public Order order()
-    {
-        return order;
-    }
-
-    @Override
-    public String toString()
-    {
-        return new StringBuilder()
-            .append( propertyReference )
-            .append( " " )
-            .append( order )
-            .toString();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyFunction.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyFunction.java
deleted file mode 100644
index 800b8ef..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyFunction.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.util.function.Function;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.CompositeInstance;
-import org.apache.zest.api.property.GenericPropertyInfo;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.query.NotQueryableException;
-import org.apache.zest.api.query.QueryExpressionException;
-import org.apache.zest.api.util.Classes;
-
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Function to get Entity Properties.
- */
-public class PropertyFunction<T>
-    implements Function<Composite, Property<T>>
-{
-    private final PropertyFunction<?> traversedProperty;
-    private final AssociationFunction<?> traversedAssociation;
-    private final ManyAssociationFunction<?> traversedManyAssociation;
-    private final NamedAssociationFunction<?> traversedNamedAssociation;
-    private final AccessibleObject accessor;
-
-    public PropertyFunction( PropertyFunction<?> traversedProperty,
-                             AssociationFunction<?> traversedAssociation,
-                             ManyAssociationFunction<?> traversedManyAssociation,
-                             NamedAssociationFunction<?> traversedNamedAssociation,
-                             AccessibleObject accessor
-    )
-    {
-        this.traversedProperty = traversedProperty;
-        this.traversedAssociation = traversedAssociation;
-        this.traversedManyAssociation = traversedManyAssociation;
-        this.traversedNamedAssociation = traversedNamedAssociation;
-        this.accessor = accessor;
-
-        // Verify that the property accessor is not marked as non queryable
-        NotQueryableException.throwIfNotQueryable( accessor );
-        // Verify that the property type itself (value composites) is not marked as non queryable
-
-        Type returnType = typeOf( accessor );
-        if( !Property.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) ) )
-        {
-            throw new QueryExpressionException( "Not a property type:" + returnType );
-        }
-        Type propertyTypeAsType = GenericPropertyInfo.toPropertyType( returnType );
-        if( propertyTypeAsType instanceof ParameterizedType )
-        {
-            propertyTypeAsType = ( (ParameterizedType) propertyTypeAsType ).getRawType();
-        }
-
-        if( !( propertyTypeAsType instanceof Class ) )
-        {
-            throw new QueryExpressionException( "Unsupported property type:" + propertyTypeAsType );
-        }
-        @SuppressWarnings( "unchecked" )
-        Class<T> type = (Class<T>) propertyTypeAsType;
-        NotQueryableException.throwIfNotQueryable( type );
-    }
-
-    public PropertyFunction<?> traversedProperty()
-    {
-        return traversedProperty;
-    }
-
-    public AssociationFunction<?> traversedAssociation()
-    {
-        return traversedAssociation;
-    }
-
-    public ManyAssociationFunction<?> traversedManyAssociation()
-    {
-        return traversedManyAssociation;
-    }
-
-    public NamedAssociationFunction<?> traversedNamedAssociation()
-    {
-        return traversedNamedAssociation;
-    }
-
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public Property<T> apply( Composite entity )
-    {
-        try
-        {
-            Object target = entity;
-            if( traversedProperty != null )
-            {
-                Property<?> property = traversedProperty.apply( entity );
-                if( property == null )
-                {
-                    return null;
-                }
-                target = property.get();
-            }
-            else if( traversedAssociation != null )
-            {
-                Association<?> association = traversedAssociation.apply( entity );
-                if( association == null )
-                {
-                    return null;
-                }
-                target = association.get();
-            }
-            else if( traversedManyAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot evaluate a ManyAssociation" );
-            }
-            else if( traversedNamedAssociation != null )
-            {
-                throw new IllegalArgumentException( "Cannot evaluate a NamedAssociation" );
-            }
-
-            if( target == null )
-            {
-                return null;
-            }
-
-            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
-            return handler.state().propertyFor( accessor );
-        }
-        catch( IllegalArgumentException e )
-        {
-            throw e;
-        }
-        catch( Throwable e )
-        {
-            throw new IllegalArgumentException( e );
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        if( traversedProperty != null )
-        {
-            return traversedProperty.toString() + "." + ( (Member) accessor ).getName();
-        }
-        else if( traversedAssociation != null )
-        {
-            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
-        }
-        else
-        {
-            return ( (Member) accessor ).getName();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNotNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNotNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNotNullPredicate.java
deleted file mode 100644
index bb33cd7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNotNullPredicate.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Property not null Specification.
- */
-public class PropertyNotNullPredicate<T>
-    extends ExpressionPredicate
-{
-    private PropertyFunction<T> property;
-
-    public PropertyNotNullPredicate( PropertyFunction<T> property )
-    {
-        this.property = property;
-    }
-
-    public PropertyFunction<T> property()
-    {
-        return property;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Property<T> prop = property.apply( item );
-
-        if( prop == null )
-        {
-            return false;
-        }
-
-        return prop.get() != null;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "is not null";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNullPredicate.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNullPredicate.java
deleted file mode 100644
index c759483..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyNullPredicate.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Property null Specification.
- */
-public class PropertyNullPredicate<T>
-    extends ExpressionPredicate
-{
-    private PropertyFunction<T> property;
-
-    public PropertyNullPredicate( PropertyFunction<T> property )
-    {
-        this.property = property;
-    }
-
-    public PropertyFunction<T> property()
-    {
-        return property;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        Property<T> prop = property.apply( item );
-
-        if( prop == null )
-        {
-            return true;
-        }
-
-        return prop.get() == null;
-    }
-
-    @Override
-    public String toString()
-    {
-        return property.toString() + "is null";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyReference.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyReference.java
deleted file mode 100644
index 69d2861..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/PropertyReference.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.function.Function;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.property.Property;
-
-/**
- * Property Reference.
- */
-public interface PropertyReference
-{
-    <T> Function<Composite, Property<T>> reference();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/QuerySpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/QuerySpecification.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/QuerySpecification.java
deleted file mode 100644
index c065c43..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/QuerySpecification.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.composite.Composite;
-
-/**
- * This should be used when doing native queries, such as SQL, SPARQL or similar. EntityFinders can choose
- * what type of query languages they can understand by checking the language property of a QuerySpecification
- */
-public class QuerySpecification
-    implements Predicate<Composite>
-{
-    public static boolean isQueryLanguage( String language, Predicate<Composite> specification )
-    {
-        if( !( specification instanceof QuerySpecification ) )
-        {
-            return false;
-        }
-
-        return ( (QuerySpecification) specification ).language().equals( language );
-    }
-
-    private String language;
-    private String query;
-
-    public QuerySpecification( String language, String query )
-    {
-        this.language = language;
-        this.query = query;
-    }
-
-    public String language()
-    {
-        return language;
-    }
-
-    public String query()
-    {
-        return query;
-    }
-
-    @Override
-    public boolean test( Composite item )
-    {
-        return false;
-    }
-
-    @Override
-    public String toString()
-    {
-        return language + ":" + query;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/Variable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/Variable.java b/core/api/src/main/java/org/apache/zest/api/query/grammar/Variable.java
deleted file mode 100644
index 300b04d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/Variable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query.grammar;
-
-/**
- * Query Variable name.
- */
-public class Variable
-{
-    private String name;
-
-    public Variable( String name )
-    {
-        this.name = name;
-    }
-
-    public String variableName()
-    {
-        return name;
-    }
-
-    @Override
-    public String toString()
-    {
-        return name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/grammar/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/grammar/package.html b/core/api/src/main/java/org/apache/zest/api/query/grammar/package.html
deleted file mode 100644
index 4a3e2f1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/grammar/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Query Grammar.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/package.html b/core/api/src/main/java/org/apache/zest/api/query/package.html
deleted file mode 100644
index c3ee7ad..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Query API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/Availability.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/Availability.java b/core/api/src/main/java/org/apache/zest/api/service/Availability.java
deleted file mode 100644
index 9ff18a2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/Availability.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-/**
- * Services can implement this interface in order to allow Polygene to ask
- * it whether it is currently available for use or not. This is accessed
- * by clients through the ServiceReference of the service. Services that do not
- * implement this are always considered to be available.
- */
-public interface Availability
-{
-    /**
-     * Implementations should return true if the underlying service is currently available for use.
-     *
-     * Reasons why a service might not be available is either if it has been configured not to be (see
-     * the Enabled interface), or if an underlying resource is currently unavailable.
-     *
-     * @return true if the service is available, false otherwise.
-     */
-    boolean isAvailable();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/DuplicateServiceIdentityException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/DuplicateServiceIdentityException.java b/core/api/src/main/java/org/apache/zest/api/service/DuplicateServiceIdentityException.java
deleted file mode 100644
index b5b13e6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/DuplicateServiceIdentityException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.common.InvalidApplicationException;
-
-/**
- * Thrown when a duplicate service reference is detected.
- */
-public class DuplicateServiceIdentityException
-    extends InvalidApplicationException
-{
-    public DuplicateServiceIdentityException( String string )
-    {
-        super( string );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ImportedServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ImportedServiceDescriptor.java b/core/api/src/main/java/org/apache/zest/api/service/ImportedServiceDescriptor.java
deleted file mode 100644
index e68f4b7..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ImportedServiceDescriptor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.identity.Identifiable;
-
-/**
- * {@code ServiceDescriptor} provides meta information of a service.
- */
-public interface ImportedServiceDescriptor
-    extends ModelDescriptor, Identifiable
-{
-    Class<? extends ServiceImporter> serviceImporter();
-
-    Class<?> type();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index a7a3df4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/NoSuchServiceException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import java.util.stream.Collectors;
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.ModelDescriptor;
-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, TypeLookup typeLookup )
-    {
-        super( "ServiceComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
-    }
-
-    private static String formatVisibleTypes( TypeLookup typeLookup )
-    {
-        return typeLookup.allServices()
-            .map( NoSuchServiceException::typeOf )
-            .collect( Collectors.joining( "\n", "Visible service types are:\n", "" ) );
-    }
-
-    private static String typeOf( ModelDescriptor descriptor )
-    {
-        if( descriptor instanceof CompositeDescriptor )
-        {
-            return ( (CompositeDescriptor) descriptor ).primaryType().getName();
-        }
-        return descriptor.types().map( Class::getName ).collect( Collectors.joining( ",", "[", "]") );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceActivation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceActivation.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceActivation.java
deleted file mode 100644
index 57dbc04..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceActivation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.activation.Activators;
-
-/**
- * Convenience interface for simple Service Activation.
- *
- * Let your ServiceComposite extends ServiceActivation and implement it in one of its Mixins.
- * A corresponding Activator is automatically registered.
- */
-@Activators( ServiceActivation.ServiceActivator.class )
-public interface ServiceActivation
-{
-
-    /**
-     * Called after ServiceComposite Activation.
-     */
-    void activateService()
-        throws Exception;
-
-    /**
-     * Called before ServiceComposite Passivation.
-     */
-    void passivateService()
-        throws Exception;
-
-    /**
-     * Service Activator.
-     */
-    class ServiceActivator
-        extends ServiceActivatorAdapter<ServiceActivation>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<ServiceActivation> activated )
-            throws Exception
-        {
-            activated.get().activateService();
-        }
-
-        @Override
-        public void beforePassivation( ServiceReference<ServiceActivation> passivating )
-            throws Exception
-        {
-            passivating.get().passivateService();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceActivatorAdapter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceActivatorAdapter.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceActivatorAdapter.java
deleted file mode 100644
index ba780f3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceActivatorAdapter.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.activation.Activator;
-
-/**
- * Adapter for Service Activator.
- *
- * @param <ServiceType> Type of the service.
- */
-public class ServiceActivatorAdapter<ServiceType>
-    implements Activator<ServiceReference<ServiceType>>
-{
-    /**
-     * Called before Service activation.
-     * @param activating Activating Service
-     */
-    @Override
-    public void beforeActivation( ServiceReference<ServiceType> activating )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called after Service activation.
-     * @param activated Activated Service
-     */
-    @Override
-    public void afterActivation( ServiceReference<ServiceType> activated )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called before Service passivation.
-     * @param passivating Passivating Service
-     */
-    @Override
-    public void beforePassivation( ServiceReference<ServiceType> passivating )
-        throws Exception
-    {
-    }
-
-    /**
-     * Called after Service passivation.
-     * @param passivated Passivated Service
-     */
-    @Override
-    public void afterPassivation( ServiceReference<ServiceType> passivated )
-        throws Exception
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceComposite.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceComposite.java
deleted file mode 100644
index 48ff167..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceComposite.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.identity.HasIdentity;
-
-/**
- * All Composites being used to implement Services
- * must extend this interface.
- */
-public interface ServiceComposite
-    extends HasIdentity, Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceDescriptor.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceDescriptor.java
deleted file mode 100644
index 8de5ff1..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceDescriptor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.composite.CompositeDescriptor;
-import org.apache.zest.api.composite.StatefulCompositeDescriptor;
-import org.apache.zest.api.identity.Identifiable;
-
-/**
- * {@code ServiceDescriptor} provides meta informations of a service.
- */
-public interface ServiceDescriptor
-    extends CompositeDescriptor, StatefulCompositeDescriptor, Identifiable
-{
-    boolean isInstantiateOnStartup();
-
-    <T> Class<T> configurationType();
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceFinder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceFinder.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceFinder.java
deleted file mode 100644
index 8c9149f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceFinder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import java.lang.reflect.Type;
-import java.util.stream.Stream;
-
-/**
- * Interface used to query for ServiceReferences.
- * <p>
- * Each ServiceFinder is
- * obtained from a specific Module, and the lookup rules are the following:
- * </p>
- * <ol>
- * <li>First look in the same Module as the ServiceFinder</li>
- * <li>Then look in the same Layer as the ServiceFinder. Any Services declared
- * with Visibility Layer and Application should be included</li>
- * <li>Then look in the used Layers. Any Services declared with Visibility Application
- * should be included</li>
- * </ol>
- * <p>
- * Both native Polygene services and imported services are considered, with preference to native services.
- * </p>
- */
-public interface ServiceFinder
-{
-    /**
-     * Find a ServiceReference that implements the given type.
-     *
-     * @param serviceType the type that the Service must implement
-     *
-     * @return a ServiceReference if one is found
-     *
-     * @throws NoSuchServiceException if no service of serviceType is found
-     */
-    <T> ServiceReference<T> findService( Class<T> serviceType )
-        throws NoSuchServiceException;
-
-    /**
-     * Find a ServiceReference that implements the given type.
-     *
-     * @param serviceType the type that the Service must implement
-     *
-     * @return a ServiceReference if one is found
-     *
-     * @throws NoSuchServiceException if no service of serviceType is found
-     */
-    <T> ServiceReference<T> findService( Type serviceType )
-        throws NoSuchServiceException;
-
-    /**
-     * Find ServiceReferences that implements the given type.
-     * <p>
-     * The order of the references is such that Services more local to the querying
-     * Module is earlier in the list.
-     * </p>
-     *
-     * @param serviceType the type that the Services must implement
-     *
-     * @return a stream of ServiceReferences for the given type. It is empty if none exist
-     */
-    <T> Stream<ServiceReference<T>> findServices( Class<T> serviceType );
-
-    /**
-     * Find ServiceReferences that implements the given type.
-     * <p>
-     * The order of the references is such that Services more local to the querying
-     * Module is earlier in the list.
-     * </p>
-     *
-     * @param serviceType the type that the Services must implement
-     *
-     * @return a stream of ServiceReferences for the given type. It is empty if none exist
-     */
-    <T> Stream<ServiceReference<T>> findServices( Type serviceType );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceImporter.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceImporter.java
deleted file mode 100644
index 444747d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceImporter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-/**
- * Import a service from some external source.
- */
-public interface ServiceImporter<T>
-{
-    /**
-     * Imports an instance of the service type described in the service descriptor.
-     *
-     * @param serviceDescriptor The service descriptor.
-     *
-     * @return The imported service instance.
-     *
-     * @throws ServiceImporterException if import failed.
-     */
-    T importService( ImportedServiceDescriptor serviceDescriptor )
-        throws ServiceImporterException;
-
-    /**
-     * Ask if the service is available or not.
-     *
-     * @param instance the instance to be checked
-     *
-     * @return true if the service is available, false if not
-     */
-    boolean isAvailable( T instance );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceImporterException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceImporterException.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceImporterException.java
deleted file mode 100644
index bf120e4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceImporterException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-/**
- * If a ServiceImporter could not import a service
- * instance it must throw this exception.
- */
-public class ServiceImporterException
-    extends RuntimeException
-{
-    public ServiceImporterException()
-    {
-    }
-
-    public ServiceImporterException( String string )
-    {
-        super( string );
-    }
-
-    public ServiceImporterException( String string, Throwable throwable )
-    {
-        super( string, throwable );
-    }
-
-    public ServiceImporterException( Throwable throwable )
-    {
-        super( throwable );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceReference.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceReference.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceReference.java
deleted file mode 100644
index cce52e4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceReference.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.identity.Identifiable;
-import org.apache.zest.api.structure.MetaInfoHolder;
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * From a ServiceReference you can access and modify metadata about a service.
- * You can also access the actual service through get(), that can then be invoked.
- */
-public interface ServiceReference<T>
-    extends HasTypes, ActivationEventListenerRegistration, MetaInfoHolder, Identifiable
-{
-    /**
-     * @return the actual service
-     */
-    T get();
-
-    /**
-     * @return TRUE if the service is active, otherwise return FALSE
-     */
-    boolean isActive();
-
-    /**
-     * @return TRUE if the service is available, otherwise return FALSE
-     */
-    boolean isAvailable();
-
-    /**
-     * @return the ServiceModel of the service referenced by this ServiceReference.
-     */
-     ModelDescriptor model();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/ServiceUnavailableException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/ServiceUnavailableException.java b/core/api/src/main/java/org/apache/zest/api/service/ServiceUnavailableException.java
deleted file mode 100644
index 0576339..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/ServiceUnavailableException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service;
-
-/**
- * Thrown when no available service is found.
- */
-public class ServiceUnavailableException
-    extends RuntimeException
-{
-    public ServiceUnavailableException( String message )
-    {
-        super( message );
-    }
-
-    public ServiceUnavailableException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/importer/InstanceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/importer/InstanceImporter.java b/core/api/src/main/java/org/apache/zest/api/service/importer/InstanceImporter.java
deleted file mode 100644
index a6ed355..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/importer/InstanceImporter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.importer;
-
-import java.util.Objects;
-import java.util.stream.Stream;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.ServiceImporterException;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Layer;
-import org.apache.zest.api.structure.Module;
-
-/**
- * Return a predefined service instance that was provided as meta-info. Search for meta-info in the following order:
- * the service itself, the module of the service, the layer of the service, the whole application.
- */
-public final class InstanceImporter<T>
-    implements ServiceImporter<T>
-{
-    @Structure
-    private Application application;
-
-    @Structure
-    private Layer layer;
-
-    @Structure
-    private Module module;
-
-    @Override
-    public T importService( final ImportedServiceDescriptor serviceDescriptor )
-        throws ServiceImporterException
-    {
-        return Stream.of( serviceDescriptor, module, layer, application )
-            .flatMap( holder -> serviceDescriptor.types().map( type -> (T) holder.metaInfo( type ) ) )
-            .filter( Objects::nonNull )
-            .findFirst().orElse( null );
-    }
-
-    @Override
-    public boolean isAvailable( T instance )
-    {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/importer/NewObjectImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/importer/NewObjectImporter.java b/core/api/src/main/java/org/apache/zest/api/service/importer/NewObjectImporter.java
deleted file mode 100644
index 0098dc4..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/importer/NewObjectImporter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.importer;
-
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.object.ObjectFactory;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.ServiceImporterException;
-
-/**
- * Import Services using a new registered Object instance.
- */
-public final class NewObjectImporter<T>
-    implements ServiceImporter<T>
-{
-    @Structure
-    private ObjectFactory obf;
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public T importService( ImportedServiceDescriptor serviceDescriptor )
-        throws ServiceImporterException
-    {
-        return obf.newObject( (Class<T>) serviceDescriptor.types().findFirst().orElse( null ));
-    }
-
-    @Override
-    public boolean isAvailable( T instance )
-    {
-        return true;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceInstanceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceInstanceImporter.java b/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceInstanceImporter.java
deleted file mode 100644
index 01302d0..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceInstanceImporter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.importer;
-
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceFinder;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.ServiceImporterException;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * Use a registered service that implements ServiceImporter to do the actual
- * import. The service id of the service that this importer should delegate to must
- * be set as meta-info on this service. Example:
- * <pre><code>
- * module.services(MyServiceImporterService.class).identifiedBy("someid");
- * module.importedServices(OtherService.class).importedBy(ServiceInstanceImporter.class).setMetaInfo("someid");
- * </code></pre>
- */
-public class ServiceInstanceImporter<T>
-    implements ServiceImporter<T>
-{
-    @Structure
-    ServiceFinder finder;
-
-    ServiceImporter<T> service;
-
-    Identity serviceId;
-
-    @Override
-    public T importService( ImportedServiceDescriptor importedServiceDescriptor )
-        throws ServiceImporterException
-    {
-        serviceId = importedServiceDescriptor.metaInfo( Identity.class );
-
-        return serviceImporter().importService( importedServiceDescriptor );
-    }
-
-    @Override
-    public boolean isAvailable( T instance )
-    {
-        return serviceImporter().isAvailable( instance );
-    }
-
-    @SuppressWarnings( {"raw", "unchecked"} )
-    private ServiceImporter<T> serviceImporter()
-    {
-        if( service == null )
-        {
-            service = finder.findServices( ServiceImporter.class )
-                            .filter( ref -> ref.identity().equals( serviceId ) )
-                            .findFirst().map( ServiceReference::get )
-                            .orElseThrow( () -> new ServiceImporterException(
-                                "No service importer with id '" + serviceId + "' was found" )
-                            );
-        }
-        return service;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceSelectorImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceSelectorImporter.java b/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceSelectorImporter.java
deleted file mode 100644
index f2d5de6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/service/importer/ServiceSelectorImporter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.service.importer;
-
-import java.util.function.Predicate;
-import java.util.stream.Stream;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.service.Availability;
-import org.apache.zest.api.service.ImportedServiceDescriptor;
-import org.apache.zest.api.service.ServiceFinder;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.ServiceImporterException;
-import org.apache.zest.api.service.ServiceReference;
-
-/**
- * If several services are available with a given type, and you want to constrain
- * the current module to use a specific one, then use this importer. Specify a
- * Specification&lt;ServiceReference&lt;T&gt;&gt; criteria as meta-info for the service, which will be applied
- * to the list of available services, and the first match will be chosen.
- *
- * This importer will avoid selecting itself, as could be possible if the ServiceQualifier.first()
- * filter is used.
- */
-public final class ServiceSelectorImporter<T>
-    implements ServiceImporter<T>
-{
-    @Structure
-    private ServiceFinder locator;
-
-    @Override
-    @SuppressWarnings( { "raw", "unchecked" } )
-    public T importService( ImportedServiceDescriptor serviceDescriptor )
-        throws ServiceImporterException
-    {
-        Predicate<ServiceReference<?>> selector = serviceDescriptor.metaInfo( Predicate.class );
-        Class serviceType = serviceDescriptor.types().findFirst().orElse( null );
-
-        Stream<ServiceReference<T>> services = locator.findServices( serviceType );
-        Predicate<ServiceReference<T>> filter = ref ->
-        {
-            Predicate selector1 = ref.metaInfo( Predicate.class );
-            return selector1 == null || selector == selector1;
-        };
-        return services.filter( filter.and( selector ) )
-                       .findFirst().map( ServiceReference::get )
-                       .orElseThrow(
-                           () -> new ServiceImporterException(
-                               "Could not find any service to import that matches the given specification for "
-                               + serviceDescriptor.identity() ) );
-    }
-
-    @Override
-    public boolean isAvailable( T instance )
-    {
-        return !( instance instanceof Availability ) || ( (Availability) instance ).isAvailable();
-    }
-}


[49/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
new file mode 100644
index 0000000..f6e9707
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
@@ -0,0 +1,115 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.doc
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.apache.polygene.gradle.PolygeneExtension
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.tasks.Copy
+
+@CompileStatic
+class ManualPlugin implements Plugin<Project>
+{
+  static class TaskNames
+  {
+    static final String WEBSITE = "website"
+    static final String ARCHIVE_WEBSITE = "archiveWebsite"
+    static final String COPY_WEBSITE = "copyWebsite"
+    static final String MANUALS = "manuals"
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    def zest = project.extensions.getByType( PolygeneExtension )
+    project.tasks.create( TaskNames.WEBSITE, DocumentationTask ) { DocumentationTask task ->
+      task.group = TaskGroups.DOCUMENTATION
+      task.description = 'Generates documentation website'
+      task.dependsOn project.rootProject.allprojects.findResults { Project p ->
+        p.tasks.findByName AsciidocBuildInfoPlugin.TASK_NAME
+      }
+      task.onlyIf { isAsciidocInstalled( project, zest ) }
+      task.docName = 'website'
+      task.docType = 'article'
+    }
+    project.tasks.create( TaskNames.ARCHIVE_WEBSITE, Copy ) { Copy task ->
+      task.group = TaskGroups.DOCUMENTATION
+      task.description = 'Copy website to ../polygene-web'
+      task.dependsOn TaskNames.WEBSITE
+      task.onlyIf { isAsciidocInstalled( project, zest ) }
+      if( zest.developmentVersion )
+      {
+        task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/develop"
+      }
+      else
+      {
+        task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/$project.version"
+      }
+      task.from "$project.buildDir/docs/website/"
+    }
+    project.tasks.create( TaskNames.COPY_WEBSITE, Copy ) { Copy task ->
+      task.group = TaskGroups.RELEASE
+      task.description = 'Copy website to ../polygene-web LATEST'
+      task.dependsOn TaskNames.ARCHIVE_WEBSITE
+      task.onlyIf { zest.releaseVersion }
+      task.from "$project.rootProject.projectDir/../polygene-web/site/content/java/$project.version/"
+      task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/latest/"
+    }
+    project.tasks.create( TaskNames.MANUALS ) { Task task ->
+      task.group = TaskGroups.DOCUMENTATION
+      task.description = 'Generates all documentation'
+      task.dependsOn TaskNames.COPY_WEBSITE
+      task.onlyIf { isAsciidocInstalled( project, zest ) }
+    }
+  }
+
+  private static Boolean asciidocInstalled = null
+
+  // Force when building a release version
+  // Skip if skipAsciidocIfAbsent property is set
+  // Skip if asciidoc is not found in PATH when building a development version
+  private static boolean isAsciidocInstalled( Project project, PolygeneExtension zest )
+  {
+    if( asciidocInstalled == null )
+    {
+      def skipAsciidocIfAbsent = project.findProperty 'skipAsciidocIfAbsent'
+      if( !skipAsciidocIfAbsent && zest.releaseVersion )
+      {
+        project.logger.info 'Asciidoc tasks forced for building a release version, hope you have Asciidoc installed'
+        asciidocInstalled = true
+      }
+      else
+      {
+        def pathDirs = System.getenv( 'PATH' ).split( File.pathSeparator )
+        def asciidocCandidates = pathDirs.collect( { String path ->
+          new File( path, 'asciidoc' )
+        } ).flatten() as List<File>
+        asciidocInstalled = asciidocCandidates.findAll( { it.isFile() } )
+        if( !asciidocInstalled )
+        {
+          project.logger.lifecycle 'WARNING Asciidoc not found in PATH, manual tasks will skip\n' +
+                                   '        Please install http://www.methods.co.nz/asciidoc/'
+        }
+      }
+    }
+    return asciidocInstalled
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
new file mode 100644
index 0000000..19ee6e0
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/XsltTask.groovy
@@ -0,0 +1,105 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.doc
+
+import groovy.transform.CompileStatic
+import org.gradle.api.file.EmptyFileVisitor
+import org.gradle.api.tasks.SourceTask
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.api.tasks.Optional
+import org.gradle.api.tasks.InputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.api.file.FileVisitDetails
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.stream.StreamResult
+import javax.xml.transform.stream.StreamSource
+
+/**
+ *  Gradle task for running a set of one or more
+ *  files through an XSLT transform.  A styleSheet
+ *  file must be specified.  The source file(s) are
+ *  configured just like any other source task:
+ *     source <file>
+ *       ...or...
+ *     source <directory>
+ *       ...and then optionally...
+ *     include '*.xml'
+ *     exclude, etc.
+ *
+ *  One of destDir or destFile must be specified, though if
+ *  there are multiple source files then destFile will just
+ *  keep getting rewritten.
+ *
+ *  The extension is stripped from the source files and the
+ *  specified extension is appended (whether it is set or not)
+ *  it defaults to no extension.
+ *
+ *  Example task formatting a check style report:
+ *
+ *  task checkstyleReport(type: XsltTask, dependsOn: check) {
+ *      source project.checkstyleResultsDir
+ *      include '*.xml'
+ *
+ *      destDir = project.checkstyleResultsDir
+ *      extension = 'html'
+ *
+ *      stylesheetFile = file( 'config/checkstyle/checkstyle-noframes.xsl' )
+ * }
+ *
+ *  The above definition requires that the specified XSL file be
+ *  copied in with the other checkstyle configuration files.  (The
+ *  file in the example is part of the checkstyle distribution.)
+ *
+ */
+@CompileStatic
+class XsltTask extends SourceTask
+{
+
+  @OutputDirectory
+  @Optional
+  File destDir
+
+  @Optional
+  String extension
+
+  @InputFile
+  File stylesheetFile
+
+  @TaskAction
+  def transform()
+  {
+    def factory = TransformerFactory.newInstance()
+    def transformer = factory.newTransformer( new StreamSource( stylesheetFile ) );
+
+    getSource().visit( new EmptyFileVisitor() {
+      @Override
+      void visitFile( FileVisitDetails fvd )
+      {
+        // Remove the extension from the file name
+        def name = fvd.file.name.replaceAll( '[.][^\\.]*$', '' )
+        if( extension == null )
+        {
+          extension = 'html'
+        }
+        name += '.' + extension
+        def destFile = new File( destDir, name )
+        transformer.transform( new StreamSource( fvd.file ), new StreamResult( destFile ) )
+      }
+    } )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
new file mode 100644
index 0000000..1b676af
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/performance/PerformanceTestsPlugin.groovy
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.performance
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.gradle.api.Action
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.bundling.Jar
+import org.gradle.api.tasks.testing.Test
+import org.gradle.language.base.plugins.LifecycleBasePlugin
+
+// TODO Add profiling tasks (jfr or honest? flamegraphs?)
+// TODO Add simple regression assertions, how? testing against a previous version?
+@CompileStatic
+class PerformanceTestsPlugin implements Plugin<Project>
+{
+  static class TaskNames
+  {
+    static final String PERFORMANCE_TEST = 'performanceTest'
+    static final String PERFORMANCE_PROFILE = 'performanceProfile'
+    static final String PERFORMANCE_CHECK = 'performanceCheck'
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+    sourceSets.create 'perf'
+    project.dependencies.add 'perfCompile', sourceSets.getByName( 'main' ).output
+    project.dependencies.add 'perfCompile', sourceSets.getByName( 'test' ).output
+    project.dependencies.add 'perfCompile', project.configurations.getByName( 'testCompile' )
+    project.dependencies.add 'perfRuntime', project.configurations.getByName( 'testRuntime' )
+    project.tasks.getByName( LifecycleBasePlugin.CHECK_TASK_NAME ).dependsOn 'compilePerfJava'
+    project.tasks.create( TaskNames.PERFORMANCE_TEST, Test, { Test task ->
+      task.group = TaskGroups.PERFORMANCE
+      task.description = 'Runs performance tests.'
+      task.maxParallelForks = 1
+      task.forkEvery = 1L
+      task.testClassesDir = sourceSets.getByName( 'perf' ).output.classesDir
+      task.classpath = sourceSets.getByName( 'perf' ).runtimeClasspath
+      task.systemProperty 'jar.path', ( project.tasks.getByName( 'jar' ) as Jar ).archivePath
+    } as Action<Test> )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
new file mode 100644
index 0000000..74c5dcf
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
@@ -0,0 +1,281 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.publish
+
+import org.gradle.api.artifacts.maven.MavenDeployer
+
+class MavenMetadata
+{
+  static void applyTo( MavenDeployer mavenDeployer )
+  {
+    mavenDeployer.pom {
+      project {
+        url 'https://polygene.apache.org/'
+        organization {
+          name 'The Apache Software Foundation'
+          url 'https://apache.org/'
+        }
+        inceptionYear '2007'
+        issueManagement {
+          system 'jira'
+          url 'https://issues.apache.org/jira/browse/ZEST'
+        }
+        scm {
+          url "https://github.com/apache/polygene-java"
+          connection "scm:git:https://git-wip-us.apache.org/repos/asf/polygene-java.git"
+          developerConnection "scm:git:https://git-wip-us.apache.org/repos/asf/polygene-java.git"
+        }
+        licenses {
+          license {
+            name 'Apache License, version 2.0.'
+            url 'http://www.apache.org/licenses/LICENSE-2.0'
+          }
+        }
+        mailingLists {
+          mailingList {
+            name 'Users List'
+            subscribe 'users-subscribe@polygene.apache.org'
+            unsubscribe 'users-unsubscribe@polygene.apache.org'
+            post 'users@polygene.apache.org'
+            archive 'https://mail-archives.apache.org/mod_mbox/polygene-users/'
+            otherArchives {
+              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+          mailingList {
+            name 'Development List'
+            subscribe 'dev-subscribe@polygene.apache.org'
+            unsubscribe 'dev-unsubscribe@polygene.apache.org'
+            post 'dev@polygene.apache.org'
+            archive 'https://mail-archives.apache.org/mod_mbox/polygene-dev/'
+            otherArchives {
+              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+          mailingList {
+            name 'Commits List'
+            subscribe 'commits-subscribe@polygene.apache.org'
+            unsubscribe 'commits-unsubscribe@polygene.apache.org'
+            post 'commits@polygene.apache.org'
+            archive 'https://mail-archives.apache.org/mod_mbox/polygene-commits/'
+            otherArchives {
+              otherArchive 'https://www.apache.org/foundation/mailinglists.html#archives'
+            }
+          }
+        }
+        developers {
+          developer {
+            id 'niclas@hedhman.org'
+            name 'Niclas Hedhman'
+            email 'niclas@hedhman.org'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+8'
+          }
+          developer {
+            id 'rickardoberg'
+            name 'Rickard \u00F6berg'
+            email 'rickard.oberg@jayway.se'
+            roles {
+              role 'Core Team'
+            }
+            url 'http://www.neotechnology.com'
+            organization 'Neo Technology AB'
+            organizationUrl 'http://www.neotechnology.com'
+            timezone 'UTC+8'
+          }
+          developer {
+            id 'edward.yakop@gmail.com'
+            name 'Edward Yakop'
+            email 'efy@codedragons.com'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+8'
+          }
+          developer {
+            id 'adreghiciu@gmail.com'
+            name 'Alin Dreghiciu'
+            email 'adreghiciu@codedragons.com'
+            roles {
+              role 'Core Team'
+            }
+            organizationUrl 'http://polygene.apache.org'
+            timezone 'UTC+2'
+          }
+          developer {
+            id 'mesirii'
+            name 'Michael Hunger'
+            email 'qi4j@jexp.de'
+            roles {
+              role 'Core Team'
+            }
+            timezone 'CET'
+          }
+
+          developer {
+            id "muhdkamil"
+            name "Muhd Kamil bin Mohd Baki"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "ops4j@leangen.net"
+            name "David Leangen"
+            organization "Bioscene"
+            email "ops4j@leangen.net"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+9"
+          }
+
+          developer {
+            id "sonny.gill@jayway.net"
+            name "Sonny Gill"
+            email "sonny.public@gmail.com"
+            roles {
+              role 'Community Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "taowen"
+            name "Tao Wen"
+            organization ""
+            email "taowen@gmail.com"
+            roles {
+              role 'Community Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "thobe"
+            name "Tobias Ivarsson"
+            email "tobias@neotechnology.com"
+            url "http://www.neotechnology.com"
+            organization "NeoTechnology"
+            organizationUrl "http://www.neotechnology.com"
+            roles {
+              role "Platform Team"
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "boon"
+            name "Lan Boon Ping"
+            email "boonping81@gmail.com"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "jan.kronquist@gmail.com"
+            name "Jan Kronquist"
+            email "jan.kronquist@gmail.com"
+            organization "Jayway"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "nmwael"
+            name "Nino Saturnino Martinez Vazquez Wael"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "peter@neubauer.se"
+            name "Peter Neubauer"
+            email "peter@neubauer.se"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "rwallace"
+            name "Richard Wallace"
+            email "rwallace@thewallacepack.net"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC-7"
+          }
+
+          developer {
+            id "siannyhalim@gmail.com"
+            name "Sianny Halim"
+            email "siannyhalim@gmail.com"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+8"
+          }
+
+          developer {
+            id "paul@nosphere.org"
+            name "Paul Merlin"
+            email "paul@nosphere.org"
+            roles {
+              role 'Core Team'
+            }
+            timezone "CET"
+          }
+
+          developer {
+            id "stas.dev+qi4j@gmail.com"
+            name "Stanislav Muhametsin"
+            email "stas.dev+qi4j@gmail.com"
+            roles {
+              role 'Platform Team'
+            }
+            timezone "UTC+2"
+          }
+
+          developer {
+            id "tonny"
+            name "Tonny Kohar"
+            roles {
+              role "Community Team"
+            }
+            email "tonny.kohar@gmail.com"
+            timezone "UTC+7"
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
new file mode 100644
index 0000000..6d55b9d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
@@ -0,0 +1,183 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.publish
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.PolygeneExtension
+import org.apache.polygene.gradle.release.ReleaseSpecExtension
+import org.gradle.api.GradleException
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.artifacts.maven.MavenDeployer
+import org.gradle.api.artifacts.maven.MavenDeployment
+import org.gradle.api.internal.plugins.DslObject
+import org.gradle.api.plugins.MavenRepositoryHandlerConvention
+import org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer
+import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
+import org.gradle.api.tasks.Upload
+import org.gradle.plugins.signing.Sign
+import org.gradle.plugins.signing.SigningExtension
+
+/**
+ * Publishing.
+ *
+ * <strong>Configuration</strong>
+ *
+ * By default RELEASES are signed, SNAPSHOTS are not.
+ * Signing can be turned on or off by setting the {@literal uploadSigned} property.
+ *
+ * By default RELEASES must satisfy {@link org.apache.polygene.gradle.release.ModuleReleaseSpec}, SNAPSHOT don't.
+ * This can be turned on or off by setting the {@literal uploadReleaseSpec} property.
+ *
+ * By default RELEASES and SNAPSHOTS are uploaded using HTTP.
+ * Used Wagon can be overridden by setting the {@literal uploadWagon} property.
+ *
+ * By default RELEASES and SNAPSHOTS are uploaded to Apache Nexus.
+ * Target repository can be overridden by setting the {@literal uploadRepository} property.
+ *
+ * No username/password is provided by default.
+ * If needed set them using the uploadUsername and {@literal uploadPassword} properties.
+ */
+@CompileStatic
+class PublishingPlugin implements Plugin<Project>
+{
+  static final String WAGON_HTTP = 'org.apache.maven.wagon:wagon-http:2.2'
+  static final String WAGON_SSH = 'org.apache.maven.wagon:wagon-ssh:2.2'
+  static final String WAGON_WEBDAV = 'org.apache.maven.wagon:wagon-webdav:1.0-beta-2'
+
+  static final String RELEASES_REPOSITORY_NAME = 'apache.releases.https'
+  static final String RELEASES_REPOSITORY_URL = 'https://repository.apache.org/service/local/staging/deploy/maven2'
+  static final String SNAPSHOTS_REPOSITORY_NAME = 'apache.snapshots.https'
+  static final String SNAPSHOTS_REPOSITORY_URL = 'https://repository.apache.org/content/repositories/snapshots'
+
+  static class Config
+  {
+    boolean snapshots
+    boolean releases
+    boolean signed
+    boolean releaseSpec
+    String wagon
+    String repositoryName
+    String repositoryUrl
+    String username
+    String password
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    Config config = configFor( project )
+    applyWagonConfiguration( project, config )
+    configureSigning( project, config )
+    configureUploadArchives( project, config )
+    configureMavenMetadata( project )
+    applyMavenPublishAuth( project )
+  }
+
+  private static Config configFor( Project project )
+  {
+    def zest = project.extensions.getByType( PolygeneExtension )
+    def config = new Config()
+    config.snapshots = zest.developmentVersion
+    config.releases = zest.releaseVersion
+    config.signed = project.findProperty( 'uploadSigned' ) ?: config.releases
+    config.releaseSpec = project.findProperty( 'uploadReleaseSpec' ) ?: config.releases
+    config.wagon = project.findProperty( 'uploadWagon' ) ?: WAGON_HTTP
+    config.repositoryName = project.findProperty( 'uploadRepositoryName' ) ?:
+                            config.releases ? RELEASES_REPOSITORY_NAME : SNAPSHOTS_REPOSITORY_NAME
+    config.repositoryUrl = project.findProperty( 'uploadRepository' ) ?:
+                           config.releases ? RELEASES_REPOSITORY_URL : SNAPSHOTS_REPOSITORY_URL
+    config.username = project.findProperty( 'uploadUsername' )
+    config.password = project.findProperty( 'uploadPassword' )
+    return config
+  }
+
+  private static void applyWagonConfiguration( Project project, Config config )
+  {
+    project.configurations.create( 'deployersJars' )
+    project.dependencies.add( 'deployersJars', config.wagon )
+  }
+
+  private static void configureSigning( Project project, Config config )
+  {
+    project.plugins.apply 'signing'
+    def signing = project.extensions.getByType( SigningExtension )
+    signing.required = config.signed
+    signing.sign project.configurations.getByName( 'archives' )
+    def signArchives = project.tasks.getByName( 'signArchives' ) as Sign
+    signArchives.onlyIf { !project.findProperty( 'skipSigning' ) }
+  }
+
+  private static void configureUploadArchives( Project project, Config config )
+  {
+    project.plugins.apply 'maven'
+    def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
+    uploadArchives.doFirst {
+      if( project.version == "0" )
+      {
+        throw new GradleException( "'version' must be given as a system property to perform a release." )
+      }
+    }
+    uploadArchives.onlyIf {
+      def notSkipped = !project.hasProperty( 'skipUpload' )
+      def approvedProject = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects.contains( project )
+      return notSkipped && ( !config.releaseSpec || ( approvedProject || project == project.rootProject ) )
+    }
+    uploadArchives.dependsOn project.tasks.getByName( 'check' )
+    def repositoriesConvention = new DslObject( uploadArchives.repositories )
+      .getConvention()
+      .getPlugin( MavenRepositoryHandlerConvention )
+    def mavenDeployer = repositoriesConvention.mavenDeployer() as DefaultGroovyMavenDeployer
+    if( config.signed )
+    {
+      mavenDeployer.beforeDeployment { MavenDeployment deployment ->
+        project.extensions.getByType( SigningExtension ).signPom( deployment )
+      }
+    }
+    mavenDeployer.configuration = project.configurations.getByName( 'deployersJars' )
+    def repository = new MavenRemoteRepository()
+    repository.id = config.repositoryName
+    repository.url = config.repositoryUrl
+    if( config.username )
+    {
+      repository.authentication.userName = config.username
+      repository.authentication.password = config.password
+    }
+    if( config.releases )
+    {
+      mavenDeployer.repository = repository
+    }
+    else
+    {
+      mavenDeployer.snapshotRepository = repository
+    }
+  }
+
+  private static void configureMavenMetadata( Project project )
+  {
+    def uploadArchives = project.tasks.getByName( 'uploadArchives' ) as Upload
+    def mavenDeployer = uploadArchives.repositories.getByName( 'mavenDeployer' ) as MavenDeployer
+    MavenMetadata.applyTo( mavenDeployer )
+  }
+
+  private static void applyMavenPublishAuth( final Project project )
+  {
+    // Bug in maven-publish-auth require apply after uploadArchives setup
+    project.plugins.apply 'maven-publish-auth'
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
new file mode 100644
index 0000000..d1fe082
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/CheckReleaseSpecTask.groovy
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release
+
+import groovy.transform.CompileStatic
+import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+import org.gradle.api.artifacts.ProjectDependency
+import org.gradle.api.tasks.TaskAction
+
+@CompileStatic
+class CheckReleaseSpecTask extends DefaultTask
+{
+  CheckReleaseSpecTask()
+  {
+    description = 'Ensure that no releasable module depend on module(s) that don\'t fit the release criteria.'
+    doFirst {
+      def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
+      dependsOn approvedProjects.collect { each -> each.configurations.getByName( 'runtime' ) }
+    }
+  }
+
+  @TaskAction
+  void check()
+  {
+    Map<Project, Set<ProjectDependency>> notReleasable = [ : ]
+    def approvedProjects = project.extensions.getByType( ReleaseSpecExtension ).approvedProjects
+    approvedProjects.each { approvedProject ->
+      def projectDependencies = approvedProject.configurations.getByName( 'runtime' ).allDependencies.findAll {
+        it instanceof ProjectDependency
+      } as Set<ProjectDependency>
+      projectDependencies.each { dep ->
+        def depNotReleaseApproved = approvedProjects.findAll { rp ->
+          rp.group == dep.dependencyProject.group && rp.name == dep.dependencyProject.name
+        }.isEmpty()
+        if( depNotReleaseApproved )
+        {
+          if( !notReleasable[ approvedProject ] )
+          {
+            notReleasable[ approvedProject ] = [ ] as Set
+          }
+          notReleasable[ approvedProject ] << dep
+        }
+      }
+    }
+    if( !notReleasable.isEmpty() )
+    {
+      def errorMessage = new StringBuilder()
+      errorMessage << "At least one releasable module depends on module(s) that don't fit the release criteria!\n"
+      errorMessage << "\tOffending module -> Non releasable dependencies\n"
+      notReleasable.each { k, v ->
+        def noRlsDeps = v.collect { d -> ':' + d.dependencyProject.group + ':' + d.dependencyProject.name }
+        errorMessage << "\t$k -> ${ noRlsDeps })\n"
+      }
+      errorMessage << "Check the dev-status.xml file content in each modules directory."
+      throw new GradleException( errorMessage.toString() )
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
new file mode 100644
index 0000000..13cbe09
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ModuleReleaseSpec.groovy
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release;
+
+import org.gradle.api.Project
+
+class ModuleReleaseSpec
+{
+  def boolean satisfiedBy( Project project )
+  {
+    def devStatusFile = new File( project.projectDir, "dev-status.xml" )
+    if( !devStatusFile.exists() )
+    {
+      return false
+    }
+    def module = new XmlSlurper().parse( devStatusFile )
+    def codebase = module.status.codebase.text()
+    def docs = module.status.documentation.text()
+    def tests = module.status.unittests.text()
+    def satisfied = ( codebase == 'none' && docs == 'complete' && tests != 'complete' )
+    satisfied |= ( codebase == 'early' && ( docs == 'complete' || docs == 'good') && (tests == 'complete' || tests == 'good' ) )
+    satisfied |= ( codebase == 'beta' && (docs == 'complete' || docs == 'good' || docs == 'brief') && (tests == 'complete' || tests == 'good' || tests == 'some') )
+    satisfied |= ( codebase == 'stable' )
+    satisfied |= ( codebase == 'mature' )
+    // TODO Add a task to report this easily
+    // println "$project.name($satisfied) -> $codebase, $docs, $tests"
+    return satisfied
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
new file mode 100644
index 0000000..9a93925
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseApprovedProjectsTask.groovy
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release
+
+import groovy.json.JsonBuilder
+import groovy.transform.CompileStatic
+import org.gradle.api.DefaultTask
+import org.gradle.api.file.FileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+
+/**
+ * Write paths of release approved projects to a JSON file.
+ *
+ * This task sole purpose is proper up-do-date behaviour when changing {@literal dev-status.xml} files.
+ */
+@CompileStatic
+class ReleaseApprovedProjectsTask extends DefaultTask
+{
+  @InputFiles
+  FileCollection getDevStatusFiles()
+  {
+    return project.files( project.allprojects
+                                 .collect( { project -> project.file( 'dev-status.xml' ) } )
+                                 .findAll( { it.exists() } ) )
+  }
+
+  @OutputFile
+  File getJsonApprovedProjects()
+  {
+    return new File( new File( project.buildDir, 'release' ), 'approved-projects.json' )
+  }
+
+  @TaskAction
+  void approveProjects()
+  {
+    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
+    jsonApprovedProjects.parentFile.mkdirs()
+    jsonApprovedProjects.text = new JsonBuilder( releaseSpec.approvedProjects.collect( { it.path } ) ).toPrettyString()
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy
new file mode 100644
index 0000000..c5b0887
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecExtension.groovy
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+
+/**
+ * Provide release approved projects.
+ *
+ * There's no up-to-date checking on Gradle extensions.
+ * Depend on {@link ReleaseApprovedProjectsTask} to get a good up-to-date behavior.
+ */
+@CompileStatic
+class ReleaseSpecExtension
+{
+  static final String NAME = 'releaseSpec'
+  Set<Project> approvedProjects
+
+  ReleaseSpecExtension( Project rootProject )
+  {
+    def spec = new ModuleReleaseSpec()
+    approvedProjects = rootProject.allprojects.findAll( { p -> spec.satisfiedBy( p ) } )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy
new file mode 100644
index 0000000..34422a9
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/release/ReleaseSpecPlugin.groovy
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.release
+
+import groovy.transform.CompileStatic
+import org.apache.polygene.gradle.TaskGroups
+import org.gradle.api.Plugin
+import org.gradle.api.Project
+import org.gradle.api.Task
+
+@CompileStatic
+class ReleaseSpecPlugin implements Plugin<Project>
+{
+  static class TaskNames
+  {
+    static final String RELEASE_APPROVED_PROJECTS = 'releaseSpecApprovedProjects'
+    static final String CHECK_RELEASE_SPEC = 'checkReleaseSpec'
+  }
+
+  @Override
+  void apply( final Project project )
+  {
+    if( project != project.rootProject )
+    {
+      throw new IllegalStateException( "This plugin is only applicable to the root project" )
+    }
+    applyReleaseSpec( project )
+  }
+
+  private static void applyReleaseSpec( Project project )
+  {
+    project.extensions.create( ReleaseSpecExtension.NAME, ReleaseSpecExtension, project.rootProject )
+    project.tasks.create( TaskNames.RELEASE_APPROVED_PROJECTS, ReleaseApprovedProjectsTask ) { Task task ->
+      task.group = TaskGroups.RELEASE
+      task.description = 'Apply release specification to projects in the build'
+    }
+    project.tasks.create( TaskNames.CHECK_RELEASE_SPEC, CheckReleaseSpecTask ) { Task task ->
+      task.group = TaskGroups.RELEASE_VERIFICATION
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
new file mode 100644
index 0000000..01b4e71
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/tasks/ExecLogged.groovy
@@ -0,0 +1,117 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.tasks
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Action
+import org.gradle.api.GradleException
+import org.gradle.api.Project
+import org.gradle.api.tasks.AbstractExecTask
+import org.gradle.api.tasks.OutputFile
+import org.gradle.api.tasks.TaskAction
+import org.gradle.internal.logging.ConsoleRenderer
+import org.gradle.process.ExecSpec
+
+@CompileStatic
+class ExecLogged extends AbstractExecTask<ExecLogged>
+{
+  @OutputFile
+  File stdoutFile = project.file( "$project.buildDir/tmp/${ getName() }/stdout.log" )
+
+  @OutputFile
+  File stderrFile = project.file( "$project.buildDir/tmp/${ getName() }/stderr.log" )
+
+  ExecLogged()
+  {
+    super( ExecLogged.class )
+  }
+
+  @TaskAction
+  protected void exec()
+  {
+    [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
+    def outStream = stdoutFile.newOutputStream()
+    def errStream = stderrFile.newOutputStream()
+    try
+    {
+      super.exec()
+    }
+    catch( Exception ex )
+    {
+      throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
+    }
+    finally
+    {
+      close outStream, errStream
+    }
+  }
+
+  static void execLogged( Project project, File stdoutFile, File stderrFile, Action<? super ExecSpec> specAction )
+  {
+    [ stdoutFile, stderrFile ].each { it.parentFile.mkdirs() }
+    def outStream = stdoutFile.newOutputStream()
+    def errStream = stderrFile.newOutputStream()
+    try
+    {
+      project.exec { ExecSpec spec ->
+        specAction.execute( spec )
+        spec.standardOutput = outStream
+        spec.errorOutput = errStream
+      }
+    }
+    catch( Exception ex )
+    {
+      throw new GradleException( errorMessage( ex, stdoutFile, stderrFile ), ex )
+    }
+    finally
+    {
+      close outStream, errStream
+    }
+  }
+
+  private static void close( Closeable... closeables )
+    throws IOException
+  {
+    def errors = [ ] as List<IOException>
+    for( Closeable closeable : closeables )
+    {
+      try
+      {
+        closeable.close()
+      }
+      catch( IOException ex )
+      {
+        errors.add( ex )
+      }
+    }
+    if( !errors.empty )
+    {
+      def ex = new IOException( 'Failed to close some' )
+      errors.each { ex.addSuppressed it }
+      throw ex
+    }
+  }
+
+  private static String errorMessage( Exception ex, File stdoutFile, File stderrFile )
+  {
+    def consoleRenderer = new ConsoleRenderer()
+    return "${ ex.message }\n" +
+           "\tSTDOUT ${ consoleRenderer.asClickableFileUrl( stdoutFile ) }\n" +
+           "\tSTDERR ${ consoleRenderer.asClickableFileUrl( stderrFile ) }"
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
new file mode 100644
index 0000000..ca10b80
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/test/AggregatedJacocoReportTask.groovy
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.test
+
+import org.gradle.api.DefaultTask
+import org.gradle.api.Project
+import org.gradle.api.file.FileCollection
+import org.gradle.api.tasks.InputFiles
+import org.gradle.api.tasks.OutputDirectory
+import org.gradle.api.tasks.TaskAction
+
+class AggregatedJacocoReportTask extends DefaultTask
+{
+  @InputFiles
+  FileCollection getJacocoExecDataDirectories()
+  {
+    return project.files( project.subprojects.collect( { Project p -> "${ p.buildDir.path }/jacoco" } ) )
+  }
+
+  @OutputDirectory
+  File getOutputDirectory()
+  {
+    return project.file( "$project.buildDir/reports/coverage" )
+  }
+
+  @TaskAction
+  void report()
+  {
+    def coveredProjects = project.subprojects.findAll { p -> new File( "${ p.buildDir.path }/jacoco" ).exists() }
+    def coreProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.core' ) }
+    def libProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.lib' ) }
+    def extProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.ext' ) }
+    def toolsProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.tool' ) }
+    def tutoProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.tuto' ) }
+    def samplesProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.apache.polygene.sample' ) }
+    def classpath = project.configurations.getByName( 'jacoco' ).asPath
+    project.ant {
+      taskdef name: 'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: classpath
+      mkdir dir: outputDirectory
+      jacocoreport {
+        executiondata {
+          coveredProjects.collect { p -> fileset( dir: "${ p.buildDir.path }/jacoco" ) { include( name: '*.exec' ) } }
+        }
+        structure( name: "Apache Polygene\u2122 (Java Edition) SDK" ) {
+          group( name: "Core" ) {
+            classfiles { coreProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { coreProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+          group( name: "Libraries" ) {
+            classfiles { libProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { libProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+          group( name: "Extensions" ) {
+            classfiles { extProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { extProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+          group( name: "Tools" ) {
+            classfiles { toolsProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { toolsProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+          group( name: "Tutorials" ) {
+            classfiles { tutoProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { tutoProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+          group( name: "Samples" ) {
+            classfiles { samplesProjects.collect { p -> fileset dir: "${ p.buildDir.path }/classes/main" } }
+            sourcefiles { samplesProjects.collect { p -> fileset dir: "${ p.projectDir.path }/src/main/java" } }
+          }
+        }
+        csv destfile: "${ outputDirectory }/jacoco.csv", encoding: "UTF-8"
+        xml destfile: "${ outputDirectory }/jacoco.xml", encoding: "UTF-8"
+        html destdir: outputDirectory, encoding: "UTF-8", locale: "en", footer: "Apache Polygene\u2122 (Java Edition) SDK"
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
new file mode 100644
index 0000000..2a99206
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/version/VersionClassPlugin.groovy
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle.version
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+import org.gradle.api.Plugin
+import org.gradle.api.Task
+import org.gradle.api.file.SourceDirectorySet
+import org.gradle.api.plugins.JavaPlugin
+import org.gradle.api.plugins.JavaPluginConvention
+import org.gradle.api.tasks.SourceSet
+import org.gradle.api.tasks.bundling.Jar
+
+// TODO:release:perf Placeholder for date for dev versions
+// TODO:release:perf Add git data, placeholders for dev versions
+@CompileStatic
+class VersionClassPlugin implements Plugin<Project>
+{
+  def void apply( Project project )
+  {
+    project.getPlugins().apply( JavaPlugin.class )
+    def genSrc = 'generated-src/version'
+    def generatedSrcDir = new File( project.buildDir, genSrc )
+
+    Task makeVersionClassTask = project.task( 'makeVersionClass' )
+    makeVersionClassTask.doLast {
+      def now = new Date()
+      def tmpGroup = project.name
+      if( tmpGroup.startsWith( "org.apache.polygene.core" ) )
+      {
+        tmpGroup = tmpGroup - ".core"
+      }
+      tmpGroup = tmpGroup.replace( '-', '_' )
+      def outFilename = "java/" + tmpGroup.replace( '.', '/' ) + "/BuildVersion.java"
+      def outFile = new File( generatedSrcDir, outFilename )
+      outFile.getParentFile().mkdirs()
+      def f = new FileWriter( outFile )
+      f.write( 'package ' + tmpGroup + ';\n' )
+      f.write( """
+/**
+ * Simple class for storing the version derived from the build system.
+ *
+ */
+public interface BuildVersion
+{
+    /** The version of the project from the gradle build.gradle file. */
+    String VERSION = \"""" + project.version + """\";
+
+    /** The name of the project from the gradle build.gradle file. */
+    String NAME = \"""" + project.name + """\";
+
+    /** The group of the project from the gradle build.gradle file. */
+    String GROUP = \"""" + project.group + """\";
+
+    /** The date this file was generated, usually the last date that the project was modified. */
+    String DATE = \"""" + now + """\";
+
+    /** The full details of the version, including the build date. */
+    String DETAILED_VERSION = GROUP + ":" + NAME + ":" + VERSION + " " + DATE;
+}\n
+""" )
+      f.close()
+    }
+    def sourceSets = project.convention.getPlugin( JavaPluginConvention ).sourceSets
+    sourceSets.create( "version" ) { SourceSet sourceSet ->
+      sourceSet.java { SourceDirectorySet dirSet ->
+        dirSet.srcDir project.buildDir.name + '/' + genSrc + '/java'
+      }
+    }
+    makeVersionClassTask.getInputs().files( sourceSets.getByName( 'main' ).allSource )
+    makeVersionClassTask.getOutputs().file( generatedSrcDir )
+    if( project.getBuildFile() != null && project.getBuildFile().exists() )
+    {
+      makeVersionClassTask.getInputs().files( project.getBuildFile() )
+    }
+    project.getTasks().getByName( 'compileJava' ).dependsOn( 'compileVersionJava' )
+    project.getTasks().getByName( 'compileVersionJava' ).dependsOn( 'makeVersionClass' )
+    project.getTasks().getByName( 'jar' ) { Jar task ->
+      task.from sourceSets.getByName( 'version' ).output
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
deleted file mode 100644
index 57a0ba3..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/AllProjectsPlugin.groovy
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.dependencies.DependenciesPlugin
-import org.apache.zest.gradle.publish.PublishingPlugin
-import org.gradle.api.JavaVersion
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.compile.JavaCompile
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.api.tasks.testing.Test
-import org.gradle.api.tasks.testing.logging.TestExceptionFormat
-import org.gradle.external.javadoc.StandardJavadocDocletOptions
-import org.nosphere.honker.gradle.HonkerExtension
-import org.nosphere.honker.gradle.HonkerGenDependenciesTask
-import org.nosphere.honker.gradle.HonkerGenLicenseTask
-import org.nosphere.honker.gradle.HonkerGenNoticeTask
-import org.nosphere.honker.gradle.HonkerLicenseOverrideCandidate
-
-@CompileStatic
-class AllProjectsPlugin implements Plugin<Project>
-{
-  @Override
-  void apply( final Project project )
-  {
-    project.defaultTasks = [ 'classes', 'test' ]
-    project.group = project.name == 'org.apache.zest' ?
-                    'org.apache.zest' :
-                    project.name.substring( 0, project.name.lastIndexOf( '.' ) )
-
-    applyDefaultVersion( project )
-    applyPolygeneExtension( project )
-
-    configureJava( project )
-    project.plugins.apply DependenciesPlugin
-    configureJavadoc( project )
-    configureTest( project )
-    if( CodeProjectsPlugin.isCodeProject( project ) )
-    {
-      project.plugins.apply CodeProjectsPlugin
-    }
-    configureDependencyReport( project )
-    configureHonker( project )
-    project.plugins.apply PublishingPlugin
-  }
-
-  private static void applyDefaultVersion( Project project )
-  {
-    if( project.version == 'unspecified' )
-    {
-      project.version = System.properties.version ?: '0'
-    }
-  }
-
-  private static void applyPolygeneExtension( Project project )
-  {
-    project.extensions.create( "zest", PolygeneExtension, project )
-  }
-
-  private static void configureJava( Project project )
-  {
-    project.plugins.apply 'java'
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    javaConvention.targetCompatibility = JavaVersion.VERSION_1_8
-    javaConvention.sourceCompatibility = JavaVersion.VERSION_1_8
-    project.tasks.withType( JavaCompile ) { JavaCompile task ->
-      task.options.encoding = 'UTF-8'
-      // Deprecation warnings for all compilations
-      task.options.compilerArgs << "-Xlint:deprecation"
-      // Unchecked warnings for non-test core compilations
-      if( 'org.apache.zest.core' == project.group && !task.name.toLowerCase( Locale.US ).contains( 'test' ) )
-      {
-        task.options.compilerArgs << "-Xlint:unchecked"
-      }
-    }
-  }
-
-  private static void configureJavadoc( Project project )
-  {
-    project.tasks.withType( Javadoc ) { Javadoc task ->
-      def options = task.options as StandardJavadocDocletOptions
-      options.encoding = 'UTF-8'
-      options.docEncoding = 'UTF-8'
-      options.charSet = 'UTF-8'
-      options.noTimestamp = true
-      options.links = [
-        'http://docs.oracle.com/javase/8/docs/api/',
-        'https://stleary.github.io/JSON-java/',
-        'http://junit.org/junit4/javadoc/latest/'
-      ]
-      // exclude '**/internal/**'
-    }
-  }
-
-  private static void configureTest( Project project )
-  {
-    // Match --max-workers and Test maxParallelForks, use 1 if parallel is disabled
-    def parallel = project.gradle.startParameter.parallelProjectExecutionEnabled
-    def maxTestWorkers = ( parallel ? project.gradle.startParameter.maxWorkerCount : 1 ) as int
-    // The space in the directory name is intentional
-    def allTestsDir = project.file( "$project.buildDir/tmp/test files" )
-    project.tasks.withType( Test ) { Test testTask ->
-      testTask.onlyIf { !project.hasProperty( 'skipTests' ) }
-      testTask.testLogging.info.exceptionFormat = TestExceptionFormat.FULL
-      testTask.maxHeapSize = '1g'
-      testTask.maxParallelForks = maxTestWorkers
-      testTask.systemProperties = [ 'proxySet' : System.properties[ 'proxySet' ],
-                                    'proxyHost': System.properties[ 'proxyHost' ],
-                                    'proxyPort': System.properties[ 'proxyPort' ] ]
-      testTask.reports.html.enabled = true
-      def testDir = new File( allTestsDir, testTask.name )
-      def workDir = new File( testDir, 'work' )
-      def tmpDir = new File( testDir, 'tmp' )
-      def homeDir = new File( testDir, 'home' )
-      testTask.workingDir = workDir
-      testTask.systemProperties << ( [
-        'user.dir'      : workDir.absolutePath,
-        'java.io.tmpdir': tmpDir.absolutePath,
-        'home.dir'      : homeDir.absolutePath
-      ] as Map<String, Object> )
-      testTask.environment << ( [
-        'HOME'       : homeDir.absolutePath,
-        'USERPROFILE': homeDir.absolutePath
-      ] as Map<String, Object> )
-      testTask.doFirst { Test task ->
-        [ workDir, tmpDir, homeDir ]*.mkdirs()
-      }
-      testTask.doLast { Test task ->
-        if( !task.state.failure )
-        {
-          project.delete testDir
-        }
-      }
-    }
-  }
-
-  // Dependency Report generate only the runtime configuration
-  // The report is packaged in the SDK distributions
-  private static void configureDependencyReport( Project project )
-  {
-    project.plugins.apply 'project-report'
-    // TODO Fails with no task found
-    // def dependencyReport = project.tasks.getByName( 'dependencyReport' ) as DependencyReportTask
-    // dependencyReport.configurations = [ project.configurations.getByName( 'runtime' ) ] as Set
-  }
-
-  private static void configureHonker( Project project )
-  {
-    project.plugins.apply 'org.nosphere.honker'
-    def honkerGenDependencies = project.tasks.getByName( 'honkerGenDependencies' ) as HonkerGenDependenciesTask
-    def honkerGenLicense = project.tasks.getByName( 'honkerGenLicense' ) as HonkerGenLicenseTask
-    def honkerGenNotice = project.tasks.getByName( 'honkerGenNotice' ) as HonkerGenNoticeTask
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    def mainSourceSet = javaConvention.sourceSets.getByName( 'main' )
-    mainSourceSet.output.dir( [ builtBy: honkerGenDependencies ] as Map<String, Object>,
-                              honkerGenDependencies.outputDir )
-    mainSourceSet.output.dir( [ builtBy: honkerGenLicense ] as Map<String, Object>,
-                              honkerGenLicense.outputDir )
-    mainSourceSet.output.dir( [ builtBy: honkerGenNotice ] as Map<String, Object>,
-                              honkerGenNotice.outputDir )
-    def honker = project.extensions.getByType( HonkerExtension )
-    // Project License, applied to all submodules
-    honker.license 'Apache 2'
-    // Dependencies (transitive or not) with no license information, overriding them
-    honker.licenseOverride { HonkerLicenseOverrideCandidate candidate ->
-      if( candidate.group == 'asm' || candidate.module == 'prefuse-core' )
-      {
-        candidate.license = 'BSD 3-Clause'
-      }
-      if( candidate.group == 'javax.websocket'
-        || candidate.group == 'javax.xml.bind' )
-      {
-        candidate.license = 'CDDL'
-      }
-      if( candidate.group == 'org.apache.httpcomponents'
-        || candidate.group == 'net.java.dev.jna'
-        || candidate.group == 'lucene'
-        || candidate.group == 'jdbm'
-        || candidate.group == 'org.osgi'
-        || candidate.group.startsWith( 'org.restlet' ) )
-      {
-        candidate.license = 'Apache 2'
-      }
-    }
-    honkerGenNotice.header = 'Apache Polygene'
-    honkerGenNotice.footer = 'This product includes software developed at\n' +
-                             'The Apache Software Foundation (http://www.apache.org/).\n'
-    project.tasks.getByName( 'check' ).dependsOn project.tasks.getByName( 'honkerCheck' )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
deleted file mode 100644
index 7225fb9..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/CodeProjectsPlugin.groovy
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.zest.gradle.doc.AsciidocBuildInfoPlugin
-import org.apache.zest.gradle.version.VersionClassPlugin
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.plugins.osgi.OsgiManifest
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.jvm.tasks.Jar
-import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
-import org.gradle.testing.jacoco.tasks.JacocoReport
-
-@CompileStatic
-class CodeProjectsPlugin implements Plugin<Project>
-{
-  static boolean isCodeProject( Project project )
-  {
-    [ 'src/main/java', 'src/test/java',
-      'src/main/groovy', 'src/test/groovy' ].collect { path ->
-      new File( "$project.projectDir/$path" )
-    }.any { dir -> dir.isDirectory() }
-  }
-
-  @Override
-  void apply( final Project project )
-  {
-    project.plugins.apply VersionClassPlugin
-    project.plugins.apply AsciidocBuildInfoPlugin
-
-    configureJar( project )
-    configureSupplementaryArchives( project )
-
-    configureJacoco( project )
-    configureCheckstyle( project )
-  }
-
-  private static void configureJar( Project project )
-  {
-    project.plugins.apply 'osgi'
-    def jar = project.tasks.getByName( 'jar' ) as Jar
-    def manifest = jar.manifest as OsgiManifest
-    manifest.attributes( [
-      license    : 'http://www.apache.org/licenses/LICENSE-2.0.txt',
-      docURL     : 'https://zest.apache.org/',
-      description: project.description ?:
-                   'Apache Polygene\u2122 (Java Edition) is a platform for Composite Oriented Programming',
-      vendor     : 'The Apache Software Foundation, https://www.apache.org',
-    ] )
-    manifest.instruction '-debug', 'true'
-  }
-
-  private static void configureSupplementaryArchives( Project project )
-  {
-    def javaConvention = project.convention.getPlugin( JavaPluginConvention )
-    def sourceJar = project.tasks.create( 'sourceJar', Jar ) { Jar task ->
-      task.description = 'Builds -sources.jar'
-      task.classifier = 'sources'
-      task.from javaConvention.sourceSets.getByName( 'main' ).allSource
-    }
-    def testSourceJar = project.tasks.create( 'testSourceJar', Jar ) { Jar task ->
-      task.description = 'Builds -testsources.jar'
-      task.classifier = 'testsources'
-      task.from javaConvention.sourceSets.getByName( 'test' ).allSource
-    }
-    def javadoc = project.tasks.getByName( 'javadoc' ) as Javadoc
-    def javadocJar = project.tasks.create( 'javadocJar', Jar ) { Jar task ->
-      task.description = 'Builds -javadoc.jar'
-      task.classifier = 'javadoc'
-      task.from javadoc.destinationDir
-      task.dependsOn javadoc
-    }
-    project.artifacts.add( 'archives', sourceJar )
-    project.artifacts.add( 'archives', testSourceJar )
-    project.artifacts.add( 'archives', javadocJar )
-  }
-
-  private static void configureJacoco( Project project )
-  {
-    def dependencies = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
-    project.plugins.apply 'jacoco'
-    def jacoco = project.extensions.getByType( JacocoPluginExtension )
-    jacoco.toolVersion = dependencies.buildToolsVersions.jacoco
-    project.tasks.withType( JacocoReport ) { JacocoReport task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates test coverage report.'
-    }
-  }
-
-  private static void configureCheckstyle( Project project )
-  {
-    // project.plugins.apply 'checkstyle'
-    //    if( name == "org.apache.zest.core.runtime" )
-    //    {
-    //      checkstyleMain {
-    //        configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-runtime-checkstyle.xml" )
-    //        ignoreFailures = true
-    //      }
-    //    }
-    //    else
-    //    {
-    //      checkstyleMain {
-    //        configFile = new File( rootProject.projectDir.absolutePath.toString() + '/etc/zest-api-checkstyle.xml' )
-    //        ignoreFailures = true
-    //        reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
-    //      }
-    //    }
-    //    checkstyleTest {
-    //      configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-tests-checkstyle.xml" )
-    //      ignoreFailures = true
-    //    }
-    //
-    //    checkstyleVersion {
-    //      configFile = new File( "$rootProject.projectDir.absolutePath/etc/zest-tests-checkstyle.xml" )
-    //      ignoreFailures = true
-    //    }
-    //    // Create checkstyle report
-    //    task checkstyleReport( type: XsltTask, dependsOn: check ) {
-    //      source project.checkstyle.reportsDir
-    //      include '*.xml'
-    //      destDir = file( "build/reports/checkstyle/" )
-    //      extension = 'html'
-    //      stylesheetFile = file( "$rootProject.projectDir/etc/checkstyle-noframes.xsl" )
-    //    }
-    //
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
deleted file mode 100644
index 47e5404..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/RootProjectPlugin.groovy
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle
-
-import groovy.transform.CompileStatic
-import org.apache.rat.gradle.RatTask
-import org.apache.zest.gradle.dependencies.DependenciesDeclarationExtension
-import org.apache.zest.gradle.dist.DistributionPlugin
-import org.apache.zest.gradle.release.ReleaseSpecExtension
-import org.apache.zest.gradle.release.ReleaseSpecPlugin
-import org.apache.zest.gradle.test.AggregatedJacocoReportTask
-import org.gradle.api.GradleException
-import org.gradle.api.Plugin
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.Configuration
-import org.gradle.api.plugins.JavaPluginConvention
-import org.gradle.api.tasks.Copy
-import org.gradle.api.tasks.javadoc.Javadoc
-import org.gradle.api.tasks.testing.Test
-import org.gradle.api.tasks.testing.TestReport
-import org.gradle.external.javadoc.StandardJavadocDocletOptions
-
-@CompileStatic
-class RootProjectPlugin implements Plugin<Project>
-{
-  static final String PROJECT_TITLE = 'Apache Polygene\u2122 (Java Edition) SDK'
-  static final String PROJECT_DESCRIPTION = 'Apache Polygene\u2122 (Java Edition) is a framework for domain centric ' +
-                                            'application development, including evolved concepts from AOP, DI and DDD.'
-
-  static class TaskNames
-  {
-    static final String GO_OFFLINE = 'goOffline'
-    static final String GLOBAL_TEST_REPORT = 'globalTestReport'
-    static final String JAVADOCS = 'javadocs'
-    static final String ARCHIVE_JAVADOCS = 'archiveJavadocs'
-    static final String BUILD_ALL = 'buildAll'
-  }
-
-  @Override
-  void apply( Project project )
-  {
-    project.plugins.apply ReleaseSpecPlugin
-
-    applyProjectMetadata( project )
-    applyHelperTasks( project )
-    applyPlugins( project )
-
-    configureJacoco( project )
-    configureTestReport( project )
-    configureJavadocs( project )
-    configureRat( project )
-
-    project.plugins.apply DistributionPlugin
-    configureReleaseTask( project )
-  }
-
-  private static void applyProjectMetadata( Project project )
-  {
-    def extraProperties = project.extensions.extraProperties
-    extraProperties.set 'title', PROJECT_TITLE
-    extraProperties.set 'description', PROJECT_DESCRIPTION
-  }
-
-  private static void applyHelperTasks( Project project )
-  {
-    project.tasks.create( TaskNames.GO_OFFLINE ) { Task task ->
-      task.group = TaskGroups.HELP
-      task.description = 'Resolves all dependencies configuration'
-      task.doLast {
-        def allConfigurations = project.allprojects.collect { Project each ->
-          each.configurations
-        }.flatten() as Set<Configuration>
-        allConfigurations*.resolvedConfiguration
-      }
-    }
-    def buildAll = project.tasks.create( TaskNames.BUILD_ALL )
-    buildAll.group = TaskGroups.BUILD
-    buildAll.description = 'Builds all'
-    buildAll.dependsOn 'javadocs', 'check', 'jar',
-                       project.subprojects.collect { p -> p.tasks.getByName( 'dependencyReport' ) },
-                       project.subprojects.collect { p -> p.tasks.getByName( 'assemble' ) },
-                       ':org.apache.zest.manual:website'
-  }
-
-  private static void applyPlugins( Project project )
-  {
-    project.plugins.apply 'org.nosphere.apache.rat'
-  }
-
-  private static void configureJacoco( Project project )
-  {
-    def dependencies = project.rootProject.extensions.getByType( DependenciesDeclarationExtension )
-    project.configurations.create( 'jacoco' )
-    project.dependencies.add( 'jacoco', "org.jacoco:org.jacoco.ant:${ dependencies.buildToolsVersions.jacoco }" )
-    def task = project.tasks.create( 'coverageReport', AggregatedJacocoReportTask ) { AggregatedJacocoReportTask task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates global coverage report'
-      task.dependsOn project.subprojects.collect( { Project p -> p.tasks.getByName( 'test' ) } )
-    }
-    project.tasks.getByName( 'check' ).dependsOn task
-  }
-
-  private static void configureTestReport( Project project )
-  {
-    project.tasks.create( TaskNames.GLOBAL_TEST_REPORT, TestReport ) { TestReport task ->
-      task.group = TaskGroups.VERIFICATION
-      task.description = 'Generates global test report'
-      task.destinationDir = project.file( "$project.buildDir/reports/tests" )
-      task.reportOn project.subprojects.collect { it.tasks.getByName( 'test' ) }
-    }
-    def test = project.tasks.getByName( 'test' ) as Test
-    test.dependsOn project.subprojects.collect { it.tasks.getByName( 'test' ) }
-    test.dependsOn project.tasks.getByName( TaskNames.GLOBAL_TEST_REPORT )
-    test.reports.html.enabled = false
-  }
-
-  private static void configureJavadocs( Project project )
-  {
-    def zest = project.extensions.getByType( PolygeneExtension )
-    def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
-    project.tasks.create( TaskNames.JAVADOCS, Javadoc ) { Javadoc task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Builds the whole SDK public Javadoc'
-      task.dependsOn ReleaseSpecPlugin.TaskNames.RELEASE_APPROVED_PROJECTS
-      def options = task.options as StandardJavadocDocletOptions
-      options.docFilesSubDirs = true
-      options.encoding = "UTF-8"
-      options.overview = "${ project.projectDir }/src/javadoc/overview.html"
-      task.title = "${ PROJECT_TITLE } ${ project.version }"
-      def apiSources = releaseSpec.approvedProjects.findAll { approved ->
-        ( approved.name.startsWith( 'org.apache.zest.core' ) &&
-          !approved.name.startsWith( 'org.apache.zest.core.runtime' ) ) ||
-        approved.name.startsWith( 'org.apache.zest.library' ) ||
-        approved.name.startsWith( 'org.apache.zest.extension' ) ||
-        approved.name.startsWith( 'org.apache.zest.tool' )
-      }
-      task.source apiSources.collect { each ->
-        each.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( 'main' ).allJava
-      }
-      task.destinationDir = project.file( "${ project.convention.getPlugin( JavaPluginConvention ).docsDir }/javadocs" )
-      task.classpath = project.files( apiSources.collect { apiProject ->
-        apiProject.convention.getPlugin( JavaPluginConvention ).sourceSets.getByName( 'main' ).compileClasspath
-      } )
-      options.group( [
-        "Core API"      : [ "org.apache.zest.api",
-                            "org.apache.zest.api.*" ],
-        "Core Bootstrap": [ "org.apache.zest.bootstrap",
-                            "org.apache.zest.bootstrap.*" ],
-        "Core SPI"      : [ "org.apache.zest.spi",
-                            "org.apache.zest.spi.*" ],
-        "Libraries"     : [ "org.apache.zest.library.*" ],
-        "Extensions"    : [ "org.apache.zest.valueserialization.*",
-                            "org.apache.zest.entitystore.*",
-                            "org.apache.zest.index.*",
-                            "org.apache.zest.metrics.*",
-                            "org.apache.zest.cache.*",
-                            "org.apache.zest.migration",
-                            "org.apache.zest.migration.*" ],
-        "Tools"         : [ "org.apache.zest.tools.*",
-                            "org.apache.zest.envisage",
-                            "org.apache.zest.envisage.*" ],
-        "Test Support"  : [ "org.apache.zest.test",
-                            "org.apache.zest.test.*" ]
-      ] )
-    }
-    project.tasks.create( TaskNames.ARCHIVE_JAVADOCS, Copy ) { Copy task ->
-      task.group = TaskGroups.DOCUMENTATION
-      task.description = 'Copy SDK public Javadoc to ../zest-web'
-      task.dependsOn TaskNames.JAVADOCS
-      task.from 'build/docs/javadoc/'
-      if( zest.developmentVersion )
-      {
-        task.into( "$project.projectDir/../zest-web/site/content/java/develop/javadocs/" )
-      }
-      else
-      {
-        task.into( "$project.projectDir/../zest-web/site/content/java/$project.version/javadocs/" )
-      }
-    }
-  }
-
-  private static void configureRat( Project project )
-  {
-    def rat = project.tasks.getByName( 'rat' ) as RatTask
-    rat.group = TaskGroups.VERIFICATION
-    rat.onlyIf { project.version != '0' }
-    rat.excludes = [
-      '**/.DS_Store/**', '**/._*',
-      // Git Files
-      '**/.git/**', '**/.gitignore',
-      // Gradle Files
-      'gradle/wrapper/**', '**/gradlew', '**/gradlew.bat', '**/.gradle/**',
-      // Build Output
-      '**/build/**', '**/derby.log', 'out/**',
-      // IDE Files
-      '**/.idea/**', '**/*.iml', '**/*.ipr', '**/*.iws',
-      '**/.settings/**', '**/.classpath', '**/.project',
-      '**/.gradletasknamecache', '**/private/cache/**',
-      '**/.nb-gradle-properties', '**/.nb-gradle/**',
-      // JSON files are not allowed to have comments, according to http://www.json.org/ and http://www.ietf.org/rfc/rfc4627.txt
-      '**/*.json',
-      // Various Text Resources
-      '**/README.*', '**/README*.*', '**/TODO',
-      '**/src/main/resources/**/*.txt',
-      '**/src/test/resources/**/*.txt',
-      'libraries/rest-server/src/main/resources/**/*.htm',
-      'libraries/rest-server/src/main/resources/**/*.atom',
-      'tools/qidea/src/main/resources/**/*.ft',
-      'tools/qidea/src/main/resources/**/*.template',
-      // Graphic Resources
-      '**/*.svg', '**/*.gif', '**/*.png', '**/*.jpg', '**/*.psd',
-      // Keystores
-      '**/*.jceks',
-      // Syntax Highlighter - MIT
-      'manual/**/sh*.css', 'manual/**/sh*.js',
-      // jQuery & plugins - MIT
-      'manual/**/jquery*.js',
-      // W3C XML Schemas - W3C Software License
-      'samples/rental/src/main/resources/*.xsd',
-      // Polygene Generator Heroes Templates - MIT
-      'tools/generator-zest/app/templates/Heroes/**',
-      // templates that will become the user's source files, should not have license headers
-      'tools/shell/src/dist/etc/templates/**',
-    ]
-  }
-
-  private static void configureReleaseTask( Project project )
-  {
-    def zest = project.extensions.getByType( PolygeneExtension )
-    def release = project.tasks.create( 'release' )
-    release.description = 'Builds, tests and uploads the release artifacts'
-    release.group = TaskGroups.RELEASE
-    release.doFirst {
-      if( zest.developmentVersion )
-      {
-        throw new GradleException( "Cannot release development version $project.version, use '-Dversion=X.Y.Z'" )
-      }
-    }
-    release.dependsOn 'checkReleaseSpec',
-                      'rat',
-                      'archiveJavadocs',
-                      ':org.apache.zest.manual:copyWebsite',
-                      project.allprojects.collect { it.tasks.getByName( 'uploadArchives' ) },
-                      'dist'
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy b/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
deleted file mode 100644
index 53a5b5e..0000000
--- a/buildSrc/src/main/groovy/org/apache/zest/gradle/TaskGroups.groovy
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.gradle
-
-import org.gradle.api.plugins.ApplicationPlugin
-import org.gradle.api.plugins.BasePlugin
-import org.gradle.api.plugins.HelpTasksPlugin
-import org.gradle.api.plugins.JavaBasePlugin
-import org.gradle.language.base.plugins.LifecycleBasePlugin
-
-class TaskGroups
-{
-  static final String HELP = HelpTasksPlugin.HELP_GROUP
-  static final String BUILD = LifecycleBasePlugin.BUILD_GROUP
-  static final String VERIFICATION = LifecycleBasePlugin.VERIFICATION_GROUP
-  static final String DOCUMENTATION = JavaBasePlugin.DOCUMENTATION_GROUP
-  static final String DISTRIBUTION = ApplicationPlugin.APPLICATION_GROUP
-  static final String DISTRIBUTION_VERIFICATION = 'distribution verification'
-  static final String PERFORMANCE = 'performance'
-  static final String PERFORMANCE_VERIFICATION = 'performance verification'
-  static final String RELEASE = 'release'
-  static final String RELEASE_VERIFICATION = 'release verification'
-  static final String UPLOAD = BasePlugin.UPLOAD_GROUP
-  static final String SAMPLES = 'samples'
-}


[06/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersInstance.java
new file mode 100644
index 0000000..e4d3880
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersInstance.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * JAVADOC
+ */
+public final class UsedLayersInstance
+{
+    private final List<LayerDescriptor> usedLayerInstances;
+
+    public UsedLayersInstance( List<LayerDescriptor> usedLayerInstances )
+    {
+        this.usedLayerInstances = usedLayerInstances;
+    }
+
+    Stream<? extends ObjectDescriptor> visibleObjects()
+    {
+        return usedLayerInstances.stream()
+            .flatMap( layerInstance -> layerInstance.visibleObjects( Visibility.application ) );
+    }
+
+    Stream<? extends TransientDescriptor> visibleTransients()
+    {
+        return usedLayerInstances.stream()
+            .flatMap( layerInstance -> layerInstance.visibleTransients( Visibility.application ) );
+    }
+
+    Stream<? extends EntityDescriptor> visibleEntities()
+    {
+        return usedLayerInstances.stream()
+            .flatMap( layerInstance -> layerInstance.visibleEntities( Visibility.application ) );
+    }
+
+    Stream<? extends ValueDescriptor> visibleValues()
+    {
+        return usedLayerInstances.stream()
+            .flatMap( layerInstance -> layerInstance.visibleValues( Visibility.application ) );
+    }
+
+    Stream<? extends ModelDescriptor> visibleServices()
+    {
+        return usedLayerInstances.stream()
+            .flatMap( layerInstance -> layerInstance.visibleServices( Visibility.application ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersModel.java
new file mode 100644
index 0000000..c5bcd1a
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/UsedLayersModel.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.UsedLayersDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public final class UsedLayersModel
+    implements UsedLayersDescriptor, VisitableHierarchy<Object, Object>
+{
+    private final List<LayerModel> usedLayers;
+
+    public UsedLayersModel( List<LayerModel> usedLayers )
+    {
+        this.usedLayers = usedLayers;
+    }
+
+    @Override
+    public Stream<? extends LayerDescriptor> layers()
+    {
+        return usedLayers.stream();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( LayerModel usedLayer : usedLayers )
+            {
+                if( !usedLayer.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+
+        return visitor.visitLeave( this );
+    }
+
+    public UsedLayersInstance newInstance( List<LayerDescriptor> usedLayerInstances )
+    {
+        return new UsedLayersInstance( usedLayerInstances );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java
new file mode 100644
index 0000000..df013c3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/structure/Visibilitypredicate.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.structure;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.ModelDescriptor;
+
+/**
+ * TODO
+ */
+public class Visibilitypredicate
+    implements Predicate<ModelDescriptor>
+{
+    public static final Predicate<ModelDescriptor> MODULE = new Visibilitypredicate( Visibility.module );
+    public static final Predicate<ModelDescriptor> LAYER = new Visibilitypredicate( Visibility.layer );
+    public static final Predicate<ModelDescriptor> APPLICATION = new Visibilitypredicate( Visibility.application );
+
+    private final Visibility visibility;
+
+    public Visibilitypredicate( Visibility visibility )
+    {
+        this.visibility = visibility;
+    }
+
+    @Override
+    public boolean test( ModelDescriptor item )
+    {
+        return item.visibility().ordinal() >= visibility.ordinal();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/types/ValueTypeFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/types/ValueTypeFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/types/ValueTypeFactory.java
new file mode 100644
index 0000000..a3538c0
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/types/ValueTypeFactory.java
@@ -0,0 +1,233 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.types;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.type.CollectionType;
+import org.apache.polygene.api.type.EnumType;
+import org.apache.polygene.api.type.MapType;
+import org.apache.polygene.api.type.Serialization;
+import org.apache.polygene.api.type.ValueCompositeType;
+import org.apache.polygene.api.type.ValueType;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.CompositeMethodsModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.property.PropertiesModel;
+import org.apache.polygene.runtime.structure.LayerModel;
+import org.apache.polygene.runtime.structure.ModuleModel;
+import org.apache.polygene.runtime.structure.UsedLayersModel;
+import org.apache.polygene.runtime.value.ValueModel;
+import org.apache.polygene.runtime.value.ValueStateModel;
+import org.apache.polygene.runtime.value.ValuesModel;
+
+public class ValueTypeFactory
+{
+    private static final ValueTypeFactory instance = new ValueTypeFactory();
+
+    public static ValueTypeFactory instance()
+    {
+        return instance;
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public ValueType newValueType( Type type,
+                                   Class declaringClass,
+                                   Class compositeType,
+                                   LayerModel layer,
+                                   ModuleModel module,
+                                   Serialization.Variant variant
+    )
+    {
+        ValueType valueType;
+        if( CollectionType.isCollection( type ) )
+        {
+            if( type instanceof ParameterizedType )
+            {
+                ParameterizedType pt = (ParameterizedType) type;
+                Type collectionType = pt.getActualTypeArguments()[ 0 ];
+                if( collectionType instanceof TypeVariable )
+                {
+                    TypeVariable collectionTypeVariable = (TypeVariable) collectionType;
+                    collectionType = Classes.resolveTypeVariable( collectionTypeVariable, declaringClass, compositeType );
+                }
+                ValueType collectedType = newValueType( collectionType, declaringClass, compositeType, layer, module, variant );
+                valueType = new CollectionType( Classes.RAW_CLASS.apply( type ), collectedType );
+            }
+            else
+            {
+                ValueType collectedType = newValueType( Object.class, declaringClass, compositeType, layer, module, variant );
+                valueType = new CollectionType( Classes.RAW_CLASS.apply( type ), collectedType );
+            }
+        }
+        else if( MapType.isMap( type ) )
+        {
+            if( type instanceof ParameterizedType )
+            {
+                ParameterizedType pt = (ParameterizedType) type;
+                Type keyType = pt.getActualTypeArguments()[ 0 ];
+                if( keyType instanceof TypeVariable )
+                {
+                    TypeVariable keyTypeVariable = (TypeVariable) keyType;
+                    keyType = Classes.resolveTypeVariable( keyTypeVariable, declaringClass, compositeType );
+                }
+                ValueType keyedType = newValueType( keyType, declaringClass, compositeType, layer, module, variant );
+                Type valType = pt.getActualTypeArguments()[ 1 ];
+                if( valType instanceof TypeVariable )
+                {
+                    TypeVariable valueTypeVariable = (TypeVariable) valType;
+                    valType = Classes.resolveTypeVariable( valueTypeVariable, declaringClass, compositeType );
+                }
+                ValueType valuedType = newValueType( valType, declaringClass, compositeType, layer, module, variant );
+                valueType = new MapType( Classes.RAW_CLASS.apply( type ), keyedType, valuedType, variant );
+            }
+            else
+            {
+                ValueType keyType = newValueType( Object.class, declaringClass, compositeType, layer, module, variant );
+                ValueType valuesType = newValueType( Object.class, declaringClass, compositeType, layer, module, variant );
+                valueType = new MapType( Classes.RAW_CLASS.apply( type ), keyType, valuesType, variant );
+            }
+        }
+        else if( ValueCompositeType.isValueComposite( type ) )
+        {
+            // Find ValueModel in module/layer/used layers
+            ValueModel model = new ValueFinder( layer, module, Classes.RAW_CLASS.apply( type ) ).getFoundModel();
+
+            if( model == null )
+            {
+                if( type.equals( ValueComposite.class ) )
+                {
+                    // Create default model
+                    MixinsModel mixinsModel = new MixinsModel();
+                    List<Class<?>> valueComposite = new ArrayList<>();
+                    valueComposite.add( ValueComposite.class );
+                    ValueStateModel valueStateModel = new ValueStateModel( new PropertiesModel(),
+                                                                           new AssociationsModel(),
+                                                                           new ManyAssociationsModel(),
+                                                                           new NamedAssociationsModel() );
+                    model = new ValueModel( module, valueComposite, Visibility.application, new MetaInfo(),
+                                            mixinsModel, valueStateModel, new CompositeMethodsModel( mixinsModel ) );
+                }
+                else
+                {
+                    throw new InvalidApplicationException( "[" + module.name() + "] Could not find ValueComposite of type " + type );
+                }
+            }
+
+            return model.valueType();
+        }
+        else if( EnumType.isEnum( type ) )
+        {
+            valueType = new EnumType( Classes.RAW_CLASS.apply( type ) );
+        }
+        else
+        {
+            valueType = new ValueType( Classes.RAW_CLASS.apply( type ) );
+        }
+
+        return valueType;
+    }
+
+    @SuppressWarnings( "raw" )
+    private static class ValueFinder
+        extends HierarchicalVisitorAdapter<Object, Object, RuntimeException>
+    {
+        private Class<?> type;
+        private ValueModel foundModel;
+        private Visibility visibility;
+
+        private ValueFinder( LayerModel layer, ModuleModel module, Class type )
+        {
+            this.type = type;
+
+            visibility = Visibility.module;
+            module.accept( this );
+
+            if( foundModel == null )
+            {
+                visibility = Visibility.layer;
+                layer.accept( this );
+
+                if( foundModel == null )
+                {
+                    visibility = Visibility.application;
+                    layer.usedLayers().accept( this );
+                }
+            }
+        }
+
+        public ValueModel getFoundModel()
+        {
+            return foundModel;
+        }
+
+        @Override
+        public boolean visitEnter( Object visited )
+            throws RuntimeException
+        {
+            if( visited instanceof ValuesModel )
+            {
+                return true;
+            }
+            else if( visited instanceof ModuleModel )
+            {
+                return true;
+            }
+            else if( visited instanceof LayerModel )
+            {
+                return true;
+            }
+            else if( visited instanceof UsedLayersModel )
+            {
+                return true;
+            }
+            else if( visited instanceof ValueModel )
+            {
+                ValueModel valueModel = (ValueModel) visited;
+                boolean typeEquality = valueModel.types().anyMatch( t -> t.equals( type ) );
+                if( typeEquality && valueModel.visibility().ordinal() >= visibility.ordinal() )
+                {
+                    foundModel = valueModel;
+                }
+            }
+
+            return false;
+        }
+
+        @Override
+        public boolean visitLeave( Object visited )
+            throws RuntimeException
+        {
+            return foundModel == null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderEntityState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderEntityState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderEntityState.java
new file mode 100644
index 0000000..c8739c5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderEntityState.java
@@ -0,0 +1,173 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.EntityStatus;
+import org.apache.polygene.spi.entity.ManyAssociationState;
+import org.apache.polygene.spi.entity.NamedAssociationState;
+
+/**
+ * Implementation of EntityState for use through EntityBuilder.
+ */
+public final class BuilderEntityState
+    implements EntityState
+{
+    private final EntityDescriptor entityType;
+    private final EntityReference reference;
+    private final Map<QualifiedName, Object> properties = new HashMap<>();
+    private final Map<QualifiedName, EntityReference> associations = new HashMap<>();
+    private final Map<QualifiedName, ManyAssociationState> manyAssociations = new HashMap<>();
+    private final Map<QualifiedName, NamedAssociationState> namedAssociations = new HashMap<>();
+
+    public BuilderEntityState( EntityDescriptor type, EntityReference reference )
+    {
+        this.entityType = type;
+        this.reference = reference;
+    }
+
+    @Override
+    public EntityReference entityReference()
+    {
+        return reference;
+    }
+
+    @Override
+    public String version()
+    {
+        return "";
+    }
+
+    @Override
+    public Instant lastModified()
+    {
+        return Instant.MIN;
+    }
+
+    @Override
+    public void remove()
+    {
+    }
+
+    @Override
+    public EntityStatus status()
+    {
+        return EntityStatus.NEW;
+    }
+
+    @Override
+    public boolean isAssignableTo( Class<?> type )
+    {
+        return Classes.exactTypeSpecification( type ).test( entityType );
+    }
+
+    @Override
+    public EntityDescriptor entityDescriptor()
+    {
+        return entityType;
+    }
+
+    @Override
+    public Object propertyValueOf( QualifiedName stateName )
+    {
+        return properties.get( stateName );
+    }
+
+    @Override
+    public EntityReference associationValueOf( QualifiedName stateName )
+    {
+        return associations.get( stateName );
+    }
+
+    @Override
+    public void setPropertyValue( QualifiedName stateName, Object newValue )
+    {
+        properties.put( stateName, newValue );
+    }
+
+    @Override
+    public void setAssociationValue( QualifiedName stateName, EntityReference newEntity )
+    {
+        associations.put( stateName, newEntity );
+    }
+
+    @Override
+    public ManyAssociationState manyAssociationValueOf( QualifiedName stateName )
+    {
+        ManyAssociationState state = manyAssociations.get( stateName );
+        if( state == null )
+        {
+            state = new BuilderManyAssociationState();
+            manyAssociations.put( stateName, state );
+        }
+        return state;
+    }
+
+    @Override
+    public NamedAssociationState namedAssociationValueOf( QualifiedName stateName )
+    {
+        NamedAssociationState state = namedAssociations.get( stateName );
+        if( state == null )
+        {
+            state = new BuilderNamedAssociationState();
+            namedAssociations.put( stateName, state );
+        }
+        return state;
+    }
+
+    public void copyTo( EntityState newEntityState )
+    {
+        for( Map.Entry<QualifiedName, Object> fromPropertyEntry : properties.entrySet() )
+        {
+            newEntityState.setPropertyValue( fromPropertyEntry.getKey(), fromPropertyEntry.getValue() );
+        }
+        for( Map.Entry<QualifiedName, EntityReference> fromAssociationEntry : associations.entrySet() )
+        {
+            newEntityState.setAssociationValue( fromAssociationEntry.getKey(), fromAssociationEntry.getValue() );
+        }
+        for( Map.Entry<QualifiedName, ManyAssociationState> fromManyAssociationEntry : manyAssociations.entrySet() )
+        {
+            QualifiedName qName = fromManyAssociationEntry.getKey();
+            ManyAssociationState fromManyAssoc = fromManyAssociationEntry.getValue();
+            ManyAssociationState toManyAssoc = newEntityState.manyAssociationValueOf( qName );
+            for( EntityReference entityReference : fromManyAssoc )
+            {
+                toManyAssoc.add( 0, entityReference );
+            }
+        }
+        for( Map.Entry<QualifiedName, NamedAssociationState> fromNamedAssociationEntry : namedAssociations.entrySet() )
+        {
+            QualifiedName qName = fromNamedAssociationEntry.getKey();
+            NamedAssociationState fromNamedAssoc = fromNamedAssociationEntry.getValue();
+            NamedAssociationState toNamedAssoc = newEntityState.namedAssociationValueOf( qName );
+            for( String name : fromNamedAssoc )
+            {
+                toNamedAssoc.put( name, fromNamedAssoc.get( name ) );
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderManyAssociationState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderManyAssociationState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderManyAssociationState.java
new file mode 100644
index 0000000..3b482d7
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderManyAssociationState.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.spi.entity.ManyAssociationState;
+
+/**
+ * Default implementation of ManyAssociationState that also
+ * keeps a list of changes that can be extracted at any time.
+ */
+public final class BuilderManyAssociationState
+    implements ManyAssociationState
+{
+    private List<EntityReference> references;
+
+    public BuilderManyAssociationState()
+    {
+        references = new ArrayList<EntityReference>();
+    }
+
+    @Override
+    public int count()
+    {
+        return references.size();
+    }
+
+    @Override
+    public boolean contains( EntityReference entityReference )
+    {
+        return references.contains( entityReference );
+    }
+
+    @Override
+    public boolean add( int i, EntityReference entityReference )
+    {
+        if( references.contains( entityReference ) )
+        {
+            return false;
+        }
+
+        references.add( i, entityReference );
+        return true;
+    }
+
+    @Override
+    public boolean remove( EntityReference entityReference )
+    {
+        return references.remove( entityReference );
+    }
+
+    @Override
+    public EntityReference get( int i )
+    {
+        return references.get( i );
+    }
+
+    @Override
+    public Iterator<EntityReference> iterator()
+    {
+        return references.iterator();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderNamedAssociationState.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderNamedAssociationState.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderNamedAssociationState.java
new file mode 100644
index 0000000..d50d79b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/BuilderNamedAssociationState.java
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.spi.entity.NamedAssociationState;
+
+/**
+ * Default implementation of NamedAssociationState that also
+ * keeps a list of changes that can be extracted at any time.
+ */
+public final class BuilderNamedAssociationState
+    implements NamedAssociationState
+{
+    private final Map<String, EntityReference> references;
+
+    public BuilderNamedAssociationState()
+    {
+        references = new LinkedHashMap<>();
+    }
+
+    @Override
+    public int count()
+    {
+        return references.size();
+    }
+
+    @Override
+    public boolean containsName( String name )
+    {
+        return references.containsKey( name );
+    }
+
+    @Override
+    public boolean put( String name, EntityReference entityReference )
+    {
+        return references.put( name, entityReference ) != null;
+    }
+
+    @Override
+    public boolean remove( String name )
+    {
+        return references.remove( name ) != null;
+    }
+
+    @Override
+    public EntityReference get( String name )
+    {
+        return references.get( name );
+    }
+
+    @Override
+    public String nameOf( EntityReference entityReference )
+    {
+        for( Map.Entry<String, EntityReference> entry : references.entrySet() )
+        {
+            if( entry.getValue().equals( entityReference ) )
+            {
+                return entry.getKey();
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public Iterator<String> iterator()
+    {
+        return references.keySet().iterator();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityBuilderInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityBuilderInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityBuilderInstance.java
new file mode 100644
index 0000000..5044ff6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityBuilderInstance.java
@@ -0,0 +1,139 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.entity.LifecycleException;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.runtime.composite.FunctionStateResolver;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+import static org.apache.polygene.api.identity.HasIdentity.IDENTITY_STATE_NAME;
+
+/**
+ * Implementation of EntityBuilder. Maintains an instance of the entity which
+ * will not have its state validated until it is created by calling newInstance().
+ */
+public final class EntityBuilderInstance<T>
+    implements EntityBuilder<T>
+{
+    private final EntityModel model;
+    private final ModuleUnitOfWork uow;
+    private final EntityStoreUnitOfWork store;
+    private Identity identity;
+
+    private final BuilderEntityState entityState;
+    private final EntityInstance prototypeInstance;
+
+    public EntityBuilderInstance(
+        EntityDescriptor model,
+        ModuleUnitOfWork uow,
+        EntityStoreUnitOfWork store,
+        Identity identity
+    )
+    {
+        this( model, uow, store, identity, null );
+    }
+
+    public EntityBuilderInstance(
+        EntityDescriptor model,
+        ModuleUnitOfWork uow,
+        EntityStoreUnitOfWork store,
+        Identity identity,
+        FunctionStateResolver stateResolver
+    )
+    {
+        this.model = (EntityModel) model;
+        this.uow = uow;
+        this.store = store;
+        this.identity = identity;
+        EntityReference reference = EntityReference.create( identity );
+        entityState = new BuilderEntityState( model, reference );
+        this.model.initState( model.module(), entityState );
+        if( stateResolver != null )
+        {
+            stateResolver.populateState( this.model, entityState );
+        }
+        entityState.setPropertyValue( IDENTITY_STATE_NAME, identity );
+        prototypeInstance = this.model.newInstance( uow, (ModuleSpi) model.module().instance(), entityState );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public T instance()
+    {
+        checkValid();
+        return prototypeInstance.<T>proxy();
+    }
+
+    @Override
+    public <K> K instanceFor( Class<K> mixinType )
+    {
+        checkValid();
+        return prototypeInstance.newProxy( mixinType );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public T newInstance()
+        throws LifecycleException
+    {
+        checkValid();
+
+        // Figure out whether to use given or generated reference
+        Identity identity = (Identity) entityState.propertyValueOf( IDENTITY_STATE_NAME );
+        EntityReference entityReference = EntityReference.create( identity );
+        EntityState newEntityState = model.newEntityState( store, entityReference );
+
+        prototypeInstance.invokeCreate();
+
+        // Check constraints
+        prototypeInstance.checkConstraints();
+
+        entityState.copyTo( newEntityState );
+
+        EntityInstance instance = model.newInstance( uow, (ModuleSpi) model.module().instance(), newEntityState );
+
+        Object proxy = instance.proxy();
+
+        // Add entity in UOW
+        uow.addEntity( instance );
+
+        // Invalidate builder
+        this.identity = null;
+
+        return (T) proxy;
+    }
+
+    private void checkValid()
+        throws IllegalStateException
+    {
+        if( identity == null )
+        {
+            throw new IllegalStateException( "EntityBuilder is not valid after call to newInstance()" );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityFunction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityFunction.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityFunction.java
new file mode 100644
index 0000000..936f5aa
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityFunction.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.lang.reflect.Type;
+import java.util.function.BiFunction;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+
+import static org.apache.polygene.api.util.Classes.RAW_CLASS;
+
+public class EntityFunction
+    implements BiFunction<EntityReference, Type, Object>
+{
+
+    private final UnitOfWorkFactory uowf;
+
+    public EntityFunction( UnitOfWorkFactory uowf )
+    {
+        this.uowf = uowf;
+    }
+
+    @Override
+    public Object apply( EntityReference entityReference, Type type )
+    {
+        return uowf.currentUnitOfWork().get( RAW_CLASS.apply( type ), entityReference.identity() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityStateStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityStateStore.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityStateStore.java
new file mode 100644
index 0000000..9f020f9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/EntityStateStore.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * JAVADOC
+ */
+final class EntityStateStore
+{
+    AssociationStateHolder stateHolder;
+    EntityState state;
+
+    @Override
+    public String toString()
+    {
+        return state.entityReference().toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java
new file mode 100644
index 0000000..bd18383
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/ModuleUnitOfWork.java
@@ -0,0 +1,769 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.time.Instant;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.entity.LifecycleException;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.IdentityGenerator;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.query.Query;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.query.QueryExecutionException;
+import org.apache.polygene.api.query.grammar.OrderBy;
+import org.apache.polygene.api.service.NoSuchServiceException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.ConcurrentEntityModificationException;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCallback;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.usecase.Usecase;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.runtime.association.AssociationInstance;
+import org.apache.polygene.runtime.composite.FunctionStateResolver;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.runtime.property.PropertyModel;
+import org.apache.polygene.runtime.value.ValueInstance;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.EntityStatus;
+import org.apache.polygene.spi.entitystore.EntityStore;
+import org.apache.polygene.spi.module.ModuleSpi;
+import org.apache.polygene.spi.query.EntityFinder;
+import org.apache.polygene.spi.query.EntityFinderException;
+import org.apache.polygene.spi.query.QueryBuilderSPI;
+import org.apache.polygene.spi.query.QuerySource;
+
+import static org.apache.polygene.api.identity.HasIdentity.IDENTITY_STATE_NAME;
+
+/**
+ * JAVADOC
+ */
+public class ModuleUnitOfWork
+    implements UnitOfWork
+{
+    @Uses
+    private UnitOfWorkInstance uow;
+
+    @Structure
+    private PolygeneAPI api;
+
+    @Structure
+    private ModuleDescriptor module;
+
+    @Service
+    private UnitOfWorkFactory unitOfWorkFactory;
+
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    public UnitOfWorkInstance instance()
+    {
+        return uow;
+    }
+
+    @Override
+    public UnitOfWorkFactory unitOfWorkFactory()
+    {
+        return unitOfWorkFactory;
+    }
+
+    @Override
+    public Instant currentTime()
+    {
+        return uow.currentTime();
+    }
+
+    @Override
+    public Usecase usecase()
+    {
+        return uow.usecase();
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return uow.metaInfo().get( infoType );
+    }
+
+    @Override
+    public void setMetaInfo( Object metaInfo )
+    {
+        uow.metaInfo().set( metaInfo );
+    }
+
+    @Override
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public <T> Query<T> newQuery( QueryBuilder<T> queryBuilder )
+    {
+        QueryBuilderSPI queryBuilderSPI = (QueryBuilderSPI) queryBuilder;
+
+        return queryBuilderSPI.newQuery( new UoWQuerySource( this ) );
+    }
+
+    @Override
+    public <T> T newEntity( Class<T> type )
+        throws NoSuchEntityTypeException, LifecycleException
+    {
+        return newEntity( type, null );
+    }
+
+    @Override
+    public <T> T newEntity( Class<T> type, Identity identity )
+        throws NoSuchEntityTypeException, LifecycleException
+    {
+        return newEntityBuilder( type, identity ).newInstance();
+    }
+
+    @Override
+    public <T> EntityBuilder<T> newEntityBuilder( Class<T> type )
+        throws NoSuchEntityTypeException
+    {
+        return newEntityBuilder( type, null );
+    }
+
+    @Override
+    public <T> EntityBuilder<T> newEntityBuilder( Class<T> type, Identity identity )
+        throws NoSuchEntityTypeException
+    {
+        EntityDescriptor model = module.typeLookup().lookupEntityModel( type );
+
+        if( model == null )
+        {
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
+        }
+
+        ModuleDescriptor modelModule = model.module();
+        EntityStore entityStore = ( (ModuleSpi) modelModule.instance() ).entityStore();
+
+        // Generate id if necessary
+        if( identity == null )
+        {
+            IdentityGenerator idGen = ( (ModuleSpi) modelModule.instance() ).identityGenerator();
+            if( idGen == null )
+            {
+                throw new NoSuchServiceException( IdentityGenerator.class.getName(), modelModule
+                    .name(), modelModule.typeLookup() );
+            }
+            identity = idGen.generate( model.types().findFirst().orElse( null ) );
+        }
+        EntityBuilder<T> builder;
+
+        builder = new EntityBuilderInstance<>( model,
+                                               this,
+                                               uow.getEntityStoreUnitOfWork( entityStore ),
+                                               identity );
+        return builder;
+    }
+
+    @Override
+    public <T> EntityBuilder<T> newEntityBuilderWithState(
+        Class<T> type,
+        Function<PropertyDescriptor, Object> propertyFunction,
+        Function<AssociationDescriptor, EntityReference> associationFunction,
+        Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+        Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
+    )
+        throws NoSuchEntityTypeException
+    {
+        return newEntityBuilderWithState( type, null,
+                                          propertyFunction,
+                                          associationFunction,
+                                          manyAssociationFunction,
+                                          namedAssociationFunction );
+    }
+
+    @Override
+    public <T> EntityBuilder<T> newEntityBuilderWithState(
+        Class<T> type, Identity identity,
+        Function<PropertyDescriptor, Object> propertyFunction,
+        Function<AssociationDescriptor, EntityReference> associationFunction,
+        Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+        Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
+    )
+        throws NoSuchEntityTypeException
+    {
+        NullArgumentException.validateNotNull( "propertyFunction", propertyFunction );
+        NullArgumentException.validateNotNull( "associationFunction", associationFunction );
+        NullArgumentException.validateNotNull( "manyAssociationFunction", manyAssociationFunction );
+        NullArgumentException.validateNotNull( "namedAssociationFunction", namedAssociationFunction );
+
+        EntityDescriptor model = module.typeLookup().lookupEntityModel( type );
+
+        if( model == null )
+        {
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
+        }
+
+        ModuleDescriptor modelModule = model.module();
+        ModuleSpi moduleSpi = (ModuleSpi) modelModule.instance();
+        EntityStore entityStore = moduleSpi.entityStore();
+
+        FunctionStateResolver stateResolver = new FunctionStateResolver(
+            propertyFunction, associationFunction, manyAssociationFunction, namedAssociationFunction
+        );
+
+        if( identity == null )
+        {
+            // Use reference from StateResolver if available
+            PropertyModel identityModel = (PropertyModel) model
+                .state()
+                .findPropertyModelByQualifiedName( IDENTITY_STATE_NAME );
+            String propertyState = (String) stateResolver.getPropertyState(identityModel);
+            if( propertyState == null )
+            {
+                // Generate reference
+                IdentityGenerator idGen = moduleSpi.identityGenerator();
+                if( idGen == null )
+                {
+                    String typeName = IdentityGenerator.class.getName();
+                    throw new NoSuchServiceException( typeName, modelModule.name(), modelModule.typeLookup() );
+                }
+                identity = idGen.generate( model.types().findFirst().orElse( null ) );
+            }
+            else
+            {
+                identity = new StringIdentity(propertyState);
+            }
+        }
+
+        return new EntityBuilderInstance<>( model,
+                                            this,
+                                            uow.getEntityStoreUnitOfWork( entityStore ),
+                                            identity,
+                                            stateResolver );
+    }
+
+    @Override
+    public <T> T get( Class<T> type, Identity identity )
+        throws NoSuchEntityTypeException, NoSuchEntityException
+    {
+        Iterable<EntityDescriptor> models = module.typeLookup().lookupEntityModels( type );
+
+        if( !models.iterator().hasNext() )
+        {
+            throw new NoSuchEntityTypeException( type.getName(), module.name(), module.typeLookup() );
+        }
+
+        return uow.get( EntityReference.create( identity ), this, models, type );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> T get( T entity )
+        throws NoSuchEntityTypeException
+    {
+        EntityComposite entityComposite = (EntityComposite) entity;
+        EntityInstance compositeInstance = EntityInstance.entityInstanceOf( entityComposite );
+        EntityDescriptor model = compositeInstance.entityModel();
+        Class<T> type = (Class<T>) compositeInstance.types().findFirst().orElse( null );
+        return uow.get( compositeInstance.reference(), this, Collections.singletonList( model ), type );
+    }
+
+    @Override
+    public void remove( Object entity )
+        throws LifecycleException
+    {
+        uow.checkOpen();
+
+        EntityComposite entityComposite = (EntityComposite) entity;
+
+        EntityInstance compositeInstance = EntityInstance.entityInstanceOf( entityComposite );
+
+        if( compositeInstance.status() == EntityStatus.NEW )
+        {
+            compositeInstance.remove( this );
+            uow.remove( compositeInstance.reference() );
+        }
+        else if( compositeInstance.status() == EntityStatus.LOADED || compositeInstance.status() == EntityStatus.UPDATED )
+        {
+            compositeInstance.remove( this );
+        }
+        else
+        {
+            throw new NoSuchEntityException( compositeInstance.reference(), compositeInstance.types(), usecase() );
+        }
+    }
+
+    @SuppressWarnings( "DuplicateThrows" )
+    @Override
+    public void complete()
+        throws UnitOfWorkCompletionException, ConcurrentEntityModificationException
+    {
+        uow.complete();
+    }
+
+    @Override
+    public void discard()
+    {
+        uow.discard();
+    }
+
+    @Override
+    public void close()
+    {
+        discard();
+    }
+
+    @Override
+    public boolean isOpen()
+    {
+        return uow.isOpen();
+    }
+
+    @Override
+    public boolean isPaused()
+    {
+        return uow.isPaused();
+    }
+
+    @Override
+    public void pause()
+    {
+        uow.pause();
+    }
+
+    @Override
+    public void resume()
+    {
+        uow.resume();
+    }
+
+    @Override
+    public void addUnitOfWorkCallback( UnitOfWorkCallback callback )
+    {
+        uow.addUnitOfWorkCallback( callback );
+    }
+
+    @Override
+    public void removeUnitOfWorkCallback( UnitOfWorkCallback callback )
+    {
+        uow.removeUnitOfWorkCallback( callback );
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        ModuleUnitOfWork that = (ModuleUnitOfWork) o;
+
+        return uow.equals( that.uow );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return uow.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        return uow.toString();
+    }
+
+    public void addEntity( EntityInstance instance )
+    {
+        uow.addEntity( instance );
+    }
+
+    @Override
+    public <T extends HasIdentity> T toValue(Class<T> primaryType, T entityComposite )
+    {
+        Function<PropertyDescriptor, Object> propertyFunction = new ToValuePropertyMappingFunction( entityComposite );
+        Function<AssociationDescriptor, EntityReference> assocationFunction = new ToValueAssociationMappingFunction<>( entityComposite );
+        Function<AssociationDescriptor, Stream<EntityReference>> manyAssocFunction = new ToValueManyAssociationMappingFunction<>( entityComposite );
+        Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssocFunction = new ToValueNameAssociationMappingFunction<>( entityComposite );
+
+        @SuppressWarnings( "unchecked" )
+        ValueBuilder<T> builder = module().instance().newValueBuilderWithState(
+            primaryType, propertyFunction, assocationFunction, manyAssocFunction, namedAssocFunction );
+        return builder.newInstance();
+    }
+
+    @Override
+    public <T extends HasIdentity> Map<String, T> toValueMap(NamedAssociation<T> association )
+    {
+        @SuppressWarnings( "unchecked" )
+        Class<T> primaryType = (Class<T>) api.associationDescriptorFor( association ).type();
+
+        return association
+            .toMap()
+            .entrySet()
+            .stream()
+            .collect( Collectors.toMap( Map.Entry::getKey, entry -> toValue( primaryType, entry.getValue()) ) );
+    }
+
+    @Override
+    public <T extends HasIdentity> List<T> toValueList(ManyAssociation<T> association )
+    {
+        @SuppressWarnings( "unchecked" )
+        Class<T> primaryType = (Class<T>) api.associationDescriptorFor( association ).type();
+
+        return association
+            .toList()
+            .stream()
+            .map( entity -> toValue( primaryType, entity ) )
+            .collect( Collectors.toList() );
+    }
+
+    @Override
+    public <T extends HasIdentity> Set<T> toValueSet(ManyAssociation<T> association )
+    {
+        @SuppressWarnings( "unchecked" )
+        Class<T> primaryType = (Class<T>) api.associationDescriptorFor( association ).type();
+
+        return association
+            .toSet()
+            .stream()
+            .map( entity -> toValue( primaryType, entity ) )
+            .collect( Collectors.toSet() );
+    }
+
+    @Override
+    public <T extends HasIdentity> T toEntity(Class<T> primaryType, T valueComposite )
+    {
+        Function<PropertyDescriptor, Object> propertyFunction = new ToEntityPropertyMappingFunction<>( valueComposite );
+        Function<AssociationDescriptor, EntityReference> assocationFunction = new ToEntityAssociationMappingFunction<>( valueComposite );
+        Function<AssociationDescriptor, Stream<EntityReference>> manyAssocFunction = new ToEntityManyAssociationMappingFunction<>( valueComposite );
+        Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssocFunction = new ToEntityNameAssociationMappingFunction<>( valueComposite );
+
+        try
+        {
+            T entity = get( primaryType, valueComposite.identity().get() );
+            // If successful, then this entity is to by modified.
+            EntityInstance instance = EntityInstance.entityInstanceOf( (EntityComposite) entity );
+            EntityState state = instance.entityState();
+            FunctionStateResolver stateResolver = new FunctionStateResolver( propertyFunction,
+                                                                             assocationFunction,
+                                                                             manyAssocFunction,
+                                                                             namedAssocFunction );
+            EntityModel model = (EntityModel) EntityInstance.entityInstanceOf( (EntityComposite) entity ).descriptor();
+            stateResolver.populateState( model, state );
+            return entity;
+        }
+        catch( NoSuchEntityException e )
+        {
+            EntityBuilder<T> entityBuilder = newEntityBuilderWithState( primaryType,
+                                                                        valueComposite.identity().get(),
+                                                                        propertyFunction,
+                                                                        assocationFunction,
+                                                                        manyAssocFunction,
+                                                                        namedAssocFunction );
+            return entityBuilder.newInstance();
+        }
+    }
+
+    private static class UoWQuerySource implements QuerySource
+    {
+        private final ModuleUnitOfWork moduleUnitOfWork;
+
+        private UoWQuerySource( ModuleUnitOfWork moduleUnitOfWork )
+        {
+            this.moduleUnitOfWork = moduleUnitOfWork;
+        }
+
+        @Override
+        public <T> T find( Class<T> resultType,
+                           Predicate<Composite> whereClause,
+                           List<OrderBy> orderBySegments,
+                           Integer firstResult,
+                           Integer maxResults,
+                           Map<String, Object> variables
+        )
+        {
+            final EntityFinder entityFinder = moduleUnitOfWork.module()
+                .instance()
+                .findService( EntityFinder.class )
+                .get();
+
+            try
+            {
+                EntityReference foundEntity = entityFinder.findEntity( resultType, whereClause, variables == null ? Collections.emptyMap() : variables );
+                if( foundEntity != null )
+                {
+                    try
+                    {
+                        return moduleUnitOfWork.get( resultType, foundEntity.identity() );
+                    }
+                    catch( NoSuchEntityException e )
+                    {
+                        return null; // Index is out of sync - entity has been removed
+                    }
+                }
+                // No entity was found
+                return null;
+            }
+            catch( EntityFinderException e )
+            {
+                throw new QueryExecutionException( "Finder caused exception", e );
+            }
+        }
+
+        @Override
+        public <T> long count( Class<T> resultType,
+                               Predicate<Composite> whereClause,
+                               List<OrderBy> orderBySegments,
+                               Integer firstResult,
+                               Integer maxResults,
+                               Map<String, Object> variables
+        )
+        {
+            EntityFinder entityFinder = moduleUnitOfWork.module().instance().findService( EntityFinder.class ).get();
+
+            try
+            {
+                return entityFinder.countEntities( resultType, whereClause, variables == null ? Collections.emptyMap() : variables );
+            }
+            catch( EntityFinderException e )
+            {
+                e.printStackTrace();
+                return 0;
+            }
+        }
+
+        @Override
+        public <T> Stream<T> stream( Class<T> resultType,
+                                     Predicate<Composite> whereClause,
+                                     List<OrderBy> orderBySegments,
+                                     Integer firstResult,
+                                     Integer maxResults,
+                                     Map<String, Object> variables )
+        {
+            EntityFinder entityFinder = moduleUnitOfWork.module().instance().findService( EntityFinder.class ).get();
+
+            try
+            {
+                return entityFinder.findEntities(
+                    resultType,
+                    whereClause,
+                    orderBySegments,
+                    firstResult,
+                    maxResults,
+                    variables == null ? Collections.emptyMap() : variables
+                ).map( ref ->
+                       {
+                           try
+                           {
+                               return moduleUnitOfWork.get( resultType, ref.identity() );
+                           }
+                           catch( NoSuchEntityException e )
+                           {
+                               // Index is out of sync - entity has been removed
+                               return null;
+                           }
+                       } );
+            }
+            catch( EntityFinderException e )
+            {
+                throw new QueryExecutionException( "Query '" + toString() + "' could not be executed", e );
+            }
+        }
+    }
+
+    private class ToValuePropertyMappingFunction
+        implements Function<PropertyDescriptor, Object>
+    {
+        private Object entity;
+
+        public ToValuePropertyMappingFunction( Object entity )
+        {
+            this.entity = entity;
+        }
+
+        @Override
+        public Object apply( PropertyDescriptor propertyDescriptor )
+        {
+            EntityState entityState = EntityInstance.entityInstanceOf( (EntityComposite) entity ).entityState();
+            return entityState.propertyValueOf( propertyDescriptor.qualifiedName() );
+        }
+    }
+
+    private class ToValueAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, EntityReference>
+    {
+        private final T entity;
+
+        public ToValueAssociationMappingFunction( T entity )
+        {
+            this.entity = entity;
+        }
+
+        @Override
+        public EntityReference apply( AssociationDescriptor associationDescriptor )
+        {
+            EntityState entityState = EntityInstance.entityInstanceOf( (EntityComposite) entity ).entityState();
+            return entityState.associationValueOf( associationDescriptor.qualifiedName() );
+        }
+    }
+
+    private class ToValueManyAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, Stream<EntityReference>>
+    {
+        private final T entity;
+
+        public ToValueManyAssociationMappingFunction( T entity )
+        {
+            this.entity = entity;
+        }
+
+        @Override
+        public Stream<EntityReference> apply( AssociationDescriptor associationDescriptor )
+        {
+            EntityState entityState = EntityInstance.entityInstanceOf( (EntityComposite) entity ).entityState();
+            return entityState.manyAssociationValueOf( associationDescriptor.qualifiedName() ).stream();
+        }
+    }
+
+    private class ToValueNameAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>>
+    {
+        private final T entity;
+
+        public ToValueNameAssociationMappingFunction( T entity )
+        {
+            this.entity = entity;
+        }
+
+        @Override
+        public Stream<Map.Entry<String, EntityReference>> apply( AssociationDescriptor associationDescriptor )
+        {
+            EntityState entityState = EntityInstance.entityInstanceOf( (EntityComposite) entity ).entityState();
+            return entityState.namedAssociationValueOf( associationDescriptor.qualifiedName() ).stream();
+        }
+    }
+
+    private class ToEntityPropertyMappingFunction<T>
+        implements Function<PropertyDescriptor, Object>
+    {
+        private final T value;
+
+        public ToEntityPropertyMappingFunction( T value )
+        {
+            this.value = value;
+        }
+
+        @Override
+        public Object apply( PropertyDescriptor propertyDescriptor )
+        {
+            StateHolder state = ValueInstance.valueInstanceOf( (ValueComposite) value ).state();
+            Property<Object> property = state.propertyFor( propertyDescriptor.accessor() );
+            return property.get();
+        }
+    }
+
+    private class ToEntityAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, EntityReference>
+    {
+
+        private final T value;
+
+        public ToEntityAssociationMappingFunction( T value )
+        {
+            this.value = value;
+        }
+
+        @Override
+        public EntityReference apply( AssociationDescriptor associationDescriptor )
+        {
+            AssociationStateHolder state = ValueInstance.valueInstanceOf( (ValueComposite) value ).state();
+            AssociationInstance<T> association = (AssociationInstance<T>) state.associationFor( associationDescriptor.accessor() );
+            return association.getAssociationState().get();
+        }
+    }
+
+    private class ToEntityManyAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, Stream<EntityReference>>
+    {
+
+        private final T value;
+
+        public ToEntityManyAssociationMappingFunction( T valueComposite )
+        {
+            this.value = valueComposite;
+        }
+
+        @Override
+        public Stream<EntityReference> apply( AssociationDescriptor associationDescriptor )
+        {
+            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
+            return valueInstance.state().manyAssociationFor( associationDescriptor.accessor() ).references();
+        }
+    }
+
+    private class ToEntityNameAssociationMappingFunction<T>
+        implements Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>>
+    {
+        private final T value;
+
+        public ToEntityNameAssociationMappingFunction( T valueComposite )
+        {
+            this.value = valueComposite;
+        }
+
+        @Override
+        public Stream<Map.Entry<String, EntityReference>> apply( AssociationDescriptor associationDescriptor )
+        {
+            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
+            return valueInstance.state().namedAssociationFor( associationDescriptor.accessor() ).references();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkFactoryMixin.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkFactoryMixin.java b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkFactoryMixin.java
new file mode 100644
index 0000000..d5a3609
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/unitofwork/UnitOfWorkFactoryMixin.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.unitofwork;
+
+import java.time.Instant;
+import java.util.Stack;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.metrics.MetricsProvider;
+import org.apache.polygene.api.time.SystemTime;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.usecase.Usecase;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+public class UnitOfWorkFactoryMixin
+    implements UnitOfWorkFactory
+{
+    @Structure
+    private TransientBuilderFactory tbf;
+
+    @Structure
+    private ModuleSpi module;
+
+    // Implementation of UnitOfWorkFactory
+    @Override
+    public UnitOfWork newUnitOfWork()
+    {
+        return newUnitOfWork( Usecase.DEFAULT );
+    }
+
+    @Override
+    public UnitOfWork newUnitOfWork(Instant currentTime )
+    {
+        return newUnitOfWork( Usecase.DEFAULT, currentTime );
+    }
+
+    @Override
+    public UnitOfWork newUnitOfWork( Usecase usecase )
+    {
+        return newUnitOfWork( usecase == null ? Usecase.DEFAULT : usecase, SystemTime.now() );
+    }
+
+    @Override
+    public UnitOfWork newUnitOfWork( Usecase usecase, Instant currentTime )
+    {
+        UnitOfWorkInstance unitOfWorkInstance = new UnitOfWorkInstance( module, usecase, currentTime, metricsProvider() );
+        return tbf.newTransient( UnitOfWork.class, unitOfWorkInstance );
+    }
+
+    private MetricsProvider metricsProvider()
+    {
+        return module.metricsProvider();
+    }
+
+    @Override
+    public boolean isUnitOfWorkActive()
+    {
+        Stack<UnitOfWorkInstance> stack = UnitOfWorkInstance.getCurrent();
+        return !stack.isEmpty();
+    }
+
+    @Override
+    public UnitOfWork currentUnitOfWork()
+    {
+        Stack<UnitOfWorkInstance> stack = UnitOfWorkInstance.getCurrent();
+        if( stack.size() == 0 )
+        {
+            throw new IllegalStateException( "No current UnitOfWork active" );
+        }
+        return tbf.newTransient( UnitOfWork.class, stack.peek() );
+    }
+
+    @Override
+    public UnitOfWork getUnitOfWork( EntityComposite entity )
+    {
+        EntityInstance instance = EntityInstance.entityInstanceOf( entity );
+        return instance.unitOfWork();
+    }
+}


[14/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/LayerAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/LayerAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/LayerAssemblyImpl.java
new file mode 100644
index 0000000..8b18426
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/LayerAssemblyImpl.java
@@ -0,0 +1,630 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Predicate;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyVisitor;
+import org.apache.polygene.bootstrap.EntityAssembly;
+import org.apache.polygene.bootstrap.EntityDeclaration;
+import org.apache.polygene.bootstrap.ImportedServiceAssembly;
+import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ObjectAssembly;
+import org.apache.polygene.bootstrap.ObjectDeclaration;
+import org.apache.polygene.bootstrap.ServiceAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.bootstrap.TransientAssembly;
+import org.apache.polygene.bootstrap.TransientDeclaration;
+import org.apache.polygene.bootstrap.ValueAssembly;
+import org.apache.polygene.bootstrap.ValueDeclaration;
+
+/**
+ * Assembly of a Layer. From here you can create more ModuleAssemblies for
+ * the Layer that is being assembled. It is also here that you define
+ * what other Layers this Layer is using by calling {@link org.apache.polygene.runtime.bootstrap.LayerAssemblyImpl#uses()}.
+ */
+public final class LayerAssemblyImpl
+    implements LayerAssembly
+{
+    private final ApplicationAssembly applicationAssembly;
+    private final HashMap<String, ModuleAssemblyImpl> moduleAssemblies;
+    private final Set<LayerAssembly> uses;
+
+    private String name;
+    private final MetaInfo metaInfo = new MetaInfo();
+    private final List<Class<? extends Activator<Layer>>> activators = new ArrayList<>();
+
+    public LayerAssemblyImpl( ApplicationAssembly applicationAssembly, String name )
+    {
+        this.applicationAssembly = applicationAssembly;
+        this.name = name;
+
+        moduleAssemblies = new LinkedHashMap<>();
+        uses = new LinkedHashSet<>();
+    }
+
+    @Override
+    public ModuleAssembly module( String name )
+    {
+        if( name != null )
+        {
+            ModuleAssemblyImpl existing = moduleAssemblies.get( name );
+            if( existing != null )
+            {
+                return existing;
+            }
+        }
+        ModuleAssemblyImpl moduleAssembly = new ModuleAssemblyImpl( this, name );
+        moduleAssemblies.put( name, moduleAssembly );
+        return moduleAssembly;
+    }
+
+    @Override
+    public ApplicationAssembly application()
+    {
+        return applicationAssembly;
+    }
+
+    @Override
+    public LayerAssembly setName( String name )
+    {
+        this.name = name;
+        return this;
+    }
+
+    @Override
+    public LayerAssembly setMetaInfo( Object info )
+    {
+        metaInfo.set( info );
+        return this;
+    }
+
+    @Override
+    public LayerAssembly uses( LayerAssembly... layerAssembly )
+        throws IllegalArgumentException
+    {
+        uses.addAll( Arrays.asList( layerAssembly ) );
+        return this;
+    }
+
+    @Override
+    @SafeVarargs
+    public final LayerAssembly withActivators( Class<? extends Activator<Layer>>... activators )
+    {
+        this.activators.addAll( Arrays.asList( activators ) );
+        return this;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType
+    {
+        visitor.visitLayer( this );
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            moduleAssembly.visit( visitor );
+        }
+    }
+
+    @Override
+    public EntityDeclaration entities( Predicate<? super EntityAssembly> specification )
+    {
+        final List<EntityDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.entities( specification ) );
+        }
+
+        return new EntityDeclaration()
+        {
+            @Override
+            public EntityDeclaration setMetaInfo( Object info )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( info );
+                }
+                return this;
+            }
+
+            @Override
+            public EntityDeclaration visibleIn( Visibility visibility )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+
+            @Override
+            public EntityDeclaration withConcerns( Class<?>... concerns )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.withConcerns( concerns );
+                }
+                return this;
+            }
+
+            @Override
+            public EntityDeclaration withSideEffects( Class<?>... sideEffects )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.withSideEffects( sideEffects );
+                }
+                return this;
+            }
+
+            @Override
+            public EntityDeclaration withMixins( Class<?>... mixins )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.withMixins( mixins );
+                }
+                return this;
+            }
+
+            @Override
+            public EntityDeclaration withTypes( Class<?>... types )
+            {
+                for( EntityDeclaration declaration : declarations )
+                {
+                    declaration.withTypes( types );
+                }
+                return this;
+            }
+        };
+    }
+
+    @Override
+    public ServiceDeclaration services( Predicate<? super ServiceAssembly> specification )
+    {
+        final List<ServiceDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.services( specification ) );
+        }
+
+        return new ServiceDeclaration()
+        {
+            @Override
+            public ServiceDeclaration setMetaInfo( Object serviceAttribute )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( serviceAttribute );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration visibleIn( Visibility visibility )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration withConcerns( Class<?>... concerns )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.withConcerns( concerns );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration withSideEffects( Class<?>... sideEffects )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.withSideEffects( sideEffects );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration withMixins( Class<?>... mixins )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.withMixins( mixins );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration withTypes( Class<?>... types )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.withTypes( types );
+                }
+                return this;
+            }
+
+            @Override
+            @SafeVarargs
+            public final ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.withActivators( activators );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration identifiedBy( String identity )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.identifiedBy( identity );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration taggedWith( String... tags )
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.taggedWith( tags );
+                }
+                return this;
+            }
+
+            @Override
+            public ServiceDeclaration instantiateOnStartup()
+            {
+                for( ServiceDeclaration declaration : declarations )
+                {
+                    declaration.instantiateOnStartup();
+                }
+
+                return this;
+            }
+        };
+    }
+
+    @Override
+    public TransientDeclaration transients( Predicate<? super TransientAssembly> specification )
+    {
+        final List<TransientDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.transients( specification ) );
+        }
+
+        return new TransientDeclaration()
+        {
+            @Override
+            public TransientDeclaration setMetaInfo( Object info )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( info );
+                }
+                return this;
+            }
+
+            @Override
+            public TransientDeclaration visibleIn( Visibility visibility )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+
+            @Override
+            public TransientDeclaration withConcerns( Class<?>... concerns )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.withConcerns( concerns );
+                }
+                return this;
+            }
+
+            @Override
+            public TransientDeclaration withSideEffects( Class<?>... sideEffects )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.withSideEffects( sideEffects );
+                }
+                return this;
+            }
+
+            @Override
+            public TransientDeclaration withMixins( Class<?>... mixins )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.withMixins( mixins );
+                }
+                return this;
+            }
+
+            @Override
+            public TransientDeclaration withTypes( Class<?>... types )
+            {
+                for( TransientDeclaration declaration : declarations )
+                {
+                    declaration.withTypes( types );
+                }
+                return this;
+            }
+        };
+    }
+
+    @Override
+    public ValueDeclaration values( Predicate<? super ValueAssembly> specification )
+    {
+        final List<ValueDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.values( specification ) );
+        }
+        return new ValueDeclaration()
+        {
+            @Override
+            public ValueDeclaration setMetaInfo( Object info )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( info );
+                }
+                return this;
+            }
+
+            @Override
+            public ValueDeclaration visibleIn( Visibility visibility )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+
+            @Override
+            public ValueDeclaration withConcerns( Class<?>... concerns )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.withConcerns( concerns );
+                }
+                return this;
+            }
+
+            @Override
+            public ValueDeclaration withSideEffects( Class<?>... sideEffects )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.withSideEffects( sideEffects );
+                }
+                return this;
+            }
+
+            @Override
+            public ValueDeclaration withMixins( Class<?>... mixins )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.withMixins( mixins );
+                }
+                return this;
+            }
+
+            @Override
+            public ValueDeclaration withTypes( Class<?>... types )
+            {
+                for( ValueDeclaration declaration : declarations )
+                {
+                    declaration.withTypes( types );
+                }
+                return this;
+            }
+        };
+    }
+
+    @Override
+    public ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification )
+    {
+        final List<ObjectDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.objects( specification ) );
+        }
+        return new ObjectDeclaration()
+        {
+            @Override
+            public ObjectDeclaration setMetaInfo( Object info )
+            {
+                for( ObjectDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( info );
+                }
+                return this;
+            }
+
+            @Override
+            public ObjectDeclaration visibleIn( Visibility visibility )
+                throws IllegalStateException
+            {
+                for( ObjectDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+        };
+    }
+
+    @Override
+    public ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification )
+    {
+        final List<ImportedServiceDeclaration> declarations = new ArrayList<>();
+
+        for( ModuleAssemblyImpl moduleAssembly : moduleAssemblies.values() )
+        {
+            declarations.add( moduleAssembly.importedServices( specification ) );
+        }
+        return new ImportedServiceDeclaration()
+        {
+
+            @Override
+            public ImportedServiceDeclaration importOnStartup()
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.importOnStartup();
+                }
+                return this;
+            }
+
+            @Override
+            public ImportedServiceDeclaration visibleIn( Visibility visibility )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.visibleIn( visibility );
+                }
+                return this;
+            }
+
+            @Override
+            public ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.importedBy( serviceImporterClass );
+                }
+                return this;
+            }
+
+            @Override
+            public ImportedServiceDeclaration identifiedBy( String identity )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.identifiedBy( identity );
+                }
+                return this;
+            }
+
+            @Override
+            public ImportedServiceDeclaration taggedWith( String... tags )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.taggedWith( tags );
+                }
+                return this;
+            }
+
+            @Override
+            public ImportedServiceDeclaration setMetaInfo( Object serviceAttribute )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.setMetaInfo( serviceAttribute );
+                }
+                return this;
+            }
+
+            @Override
+            @SafeVarargs
+            public final ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
+            {
+                for( ImportedServiceDeclaration declaration : declarations )
+                {
+                    declaration.withActivators( activators );
+                }
+                return this;
+            }
+
+        };
+    }
+
+    Collection<ModuleAssemblyImpl> moduleAssemblies()
+    {
+        return moduleAssemblies.values();
+    }
+
+    Set<LayerAssembly> uses()
+    {
+        return uses;
+    }
+
+    public MetaInfo metaInfo()
+    {
+        return metaInfo;
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public List<Class<? extends Activator<Layer>>> activators()
+    {
+        return activators;
+    }
+
+    @Override
+    public final String toString()
+    {
+        return "LayerAssembly [" + name + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
new file mode 100644
index 0000000..62220a6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
@@ -0,0 +1,645 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.IdentityGenerator;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.service.DuplicateServiceIdentityException;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.type.MatchTypeSpecification;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.AssemblySpecifications;
+import org.apache.polygene.bootstrap.AssemblyVisitor;
+import org.apache.polygene.bootstrap.ConfigurationDeclaration;
+import org.apache.polygene.bootstrap.EntityAssembly;
+import org.apache.polygene.bootstrap.EntityDeclaration;
+import org.apache.polygene.bootstrap.ImportedServiceAssembly;
+import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.MetaInfoDeclaration;
+import org.apache.polygene.bootstrap.MixinDeclaration;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ObjectAssembly;
+import org.apache.polygene.bootstrap.ObjectDeclaration;
+import org.apache.polygene.bootstrap.ServiceAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.bootstrap.TransientAssembly;
+import org.apache.polygene.bootstrap.TransientDeclaration;
+import org.apache.polygene.bootstrap.ValueAssembly;
+import org.apache.polygene.bootstrap.ValueDeclaration;
+import org.apache.polygene.bootstrap.identity.DefaultIdentityGeneratorAssembler;
+import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.composite.TransientModel;
+import org.apache.polygene.runtime.composite.TransientsModel;
+import org.apache.polygene.runtime.entity.EntitiesModel;
+import org.apache.polygene.runtime.entity.EntityModel;
+import org.apache.polygene.runtime.object.ObjectModel;
+import org.apache.polygene.runtime.object.ObjectsModel;
+import org.apache.polygene.runtime.service.ImportedServiceModel;
+import org.apache.polygene.runtime.service.ImportedServicesModel;
+import org.apache.polygene.runtime.service.ServiceModel;
+import org.apache.polygene.runtime.service.ServicesModel;
+import org.apache.polygene.runtime.structure.LayerModel;
+import org.apache.polygene.runtime.structure.ModuleModel;
+import org.apache.polygene.runtime.value.ValueModel;
+import org.apache.polygene.runtime.value.ValuesModel;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.singleton;
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Assembly of a Module. This is where you register all objects, Composites,
+ * Services. Each "add" method returns a declaration that you can use to add
+ * additional information and metadata. If you call an "add" method with many
+ * parameters then the declared metadata will apply to all types in the method
+ * call.
+ */
+final class ModuleAssemblyImpl
+        implements ModuleAssembly
+{
+    private static HashMap<Class, Assembler> defaultAssemblers;
+
+    private final LayerAssembly layerAssembly;
+    private String name;
+    private final MetaInfo metaInfo = new MetaInfo();
+
+    private final List<Class<? extends Activator<Module>>> activators = new ArrayList<>();
+    private final List<ServiceAssemblyImpl> serviceAssemblies = new ArrayList<>();
+    private final Map<Class<?>, ImportedServiceAssemblyImpl> importedServiceAssemblies = new LinkedHashMap<>();
+    private final Map<Class<? extends EntityComposite>, EntityAssemblyImpl> entityAssemblies = new LinkedHashMap<>();
+    private final Map<Class<? extends ValueComposite>, ValueAssemblyImpl> valueAssemblies = new LinkedHashMap<>();
+    private final Map<Class<? extends TransientComposite>, TransientAssemblyImpl> transientAssemblies = new LinkedHashMap<>();
+
+    private final Map<Class<?>, ObjectAssemblyImpl> objectAssemblies = new LinkedHashMap<>();
+
+    private final MetaInfoDeclaration metaInfoDeclaration = new MetaInfoDeclaration();
+
+    static
+    {
+        defaultAssemblers = new HashMap<>();
+        defaultAssemblers.put(UnitOfWorkFactory.class, new DefaultUnitOfWorkAssembler());
+        defaultAssemblers.put(IdentityGenerator.class, new DefaultIdentityGeneratorAssembler());
+    }
+
+    ModuleAssemblyImpl(LayerAssembly layerAssembly, String name)
+    {
+        this.layerAssembly = layerAssembly;
+        this.name = name;
+    }
+
+    @Override
+    public LayerAssembly layer()
+    {
+        return layerAssembly;
+    }
+
+    @Override
+    public ModuleAssembly module(String layerName, String moduleName)
+    {
+        return layerAssembly.application().module(layerName, moduleName);
+    }
+
+    @Override
+    public ModuleAssembly setName(String name)
+    {
+        this.name = name;
+        return this;
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public ModuleAssembly setMetaInfo(Object info)
+    {
+        metaInfo.set(info);
+        return this;
+    }
+
+    @Override
+    @SafeVarargs
+    public final ModuleAssembly withActivators(Class<? extends Activator<Module>>... activators)
+    {
+        this.activators.addAll( asList( activators ) );
+        return this;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public ValueDeclaration values(Class<?>... valueTypes)
+    {
+        List<ValueAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class valueType : valueTypes)
+        {
+            if (valueAssemblies.containsKey(valueType))
+            {
+                assemblies.add(valueAssemblies.get(valueType));
+            }
+            else
+            {
+                ValueAssemblyImpl valueAssembly = new ValueAssemblyImpl(valueType);
+                valueAssemblies.put(valueType, valueAssembly);
+                assemblies.add(valueAssembly);
+            }
+        }
+
+        return new ValueDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ValueDeclaration values(Predicate<? super ValueAssembly> specification)
+    {
+        List<ValueAssemblyImpl> assemblies = valueAssemblies.values().stream()
+                .filter(specification::test)
+                .collect(toList());
+        return new ValueDeclarationImpl(assemblies);
+    }
+
+    @Override
+    @SuppressWarnings({"raw", "unchecked"})
+    public TransientDeclaration transients(Class<?>... transientTypes)
+    {
+        List<TransientAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class valueType : transientTypes)
+        {
+            if (transientAssemblies.containsKey(valueType))
+            {
+                assemblies.add(transientAssemblies.get(valueType));
+            }
+            else
+            {
+                TransientAssemblyImpl transientAssembly = new TransientAssemblyImpl(valueType);
+                transientAssemblies.put(valueType, transientAssembly);
+                assemblies.add(transientAssembly);
+            }
+        }
+
+        return new TransientDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public TransientDeclaration transients(Predicate<? super TransientAssembly> specification)
+    {
+        List<TransientAssemblyImpl> assemblies = transientAssemblies.values().stream()
+                .filter(specification::test)
+                .collect(toList());
+
+        return new TransientDeclarationImpl(assemblies);
+    }
+
+    @Override
+    @SuppressWarnings({"raw", "unchecked"})
+    public EntityDeclaration entities(Class<?>... entityTypes)
+    {
+        List<EntityAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class entityType : entityTypes)
+        {
+            if (entityAssemblies.containsKey(entityType))
+            {
+                assemblies.add(entityAssemblies.get(entityType));
+            }
+            else
+            {
+                EntityAssemblyImpl entityAssembly = new EntityAssemblyImpl(entityType);
+                entityAssemblies.put(entityType, entityAssembly);
+                assemblies.add(entityAssembly);
+            }
+        }
+
+        return new EntityDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public EntityDeclaration entities(Predicate<? super EntityAssembly> specification)
+    {
+        List<EntityAssemblyImpl> assemblies = entityAssemblies.values().stream()
+                .filter(specification::test)
+                .collect(toList());
+
+        return new EntityDeclarationImpl(assemblies);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public ConfigurationDeclaration configurations(Class<?>... configurationTypes)
+    {
+        List<EntityAssemblyImpl> entityAssemblyList = new ArrayList<>();
+
+        for (Class entityType : configurationTypes)
+        {
+            if (this.entityAssemblies.containsKey(entityType))
+            {
+                entityAssemblyList.add(this.entityAssemblies.get(entityType));
+            }
+            else
+            {
+                EntityAssemblyImpl entityAssembly = new EntityAssemblyImpl(entityType);
+                this.entityAssemblies.put(entityType, entityAssembly);
+                entityAssemblyList.add(entityAssembly);
+            }
+        }
+
+        List<ValueAssemblyImpl> valueAssemblyList = new ArrayList<>();
+
+        for (Class valueType : configurationTypes)
+        {
+            if (valueAssemblies.containsKey(valueType))
+            {
+                valueAssemblyList.add(valueAssemblies.get(valueType));
+            }
+            else
+            {
+                ValueAssemblyImpl valueAssembly = new ValueAssemblyImpl(valueType);
+                valueAssemblies.put(valueType, valueAssembly);
+                valueAssemblyList.add(valueAssembly);
+                valueAssembly.types.add(HasIdentity.class);
+            }
+        }
+
+        return new ConfigurationDeclarationImpl(entityAssemblyList, valueAssemblyList);
+    }
+
+    @Override
+    public ConfigurationDeclaration configurations(Predicate<HasTypes> specification)
+    {
+        Predicate<HasTypes> isConfigurationComposite = new MatchTypeSpecification(HasIdentity.class);
+        specification = specification.and(isConfigurationComposite);
+        List<EntityAssemblyImpl> entityAssmblyList = new ArrayList<>();
+        for (EntityAssemblyImpl entityAssembly : entityAssemblies.values())
+        {
+            if (specification.test(entityAssembly))
+            {
+                entityAssmblyList.add(entityAssembly);
+            }
+        }
+        List<ValueAssemblyImpl> valueAssemblyList = new ArrayList<>();
+        for (ValueAssemblyImpl transientAssembly : valueAssemblies.values())
+        {
+            if (specification.test(transientAssembly))
+            {
+                valueAssemblyList.add(transientAssembly);
+            }
+        }
+        return new ConfigurationDeclarationImpl(entityAssmblyList, valueAssemblyList);
+    }
+
+    @Override
+    public ObjectDeclaration objects(Class<?>... objectTypes)
+            throws AssemblyException
+    {
+        List<ObjectAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class<?> objectType : objectTypes)
+        {
+            if (objectType.isInterface())
+            {
+                throw new AssemblyException("Interfaces can not be Polygene Objects.");
+            }
+            if (objectAssemblies.containsKey(objectType))
+            {
+                assemblies.add(objectAssemblies.get(objectType));
+            }
+            else
+            {
+                ObjectAssemblyImpl objectAssembly = new ObjectAssemblyImpl(objectType);
+                objectAssemblies.put(objectType, objectAssembly);
+                assemblies.add(objectAssembly);
+            }
+        }
+
+        return new ObjectDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ObjectDeclaration objects(Predicate<? super ObjectAssembly> specification)
+    {
+        List<ObjectAssemblyImpl> assemblies = objectAssemblies.values().stream()
+                .filter(specification::test)
+                .collect(toList());
+
+        return new ObjectDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ServiceDeclaration addServices(Class<?>... serviceTypes)
+    {
+        List<ServiceAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class<?> serviceType : serviceTypes)
+        {
+            ServiceAssemblyImpl serviceAssembly = new ServiceAssemblyImpl(serviceType);
+            serviceAssemblies.add(serviceAssembly);
+            assemblies.add(serviceAssembly);
+        }
+
+        return new ServiceDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ServiceDeclaration services(Class<?>... serviceTypes)
+    {
+        List<ServiceAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class<?> serviceType : serviceTypes)
+        {
+            if( serviceAssemblies.stream().anyMatch( AssemblySpecifications.ofAnyType( serviceType ) ) )
+            {
+                serviceAssemblies.stream().filter( AssemblySpecifications.ofAnyType( serviceType ) )
+                                 .forEach( assemblies::add );
+            }
+            else
+            {
+                ServiceAssemblyImpl serviceAssembly = new ServiceAssemblyImpl(serviceType);
+                serviceAssemblies.add(serviceAssembly);
+                assemblies.add(serviceAssembly);
+            }
+        }
+
+        return new ServiceDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ServiceDeclaration services(Predicate<? super ServiceAssembly> specification)
+    {
+        List<ServiceAssemblyImpl> assemblies = serviceAssemblies.stream()
+                .filter(specification::test)
+                .collect(toList());
+        return new ServiceDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ImportedServiceDeclaration importedServices(Class<?>... serviceTypes)
+    {
+        List<ImportedServiceAssemblyImpl> assemblies = new ArrayList<>();
+
+        for (Class<?> serviceType : serviceTypes)
+        {
+            if (importedServiceAssemblies.containsKey(serviceType))
+            {
+                assemblies.add(importedServiceAssemblies.get(serviceType));
+            }
+            else
+            {
+                ImportedServiceAssemblyImpl serviceAssembly = new ImportedServiceAssemblyImpl(serviceType, this);
+                importedServiceAssemblies.put(serviceType, serviceAssembly);
+                assemblies.add(serviceAssembly);
+            }
+        }
+
+        return new ImportedServiceDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public ImportedServiceDeclaration importedServices(Predicate<? super ImportedServiceAssembly> specification)
+    {
+        List<ImportedServiceAssemblyImpl> assemblies = importedServiceAssemblies.values().stream()
+                .filter(specification::test)
+                .collect(toList());
+
+        return new ImportedServiceDeclarationImpl(assemblies);
+    }
+
+    @Override
+    public <T> MixinDeclaration<T> forMixin(Class<T> mixinType)
+    {
+        return metaInfoDeclaration.on(mixinType);
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> void visit(AssemblyVisitor<ThrowableType> visitor)
+            throws ThrowableType
+    {
+        visitor.visitModule( this );
+
+        for( TransientAssemblyImpl compositeDeclaration : transientAssemblies.values() )
+        {
+            visitor.visitComposite( new TransientDeclarationImpl( singleton( compositeDeclaration ) ) );
+        }
+
+        for( EntityAssemblyImpl entityDeclaration : entityAssemblies.values() )
+        {
+            visitor.visitEntity( new EntityDeclarationImpl( singleton( entityDeclaration ) ) );
+        }
+
+        for( ObjectAssemblyImpl objectDeclaration : objectAssemblies.values() )
+        {
+            visitor.visitObject( new ObjectDeclarationImpl( singleton( objectDeclaration ) ) );
+        }
+
+        for( ServiceAssemblyImpl serviceDeclaration : serviceAssemblies )
+        {
+            visitor.visitService( new ServiceDeclarationImpl( singleton( serviceDeclaration ) ) );
+        }
+
+        for( ImportedServiceAssemblyImpl importedServiceDeclaration : importedServiceAssemblies.values() )
+        {
+            visitor.visitImportedService( new ImportedServiceDeclarationImpl( singleton( importedServiceDeclaration ) ) );
+        }
+
+        for( ValueAssemblyImpl valueDeclaration : valueAssemblies.values() )
+        {
+            visitor.visitValue( new ValueDeclarationImpl( singleton( valueDeclaration ) ) );
+        }
+    }
+
+    @SuppressWarnings("OptionalGetWithoutIsPresent")
+    ModuleModel assembleModule(LayerModel layerModel, AssemblyHelper helper)
+            throws AssemblyException
+    {
+        addDefaultAssemblers();
+        List<TransientModel> transientModels = new ArrayList<>();
+        List<ObjectModel> objectModels = new ArrayList<>();
+        List<ValueModel> valueModels = new ArrayList<>();
+        List<ServiceModel> serviceModels = new ArrayList<>();
+        List<ImportedServiceModel> importedServiceModels = new ArrayList<>();
+        List<EntityModel> entityModels = new ArrayList<>();
+        ModuleModel moduleModel = new ModuleModel(name,
+                metaInfo,
+                layerModel,
+                new ActivatorsModel<>(activators),
+                new TransientsModel(transientModels),
+                new EntitiesModel(entityModels),
+                new ObjectsModel(objectModels),
+                new ValuesModel(valueModels),
+                new ServicesModel(serviceModels),
+                new ImportedServicesModel(importedServiceModels));
+
+        if (name == null)
+        {
+            throw new AssemblyException("Module must have name set");
+        }
+
+        transientModels.addAll(transientAssemblies.values().stream()
+                .map(composite -> composite.newTransientModel(moduleModel, metaInfoDeclaration, helper))
+                .collect(toList()));
+
+        valueModels.addAll(valueAssemblies.values().stream()
+                .map(value -> value.newValueModel(moduleModel, metaInfoDeclaration, helper))
+                .collect(toList()));
+
+        entityModels.addAll(entityAssemblies.values().stream()
+                .map(entityDeclaration -> entityDeclaration.newEntityModel(moduleModel,
+                        metaInfoDeclaration,
+                        metaInfoDeclaration,
+                        metaInfoDeclaration,
+                        metaInfoDeclaration,
+                        helper))
+                .collect(Collectors.toList()));
+
+        for (ObjectAssemblyImpl objectDeclaration : objectAssemblies.values())
+        {
+            objectDeclaration.addObjectModel(moduleModel, objectModels);
+        }
+
+        for (ServiceAssemblyImpl serviceDeclaration : serviceAssemblies)
+        {
+            if (serviceDeclaration.identity == null)
+            {
+                serviceDeclaration.identity = generateId(serviceDeclaration.types());
+            }
+
+            serviceModels.add(serviceDeclaration.newServiceModel(moduleModel, metaInfoDeclaration, helper));
+        }
+
+        for (ImportedServiceAssemblyImpl importedServiceDeclaration : importedServiceAssemblies.values())
+        {
+            importedServiceDeclaration.addImportedServiceModel(moduleModel, importedServiceModels);
+        }
+
+        // Check for duplicate service identities
+        Set<String> identities = new HashSet<>();
+        for (ServiceModel serviceModel : serviceModels)
+        {
+            String identity = serviceModel.identity().toString();
+            if (identities.contains(identity))
+            {
+                throw new DuplicateServiceIdentityException(
+                        "Duplicated service reference: " + identity + " in module " + moduleModel.name()
+                );
+            }
+            identities.add(identity);
+        }
+        for (ImportedServiceModel serviceModel : importedServiceModels)
+        {
+            String identity = serviceModel.identity().toString();
+            if (identities.contains(identity))
+            {
+                throw new DuplicateServiceIdentityException(
+                        "Duplicated service reference: " + identity + " in module " + moduleModel.name()
+                );
+            }
+            identities.add(identity);
+        }
+
+        importedServiceModels
+            .stream()
+            .filter(
+                importedServiceModel ->
+                    objectModels.stream().noneMatch( model -> model.types().findFirst().get()
+                                                                   .equals( importedServiceModel.serviceImporter() ) ) )
+            .forEach(
+                importedServiceModel ->
+                    objectModels.add( new ObjectModel( moduleModel, importedServiceModel.serviceImporter(),
+                                                       Visibility.module, new MetaInfo() ) ) );
+
+        return moduleModel;
+    }
+
+    private void addDefaultAssemblers()
+            throws AssemblyException
+    {
+        try
+        {
+            defaultAssemblers.entrySet().stream()
+                    .filter(entry -> serviceAssemblies.stream().noneMatch(serviceAssembly -> serviceAssembly.hasType(entry.getKey())))
+                    .forEach(entry ->
+                    {
+                        try
+                        {
+                            entry.getValue().assemble(this);
+                        }
+                        catch (AssemblyException e)
+                        {
+                            throw new UndeclaredThrowableException(e);
+                        }
+                    });
+        }
+        catch (UndeclaredThrowableException e)
+        {
+            throw (AssemblyException) e.getUndeclaredThrowable();
+        }
+    }
+
+    private Identity generateId(Stream<Class<?>> serviceTypes)
+    {
+        // Find service reference that is not yet used
+        Class<?> serviceType = serviceTypes.findFirst()
+                .orElse(null); // Use the first, which *SHOULD* be the main serviceType
+        int idx = 0;
+        Identity id = new StringIdentity(serviceType.getSimpleName());
+        boolean invalid;
+        do
+        {
+            invalid = false;
+            for (ServiceAssemblyImpl serviceAssembly : serviceAssemblies)
+            {
+                if (serviceAssembly.identity() != null && serviceAssembly.identity().equals(id))
+                {
+                    idx++;
+                    id = new StringIdentity(serviceType.getSimpleName() + "_" + idx);
+                    invalid = true;
+                    break;
+                }
+            }
+        }
+        while (invalid);
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectAssemblyImpl.java
new file mode 100644
index 0000000..50a4256
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectAssemblyImpl.java
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.bootstrap.ObjectAssembly;
+import org.apache.polygene.runtime.object.ObjectModel;
+
+/**
+ * Assembly of an Object.
+ */
+public final class ObjectAssemblyImpl
+    implements ObjectAssembly
+{
+    private Class<?> objectType;
+    MetaInfo metaInfo = new MetaInfo();
+    Visibility visibility = Visibility.module;
+
+    public ObjectAssemblyImpl( Class<?> clazz )
+    {
+        // best try to find out if the class is a concrete class
+        if( clazz.isEnum() ||
+            ( !Composite.class.isAssignableFrom( clazz ) && Modifier.isAbstract( clazz.getModifiers() ) ) )
+        {
+            throw new IllegalArgumentException( "Declared objects must be concrete classes: " + clazz );
+        }
+        this.objectType = clazz;
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return Stream.of( objectType );
+    }
+
+    void addObjectModel( ModuleDescriptor module, List<ObjectModel> objectModels )
+    {
+        try
+        {
+            ObjectModel objectModel = new ObjectModel( module, objectType, visibility, metaInfo );
+            objectModels.add( objectModel );
+        }
+        catch( Throwable e )
+        {
+            throw new InvalidApplicationException( "Could not register " + objectType.getName(), e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectDeclarationImpl.java
new file mode 100644
index 0000000..bba3faa
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ObjectDeclarationImpl.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ObjectDeclaration;
+
+/**
+ * Declaration of an Object. Created by {@link org.apache.polygene.runtime.bootstrap.ModuleAssemblyImpl#objects(Class[])}.
+ */
+public final class ObjectDeclarationImpl
+    implements ObjectDeclaration
+{
+    private final Iterable<ObjectAssemblyImpl> assemblies;
+
+    public ObjectDeclarationImpl( Iterable<ObjectAssemblyImpl> assemblies )
+    {
+        this.assemblies = assemblies;
+    }
+
+    @Override
+    public ObjectDeclaration setMetaInfo( Object info )
+    {
+        for( ObjectAssemblyImpl assembly : assemblies )
+        {
+            assembly.metaInfo.set( info );
+        }
+        return this;
+    }
+
+    @Override
+    public ObjectDeclaration visibleIn( Visibility visibility )
+        throws IllegalStateException
+    {
+        for( ObjectAssemblyImpl assembly : assemblies )
+        {
+            assembly.visibility = visibility;
+        }
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/OrAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/OrAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/OrAppliesToFilter.java
new file mode 100644
index 0000000..77d9c39
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/OrAppliesToFilter.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class OrAppliesToFilter
+    implements AppliesToFilter
+{
+    private final AppliesToFilter left;
+    private final AppliesToFilter right;
+
+    OrAppliesToFilter( AppliesToFilter left, AppliesToFilter right )
+    {
+        this.left = left;
+        this.right = right;
+    }
+
+    @Override
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        return left.appliesTo( method, mixin, compositeType, fragmentClass ) ||
+               right.appliesTo( method, mixin, compositeType, fragmentClass );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceAssemblyImpl.java
new file mode 100644
index 0000000..dab0b31
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceAssemblyImpl.java
@@ -0,0 +1,106 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.activation.Activators;
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.util.Annotations;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.bootstrap.ServiceAssembly;
+import org.apache.polygene.bootstrap.StateDeclarations;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.service.ServiceModel;
+import org.apache.polygene.runtime.structure.ModuleModel;
+
+/**
+ * Assembly of a Service.
+ */
+public final class ServiceAssemblyImpl extends CompositeAssemblyImpl
+    implements ServiceAssembly
+{
+    Identity identity;
+    boolean instantiateOnStartup = false;
+    List<Class<? extends Activator<?>>> activators = new ArrayList<>();
+
+    public ServiceAssemblyImpl( Class<?> serviceType )
+    {
+        super( serviceType );
+        // The composite must always implement ServiceComposite, as a marker interface
+        if( !ServiceComposite.class.isAssignableFrom( serviceType ) )
+        {
+            types.add( ServiceComposite.class );
+        }
+    }
+
+    @Override
+    public Identity identity()
+    {
+        return identity;
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    ServiceModel newServiceModel( ModuleModel module, StateDeclarations stateDeclarations, AssemblyHelper helper )
+    {
+        try
+        {
+            buildComposite( helper, stateDeclarations );
+            List<Class<? extends Activator<?>>> activatorClasses = Stream
+                .concat( activators.stream(), activatorsDeclarations( types ) )
+                .collect( Collectors.toList() );
+            return new ServiceModel( module, types, visibility, metaInfo,
+                                     new ActivatorsModel( activatorClasses ),
+                                     mixinsModel, stateModel, compositeMethodsModel,
+                                     identity, instantiateOnStartup );
+        }
+        catch( Exception e )
+        {
+            throw new InvalidApplicationException( "Could not register " + types, e );
+        }
+    }
+
+    private Stream<Class<? extends Activator<?>>> activatorsDeclarations( List<? extends Class<?>> types )
+    {
+        return types.stream()
+                    .flatMap( Classes::typesOf )
+                    //.filter( type -> Annotations.annotationOn( type, Activators.class ) == null )
+                    .flatMap( this::getAnnotations );
+    }
+
+    private Stream<? extends Class<? extends Activator<?>>> getAnnotations( Type type )
+    {
+        Activators activators = Annotations.annotationOn( type, Activators.class );
+        if( activators == null )
+        {
+            return Stream.empty();
+        }
+        return Arrays.stream( activators.value() );
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
new file mode 100644
index 0000000..9fe0cb0
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ServiceDeclarationImpl.java
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.service.qualifier.ServiceTags;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Declaration of a Service. Created by {@link org.apache.polygene.runtime.bootstrap.ModuleAssemblyImpl#services(Class[])}.
+ */
+public final class ServiceDeclarationImpl
+    implements ServiceDeclaration
+{
+    private final Iterable<ServiceAssemblyImpl> serviceAssemblies;
+
+    public ServiceDeclarationImpl( Iterable<ServiceAssemblyImpl> serviceAssemblies )
+    {
+        this.serviceAssemblies = serviceAssemblies;
+    }
+
+    @Override
+    public ServiceDeclaration visibleIn( Visibility visibility )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration identifiedBy( String identity )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.identity = new StringIdentity( identity );
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration taggedWith( String... tags )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            ServiceTags previousTags = serviceAssembly.metaInfo.get( ServiceTags.class );
+            if( previousTags != null )
+            {
+                List<String> tagList = new ArrayList<>();
+                tagList.addAll( asList( previousTags.tags() ) );
+                tagList.addAll( asList( tags ) );
+                serviceAssembly.metaInfo.set( new ServiceTags( tagList.toArray( new String[ tagList.size() ] ) ) );
+            }
+            else
+            {
+                serviceAssembly.metaInfo.set( new ServiceTags( tags ) );
+            }
+        }
+
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration instantiateOnStartup()
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.instantiateOnStartup = true;
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration setMetaInfo( Object serviceAttribute )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.metaInfo.set( serviceAttribute );
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration withConcerns( Class<?>... concerns )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.concerns.addAll( asList( concerns ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration withSideEffects( Class<?>... sideEffects )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.sideEffects.addAll( asList( sideEffects ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration withMixins( Class<?>... mixins )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.mixins.addAll( asList( mixins ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ServiceDeclaration withTypes( Class<?>... types )
+    {
+        for( ServiceAssemblyImpl serviceAssembly : serviceAssemblies )
+        {
+            serviceAssembly.types.addAll( asList( types ) );
+        }
+        return this;
+    }
+
+    @Override
+    @SafeVarargs
+    public final ServiceDeclaration withActivators( Class<? extends Activator<?>>... activators )
+    {
+        for ( ServiceAssemblyImpl serviceAssembly : serviceAssemblies ) {
+            serviceAssembly.activators.addAll( asList( activators ) );
+        }
+        return this;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientAssemblyImpl.java
new file mode 100644
index 0000000..11c0230
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientAssemblyImpl.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.bootstrap.StateDeclarations;
+import org.apache.polygene.bootstrap.TransientAssembly;
+import org.apache.polygene.runtime.composite.TransientModel;
+
+/**
+ * Declaration of a TransientComposite.
+ */
+public final class TransientAssemblyImpl extends CompositeAssemblyImpl
+    implements TransientAssembly
+{
+    public TransientAssemblyImpl( Class<?> transientType )
+    {
+        super( transientType );
+
+        // The composite must always implement TransientComposite, as a marker interface
+        if( !TransientComposite.class.isAssignableFrom( transientType ) )
+        {
+            types.add( TransientComposite.class );
+        }
+
+        // If type is a class, register it as a mixin
+        if( !transientType.isInterface() )
+        {
+            mixins.add( transientType );
+        }
+    }
+
+    TransientModel newTransientModel( ModuleDescriptor module,
+                                      StateDeclarations stateDeclarations,
+                                      AssemblyHelper helper
+    )
+    {
+        try
+        {
+            buildComposite( helper, stateDeclarations );
+            return new TransientModel(
+                module, types, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel );
+        }
+        catch( Exception e )
+        {
+            throw new InvalidApplicationException( "Could not register " + types, e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientDeclarationImpl.java
new file mode 100644
index 0000000..75a07b1
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TransientDeclarationImpl.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.TransientDeclaration;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Declaration of a Composite. Created by {@link org.apache.polygene.bootstrap.ModuleAssembly#transients(Class[])}.
+ */
+public final class TransientDeclarationImpl
+    implements TransientDeclaration
+{
+    private final Iterable<TransientAssemblyImpl> assemblies;
+
+    public TransientDeclarationImpl( Iterable<TransientAssemblyImpl> assemblies )
+    {
+        this.assemblies = assemblies;
+    }
+
+    @Override
+    public TransientDeclaration setMetaInfo( Object info )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.metaInfo.set( info );
+        }
+        return this;
+    }
+
+    @Override
+    public TransientDeclaration visibleIn( Visibility visibility )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    public TransientDeclaration withConcerns( Class<?>... concerns )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.concerns.addAll( asList( concerns ) );
+        }
+        return this;
+    }
+
+    @Override
+    public TransientDeclaration withSideEffects( Class<?>... sideEffects )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.sideEffects.addAll( asList( sideEffects ) );
+        }
+        return this;
+    }
+
+    @Override
+    public TransientDeclaration withMixins( Class<?>... mixins )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.mixins.addAll( asList( mixins ) );
+        }
+        return this;
+    }
+
+    @Override
+    public TransientDeclaration withTypes( Class<?>... types )
+    {
+        for( TransientAssemblyImpl assembly : assemblies )
+        {
+            assembly.types.addAll( asList( types ) );
+        }
+        return this;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypeCheckAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypeCheckAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypeCheckAppliesToFilter.java
new file mode 100644
index 0000000..9fcac21
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypeCheckAppliesToFilter.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class TypeCheckAppliesToFilter
+    implements AppliesToFilter
+{
+    @SuppressWarnings( "raw" )
+    private final Class type;
+
+    @SuppressWarnings( "raw" )
+    TypeCheckAppliesToFilter( Class type )
+    {
+        this.type = type;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        return type.isAssignableFrom( compositeType );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypedFragmentAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypedFragmentAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypedFragmentAppliesToFilter.java
new file mode 100644
index 0000000..bd6c8f7
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/TypedFragmentAppliesToFilter.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class TypedFragmentAppliesToFilter
+    implements AppliesToFilter
+{
+    @Override
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        return method.getDeclaringClass().isAssignableFrom( fragmentClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
new file mode 100644
index 0000000..408da07
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.InvalidApplicationException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.StateDeclarations;
+import org.apache.polygene.bootstrap.ValueAssembly;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.value.ValueModel;
+import org.apache.polygene.runtime.value.ValueStateModel;
+
+/**
+ * Declaration of a ValueComposite.
+ */
+public final class ValueAssemblyImpl
+    extends CompositeAssemblyImpl
+    implements ValueAssembly
+{
+    private AssociationsModel associationsModel;
+    private ManyAssociationsModel manyAssociationsModel;
+    private NamedAssociationsModel namedAssociationsModel;
+
+    public ValueAssemblyImpl( Class<?> compositeType )
+    {
+        super( compositeType );
+        // The composite must always implement ValueComposite, as a marker interface
+        if( !ValueComposite.class.isAssignableFrom( compositeType ) )
+        {
+            types.add( ValueComposite.class );
+        }
+    }
+
+    @Override
+    protected StateModel createStateModel()
+    {
+        return new ValueStateModel( propertiesModel, associationsModel, manyAssociationsModel, namedAssociationsModel );
+    }
+
+    ValueModel newValueModel( ModuleDescriptor module,
+                              StateDeclarations stateDeclarations,
+                              AssemblyHelper helper
+    )
+    {
+        try
+        {
+            associationsModel = new AssociationsModel();
+            manyAssociationsModel = new ManyAssociationsModel();
+            namedAssociationsModel = new NamedAssociationsModel();
+            buildComposite( helper, stateDeclarations );
+            return new ValueModel(
+                module, types, visibility, metaInfo, mixinsModel, (ValueStateModel) stateModel, compositeMethodsModel );
+        }
+        catch( Exception e )
+        {
+            throw new InvalidApplicationException( "Could not register " + types, e );
+        }
+    }
+
+    protected AssociationsModel associationsModel()
+    {
+        return associationsModel;
+    }
+
+    protected ManyAssociationsModel manyAssociationsModel()
+    {
+        return manyAssociationsModel;
+    }
+
+    protected NamedAssociationsModel namedAssociationsModel()
+    {
+        return namedAssociationsModel;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueDeclarationImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueDeclarationImpl.java
new file mode 100644
index 0000000..0227a4c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueDeclarationImpl.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ValueDeclaration;
+
+import static java.util.Arrays.asList;
+
+/**
+ * Declaration of a ValueComposite.
+ */
+public final class ValueDeclarationImpl
+    implements ValueDeclaration
+{
+    private final Iterable<ValueAssemblyImpl> assemblies;
+
+    public ValueDeclarationImpl( Iterable<ValueAssemblyImpl> assemblies )
+    {
+        this.assemblies = assemblies;
+    }
+
+    @Override
+    public ValueDeclaration setMetaInfo( Object info )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.metaInfo.set( info );
+        }
+        return this;
+    }
+
+    @Override
+    public ValueDeclaration visibleIn( Visibility visibility )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.visibility = visibility;
+        }
+        return this;
+    }
+
+    @Override
+    public ValueDeclaration withConcerns( Class<?>... concerns )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.concerns.addAll( asList( concerns ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ValueDeclaration withSideEffects( Class<?>... sideEffects )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.sideEffects.addAll( asList( sideEffects ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ValueDeclaration withMixins( Class<?>... mixins )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.mixins.addAll( asList( mixins ) );
+        }
+        return this;
+    }
+
+    @Override
+    public ValueDeclaration withTypes( Class<?>... types )
+    {
+        for( ValueAssemblyImpl assembly : assemblies )
+        {
+            assembly.types.addAll( asList( types ) );
+        }
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractConstraintModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractConstraintModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractConstraintModel.java
new file mode 100644
index 0000000..0c058bd
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractConstraintModel.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import org.apache.polygene.api.constraint.ConstraintDescriptor;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+
+/**
+ * JAVADOC
+ */
+public abstract class AbstractConstraintModel
+    implements ConstraintDescriptor, Visitable<ConstraintDescriptor>
+{
+    protected final Annotation annotation;
+
+    public AbstractConstraintModel( Annotation annotation )
+    {
+        this.annotation = annotation;
+    }
+
+    @Override
+    public Annotation annotation()
+    {
+        return annotation;
+    }
+
+    public abstract ConstraintInstance<?, ?> newInstance();
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super ConstraintDescriptor, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        return modelVisitor.visit( this );
+    }
+}
\ No newline at end of file


[42/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/StateHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/StateHolder.java b/core/api/src/main/java/org/apache/polygene/api/property/StateHolder.java
new file mode 100644
index 0000000..28c3620
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/StateHolder.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.stream.Stream;
+
+/**
+ * This represents the state of a composite (properties).
+ */
+public interface StateHolder
+{
+    /**
+     * Get a property for a specific accessor
+     *
+     * @param accessor of the property
+     *
+     * @return the property
+     *
+     * @throws IllegalArgumentException if no property for given accessor exists
+     */
+    <T> Property<T> propertyFor( AccessibleObject accessor )
+        throws IllegalArgumentException;
+
+    Stream<? extends Property<?>> properties();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/package.html b/core/api/src/main/java/org/apache/polygene/api/property/package.html
new file mode 100644
index 0000000..95d7f77
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Property API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/MissingIndexingSystemException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/MissingIndexingSystemException.java b/core/api/src/main/java/org/apache/polygene/api/query/MissingIndexingSystemException.java
new file mode 100644
index 0000000..e15cbee
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/MissingIndexingSystemException.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+/**
+ * This Exception is thrown in <code>QueryBuilderFactory.newQueryBuilder()</code> method if
+ * no indexing subsystem has been declared in the assembly.
+ */
+public final class MissingIndexingSystemException
+    extends QueryException
+{
+    private static final long serialVersionUID = 5147421865890379209L;
+
+    public MissingIndexingSystemException()
+    {
+        super( "No EntityFinder has been declared in the assembly of the application." );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/NotQueryableException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/NotQueryableException.java b/core/api/src/main/java/org/apache/polygene/api/query/NotQueryableException.java
new file mode 100644
index 0000000..75dd611
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/NotQueryableException.java
@@ -0,0 +1,90 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.util.Classes;
+
+/**
+ * Thrown in case that a non queryable type or accessor (marked with @Queriable(false)) is used during query building,
+ * or when non-Property, non-Associations are trying to be queried (possibly can not happen).
+ */
+public class NotQueryableException
+    extends QueryException
+{
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Constructor.
+     *
+     * @param message exception message
+     */
+    public NotQueryableException( final String message )
+    {
+        super( message );
+    }
+
+    /**
+     * Verify that the provided accessor method has not been marked with a Queryable(false).
+     *
+     * @param accessor accessor method
+     *
+     * @throws NotQueryableException - If accessor method has been marked as not queryable
+     */
+    public static void throwIfNotQueryable( final AccessibleObject accessor )
+    {
+        Queryable queryable = accessor.getAnnotation( Queryable.class );
+        if( queryable != null && !queryable.value() )
+        {
+            throw new NotQueryableException(
+                String.format(
+                    "%1$s \"%2$s\" (%3$s) is not queryable as has been marked with @Queryable(false)",
+                    Classes.RAW_CLASS.apply( GenericPropertyInfo.propertyTypeOf( accessor ) ).getSimpleName(),
+                    ( (Member) accessor ).getName(),
+                    ( (Member) accessor ).getDeclaringClass().getName()
+                )
+            );
+        }
+    }
+
+    /**
+     * Verify that the provided type has not been marked with a Queryable(false).
+     *
+     * @param type a type
+     *
+     * @throws NotQueryableException - If type has been marked as not queryable
+     */
+    public static void throwIfNotQueryable( final Class<?> type )
+    {
+        Queryable queryable = type.getAnnotation( Queryable.class );
+        if( queryable != null && !queryable.value() )
+        {
+            throw new NotQueryableException(
+                String.format(
+                    "Type \"%1$s\" is not queryable as has been marked with @Queryable(false)",
+                    type.getName()
+                )
+            );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/Query.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/Query.java b/core/api/src/main/java/org/apache/polygene/api/query/Query.java
new file mode 100644
index 0000000..dda526d
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/Query.java
@@ -0,0 +1,143 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+import java.io.Serializable;
+import java.util.stream.Stream;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.grammar.OrderBy;
+
+/**
+ * This represents a Query in an indexing system. It is created from a
+ * {@link QueryBuilder}, which decides the "where" clause in the query.
+ * <p>
+ * Additional limitations, such as paging, ordering, and variables, can be set on
+ * a Query before it is executed by calling one of find(), iterator(),
+ * or count().
+ * </p>
+ * <p>
+ * DDD tip: typically Queries are created in the Domain Model and passed to the UI,
+ * which sets the order and paging before executing it.
+ * </p>
+ */
+public interface Query<T>
+    extends Iterable<T>, Serializable
+{
+    /**
+     * Set the ordering rules. If many segments are used for ordering
+     * then they will be applied in order.
+     *
+     * @param segments the segments to order by
+     *
+     * @return the Query
+     */
+    Query<T> orderBy( OrderBy... segments );
+
+    /**
+     * Append an ordering rule to the existing segments.
+     *
+     * @param property the property to order by
+     * @param order the order to apply
+     *
+     * @return the Query
+     */
+    Query<T> orderBy( final Property<?> property, final OrderBy.Order order );
+
+    /**
+     * Append an ascending ordering rule to the existing segments.
+     *
+     * @param property the property to order by
+     *
+     * @return the Query
+     */
+    Query<T> orderBy( Property<?> property );
+
+    /**
+     * Set the index of the first result. Default is 0 (zero).
+     *
+     * @param firstResult which index to use as the first one
+     *
+     * @return the Query
+     */
+    Query<T> firstResult( int firstResult );
+
+    /**
+     * Set how many results should be returned. Default is that
+     * there is no limit set.
+     *
+     * @param maxResults that shouldbe returned
+     *
+     * @return the query
+     */
+    Query<T> maxResults( int maxResults );
+
+    /**
+     * Get the first Entity that matches the criteria. This
+     * executes the Query.
+     *
+     * @return the first found Entity or null if none were found
+     *
+     * @throws QueryExecutionException if the query fails
+     */
+    T find()
+        throws QueryExecutionException;
+
+    /**
+     * Set the value of a named variable.
+     *
+     * @param name  of the variable
+     * @param value of the variable
+     *
+     * @return the query
+     */
+    Query<T> setVariable( String name, Object value );
+
+    /**
+     * Get the value of a named variable.
+     *
+     * @param name of the variable
+     *
+     * @return value of the variable
+     */
+    <V> V getVariable( String name );
+
+    /**
+     * Get the result type of this Query
+     *
+     * @return the result type
+     */
+    Class<T> resultType();
+
+    /**
+     * Count how many results would be returned by this Query.
+     * This executes the Query.
+     *
+     * @return result count
+     *
+     * @throws QueryExecutionException if the query fails
+     */
+    long count()
+        throws QueryExecutionException;
+
+    /**
+     * @return Stream results
+     */
+    Stream<T> stream();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilder.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilder.java
new file mode 100644
index 0000000..cd65e39
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilder.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * QueryBuilders are used to create {@link Query} instances.
+ * Iteratively add where() clauses to the query, and then use
+ * {@link org.apache.polygene.api.unitofwork.UnitOfWork#newQuery(QueryBuilder)}  to instantiate the Query.
+ * QueryBuilders are immutable, so when adding new where-clauses you get new instances. This
+ *
+ * DDD tip: Query objects are not executed immediately, so they
+ * should be constructed in the domain model and handed over to
+ * the UI, which can then further constrain it before actual
+ * execution.
+ */
+public interface QueryBuilder<T>
+{
+    /**
+     * Add a where-clause to the Query. Use {@link QueryExpressions}
+     * to create the expression.
+     *
+     * @param specification the where clause
+     *
+     * @return a new builder with the added where-clause
+     */
+    QueryBuilder<T> where( Predicate<Composite> specification );
+
+    /**
+     * Create a new query with the declared where-clauses that will be evaluated against the iterable entries.
+     *
+     * @param iterable collection of objects (composites?)
+     *
+     * @return a new Query instance
+     */
+    Query<T> newQuery( Iterable<T> iterable );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilderFactory.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilderFactory.java
new file mode 100644
index 0000000..be2666d
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryBuilderFactory.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+/**
+ * This is used to create QueryBuilders.
+ *
+ * @see QueryBuilder
+ */
+public interface QueryBuilderFactory
+{
+    /**
+     * Create a new QueryBuilder.
+     *
+     * @param resultType the type of the result that you want
+     *
+     * @return a QueryBuilder
+     *
+     * @throws MissingIndexingSystemException if there is no EntityFinder service available
+     */
+    <T> QueryBuilder<T> newQueryBuilder( Class<T> resultType )
+        throws MissingIndexingSystemException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryException.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryException.java
new file mode 100644
index 0000000..6a52120
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryException.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+/**
+ * Base class for Query exceptions.
+ */
+public abstract class QueryException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = -3602596752342902060L;
+
+    public QueryException()
+    {
+    }
+
+    public QueryException( final String message )
+    {
+        super( message );
+    }
+
+    public QueryException( final String message, final Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryExecutionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryExecutionException.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryExecutionException.java
new file mode 100644
index 0000000..bbed7f7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryExecutionException.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+/**
+ * Throw this exception if a query could not be executed
+ */
+public final class QueryExecutionException
+    extends QueryException
+{
+    private static final long serialVersionUID = 5147421865890379209L;
+
+    public QueryExecutionException( String message )
+    {
+        super( message );
+    }
+
+    public QueryExecutionException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressionException.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressionException.java
new file mode 100644
index 0000000..ed665ee
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressionException.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+/**
+ * Throw this exception if a QueryExpression is invalid.
+ */
+public class QueryExpressionException
+    extends QueryException
+{
+
+    private static final long serialVersionUID = 1L;
+
+    public QueryExpressionException( String message )
+    {
+        super( message );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressions.java b/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressions.java
new file mode 100644
index 0000000..ca83940
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/QueryExpressions.java
@@ -0,0 +1,940 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.function.Predicate;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.property.GenericPropertyInfo;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.query.grammar.AndPredicate;
+import org.apache.polygene.api.query.grammar.AssociationFunction;
+import org.apache.polygene.api.query.grammar.AssociationNotNullPredicate;
+import org.apache.polygene.api.query.grammar.AssociationNullPredicate;
+import org.apache.polygene.api.query.grammar.ContainsAllPredicate;
+import org.apache.polygene.api.query.grammar.ContainsPredicate;
+import org.apache.polygene.api.query.grammar.EqPredicate;
+import org.apache.polygene.api.query.grammar.GePredicate;
+import org.apache.polygene.api.query.grammar.GtPredicate;
+import org.apache.polygene.api.query.grammar.LePredicate;
+import org.apache.polygene.api.query.grammar.LtPredicate;
+import org.apache.polygene.api.query.grammar.ManyAssociationContainsPredicate;
+import org.apache.polygene.api.query.grammar.ManyAssociationFunction;
+import org.apache.polygene.api.query.grammar.MatchesPredicate;
+import org.apache.polygene.api.query.grammar.NamedAssociationContainsNamePredicate;
+import org.apache.polygene.api.query.grammar.NamedAssociationContainsPredicate;
+import org.apache.polygene.api.query.grammar.NamedAssociationFunction;
+import org.apache.polygene.api.query.grammar.NePredicate;
+import org.apache.polygene.api.query.grammar.Notpredicate;
+import org.apache.polygene.api.query.grammar.OrPredicate;
+import org.apache.polygene.api.query.grammar.OrderBy;
+import org.apache.polygene.api.query.grammar.PropertyFunction;
+import org.apache.polygene.api.query.grammar.PropertyNotNullPredicate;
+import org.apache.polygene.api.query.grammar.PropertyNullPredicate;
+import org.apache.polygene.api.query.grammar.PropertyReference;
+import org.apache.polygene.api.query.grammar.Variable;
+import org.apache.polygene.api.util.NullArgumentException;
+
+import static org.apache.polygene.api.identity.HasIdentity.IDENTITY_METHOD;
+
+/**
+ * Static factory methods for query expressions and operators.
+ */
+public final class QueryExpressions
+{
+    // This is used for eq(Association,Composite)
+
+    // Templates and variables -----------------------------------------------|
+
+    /**
+     * Create a Query Template using the given type.
+     *
+     * @param <T> the type of the template
+     * @param clazz a class declaring the type of the template
+     *
+     * @return a new Query Template
+     */
+    public static <T> T templateFor( Class<T> clazz )
+    {
+        NullArgumentException.validateNotNull( "Template class", clazz );
+
+        if( clazz.isInterface() )
+        {
+            return clazz.cast( Proxy.newProxyInstance( clazz.getClassLoader(),
+                                                       array( clazz ),
+                                                       new TemplateHandler<T>( null, null, null, null ) ) );
+        }
+        else
+        {
+            try
+            {
+                T mixin = clazz.newInstance();
+                for( Field field : clazz.getFields() )
+                {
+                    if( field.getAnnotation( State.class ) != null )
+                    {
+                        if( field.getType().equals( Property.class ) )
+                        {
+                            field.set( mixin,
+                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
+                                                               array( field.getType() ),
+                                                               new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) ) );
+                        }
+                        else if( field.getType().equals( Association.class ) )
+                        {
+                            field.set( mixin,
+                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
+                                                               array( field.getType() ),
+                                                               new AssociationReferenceHandler<>( new AssociationFunction<T>( null, null, null, field ) ) ) );
+                        }
+                        else if( field.getType().equals( ManyAssociation.class ) )
+                        {
+                            field.set( mixin,
+                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
+                                                               array( field.getType() ),
+                                                               new ManyAssociationReferenceHandler<>( new ManyAssociationFunction<T>( null, null, null, field ) ) ) );
+                        }
+                        else if( field.getType().equals( NamedAssociation.class ) )
+                        {
+                            field.set( mixin,
+                                       Proxy.newProxyInstance( field.getType().getClassLoader(),
+                                                               array( field.getType() ),
+                                                               new NamedAssociationReferenceHandler<>( new NamedAssociationFunction<T>( null, null, null, field ) ) ) );
+                        }
+                    }
+                }
+                return mixin;
+            }
+            catch( IllegalAccessException | IllegalArgumentException | InstantiationException | SecurityException e )
+            {
+                throw new IllegalArgumentException( "Cannot use class as template", e );
+            }
+        }
+    }
+
+    /**
+     * Create a Query Template using the given mixin class and association.
+     *
+     * @param <T> the type of the template
+     * @param mixinType  a class declaring the type of the template
+     * @param association an association
+     *
+     * @return a new Query Template
+     */
+    public static <T> T templateFor( final Class<T> mixinType, Association<?> association )
+    {
+        NullArgumentException.validateNotNull( "Mixin class", mixinType );
+        NullArgumentException.validateNotNull( "Association", association );
+        return mixinType.cast( Proxy.newProxyInstance( mixinType.getClassLoader(),
+                                                       array( mixinType ),
+                                                       new TemplateHandler<T>( null,
+                                                                               association( association ),
+                                                                               null,
+                                                                               null ) ) );
+    }
+
+    public static <T> T oneOf( final ManyAssociation<T> association )
+    {
+        NullArgumentException.validateNotNull( "Association", association );
+        return association.get( 0 );
+    }
+
+    public static <T> T oneOf( final NamedAssociation<T> association )
+    {
+        NullArgumentException.validateNotNull( "Association", association );
+        Iterator<String> iterator = association.iterator();
+        return association.get( iterator.hasNext() ? iterator.next() : null );
+    }
+
+    /**
+     * Create a new Query Variable.
+     *
+     * @param name a name for the Variable
+     *
+     * @return a new Query Variable.
+     */
+    public static Variable variable( String name )
+    {
+        NullArgumentException.validateNotNull( "Variable name", name );
+        return new Variable( name );
+    }
+
+    /**
+     * Create a new Query Template PropertyFunction.
+     *
+     * @param <T> type of the Property
+     * @param property a Property
+     *
+     * @return a new Query Template PropertyFunction
+     */
+    @SuppressWarnings( "unchecked" )
+    public static <T> PropertyFunction<T> property( Property<T> property )
+    {
+        return ( (PropertyReferenceHandler<T>) Proxy.getInvocationHandler( property ) ).property();
+    }
+
+    /**
+     * Create a new Query Property instance.
+     *
+     * @param <T> type of the Property
+     * @param mixinClass mixin of the Property
+     * @param fieldName name of the Property field
+     *
+     * @return a new Query Property instance for the given mixin and property name.
+     */
+    @SuppressWarnings( "unchecked" )
+    public static <T> Property<T> property( Class<?> mixinClass, String fieldName )
+    {
+        try
+        {
+            Field field = mixinClass.getField( fieldName );
+            if( !Property.class.isAssignableFrom( field.getType() ) )
+            {
+                throw new IllegalArgumentException( "Field must be of type Property<?>" );
+            }
+            return (Property<T>) Proxy.newProxyInstance(
+                mixinClass.getClassLoader(),
+                array( field.getType() ),
+                new PropertyReferenceHandler<>( new PropertyFunction<T>( null, null, null, null, field ) ) );
+        }
+        catch( NoSuchFieldException e )
+        {
+            throw new IllegalArgumentException( "No such field '" + fieldName + "' in mixin " + mixinClass.getName() );
+        }
+    }
+
+    /**
+     * Create a new Query Template AssociationFunction.
+     *
+     * @param <T> type of the Association
+     * @param association an Association
+     *
+     * @return a new Query Template AssociationFunction
+     */
+    @SuppressWarnings( "unchecked" )
+    public static <T> AssociationFunction<T> association( Association<T> association )
+    {
+        return ( (AssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).association();
+    }
+
+    /**
+     * Create a new Query Template ManyAssociationFunction.
+     *
+     * @param <T> type of the ManyAssociation
+     * @param association a ManyAssociation
+     *
+     * @return a new Query Template ManyAssociationFunction
+     */
+    @SuppressWarnings( "unchecked" )
+    public static <T> ManyAssociationFunction<T> manyAssociation( ManyAssociation<T> association )
+    {
+        return ( (ManyAssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).manyAssociation();
+    }
+
+    /**
+     * Create a new Query Template NamedAssociationFunction.
+     *
+     * @param <T> type of the NamedAssociation
+     * @param association a NamedAssociation
+     *
+     * @return a new Query Template NamedAssociationFunction
+     */
+    @SuppressWarnings( "unchecked" )
+    public static <T> NamedAssociationFunction<T> namedAssociation( NamedAssociation<T> association )
+    {
+        return ( (NamedAssociationReferenceHandler<T>) Proxy.getInvocationHandler( association ) ).namedAssociation();
+    }
+
+    // And/Or/Not ------------------------------------------------------------|
+    /**
+     * Create a new AND specification.
+     *
+     * @param left first operand
+     * @param right second operand
+     * @param optionalRight optional operands
+     *
+     * @return a new AND specification
+     */
+    @SafeVarargs
+    public static AndPredicate and( Predicate<Composite> left,
+                                    Predicate<Composite> right,
+                                    Predicate<Composite>... optionalRight
+    )
+    {
+        List<Predicate<Composite>> predicates = new ArrayList<>( 2 + optionalRight.length );
+        predicates.add( left );
+        predicates.add( right );
+        Collections.addAll( predicates, optionalRight );
+        return new AndPredicate( predicates );
+    }
+
+    /**
+     * Create a new OR specification.
+     *
+     * @param specs operands
+     *
+     * @return a new OR specification
+     */
+    @SafeVarargs
+    public static OrPredicate or( Predicate<Composite>... specs )
+    {
+        return new OrPredicate( Arrays.asList( specs ) );
+    }
+
+    /**
+     * Create a new NOT specification.
+     *
+     * @param operand specification to be negated
+     *
+     * @return a new NOT specification
+     */
+    public static Notpredicate not( Predicate<Composite> operand )
+    {
+        return new Notpredicate( operand );
+    }
+
+    // Comparisons -----------------------------------------------------------|
+
+    /**
+     * Create a new EQUALS specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new EQUALS specification for a Property.
+     */
+    public static <T> EqPredicate<T> eq( Property<T> property, T value )
+    {
+        return new EqPredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new EQUALS specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new EQUALS specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> EqPredicate<T> eq( Property<T> property, Variable variable )
+    {
+        return new EqPredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new EQUALS specification for an Association.
+     *
+     * @param association an Association
+     * @param value its value
+     *
+     * @return a new EQUALS specification for an Association.
+     */
+    public static <T> EqPredicate<Identity> eq( Association<T> association, T value )
+    {
+        return new EqPredicate<>(
+                new PropertyFunction<>(
+                        null,
+                        association(association),
+                        null,
+                        null,
+                        IDENTITY_METHOD),
+                ((HasIdentity) value).identity().get());
+    }
+
+    /**
+     * Create a new GREATER OR EQUALS specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new GREATER OR EQUALS specification for a Property.
+     */
+    public static <T> GePredicate<T> ge( Property<T> property, T value )
+    {
+        return new GePredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new GREATER OR EQUALS specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new GREATER OR EQUALS specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> GePredicate<T> ge( Property<T> property, Variable variable )
+    {
+        return new GePredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new GREATER THAN specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new GREATER THAN specification for a Property.
+     */
+    public static <T> GtPredicate<T> gt( Property<T> property, T value )
+    {
+        return new GtPredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new GREATER THAN specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new GREATER THAN specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> GtPredicate<T> gt( Property<T> property, Variable variable )
+    {
+        return new GtPredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new LESS OR EQUALS specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new LESS OR EQUALS specification for a Property.
+     */
+    public static <T> LePredicate<T> le( Property<T> property, T value )
+    {
+        return new LePredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new LESS OR EQUALS specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new LESS OR EQUALS specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> LePredicate<T> le( Property<T> property, Variable variable )
+    {
+        return new LePredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new LESSER THAN specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new LESSER THAN specification for a Property.
+     */
+    public static <T> LtPredicate<T> lt( Property<T> property, T value )
+    {
+        return new LtPredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new LESSER THAN specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new LESSER THAN specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> LtPredicate<T> lt( Property<T> property, Variable variable )
+    {
+        return new LtPredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new NOT EQUALS specification for a Property.
+     *
+     * @param property a Property
+     * @param value its value
+     *
+     * @return a new NOT EQUALS specification for a Property.
+     */
+    public static <T> NePredicate<T> ne( Property<T> property, T value )
+    {
+        return new NePredicate<>( property( property ), value );
+    }
+
+    /**
+     * Create a new NOT EQUALS specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new NOT EQUALS specification for a Property using a named Variable.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> NePredicate<T> ne( Property<T> property, Variable variable )
+    {
+        return new NePredicate( property( property ), variable );
+    }
+
+    /**
+     * Create a new REGULAR EXPRESSION specification for a Property.
+     *
+     * @param property a Property
+     * @param regexp its value
+     *
+     * @return a new REGULAR EXPRESSION specification for a Property.
+     */
+    public static MatchesPredicate matches( Property<String> property, String regexp )
+    {
+        return new MatchesPredicate( property( property ), regexp );
+    }
+
+    /**
+     * Create a new REGULAR EXPRESSION specification for a Property using a named Variable.
+     *
+     * @param property a Property
+     * @param variable a Query Variable
+     *
+     * @return a new REGULAR EXPRESSION specification for a Property using a named Variable.
+     */
+    public static MatchesPredicate matches( Property<String> property, Variable variable )
+    {
+        return new MatchesPredicate( property( property ), variable );
+    }
+
+    // Null checks -----------------------------------------------------------|
+
+    /**
+     * Create a new NOT NULL specification for a Property.
+     *
+     * @param property a Property
+     *
+     * @return a new NOT NULL specification for a Property.
+     */
+    public static <T> PropertyNotNullPredicate<T> isNotNull( Property<T> property )
+    {
+        return new PropertyNotNullPredicate<>( property( property ) );
+    }
+
+    /**
+     * Create a new NULL specification for a Property.
+     *
+     * @param property a Property
+     *
+     * @return a new NULL specification for a Property.
+     */
+    public static <T> PropertyNullPredicate<T> isNull( Property<T> property )
+    {
+        return new PropertyNullPredicate<>( property( property ) );
+    }
+
+    /**
+     * Create a new NOT NULL specification for an Association.
+     *
+     * @param association an Association
+     *
+     * @return a new NOT NULL specification for an Association.
+     */
+    public static <T> AssociationNotNullPredicate<T> isNotNull( Association<T> association )
+    {
+        return new AssociationNotNullPredicate<>( association( association ) );
+    }
+
+    /**
+     * Create a new NULL specification for an Association.
+     *
+     * @param association an Association
+     *
+     * @return a new NULL specification for an Association.
+     */
+    public static <T> AssociationNullPredicate<T> isNull( Association<T> association )
+    {
+        return new AssociationNullPredicate<>( association( association ) );
+    }
+
+    // Collections -----------------------------------------------------------|
+
+    /**
+     * Create a new CONTAINS ALL specification for a Collection Property.
+     *
+     * @param collectionProperty a Collection Property
+     * @param values its values
+     *
+     * @return a new CONTAINS ALL specification for a Collection Property.
+     */
+    public static <T> ContainsAllPredicate<T> containsAll( Property<? extends Collection<T>> collectionProperty,
+                                                           Collection<T> values )
+    {
+        NullArgumentException.validateNotNull( "Values", values );
+        return new ContainsAllPredicate<>( property( collectionProperty ), values );
+    }
+
+    /**
+     * Create a new CONTAINS ALL specification for a Collection Property using named Variables.
+     *
+     * @param collectionProperty a Collection Property
+     * @param variables named Variables
+     *
+     * @return a new CONTAINS ALL specification for a Collection Property using named Variables.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> ContainsAllPredicate<T> containsAllVariables(
+        Property<? extends Collection<T>> collectionProperty,
+        Collection<Variable> variables )
+    {
+        NullArgumentException.validateNotNull( "Variables", variables );
+        return new ContainsAllPredicate( property( collectionProperty ), variables );
+    }
+
+    /**
+     * Create a new CONTAINS specification for a Collection Property.
+     *
+     * @param collectionProperty a Collection Property
+     * @param value the value
+     *
+     * @return a new CONTAINS specification for a Collection Property.
+     */
+    public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
+                                                         T value )
+    {
+        NullArgumentException.validateNotNull( "Value", value );
+        return new ContainsPredicate<>( property( collectionProperty ), value );
+    }
+
+    /**
+     * Create a new CONTAINS specification for a Collection Property using named Variables.
+     *
+     * @param collectionProperty a Collection Property
+     * @param variable named Variable
+     *
+     * @return a new CONTAINS specification for a Collection Property using named Variables.
+     */
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public static <T> ContainsPredicate<T> contains( Property<? extends Collection<T>> collectionProperty,
+                                                         Variable variable )
+    {
+        NullArgumentException.validateNotNull( "Variable", variable );
+        return new ContainsPredicate( property( collectionProperty ), variable );
+    }
+
+    /**
+     * Create a new CONTAINS specification for a ManyAssociation.
+     *
+     * @param manyAssoc  a ManyAssociation
+     * @param value the value
+     *
+     * @return a new CONTAINS specification for a ManyAssociation.
+     */
+    public static <T> ManyAssociationContainsPredicate<T> contains( ManyAssociation<T> manyAssoc, T value )
+    {
+        return new ManyAssociationContainsPredicate<>( manyAssociation( manyAssoc ), value );
+    }
+
+    /**
+     * Create a new CONTAINS specification for a NamedAssociation.
+     *
+     * @param namedAssoc  a NamedAssociation
+     * @param value the value
+     *
+     * @return a new CONTAINS specification for a NamedAssociation.
+     */
+    public static <T> NamedAssociationContainsPredicate<T> contains( NamedAssociation<T> namedAssoc, T value )
+    {
+        return new NamedAssociationContainsPredicate<>( namedAssociation( namedAssoc ), value );
+    }
+
+    /**
+     * Create a new CONTAINS NAME specification for a NamedAssociation.
+     *
+     * @param namedAssoc  a NamedAssociation
+     * @param name the name
+     *
+     * @return a new CONTAINS NAME specification for a NamedAssociation.
+     */
+    public static <T> NamedAssociationContainsNamePredicate<T> containsName( NamedAssociation<T> namedAssoc,
+                                                                                 String name )
+    {
+        return new NamedAssociationContainsNamePredicate<>( namedAssociation( namedAssoc ), name );
+    }
+
+    // Ordering --------------------------------------------------------------|
+    /**
+     * Create a new Query ascending order segment for a Property.
+     *
+     * @param <T> type of the Property
+     * @param property a Property
+     *
+     * @return a new Query ascending order segment for a Property.
+     */
+    public static <T> OrderBy orderBy( final Property<T> property )
+    {
+        return orderBy( property, OrderBy.Order.ASCENDING );
+    }
+
+    /**
+     * Create a new Query ordering segment for a Property.
+     *
+     * @param <T> type of the Property
+     * @param property a Property
+     * @param order ascending or descending
+     *
+     * @return a new Query ordering segment for a Property.
+     */
+    public static <T> OrderBy orderBy( final Property<T> property, final OrderBy.Order order )
+    {
+        return new OrderBy( property( property ), order );
+    }
+
+    // Query Templates InvocationHandlers ------------------------------------|
+
+    private static class TemplateHandler<T>
+        implements InvocationHandler
+    {
+        private final PropertyFunction<?> compositeProperty;
+        private final AssociationFunction<?> compositeAssociation;
+        private final ManyAssociationFunction<?> compositeManyAssociation;
+        private final NamedAssociationFunction<?> compositeNamedAssociation;
+
+        private TemplateHandler( PropertyFunction<?> compositeProperty,
+                                 AssociationFunction<?> compositeAssociation,
+                                 ManyAssociationFunction<?> compositeManyAssociation,
+                                 NamedAssociationFunction<?> compositeNamedAssociation
+        )
+        {
+            this.compositeProperty = compositeProperty;
+            this.compositeAssociation = compositeAssociation;
+            this.compositeManyAssociation = compositeManyAssociation;
+            this.compositeNamedAssociation = compositeNamedAssociation;
+        }
+
+        @Override
+        public Object invoke( Object o, Method method, Object[] objects )
+            throws Throwable
+        {
+            if( Property.class.isAssignableFrom( method.getReturnType() ) )
+            {
+                return Proxy.newProxyInstance(
+                    method.getReturnType().getClassLoader(),
+                    array( method.getReturnType() ),
+                    new PropertyReferenceHandler<>( new PropertyFunction<T>( compositeProperty,
+                                                                             compositeAssociation,
+                                                                             compositeManyAssociation,
+                                                                             compositeNamedAssociation,
+                                                                             method ) ) );
+            }
+            else if( Association.class.isAssignableFrom( method.getReturnType() ) )
+            {
+                return Proxy.newProxyInstance(
+                    method.getReturnType().getClassLoader(),
+                    array( method.getReturnType() ),
+                    new AssociationReferenceHandler<>( new AssociationFunction<T>( compositeAssociation,
+                                                                                   compositeManyAssociation,
+                                                                                   compositeNamedAssociation,
+                                                                                   method ) ) );
+            }
+            else if( ManyAssociation.class.isAssignableFrom( method.getReturnType() ) )
+            {
+                return Proxy.newProxyInstance(
+                    method.getReturnType().getClassLoader(),
+                    array( method.getReturnType() ),
+                    new ManyAssociationReferenceHandler<>( new ManyAssociationFunction<T>( compositeAssociation,
+                                                                                           compositeManyAssociation,
+                                                                                           compositeNamedAssociation,
+                                                                                           method ) ) );
+            }
+            else if( NamedAssociation.class.isAssignableFrom( method.getReturnType() ) )
+            {
+                return Proxy.newProxyInstance(
+                    method.getReturnType().getClassLoader(),
+                    array( method.getReturnType() ),
+                    new NamedAssociationReferenceHandler<>( new NamedAssociationFunction<T>( compositeAssociation,
+                                                                                             compositeManyAssociation,
+                                                                                             compositeNamedAssociation,
+                                                                                             method ) ) );
+            }
+
+            return null;
+        }
+    }
+
+    private static class PropertyReferenceHandler<T>
+        implements InvocationHandler
+    {
+        private final PropertyFunction<T> property;
+
+        private PropertyReferenceHandler( PropertyFunction<T> property )
+        {
+            this.property = property;
+        }
+
+        private PropertyFunction<T> property()
+        {
+            return property;
+        }
+
+        @Override
+        public Object invoke( Object o, final Method method, Object[] objects )
+            throws Throwable
+        {
+            if( method.equals( Property.class.getMethod( "get" ) ) )
+            {
+                Type propertyType = GenericPropertyInfo.propertyTypeOf( property.accessor() );
+                if( propertyType.getClass().equals( Class.class ) )
+                {
+                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
+                                                   array( (Class<?>) propertyType, PropertyReference.class ),
+                                                   new TemplateHandler<T>( property, null, null, null ) );
+                }
+            }
+
+            return null;
+        }
+    }
+
+    private static class AssociationReferenceHandler<T>
+        implements InvocationHandler
+    {
+        private final AssociationFunction<T> association;
+
+        private AssociationReferenceHandler( AssociationFunction<T> association )
+        {
+            this.association = association;
+        }
+
+        private AssociationFunction<T> association()
+        {
+            return association;
+        }
+
+        @Override
+        public Object invoke( Object o, final Method method, Object[] objects )
+            throws Throwable
+        {
+            if( method.equals( Association.class.getMethod( "get" ) ) )
+            {
+                Type associationType = GenericAssociationInfo.associationTypeOf( association.accessor() );
+                if( associationType.getClass().equals( Class.class ) )
+                {
+                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
+                                                   array( (Class) associationType, PropertyReference.class ),
+                                                   new TemplateHandler<T>( null, association, null, null ) );
+                }
+            }
+
+            return null;
+        }
+    }
+
+    private static class ManyAssociationReferenceHandler<T>
+        implements InvocationHandler
+    {
+        private final ManyAssociationFunction<T> manyAssociation;
+
+        private ManyAssociationReferenceHandler( ManyAssociationFunction<T> manyAssociation )
+        {
+            this.manyAssociation = manyAssociation;
+        }
+
+        public ManyAssociationFunction<T> manyAssociation()
+        {
+            return manyAssociation;
+        }
+
+        @Override
+        public Object invoke( Object o, final Method method, Object[] objects )
+            throws Throwable
+        {
+            if( method.equals( ManyAssociation.class.getMethod( "get", Integer.TYPE ) ) )
+            {
+                Type manyAssociationType = GenericAssociationInfo.associationTypeOf( manyAssociation.accessor() );
+                if( manyAssociationType.getClass().equals( Class.class ) )
+                {
+                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
+                                                   array( (Class) manyAssociationType, PropertyReference.class ),
+                                                   new TemplateHandler<T>( null, null, manyAssociation, null ) );
+                }
+            }
+
+            return null;
+        }
+    }
+
+    private static class NamedAssociationReferenceHandler<T>
+        implements InvocationHandler
+    {
+        private final NamedAssociationFunction<T> namedAssociation;
+
+        private NamedAssociationReferenceHandler( NamedAssociationFunction<T> namedAssociation )
+        {
+            this.namedAssociation = namedAssociation;
+        }
+
+        public NamedAssociationFunction<T> namedAssociation()
+        {
+            return namedAssociation;
+        }
+
+        @Override
+        public Object invoke( Object o, final Method method, Object[] objects )
+            throws Throwable
+        {
+            if( method.equals( NamedAssociation.class.getMethod( "get", String.class ) ) )
+            {
+                Type namedAssociationType = GenericAssociationInfo.associationTypeOf( namedAssociation.accessor() );
+                if( namedAssociationType.getClass().equals( Class.class ) )
+                {
+                    return Proxy.newProxyInstance( method.getDeclaringClass().getClassLoader(),
+                                                   array( (Class) namedAssociationType, PropertyReference.class ),
+                                                   new TemplateHandler<T>( null, null, null, namedAssociation ) );
+                }
+            }
+
+            return null;
+        }
+    }
+
+    @SafeVarargs
+    private static <T> T[] array( T... array )
+    {
+        return array;
+    }
+
+    private QueryExpressions()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/AndPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/AndPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AndPredicate.java
new file mode 100644
index 0000000..5e9c0bf
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AndPredicate.java
@@ -0,0 +1,61 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.Collection;
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * AND Specification.
+ */
+public class AndPredicate
+    extends BinaryPredicate
+{
+    public AndPredicate( Collection<Predicate<Composite>> operands )
+    {
+        super( operands );
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Predicate<Composite> master = t -> true;
+        for( Predicate<Composite> p : operands )
+        {
+            master = master.and( p );
+        }
+        return master.test( item );
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "(" );
+        String and = "";
+        for( Predicate<Composite> operand : operands )
+        {
+            sb.append( and ).append( operand );
+            and = " and ";
+        }
+        return sb.append( ")" ).toString();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationFunction.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationFunction.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationFunction.java
new file mode 100644
index 0000000..1a77c69
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationFunction.java
@@ -0,0 +1,149 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.function.Function;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.query.QueryExpressionException;
+import org.apache.polygene.api.util.Classes;
+
+import static org.apache.polygene.api.util.Classes.typeOf;
+
+/**
+ * Function to get Entity Associations
+ */
+public class AssociationFunction<T>
+    implements Function<Composite, Association<T>>
+{
+    private final AssociationFunction<?> traversedAssociation;
+    private final ManyAssociationFunction<?> traversedManyAssociation;
+    private final NamedAssociationFunction<?> traversedNamedAssociation;
+    private final AccessibleObject accessor;
+
+    public AssociationFunction( AssociationFunction<?> traversedAssociation,
+                                ManyAssociationFunction<?> traversedManyAssociation,
+                                NamedAssociationFunction<?> traversedNamedAssociation,
+                                AccessibleObject accessor
+    )
+    {
+        this.traversedAssociation = traversedAssociation;
+        this.traversedManyAssociation = traversedManyAssociation;
+        this.traversedNamedAssociation = traversedNamedAssociation;
+        this.accessor = accessor;
+
+        Type returnType = typeOf( accessor );
+        if( !Association.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) )
+            && !ManyAssociation.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) )
+            && !NamedAssociation.class.isAssignableFrom( Classes.RAW_CLASS.apply( returnType ) ) )
+        {
+            throw new QueryExpressionException( "Unsupported association type:" + returnType );
+        }
+        Type associationTypeAsType = GenericAssociationInfo.toAssociationType( returnType );
+        if( !( associationTypeAsType instanceof Class ) )
+        {
+            throw new QueryExpressionException( "Unsupported association type:" + associationTypeAsType );
+        }
+    }
+
+    public AssociationFunction<?> traversedAssociation()
+    {
+        return traversedAssociation;
+    }
+
+    public ManyAssociationFunction<?> traversedManyAssociation()
+    {
+        return traversedManyAssociation;
+    }
+
+    public NamedAssociationFunction<?> traversedNamedAssociation()
+    {
+        return traversedNamedAssociation;
+    }
+
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public Association<T> apply( Composite entity )
+    {
+        try
+        {
+            Object target = entity;
+            if( traversedAssociation != null )
+            {
+                Association<?> association = traversedAssociation.apply( entity );
+                if( association == null )
+                {
+                    return null;
+                }
+                target = association.get();
+            }
+            else if( traversedManyAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot evaluate a ManyAssociation" );
+            }
+            else if( traversedNamedAssociation != null )
+            {
+                throw new IllegalArgumentException( "Cannot evaluate a NamedAssociation" );
+            }
+
+            if( target == null )
+            {
+                return null;
+            }
+
+            CompositeInstance handler = (CompositeInstance) Proxy.getInvocationHandler( target );
+            return ( (AssociationStateHolder) handler.state() ).associationFor( accessor );
+        }
+        catch( IllegalArgumentException e )
+        {
+            throw e;
+        }
+        catch( Throwable e )
+        {
+            throw new IllegalArgumentException( e );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        if( traversedAssociation != null )
+        {
+            return traversedAssociation.toString() + "." + ( (Member) accessor ).getName();
+        }
+        else
+        {
+            return ( (Member) accessor ).getName();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNotNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNotNullPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNotNullPredicate.java
new file mode 100644
index 0000000..b4f1f64
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNotNullPredicate.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Association not null Specification.
+ */
+public class AssociationNotNullPredicate<T>
+    extends ExpressionPredicate
+{
+    private AssociationFunction<T> association;
+
+    public AssociationNotNullPredicate( AssociationFunction<T> association )
+    {
+        this.association = association;
+    }
+
+    public AssociationFunction<T> association()
+    {
+        return association;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        try
+        {
+            Association<T> assoc = association.apply( item );
+
+            if( assoc == null )
+            {
+                return false;
+            }
+
+            return assoc.get() != null;
+        }
+        catch( IllegalArgumentException e )
+        {
+            return false;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return association.toString() + " is not null";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNullPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNullPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNullPredicate.java
new file mode 100644
index 0000000..ba1ec40
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/AssociationNullPredicate.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Association null Specification.
+ */
+public class AssociationNullPredicate<T>
+    extends ExpressionPredicate
+{
+    private AssociationFunction<T> association;
+
+    public AssociationNullPredicate( AssociationFunction<T> association )
+    {
+        this.association = association;
+    }
+
+    public AssociationFunction<T> association()
+    {
+        return association;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        try
+        {
+            Association<T> assoc = association.apply( item );
+
+            if( assoc == null )
+            {
+                return true;
+            }
+
+            return assoc.get() == null;
+        }
+        catch( IllegalArgumentException e )
+        {
+            return true;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return association.toString() + " is null";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/BinaryPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/BinaryPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/BinaryPredicate.java
new file mode 100644
index 0000000..cdc6919
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/BinaryPredicate.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Base binary Specification, used for AND and OR Specifications..
+ */
+public abstract class BinaryPredicate
+    extends ExpressionPredicate
+{
+    protected final Collection<Predicate<Composite>> operands;
+
+    protected BinaryPredicate( Collection<Predicate<Composite>> operands )
+    {
+        this.operands = Collections.unmodifiableCollection( operands );
+    }
+
+    public Collection<Predicate<Composite>> operands()
+    {
+        return operands;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ComparisonPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ComparisonPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ComparisonPredicate.java
new file mode 100644
index 0000000..955f3ae
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ComparisonPredicate.java
@@ -0,0 +1,77 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Base comparison Specification.
+ */
+public abstract class ComparisonPredicate<T>
+    extends ExpressionPredicate
+{
+    protected final PropertyFunction<T> property;
+    protected final T value;
+
+    public ComparisonPredicate( PropertyFunction<T> property, T value )
+    {
+        this.property = property;
+        this.value = value;
+    }
+
+    public PropertyFunction<T> property()
+    {
+        return property;
+    }
+
+    @Override
+    public final boolean test( Composite item )
+    {
+        try
+        {
+            Property<T> prop = property.apply( item );
+
+            if( prop == null )
+            {
+                return false;
+            }
+
+            T propValue = prop.get();
+            if( propValue == null )
+            {
+                return false;
+            }
+
+            return compare( propValue );
+        }
+        catch( IllegalArgumentException e )
+        {
+            return false;
+        }
+    }
+
+    protected abstract boolean compare( T value );
+
+    public T value()
+    {
+        return value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsAllPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsAllPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsAllPredicate.java
new file mode 100644
index 0000000..b06c6f8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsAllPredicate.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Contains All Specification.
+ */
+public class ContainsAllPredicate<T>
+    extends ExpressionPredicate
+{
+    private PropertyFunction<? extends Collection<T>> collectionProperty;
+    private Collection<T> valueCollection;
+
+    public ContainsAllPredicate( PropertyFunction<? extends Collection<T>> collectionProperty,
+                                 Collection<T> valueCollection
+    )
+    {
+        this.collectionProperty = collectionProperty;
+        this.valueCollection = Collections.unmodifiableCollection( valueCollection );
+    }
+
+    public PropertyFunction<? extends Collection<T>> collectionProperty()
+    {
+        return collectionProperty;
+    }
+
+    public Collection<T> containedValues()
+    {
+        return valueCollection;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Collection<T> collection = collectionProperty.apply( item ).get();
+
+        if( collection == null )
+        {
+            return false;
+        }
+
+        for( T value : valueCollection )
+        {
+            if( !collection.contains( value ) )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public String toString()
+    {
+        return collectionProperty + " contains " + valueCollection;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsPredicate.java
new file mode 100644
index 0000000..a277307
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ContainsPredicate.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.Collection;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Contains Specification.
+ */
+public class ContainsPredicate<T>
+    extends ExpressionPredicate
+{
+    private PropertyFunction<? extends Collection<T>> collectionProperty;
+    private T value;
+
+    public ContainsPredicate( PropertyFunction<? extends Collection<T>> collectionProperty, T value )
+    {
+        this.collectionProperty = collectionProperty;
+        this.value = value;
+    }
+
+    public PropertyFunction<? extends Collection<T>> collectionProperty()
+    {
+        return collectionProperty;
+    }
+
+    public T value()
+    {
+        return value;
+    }
+
+    @Override
+    public boolean test( Composite item )
+    {
+        Collection<T> collection = collectionProperty.apply( item ).get();
+
+        if( collection == null )
+        {
+            return false;
+        }
+
+        return collection.contains( value );
+    }
+
+    @Override
+    public String toString()
+    {
+        return collectionProperty + " contains " + value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/EqPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/EqPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/EqPredicate.java
new file mode 100644
index 0000000..84eb77a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/EqPredicate.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+/**
+ * Equals Specification.
+ */
+public class EqPredicate<T>
+    extends ComparisonPredicate<T>
+{
+    public EqPredicate( PropertyFunction<T> property, T value )
+    {
+        super( property, value );
+    }
+
+    @Override
+    protected boolean compare( T value )
+    {
+        return value.equals( this.value );
+    }
+
+    @Override
+    public String toString()
+    {
+        return property.toString() + "=" + value.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/query/grammar/ExpressionPredicate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/query/grammar/ExpressionPredicate.java b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ExpressionPredicate.java
new file mode 100644
index 0000000..94ec810
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/query/grammar/ExpressionPredicate.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.query.grammar;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.composite.Composite;
+
+/**
+ * Base expression Specification.
+ */
+public abstract class ExpressionPredicate
+    implements Predicate<Composite>
+{
+}


[09/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderFactoryStrategy.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderFactoryStrategy.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderFactoryStrategy.java
new file mode 100644
index 0000000..38bc5ba
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderFactoryStrategy.java
@@ -0,0 +1,106 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.composite.InvalidValueCompositeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.concern.internal.ConcernFor;
+import org.apache.polygene.api.injection.scope.Invocation;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.This;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.api.sideeffect.internal.SideEffectFor;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class InjectionProviderFactoryStrategy
+    implements InjectionProviderFactory
+{
+    private final Map<Class<? extends Annotation>, InjectionProviderFactory> generalProviderFactories = new HashMap<>();
+    private final Map<Class<? extends Annotation>, InjectionProviderFactory> valuesProviderFactories = new HashMap<>();
+    private MetaInfo metaInfo;
+
+    public InjectionProviderFactoryStrategy( MetaInfo metaInfo )
+    {
+        this.metaInfo = metaInfo;
+        valuesProviderFactories.put( This.class, new ThisInjectionProviderFactory() );
+        ModifiesInjectionProviderFactory modifiesInjectionProviderFactory = new ModifiesInjectionProviderFactory();
+        valuesProviderFactories.put( ConcernFor.class, modifiesInjectionProviderFactory );
+        valuesProviderFactories.put( SideEffectFor.class, modifiesInjectionProviderFactory );
+        valuesProviderFactories.put( State.class, new StateInjectionProviderFactory() );
+
+        valuesProviderFactories.put( Structure.class, new CachingInjectionProviderFactoryDecorator( new StructureInjectionProviderFactory() ) );
+        valuesProviderFactories.put( Service.class, new CachingInjectionProviderFactoryDecorator( new ServiceInjectionProviderFactory() ) );
+        generalProviderFactories.put( Invocation.class, new InvocationInjectionProviderFactory() );
+        generalProviderFactories.put( Uses.class, new UsesInjectionProviderFactory() );
+    }
+
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        Class<? extends Annotation> injectionAnnotationType = dependencyModel.injectionAnnotation().annotationType();
+        InjectionProviderFactory factory1 = generalProviderFactories.get( injectionAnnotationType );
+        InjectionProviderFactory factory2 = valuesProviderFactories.get( injectionAnnotationType );
+        if( factory1 == null && factory2 == null )
+        {
+            InjectionProviderFactory factory = metaInfo.get( InjectionProviderFactory.class );
+            if( factory != null )
+            {
+                return factory.newInjectionProvider( resolution, dependencyModel );
+            }
+            else
+            {
+                throw new InvalidInjectionException( "Unknown injection annotation @" + injectionAnnotationType.getSimpleName() );
+            }
+        }
+        ModelDescriptor composite = resolution.model();
+        Class<?> compositeType = composite.types().findFirst().orElse( null );
+        if( factory1 != null && ValueComposite.class.isAssignableFrom( compositeType ) )
+        {
+            throw new InvalidValueCompositeException( "@" + injectionAnnotationType.getSimpleName() + " is not allowed in ValueComposites: " + compositeType );
+        }
+
+        InjectionProviderFactory factory;
+        if( factory1 == null )
+        {
+            factory = factory2;
+        }
+        else
+        {
+            factory = factory1;
+        }
+        return factory.newInjectionProvider( resolution, dependencyModel );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InvocationInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InvocationInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InvocationInjectionProviderFactory.java
new file mode 100644
index 0000000..90e2987
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InvocationInjectionProviderFactory.java
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.composite.CompositeMethodModel;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class InvocationInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    @SuppressWarnings( "raw" )
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        Class injectionClass = Classes.RAW_CLASS.apply( dependencyModel.injectionType() );
+        if( injectionClass.equals( Method.class ) ||
+            injectionClass.equals( AnnotatedElement.class ) ||
+            injectionClass.equals( Iterable.class ) ||
+            Annotation.class.isAssignableFrom( injectionClass ) )
+        {
+            return new InvocationDependencyResolution( resolution, dependencyModel );
+        }
+        else
+        {
+            String injectedTo = dependencyModel.injectedClass().getName();
+            throw new InvalidInjectionException( "Invalid injection type " + injectionClass + " in " + injectedTo );
+        }
+    }
+
+    private static class InvocationDependencyResolution
+        implements InjectionProvider
+    {
+        private final Resolution resolution;
+        private final DependencyModel dependencyModel;
+
+        private InvocationDependencyResolution( Resolution resolution, DependencyModel dependencyModel )
+        {
+            this.resolution = resolution;
+            this.dependencyModel = dependencyModel;
+        }
+
+        @Override
+        @SuppressWarnings( {"raw", "unchecked"} )
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            Class injectionClass = Classes.RAW_CLASS.apply( dependencyModel.injectionType() );
+            final CompositeMethodModel methodModel = resolution.method();
+            if( injectionClass.equals( Method.class ) )
+            {
+                return methodModel.method();
+            }
+
+            final AnnotatedElement annotatedElement = methodModel.annotatedElement();
+            if( injectionClass.equals( AnnotatedElement.class ) )
+            {
+                return annotatedElement;
+            }
+            final Annotation annotation = annotatedElement.getAnnotation( injectionClass );
+            if( annotation != null )
+            {
+                return annotation;
+            }
+            if( dependencyModel.injectionType() instanceof Class<?> )
+            {
+                return annotatedElement.getAnnotation( (Class<Annotation>) dependencyModel.injectionType() );
+            }
+            if( dependencyModel.injectionType() instanceof ParameterizedType )
+            {
+                ParameterizedType injectionType = (ParameterizedType) dependencyModel.injectionType();
+                Type rawType = injectionType.getRawType();
+                Type[] actualTypeArguments = injectionType.getActualTypeArguments();
+                boolean isAnIterable = rawType.equals( Iterable.class );
+                boolean haveOneGenericType = actualTypeArguments.length == 1;
+                boolean thatIsOfTypeMethod = actualTypeArguments[ 0 ].equals( Method.class );
+                if( isAnIterable && haveOneGenericType && thatIsOfTypeMethod )
+                {
+                    Class<?> injectedClass = dependencyModel.injectedClass();
+                    Iterable<Method> result = methodModel.invocationsFor( injectedClass );
+                    return result;
+                }
+            }
+            return null;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ModifiesInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ModifiesInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ModifiesInjectionProviderFactory.java
new file mode 100644
index 0000000..b0f662b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ModifiesInjectionProviderFactory.java
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class ModifiesInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution bindingContext, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        if( bindingContext.model() instanceof CompositeDescriptor )
+        {
+            Class<?> type = Classes.RAW_CLASS.apply( dependencyModel.injectionType() );
+            if( type.isAssignableFrom( dependencyModel.injectedClass() ) )
+            {
+                return new ModifiedInjectionProvider();
+            }
+            else
+            {
+                throw new InvalidInjectionException( "Composite " + bindingContext.model() + " does not implement @ConcernFor type " + type
+                    .getName() + " in modifier " + dependencyModel.injectedClass().getName() );
+            }
+        }
+        else
+        {
+            throw new InvalidInjectionException( "The class " + dependencyModel.injectedClass()
+                .getName() + " is not a modifier" );
+        }
+    }
+
+    private static class ModifiedInjectionProvider
+        implements InjectionProvider
+    {
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            return context.next();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ServiceInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ServiceInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ServiceInjectionProviderFactory.java
new file mode 100644
index 0000000..f3dc70c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ServiceInjectionProviderFactory.java
@@ -0,0 +1,224 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.service.NoSuchServiceException;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.service.qualifier.Qualifier;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+import static java.util.stream.Collectors.toCollection;
+import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
+
+public final class ServiceInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        // TODO This could be changed to allow multiple @Qualifier annotations
+        Annotation qualifierAnnotation = Stream.of( dependencyModel.annotations() )
+                                               .filter( typeHasAnnotation( Qualifier.class ) )
+                                               .findFirst().orElse( null );
+        Predicate<ServiceReference<?>> serviceQualifier = null;
+        if( qualifierAnnotation != null )
+        {
+            Qualifier qualifier = qualifierAnnotation.annotationType().getAnnotation( Qualifier.class );
+            try
+            {
+                serviceQualifier = qualifier.value().newInstance().qualifier( qualifierAnnotation );
+            }
+            catch( Exception e )
+            {
+                throw new InvalidInjectionException( "Could not instantiate qualifier serviceQualifier", e );
+            }
+        }
+
+        if( dependencyModel.rawInjectionType().equals( Iterable.class ) )
+        {
+            Type iterableType = ( (ParameterizedType) dependencyModel.injectionType() ).getActualTypeArguments()[ 0 ];
+            if( Classes.RAW_CLASS.apply( iterableType ).equals( ServiceReference.class ) )
+            {
+                // @Service Iterable<ServiceReference<MyService<Foo>> serviceRefs
+                Type serviceType = ( (ParameterizedType) iterableType ).getActualTypeArguments()[ 0 ];
+
+                return new IterableServiceReferenceProvider( serviceType, serviceQualifier );
+            }
+            else
+            {
+                // @Service Iterable<MyService<Foo>> services
+                return new IterableServiceProvider( iterableType, serviceQualifier );
+            }
+        }
+        else if( dependencyModel.rawInjectionType().equals( ServiceReference.class ) )
+        {
+            // @Service ServiceReference<MyService<Foo>> serviceRef
+            Type referencedType = ( (ParameterizedType) dependencyModel.injectionType() ).getActualTypeArguments()[ 0 ];
+            return new ServiceReferenceProvider( referencedType, serviceQualifier );
+        }
+        else
+        {
+            // @Service MyService<Foo> service
+            return new ServiceProvider( dependencyModel.injectionType(), serviceQualifier );
+        }
+    }
+
+    private static class IterableServiceReferenceProvider
+        extends ServiceInjectionProvider
+    {
+        private IterableServiceReferenceProvider( Type serviceType, Predicate<ServiceReference<?>> serviceQualifier )
+        {
+            super( serviceType, serviceQualifier );
+        }
+
+        @Override
+        public synchronized Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            return getServiceReferences( context ).collect( toCollection( ArrayList::new ) );
+        }
+    }
+
+    private static class IterableServiceProvider
+        extends ServiceInjectionProvider
+        implements Function<ServiceReference<?>, Object>
+    {
+        private IterableServiceProvider( Type serviceType, Predicate<ServiceReference<?>> serviceQualifier )
+        {
+            super( serviceType, serviceQualifier );
+        }
+
+        @Override
+        public synchronized Object provideInjection( final InjectionContext context )
+            throws InjectionProviderException
+        {
+            return getServiceReferences( context ).map( ServiceReference::get )
+                                                  .collect( toCollection( ArrayList::new ) );
+        }
+
+        @Override
+        public Object apply( ServiceReference<?> objectServiceReference )
+        {
+            return objectServiceReference.get();
+        }
+    }
+
+    private static class ServiceReferenceProvider
+        extends ServiceInjectionProvider
+    {
+        ServiceReferenceProvider( Type serviceType, Predicate<ServiceReference<?>> qualifier )
+        {
+            super( serviceType, qualifier );
+        }
+
+        @Override
+        public synchronized Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            return getServiceReference( context );
+        }
+    }
+
+    private static class ServiceProvider
+        extends ServiceInjectionProvider
+    {
+        ServiceProvider( Type serviceType, Predicate<ServiceReference<?>> qualifier )
+        {
+            super( serviceType, qualifier );
+        }
+
+        @Override
+        public synchronized Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            ServiceReference<?> ref = getServiceReference( context );
+
+            if( ref != null )
+            {
+                return ref.get();
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+    public abstract static class ServiceInjectionProvider
+        implements InjectionProvider
+    {
+        private final Type serviceType;
+        private final Predicate<ServiceReference<?>> serviceQualifier;
+
+        private ServiceInjectionProvider( Type serviceType, Predicate<ServiceReference<?>> serviceQualifier )
+        {
+            this.serviceType = serviceType;
+            this.serviceQualifier = serviceQualifier;
+        }
+
+        protected ServiceReference<Object> getServiceReference( InjectionContext context )
+        {
+            try
+            {
+                if( serviceQualifier == null )
+                {
+                    return context.module().instance().findService( serviceType );
+                }
+                else
+                {
+                    return context.module().instance().findServices( serviceType )
+                                  .filter( serviceQualifier ).findFirst().orElse( null );
+                }
+            }
+            catch( NoSuchServiceException e )
+            {
+                return null;
+            }
+        }
+
+        protected Stream<ServiceReference<Object>> getServiceReferences( final InjectionContext context )
+        {
+            if( serviceQualifier == null )
+            {
+                return context.module().instance().findServices( serviceType );
+            }
+            else
+            {
+                return context.module().instance().findServices( serviceType ).filter( serviceQualifier );
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StateInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StateInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StateInjectionProviderFactory.java
new file mode 100644
index 0000000..3a3a80e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StateInjectionProviderFactory.java
@@ -0,0 +1,273 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.composite.StateDescriptor;
+import org.apache.polygene.api.composite.StatefulCompositeDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.injection.scope.State;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class StateInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        if( StateHolder.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            // @State StateHolder properties;
+            return new StateInjectionProvider();
+        }
+        else if( UnitOfWork.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            if( !( resolution.model() instanceof EntityDescriptor ) )
+            {
+                throw new InvalidInjectionException( "Only EntityComposites can be injected with '@State UnitOfWork'" );
+            }
+            return new UnitOfWorkInjectionProvider();
+        }
+        else if( Property.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            // @State Property<String> name;
+            StateDescriptor descriptor;
+            descriptor = ( (StatefulCompositeDescriptor) resolution.model() ).state();
+
+            State annotation = (State) dependencyModel.injectionAnnotation();
+            String name;
+            if( annotation.value().isEmpty() )
+            {
+                name = resolution.field().getName();
+            }
+            else
+            {
+                name = annotation.value();
+            }
+
+            PropertyDescriptor propertyDescriptor = descriptor.findPropertyModelByName( name );
+            return new PropertyInjectionProvider( propertyDescriptor );
+        }
+        else if( Association.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            // @State Association<MyEntity> name;
+            AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
+            State annotation = (State) dependencyModel.injectionAnnotation();
+            String name;
+            if( annotation.value().isEmpty() )
+            {
+                name = resolution.field().getName();
+            }
+            else
+            {
+                name = annotation.value();
+            }
+            AssociationDescriptor model = descriptor.getAssociationByName( name );
+            return new AssociationInjectionProvider( model );
+        }
+        else if( ManyAssociation.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            // @State ManyAssociation<MyEntity> name;
+            AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
+            State annotation = (State) dependencyModel.injectionAnnotation();
+            String name;
+            if( annotation.value().isEmpty() )
+            {
+                name = resolution.field().getName();
+            }
+            else
+            {
+                name = annotation.value();
+            }
+            AssociationDescriptor model = descriptor.getManyAssociationByName( name );
+            return new ManyAssociationInjectionProvider( model );
+        }
+        else if( NamedAssociation.class.isAssignableFrom( dependencyModel.rawInjectionType() ) )
+        {
+            // @State NamedAssociation<MyEntity> name;
+            AssociationStateDescriptor descriptor = ( (EntityDescriptor) resolution.model() ).state();
+            State annotation = (State) dependencyModel.injectionAnnotation();
+            String name;
+            if( annotation.value().isEmpty() )
+            {
+                name = resolution.field().getName();
+            }
+            else
+            {
+                name = annotation.value();
+            }
+            AssociationDescriptor model = descriptor.getNamedAssociationByName( name );
+            return new NamedAssociationInjectionProvider( model );
+        }
+
+        throw new InjectionProviderException( "Injected value has invalid type" );
+    }
+
+    private static class PropertyInjectionProvider
+        implements InjectionProvider
+    {
+        private final PropertyDescriptor propertyDescriptor;
+
+        private PropertyInjectionProvider( PropertyDescriptor propertyDescriptor )
+        {
+            this.propertyDescriptor = propertyDescriptor;
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            Property<?> value = context.state().propertyFor( propertyDescriptor.accessor() );
+            if( value != null )
+            {
+                return value;
+            }
+            else
+            {
+                throw new InjectionProviderException( "Non-optional property " + propertyDescriptor + " had no value" );
+            }
+        }
+    }
+
+    private static class AssociationInjectionProvider
+        implements InjectionProvider
+    {
+        private final AssociationDescriptor associationDescriptor;
+
+        private AssociationInjectionProvider( AssociationDescriptor associationDescriptor )
+        {
+            this.associationDescriptor = associationDescriptor;
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            AbstractAssociation abstractAssociation = ( (AssociationStateHolder) context.state() ).
+                associationFor( associationDescriptor.accessor() );
+            if( abstractAssociation != null )
+            {
+                return abstractAssociation;
+            }
+            else
+            {
+                throw new InjectionProviderException( "Non-optional association " + associationDescriptor.qualifiedName() + " had no association" );
+            }
+        }
+    }
+
+    private static class ManyAssociationInjectionProvider
+        implements InjectionProvider
+    {
+        private final AssociationDescriptor manyAssociationDescriptor;
+
+        private ManyAssociationInjectionProvider( AssociationDescriptor manyAssociationDescriptor )
+        {
+            this.manyAssociationDescriptor = manyAssociationDescriptor;
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            ManyAssociation<?> abstractAssociation = ( (AssociationStateHolder) context.state() ).
+                manyAssociationFor( manyAssociationDescriptor.accessor() );
+            if( abstractAssociation != null )
+            {
+                return abstractAssociation;
+            }
+            else
+            {
+                throw new InjectionProviderException( "Non-optional association " + manyAssociationDescriptor.qualifiedName() + " had no association" );
+            }
+        }
+    }
+
+    private static class NamedAssociationInjectionProvider
+        implements InjectionProvider
+    {
+        private final AssociationDescriptor namedAssociationDescriptor;
+
+        private NamedAssociationInjectionProvider( AssociationDescriptor namedAssociationDescriptor )
+        {
+            this.namedAssociationDescriptor = namedAssociationDescriptor;
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            NamedAssociation<?> abstractAssociation = ( (AssociationStateHolder) context.state() ).
+                namedAssociationFor( namedAssociationDescriptor.accessor() );
+            if( abstractAssociation != null )
+            {
+                return abstractAssociation;
+            }
+            else
+            {
+                throw new InjectionProviderException( "Non-optional association " + namedAssociationDescriptor.qualifiedName() + " had no association" );
+            }
+        }
+    }
+
+    static private class StateInjectionProvider
+        implements InjectionProvider
+    {
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            return context.state();
+        }
+    }
+
+    static private class UnitOfWorkInjectionProvider
+        implements InjectionProvider
+    {
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            return ( (EntityInstance) context.compositeInstance() ).unitOfWork();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StructureInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StructureInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StructureInjectionProviderFactory.java
new file mode 100644
index 0000000..0d20dab
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/StructureInjectionProviderFactory.java
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.reflect.Type;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+import org.apache.polygene.runtime.structure.ApplicationInstance;
+
+public final class StructureInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        return new StructureInjectionProvider( dependencyModel );
+    }
+
+    private static class StructureInjectionProvider
+        implements InjectionProvider
+    {
+        private final DependencyModel dependencyModel;
+
+        private StructureInjectionProvider( DependencyModel dependencyModel )
+        {
+            this.dependencyModel = dependencyModel;
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            Type type1 = dependencyModel.injectionType();
+            if( !( type1 instanceof Class ) )
+            {
+                throw new InjectionProviderException( "Type [" + type1 + "] can not be injected from the @Structure injection scope: " + context );
+            }
+            Class clazz = (Class) type1;
+            if( clazz.equals( TransientBuilderFactory.class ) )
+            {
+                return context.module().instance();
+            }
+            else if( clazz.equals( ObjectFactory.class ) )
+            {
+                return context.module().instance();
+            }
+            else if( clazz.equals( ValueBuilderFactory.class ) )
+            {
+                return context.module().instance();
+            }
+            else if( clazz.equals( UnitOfWorkFactory.class ) )
+            {
+                return context.module().instance().unitOfWorkFactory();
+            }
+            else if( clazz.equals( QueryBuilderFactory.class ) )
+            {
+                return context.module().instance();
+            }
+            else if( clazz.equals( ServiceFinder.class ) )
+            {
+                return context.module().instance();
+            }
+            else if( Module.class.isAssignableFrom( clazz ) )
+            {
+                return context.module().instance();
+            }
+            else if( ModuleDescriptor.class.isAssignableFrom( clazz ) )
+            {
+                return context.module();
+            }
+            else if( Layer.class.isAssignableFrom( clazz ) )
+            {
+                return context.module().layer().instance();
+            }
+            else if( LayerDescriptor.class.isAssignableFrom( clazz ) )
+            {
+                return context.module().layer();
+            }
+            else if( Application.class.isAssignableFrom( clazz ) )
+            {
+                return context.module().layer().instance().application();
+            }
+            else if( ApplicationDescriptor.class.isAssignableFrom( clazz ) )
+            {
+                return context.module().layer().instance().application().descriptor();
+            }
+            else if( PolygeneAPI.class.isAssignableFrom( clazz ) )
+            {
+                return (( ApplicationInstance) context.module().layer().instance().application()).runtime();
+            }
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ThisInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ThisInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ThisInjectionProviderFactory.java
new file mode 100644
index 0000000..161cfbd
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/ThisInjectionProviderFactory.java
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.composite.ProxyGenerator;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class ThisInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public InjectionProvider newInjectionProvider( Resolution bindingContext, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        if( bindingContext.model() instanceof CompositeDescriptor )
+        {
+            // If Composite type then return real type, otherwise use the specified one
+            final Class<?> thisType = dependencyModel.rawInjectionType();
+
+            Stream<Class<?>> injectionTypes;
+            if( Classes.assignableTypeSpecification( thisType ).test( bindingContext.model() ) )
+            {
+                injectionTypes = bindingContext.model().types();
+            }
+            else
+            {
+                CompositeDescriptor acd = ( (CompositeDescriptor) bindingContext.model() );
+                injectionTypes = acd.mixinTypes().filter( thisType::isAssignableFrom );
+            }
+
+            List<Class<?>> classes = injectionTypes.collect( Collectors.toList() );
+            if( classes.size() == 0 )
+            {
+                throw new InvalidInjectionException( "Composite " + bindingContext.model()
+                                                     + " does not implement @This type " + thisType.getName() + " in fragment "
+                                                     + dependencyModel.injectedClass().getName() );
+            }
+            return new ThisInjectionProvider( classes );
+        }
+        else
+        {
+            throw new InvalidInjectionException( "Object " + dependencyModel.injectedClass() + " may not use @This" );
+        }
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    private static class ThisInjectionProvider
+        implements InjectionProvider
+    {
+        Constructor proxyConstructor;
+        private Class[] interfaces;
+
+        private ThisInjectionProvider( List<Class<?>> types )
+        {
+            try
+            {
+                Class proxyClass;
+                Class<?> mainType = types.get( 0 );
+                if( Proxy.class.isAssignableFrom( mainType ) )
+                {
+                    proxyClass = mainType;
+                }
+                else
+                {
+                    interfaces = types.stream().map( Class.class::cast ).toArray( Class[]::new );
+                    proxyClass = ProxyGenerator.createProxyClass( mainType.getClassLoader(), interfaces );
+                }
+
+                proxyConstructor = proxyClass.getConstructor( InvocationHandler.class );
+            }
+            catch( Exception e )
+            {
+                // Ignore
+                e.printStackTrace();
+            }
+        }
+
+        @Override
+        public Object provideInjection( InjectionContext context )
+        {
+            try
+            {
+                InvocationHandler handler = context.compositeInstance();
+                if( handler == null )
+                {
+                    handler = context.proxyHandler();
+                }
+                return proxyConstructor.newInstance( handler );
+            }
+            catch( Exception e )
+            {
+                throw new InjectionProviderException( "Could not instantiate @This proxy", e );
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/UsesInjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/UsesInjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/UsesInjectionProviderFactory.java
new file mode 100644
index 0000000..f4549c5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/UsesInjectionProviderFactory.java
@@ -0,0 +1,132 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import java.lang.reflect.Constructor;
+import org.apache.polygene.api.composite.NoSuchTransientException;
+import org.apache.polygene.api.object.NoSuchObjectException;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class UsesInjectionProviderFactory
+    implements InjectionProviderFactory
+{
+    public UsesInjectionProviderFactory()
+    {
+    }
+
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        return new UsesInjectionProvider( dependencyModel );
+    }
+
+    private static class UsesInjectionProvider
+        implements InjectionProvider
+    {
+        private final DependencyModel dependency;
+
+        public UsesInjectionProvider( DependencyModel dependency )
+        {
+            this.dependency = dependency;
+        }
+
+        @SuppressWarnings( "unchecked" )
+        @Override
+        public Object provideInjection( InjectionContext context )
+            throws InjectionProviderException
+        {
+            UsesInstance uses = context.uses();
+
+            Class injectionType = dependency.rawInjectionType();
+            Object usesObject = uses.useForType( injectionType );
+
+            if( usesObject == null && !dependency.optional() )
+            {
+                // No @Uses object provided
+                // Try instantiating a Transient or Object for the given type
+                Module moduleInstance = context.module().instance();
+
+                try
+                {
+                    if( context.instance() != null )
+                    {
+                        uses = uses.use( context.instance() );
+                    }
+                    usesObject = moduleInstance.newTransient( injectionType, uses.toArray() );
+                }
+                catch( NoSuchTransientException e )
+                {
+                    try
+                    {
+                        usesObject = moduleInstance.newObject( injectionType, uses.toArray() );
+                    }
+                    catch( NoSuchObjectException e1 )
+                    {
+                        // Could not instantiate an instance - to try instantiate as plain class
+                        try
+                        {
+                            usesObject = injectionType.newInstance();
+                        }
+                        catch( Throwable e2 )
+                        {
+                            // Could not instantiate - try with this as first argument
+                            try
+                            {
+                                Constructor constructor = injectionType.getDeclaredConstructor( context.instance()
+                                                                                                    .getClass() );
+                                if( !constructor.isAccessible() )
+                                {
+                                    constructor.setAccessible( true );
+                                }
+                                usesObject = constructor.newInstance( context.instance() );
+                            }
+                            catch( Throwable e3 )
+                            {
+                                // Really can't instantiate it - ignore
+                            }
+                        }
+                    }
+                }
+
+                if( usesObject != null )
+                {
+                    context.setUses( context.uses().use( usesObject ) ); // Use this for other injections in same graph
+                }
+
+                return usesObject;
+            }
+            else
+            {
+                return usesObject;
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/internal/Activator.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/internal/Activator.java b/core/runtime/src/main/java/org/apache/polygene/runtime/internal/Activator.java
new file mode 100644
index 0000000..6a0481f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/internal/Activator.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.internal;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.apache.polygene.bootstrap.PolygeneRuntime;
+import org.apache.polygene.bootstrap.RuntimeFactory;
+import org.apache.polygene.runtime.PolygeneRuntimeImpl;
+
+/**
+ *
+ */
+public class Activator
+    implements BundleActivator
+{
+    private ServiceRegistration registration;
+
+    @Override
+    public void start( BundleContext bundleContext )
+        throws Exception
+    {
+        RuntimeFactory factory = new RuntimeFactory()
+        {
+            @Override
+            public PolygeneRuntime createRuntime()
+            {
+                return new PolygeneRuntimeImpl();
+            }
+        };
+        registration = bundleContext.registerService( RuntimeFactory.class.getName(), factory, null );
+    }
+
+    @Override
+    public void stop( BundleContext bundleContext )
+        throws Exception
+    {
+        registration.unregister();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/model/Binder.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/model/Binder.java b/core/runtime/src/main/java/org/apache/polygene/runtime/model/Binder.java
new file mode 100644
index 0000000..c59cc96
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/model/Binder.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.model;
+
+import org.apache.polygene.bootstrap.BindingException;
+
+/**
+ * Interface for models that can understand binding of dependencies
+ */
+public interface Binder
+{
+    void bind( Resolution resolution )
+        throws BindingException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/model/Resolution.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/model/Resolution.java b/core/runtime/src/main/java/org/apache/polygene/runtime/model/Resolution.java
new file mode 100644
index 0000000..f5ff0f5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/model/Resolution.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.model;
+
+import java.lang.reflect.Field;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.runtime.composite.CompositeMethodModel;
+import org.apache.polygene.runtime.structure.ApplicationModel;
+import org.apache.polygene.runtime.structure.LayerModel;
+import org.apache.polygene.runtime.structure.ModuleModel;
+
+/**
+ * JAVADOC
+ */
+public final class Resolution
+{
+    private final ApplicationModel application;
+    private final LayerModel layer;
+    private final ModuleModel module;
+    private final ModelDescriptor modelDescriptor;
+    private final CompositeMethodModel method;
+    private final Field field;
+
+    public Resolution( ApplicationModel application,
+                       LayerModel layer,
+                       ModuleModel module,
+                       ModelDescriptor modelDescriptor,
+                       CompositeMethodModel method,
+                       Field field
+    )
+    {
+        this.application = application;
+        this.layer = layer;
+        this.module = module;
+        this.modelDescriptor = modelDescriptor;
+        this.method = method;
+        this.field = field;
+    }
+
+    public ApplicationModel application()
+    {
+        return application;
+    }
+
+    public LayerModel layer()
+    {
+        return layer;
+    }
+
+    public ModuleModel module()
+    {
+        return module;
+    }
+
+    public ModelDescriptor model()
+    {
+        return modelDescriptor;
+    }
+
+    public CompositeMethodModel method()
+    {
+        return method;
+    }
+
+    public Field field()
+    {
+        return field;
+    }
+
+    public Resolution forField( final Field injectedField )
+    {
+        return new Resolution( application, layer, module, modelDescriptor, method, injectedField );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectModel.java
new file mode 100644
index 0000000..c1a3dbf
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectModel.java
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.object;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.mixin.Initializable;
+import org.apache.polygene.api.mixin.InitializationException;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.composite.ConstructorsModel;
+import org.apache.polygene.runtime.injection.InjectedFieldsModel;
+import org.apache.polygene.runtime.injection.InjectedMethodsModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * JAVADOC
+ */
+public final class ObjectModel
+    implements ObjectDescriptor, VisitableHierarchy<Object, Object>
+{
+    private final ModuleDescriptor module;
+    private final Class<?> objectType;
+    private final Visibility visibility;
+    private final MetaInfo metaInfo;
+    private final ConstructorsModel constructorsModel;
+    private final InjectedFieldsModel injectedFieldsModel;
+    private final InjectedMethodsModel injectedMethodsModel;
+
+    public ObjectModel( ModuleDescriptor module,
+                        Class<?> objectType,
+                        Visibility visibility,
+                        MetaInfo metaInfo
+    )
+    {
+        this.module = module;
+        this.objectType = objectType;
+        this.visibility = visibility;
+        this.metaInfo = metaInfo;
+
+        constructorsModel = new ConstructorsModel( objectType );
+        injectedFieldsModel = new InjectedFieldsModel( objectType );
+        injectedMethodsModel = new InjectedMethodsModel( objectType );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public Stream<Class<?>> types()
+    {
+        return Stream.of( objectType );
+    }
+
+    @Override
+    public Visibility visibility()
+    {
+        return visibility;
+    }
+
+    @Override
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public boolean isAssignableTo( Class<?> type )
+    {
+        return type.isAssignableFrom( objectType );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( constructorsModel.accept( visitor ) )
+            {
+                if( injectedFieldsModel.accept( visitor ) )
+                {
+                    injectedMethodsModel.accept( visitor );
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Object newInstance( InjectionContext injectionContext )
+    {
+        Object instance;
+        try
+        {
+            instance = constructorsModel.newInstance( injectionContext );
+            injectionContext = new InjectionContext( injectionContext.module(), injectionContext.uses(), instance );
+            injectedFieldsModel.inject( injectionContext, instance );
+            injectedMethodsModel.inject( injectionContext, instance );
+        }
+        catch( Exception e )
+        {
+            throw new ConstructionException( "Could not instantiate " + objectType.getName(), e );
+        }
+
+        if( instance instanceof Initializable )
+        {
+            try
+            {
+                ( (Initializable) instance ).initialize();
+            }
+            catch( Exception e )
+            {
+                String message = "Unable to initialize " + objectType;
+                throw new ConstructionException( new InitializationException( message, e ) );
+            }
+        }
+
+        return instance;
+    }
+
+    public void inject( InjectionContext injectionContext, Object instance )
+    {
+        injectedFieldsModel.inject( injectionContext, instance );
+        injectedMethodsModel.inject( injectionContext, instance );
+    }
+
+    @Override
+    public String toString()
+    {
+        return objectType.getName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectsModel.java
new file mode 100644
index 0000000..84d2c11
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/object/ObjectsModel.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.object;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public class ObjectsModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<ObjectModel> objectModels;
+
+    public ObjectsModel( List<ObjectModel> objectModels )
+    {
+        this.objectModels = objectModels;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ObjectModel objectModel : objectModels )
+            {
+                if( !objectModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Stream<ObjectModel> models()
+    {
+        return objectModels.stream();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/package.html
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/package.html b/core/runtime/src/main/java/org/apache/polygene/runtime/package.html
new file mode 100644
index 0000000..1ed6d55
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Apache Polygene\u2122 Runtime.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertiesModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertiesModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertiesModel.java
new file mode 100644
index 0000000..cfcfcb5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertiesModel.java
@@ -0,0 +1,107 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.property;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * Base class for properties model
+ */
+public class PropertiesModel
+    implements VisitableHierarchy<Object, Object>
+{
+    protected final Map<AccessibleObject, PropertyModel> mapAccessiblePropertyModel = new LinkedHashMap<>();
+
+    public PropertiesModel()
+    {
+    }
+
+    public void addProperty( PropertyModel property )
+    {
+        mapAccessiblePropertyModel.put( property.accessor(), property );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( PropertyModel propertyModel : mapAccessiblePropertyModel.values() )
+            {
+                if( !propertyModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+
+        return visitor.visitLeave( this );
+    }
+
+    public Stream<PropertyModel> properties()
+    {
+        return mapAccessiblePropertyModel.values().stream();
+    }
+
+    public PropertyModel getProperty( AccessibleObject accessor )
+    {
+        PropertyModel propertyModel = mapAccessiblePropertyModel.get( accessor );
+        if( propertyModel == null )
+        {
+            throw new IllegalArgumentException( "No property found with name: " + ( (Member) accessor ).getName() );
+        }
+
+        return propertyModel;
+    }
+
+    public PropertyModel getPropertyByName( String name )
+        throws IllegalArgumentException
+    {
+        for( PropertyModel propertyModel : mapAccessiblePropertyModel.values() )
+        {
+            if( propertyModel.qualifiedName().name().equals( name ) )
+            {
+                return propertyModel;
+            }
+        }
+        throw new IllegalArgumentException( "No property found with name: " + name );
+    }
+
+    public PropertyModel getPropertyByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        for( PropertyModel propertyModel : mapAccessiblePropertyModel.values() )
+        {
+            if( propertyModel.qualifiedName().equals( name ) )
+            {
+                return propertyModel;
+            }
+        }
+        throw new IllegalArgumentException( "No property found with qualified name: " + name );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInfo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInfo.java b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInfo.java
new file mode 100644
index 0000000..fa8e1e6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInfo.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.property;
+
+import java.lang.reflect.Type;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.runtime.composite.ConstraintsCheck;
+
+/**
+ * TODO
+ */
+public interface PropertyInfo
+    extends ConstraintsCheck
+{
+    boolean isImmutable();
+
+    QualifiedName qualifiedName();
+
+    Type type();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInstance.java
new file mode 100644
index 0000000..72d39cb
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyInstance.java
@@ -0,0 +1,326 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.property;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.PropertyWrapper;
+import org.apache.polygene.api.type.CollectionType;
+import org.apache.polygene.api.type.MapType;
+import org.apache.polygene.api.type.ValueCompositeType;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.runtime.value.ValueInstance;
+
+/**
+ * {@code PropertyInstance} represents a property.
+ */
+public class PropertyInstance<T>
+    implements Property<T>
+{
+    protected volatile T value;
+    protected PropertyInfo model;
+
+    /**
+     * Construct an instance of {@code PropertyInstance} with the specified arguments.
+     *
+     * @param model  The property model. This argument must not be {@code null}.
+     * @param aValue The property value.
+     */
+    public PropertyInstance( PropertyInfo model, T aValue )
+    {
+        this.model = model;
+        value = aValue;
+    }
+
+    public PropertyInfo propertyInfo()
+    {
+        return model;
+    }
+
+    /**
+     * @param model The property model. This argument must not be {@code null}.
+     */
+    public void setPropertyInfo( PropertyInfo model )
+    {
+        this.model = model;
+    }
+
+    /**
+     * Returns this property value.
+     *
+     * @return This property value.
+     */
+    @Override
+    public T get()
+    {
+        return value;
+    }
+
+    /**
+     * Sets this property value.
+     *
+     * @param aNewValue The new value.
+     */
+    @Override
+    public void set( T aNewValue )
+    {
+        if( model.isImmutable() )
+        {
+            throw new IllegalStateException( "Property [" + model.qualifiedName() + "] is immutable." );
+        }
+
+        model.checkConstraints( aNewValue );
+
+        value = aNewValue;
+    }
+
+    /**
+     * Perform equals with {@code o} argument.
+     * <p>
+     *     The definition of equals() for the Property is that if both the state and descriptor are equal,
+     *     then the properties are equal.
+     * </p>
+     *
+     * @param o The other object to compare.
+     * @return Returns a {@code boolean} indicator whether this object is equals the other.
+     */
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        Property<?> that = (Property<?>) o;
+        // Unwrap if needed
+        while( that instanceof PropertyWrapper )
+        {
+            that = ( (PropertyWrapper) that ).next();
+        }
+        // Descriptor equality
+        PropertyDescriptor thatDescriptor = (PropertyDescriptor) ( (PropertyInstance) that ).propertyInfo();
+        if( !model.equals( thatDescriptor ) )
+        {
+            return false;
+        }
+        // State equality
+        T value = get();
+        if( value == null )
+        {
+            return that.get() == null;
+        }
+        return value.equals( that.get() );
+    }
+
+    /**
+     * Calculate hash code.
+     *
+     * @return the hashcode of this instance.
+     */
+    @Override
+    public int hashCode()
+    {
+        int hash = model.hashCode() * 19; // Descriptor
+        T value = get();
+        if( value != null )
+        {
+            hash += value.hashCode() * 13; // State
+        }
+        return hash;
+    }
+
+    /**
+     * Returns the value as string.
+     *
+     * @return The value as string.
+     */
+    @Override
+    public String toString()
+    {
+        Object value = get();
+        return value == null ? "" : value.toString();
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public void prepareToBuild( PropertyModel propertyDescriptor )
+    {
+        // Check if state has to be modified
+        model = propertyDescriptor.getBuilderInfo();
+        if( propertyDescriptor.valueType() instanceof ValueCompositeType )
+        {
+            Object value = get();
+            if( value != null )
+            {
+                ValueInstance.valueInstanceOf( (ValueComposite) value ).prepareToBuild();
+            }
+        }
+        else if( propertyDescriptor.valueType() instanceof CollectionType )
+        {
+            Object value = get();
+
+            if( value != null )
+            {
+                if( value instanceof List )
+                {
+                    value = new ArrayList( (Collection) value );
+                }
+                else if( value instanceof Set )
+                {
+                    value = new LinkedHashSet( (Collection) value );
+                }
+
+                // Check if items are Values
+                CollectionType collection = (CollectionType) propertyDescriptor.valueType();
+                if( collection.collectedType() instanceof ValueCompositeType )
+                {
+                    Collection coll = (Collection) value;
+                    for( Object instance : coll )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareToBuild();
+                    }
+                }
+
+                set( (T) value );
+            }
+        }
+        else if( propertyDescriptor.valueType() instanceof MapType )
+        {
+            Object value = get();
+
+            if( value != null )
+            {
+                Map map = new LinkedHashMap( (Map) value );
+
+                // Check if keys/values are Values
+                MapType mapType = (MapType) propertyDescriptor.valueType();
+                if( mapType.keyType() instanceof ValueCompositeType )
+                {
+                    for( Object instance : map.keySet() )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareToBuild();
+                    }
+                }
+                if( mapType.valueType() instanceof ValueCompositeType )
+                {
+                    for( Object instance : map.values() )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareToBuild();
+                    }
+                }
+
+                set( (T) value );
+            }
+        }
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public void prepareBuilderState( PropertyModel propertyDescriptor )
+    {
+        // Check if state has to be modified
+        if( propertyDescriptor.valueType() instanceof ValueCompositeType )
+        {
+            Object value = get();
+            if( value != null )
+            {
+                ValueInstance.valueInstanceOf( (ValueComposite) value ).prepareBuilderState();
+            }
+        }
+        else if( propertyDescriptor.valueType() instanceof CollectionType )
+        {
+            T value = get();
+            if( value != null )
+            {
+                if( propertyDescriptor.isImmutable() )
+                {
+                    if( value instanceof List )
+                    {
+                        value = (T) Collections.unmodifiableList( (List<? extends Object>) value );
+                    }
+                    else if( value instanceof Set )
+                    {
+                        value = (T) Collections.unmodifiableSet( (Set<? extends Object>) value );
+                    }
+                    else
+                    {
+                        value = (T) Collections.unmodifiableCollection( (Collection<? extends Object>) value );
+                    }
+
+                    this.value = value;
+                }
+
+                CollectionType collection = (CollectionType) propertyDescriptor.valueType();
+                if( collection.collectedType() instanceof ValueCompositeType )
+                {
+                    Collection coll = (Collection) value;
+                    for( Object instance : coll )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareBuilderState();
+                    }
+                }
+            }
+        }
+        else if( propertyDescriptor.valueType() instanceof MapType )
+        {
+            T value = get();
+
+            if( value != null )
+            {
+                MapType mapType = (MapType) propertyDescriptor.valueType();
+                if( mapType.keyType() instanceof ValueCompositeType )
+                {
+                    Map map = (Map) value;
+                    for( Object instance : map.keySet() )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareBuilderState();
+                    }
+                }
+                if( mapType.valueType() instanceof ValueCompositeType )
+                {
+                    Map map = (Map) value;
+                    for( Object instance : map.values() )
+                    {
+                        ValueInstance.valueInstanceOf( (ValueComposite) instance ).prepareBuilderState();
+                    }
+                }
+                if( propertyDescriptor.isImmutable() )
+                {
+                    value = (T) Collections.unmodifiableMap( (Map<?, ?>) value );
+                }
+
+                this.value = value;
+            }
+        }
+
+        model = propertyDescriptor;
+    }
+}


[65/81] [abbrv] zest-java git commit: ZEST-195 ; Fix file names.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
new file mode 100644
index 0000000..962c1bb
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.service.common;
+
+import com.intellij.psi.PsiAnnotation;
+import com.intellij.psi.PsiModifierList;
+import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiVariable;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneServiceAnnotationUtil
+{
+    /**
+     * Returns {@code @Service} annotation if exists.
+     *
+     * @param modifierListOwner modifier list owner to process.
+     * @return {@code @Service} annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION );
+    }
+
+    /**
+     * Validates whether the variable has {@code @Service} annotation declared correctly.
+     *
+     * @param variable variable to check.
+     * @return Look at {@link ServiceAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation serviceAnnotation = getServiceAnnotation( variable );
+        if( serviceAnnotation == null )
+        {
+            return invalidServiceAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        // Can't be type that is injected by @Structure
+        if( isInjecteableByStructureAnnotation( variable ) )
+        {
+            return invalidTypeIsInjectedViaStructureAnnotation;
+        }
+
+        return valid;
+    }
+
+    public enum ServiceAnnotationDeclarationValidationResult
+    {
+        invalidServiceAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidTypeIsInjectedViaStructureAnnotation,
+        valid,
+    }
+
+    private PolygeneServiceAnnotationUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java
deleted file mode 100644
index 5a95513..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.service.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneServiceAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_SERVICE_ANNOTATION = "org.apache.polygene.api.injection.scope.Service";
-
-    private PolygeneServiceAnnotationConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java
deleted file mode 100644
index 962c1bb..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.service.common;
-
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiModifierListOwner;
-import com.intellij.psi.PsiVariable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneServiceAnnotationUtil
-{
-    /**
-     * Returns {@code @Service} annotation if exists.
-     *
-     * @param modifierListOwner modifier list owner to process.
-     * @return {@code @Service} annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION );
-    }
-
-    /**
-     * Validates whether the variable has {@code @Service} annotation declared correctly.
-     *
-     * @param variable variable to check.
-     * @return Look at {@link ServiceAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation serviceAnnotation = getServiceAnnotation( variable );
-        if( serviceAnnotation == null )
-        {
-            return invalidServiceAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        // Can't be type that is injected by @Structure
-        if( isInjecteableByStructureAnnotation( variable ) )
-        {
-            return invalidTypeIsInjectedViaStructureAnnotation;
-        }
-
-        return valid;
-    }
-
-    public enum ServiceAnnotationDeclarationValidationResult
-    {
-        invalidServiceAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidTypeIsInjectedViaStructureAnnotation,
-        valid,
-    }
-
-    private PolygeneServiceAnnotationUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
new file mode 100644
index 0000000..2a5d3bf
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
+
+import static java.util.Arrays.sort;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneStructureAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure";
+
+    public static final String[] VALID_STRUCTURE_INJECTION_TYPE;
+
+    static
+    {
+        VALID_STRUCTURE_INJECTION_TYPE = new String[]
+            {
+                "org.apache.polygene.composite.CompositeBuilderFactory",
+                "org.apache.polygene.object.ObjectBuilderFactory",
+                "org.apache.polygene.entity.UnitOfWorkFactory",
+                "org.apache.polygene.service.ServiceFinder",
+                "org.apache.polygene.structure.Module",
+                "org.apache.polygene.structure.Layer",
+                "org.apache.polygene.structure.Application",
+                "org.apache.polygene.api.PolygeneAPI",
+                "org.apache.polygene.spi.PolygeneSPI"
+            };
+        sort( VALID_STRUCTURE_INJECTION_TYPE );
+    }
+
+    private PolygeneStructureAnnotationConstants()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
new file mode 100644
index 0000000..c334276
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
@@ -0,0 +1,124 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneStructureAnnotationUtil
+{
+    /**
+     * Returns {@code Structure} annotation if exists.
+     *
+     * @param modifierListOwner Modifier list owner.
+     * @return @Structure annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION );
+    }
+
+    /**
+     * Create structure annotation.
+     *
+     * @param project project to create structure annotation.
+     * @param context the context to create structure annotation.
+     * @return @Structure annotation.
+     */
+    @NotNull
+    public static PsiAnnotation createStructureAnnotation( @NotNull Project project,
+                                                           @NotNull PsiElement context )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context );
+    }
+
+    /**
+     * @param variable variable to check.
+     * @return Look at {@link StructureAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation structureAnnotation = getStructureAnnotation( variable );
+        if( structureAnnotation == null )
+        {
+            return invalidStructureAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        if( !isInjecteableByStructureAnnotation( variable ) )
+        {
+            return invalidInjectionType;
+        }
+
+        return valid;
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation.
+     *
+     * @param variable variable to check.
+     * @return {@code true} if variable type is injecteable by @Structure annotation.
+     * @since 0.1
+     */
+    public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable )
+    {
+        PsiType type = variable.getType();
+        String fieldClassQualifiedName = type.getCanonicalText();
+        return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1;
+    }
+
+    private PolygeneStructureAnnotationUtil()
+    {
+    }
+
+    public enum StructureAnnotationDeclarationValidationResult
+    {
+        invalidStructureAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidInjectionType,
+        valid,
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
deleted file mode 100644
index 2a5d3bf..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
-
-import static java.util.Arrays.sort;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneStructureAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure";
-
-    public static final String[] VALID_STRUCTURE_INJECTION_TYPE;
-
-    static
-    {
-        VALID_STRUCTURE_INJECTION_TYPE = new String[]
-            {
-                "org.apache.polygene.composite.CompositeBuilderFactory",
-                "org.apache.polygene.object.ObjectBuilderFactory",
-                "org.apache.polygene.entity.UnitOfWorkFactory",
-                "org.apache.polygene.service.ServiceFinder",
-                "org.apache.polygene.structure.Module",
-                "org.apache.polygene.structure.Layer",
-                "org.apache.polygene.structure.Application",
-                "org.apache.polygene.api.PolygeneAPI",
-                "org.apache.polygene.spi.PolygeneSPI"
-            };
-        sort( VALID_STRUCTURE_INJECTION_TYPE );
-    }
-
-    private PolygeneStructureAnnotationConstants()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
deleted file mode 100644
index c334276..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneStructureAnnotationUtil
-{
-    /**
-     * Returns {@code Structure} annotation if exists.
-     *
-     * @param modifierListOwner Modifier list owner.
-     * @return @Structure annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION );
-    }
-
-    /**
-     * Create structure annotation.
-     *
-     * @param project project to create structure annotation.
-     * @param context the context to create structure annotation.
-     * @return @Structure annotation.
-     */
-    @NotNull
-    public static PsiAnnotation createStructureAnnotation( @NotNull Project project,
-                                                           @NotNull PsiElement context )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context );
-    }
-
-    /**
-     * @param variable variable to check.
-     * @return Look at {@link StructureAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation structureAnnotation = getStructureAnnotation( variable );
-        if( structureAnnotation == null )
-        {
-            return invalidStructureAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        if( !isInjecteableByStructureAnnotation( variable ) )
-        {
-            return invalidInjectionType;
-        }
-
-        return valid;
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation.
-     *
-     * @param variable variable to check.
-     * @return {@code true} if variable type is injecteable by @Structure annotation.
-     * @since 0.1
-     */
-    public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable )
-    {
-        PsiType type = variable.getType();
-        String fieldClassQualifiedName = type.getCanonicalText();
-        return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1;
-    }
-
-    private PolygeneStructureAnnotationUtil()
-    {
-    }
-
-    public enum StructureAnnotationDeclarationValidationResult
-    {
-        invalidStructureAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidInjectionType,
-        valid,
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
new file mode 100644
index 0000000..c871b3d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneMixinConstants
+{
+    public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins";
+
+    private PolygeneMixinConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
new file mode 100644
index 0000000..729ff58
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
@@ -0,0 +1,196 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.mixins.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+import java.util.Set;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptySet;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
+import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneMixinUtil
+{
+    /**
+     * Get all valid mixin types of given the {@code psiClass} argument.
+     *
+     * @param psiClass The psi class to check.
+     * @return all vlaid mixin types of the given {@code psiClass} argument.
+     * @since 0.1
+     */
+    @NotNull
+    public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
+    {
+        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
+        if( mixinsAnnotation == null )
+        {
+            return emptySet();
+        }
+
+        Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
+        validMixinsType.add( psiClass );
+        return validMixinsType;
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
+    {
+        return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
+    {
+        if( mixinsAnnotation == null )
+        {
+            return emptyList();
+        }
+
+        String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
+        if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( mixinsAnnotation );
+    }
+
+    @Nullable
+    public static PsiAnnotation getMixinsAnnotation( PsiElement element )
+    {
+        PsiClass psiClass = getPSIClass( element );
+        if( psiClass == null )
+        {
+            return null;
+        }
+
+        return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
+    }
+
+    @NotNull
+    public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
+                                                             @NotNull PsiClass mixinClassToAdd )
+    {
+        Project project = modifierListOwner.getProject();
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
+
+        boolean isReplace = false;
+        PsiAnnotation newMixinsAnnotation;
+        if( existingMixinsAnnotation != null )
+        {
+            // Check duplicate
+            List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
+            for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+            {
+                PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
+                if( mixinClassReference == null )
+                {
+                    continue;
+                }
+
+                PsiElement mixinClass = mixinClassReference.resolve();
+                if( mixinClassToAdd.equals( mixinClass ) )
+                {
+                    return existingMixinsAnnotation;
+                }
+            }
+
+            isReplace = true;
+        }
+
+        String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
+        newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
+
+        if( isReplace )
+        {
+            // Replace @Mixins instead
+            existingMixinsAnnotation.replace( newMixinsAnnotation );
+        }
+        else
+        {
+            // @Mixins doesn't exists, add it as first child
+            PsiModifierList modifierList = modifierListOwner.getModifierList();
+            modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
+        }
+
+        // Shorten all class references if possible
+        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
+        codeStyleManager.shortenClassReferences( newMixinsAnnotation );
+
+        return newMixinsAnnotation;
+    }
+
+    @NotNull
+    private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
+                                                      @NotNull PsiClass mixinClassToAdd )
+    {
+        StringBuilder annotationTextBuilder = new StringBuilder();
+        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
+        List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
+        for( PsiAnnotationMemberValue mixinValue : mixinsValues )
+        {
+            annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
+        }
+        annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
+        annotationTextBuilder.append( "} )" );
+
+        return annotationTextBuilder.toString();
+    }
+
+
+    @Nullable
+    public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Validate whether psiClass is a mixin.
+     *
+     * @param psiClass psi class to check.
+     * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
+     */
+    public static boolean isAMixin( @NotNull PsiClass psiClass )
+    {
+        return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
+    }
+
+    private PolygeneMixinUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
deleted file mode 100644
index c871b3d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneMixinConstants
-{
-    public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins";
-
-    private PolygeneMixinConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
deleted file mode 100644
index 729ff58..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-import java.util.Set;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptySet;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
-import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneMixinUtil
-{
-    /**
-     * Get all valid mixin types of given the {@code psiClass} argument.
-     *
-     * @param psiClass The psi class to check.
-     * @return all vlaid mixin types of the given {@code psiClass} argument.
-     * @since 0.1
-     */
-    @NotNull
-    public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
-    {
-        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
-        if( mixinsAnnotation == null )
-        {
-            return emptySet();
-        }
-
-        Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
-        validMixinsType.add( psiClass );
-        return validMixinsType;
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
-    {
-        return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
-    {
-        if( mixinsAnnotation == null )
-        {
-            return emptyList();
-        }
-
-        String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
-        if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( mixinsAnnotation );
-    }
-
-    @Nullable
-    public static PsiAnnotation getMixinsAnnotation( PsiElement element )
-    {
-        PsiClass psiClass = getPSIClass( element );
-        if( psiClass == null )
-        {
-            return null;
-        }
-
-        return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
-    }
-
-    @NotNull
-    public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
-                                                             @NotNull PsiClass mixinClassToAdd )
-    {
-        Project project = modifierListOwner.getProject();
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
-
-        boolean isReplace = false;
-        PsiAnnotation newMixinsAnnotation;
-        if( existingMixinsAnnotation != null )
-        {
-            // Check duplicate
-            List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
-            for( PsiAnnotationMemberValue mixinValue : mixinsValues )
-            {
-                PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
-                if( mixinClassReference == null )
-                {
-                    continue;
-                }
-
-                PsiElement mixinClass = mixinClassReference.resolve();
-                if( mixinClassToAdd.equals( mixinClass ) )
-                {
-                    return existingMixinsAnnotation;
-                }
-            }
-
-            isReplace = true;
-        }
-
-        String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
-        newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
-
-        if( isReplace )
-        {
-            // Replace @Mixins instead
-            existingMixinsAnnotation.replace( newMixinsAnnotation );
-        }
-        else
-        {
-            // @Mixins doesn't exists, add it as first child
-            PsiModifierList modifierList = modifierListOwner.getModifierList();
-            modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
-        }
-
-        // Shorten all class references if possible
-        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
-        codeStyleManager.shortenClassReferences( newMixinsAnnotation );
-
-        return newMixinsAnnotation;
-    }
-
-    @NotNull
-    private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
-                                                      @NotNull PsiClass mixinClassToAdd )
-    {
-        StringBuilder annotationTextBuilder = new StringBuilder();
-        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
-        List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
-        for( PsiAnnotationMemberValue mixinValue : mixinsValues )
-        {
-            annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
-        }
-        annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
-        annotationTextBuilder.append( "} )" );
-
-        return annotationTextBuilder.toString();
-    }
-
-
-    @Nullable
-    public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Validate whether psiClass is a mixin.
-     *
-     * @param psiClass psi class to check.
-     * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
-     */
-    public static boolean isAMixin( @NotNull PsiClass psiClass )
-    {
-        return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
-    }
-
-    private PolygeneMixinUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
new file mode 100644
index 0000000..d3c269f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneSideEffectConstants
+{
+    public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects";
+
+    public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf";
+    public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect";
+
+    private PolygeneSideEffectConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
new file mode 100644
index 0000000..c1533fc
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneSideEffectUtil
+{
+    /**
+     * @param searchContext Search context.
+     * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getGenericSideEffectClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericSideEffectClass( @NotNull Project project,
+                                                      @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
+    }
+
+    /**
+     * @param searchContext Search context.
+     * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getSideEffectOfClass( project, searchScope );
+    }
+
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
+     *         Returns {@code null} if not found.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getSideEffectOfClass( @NotNull Project project,
+                                                 @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
+    }
+
+    /**
+     * @param elementWithinJavaClass element within java class.
+     * @return {@code @SideEffects} annotation declaration of the class that contains the element.
+     *         Returns {@code null} if not found, or {@code element} is an invalid context.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
+    {
+        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
+        return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
+    }
+
+    /**
+     * @param annotation annotation to process.
+     * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
+     *         {@code null} or annotation is not a {@code @SideEffects} annotation.
+     * @since 0.1
+     */
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
+    {
+        if( annotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = annotation.getQualifiedName();
+        if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( annotation );
+    }
+
+    /**
+     * @param value annotation member value.
+     * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
+     *         class reference.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
+     *
+     * @param psiClass class to check.
+     * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
+     * @since 0.1
+     */
+    public static boolean isASideEffect( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
+        return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
+     *         {@code psiClass} does
+     *         not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
+     * @since 0.1
+     */
+    public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
+        return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
+    }
+
+    private PolygeneSideEffectUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
deleted file mode 100644
index d3c269f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneSideEffectConstants
-{
-    public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects";
-
-    public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf";
-    public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect";
-
-    private PolygeneSideEffectConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
deleted file mode 100644
index c1533fc..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneSideEffectUtil
-{
-    /**
-     * @param searchContext Search context.
-     * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getGenericSideEffectClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericSideEffectClass( @NotNull Project project,
-                                                      @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
-    }
-
-    /**
-     * @param searchContext Search context.
-     * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getSideEffectOfClass( project, searchScope );
-    }
-
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getSideEffectOfClass( @NotNull Project project,
-                                                 @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
-    }
-
-    /**
-     * @param elementWithinJavaClass element within java class.
-     * @return {@code @SideEffects} annotation declaration of the class that contains the element.
-     *         Returns {@code null} if not found, or {@code element} is an invalid context.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
-    {
-        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
-        return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
-    }
-
-    /**
-     * @param annotation annotation to process.
-     * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
-     *         {@code null} or annotation is not a {@code @SideEffects} annotation.
-     * @since 0.1
-     */
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
-    {
-        if( annotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = annotation.getQualifiedName();
-        if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( annotation );
-    }
-
-    /**
-     * @param value annotation member value.
-     * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
-     *         class reference.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
-     *
-     * @param psiClass class to check.
-     * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
-     * @since 0.1
-     */
-    public static boolean isASideEffect( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
-        return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
-     *         {@code psiClass} does
-     *         not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
-     * @since 0.1
-     */
-    public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
-        return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
-    }
-
-    private PolygeneSideEffectUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
new file mode 100644
index 0000000..8c5f29b
--- /dev/null
+++ b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
@@ -0,0 +1,164 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+#
+#
+#
+
+# *****************************************************************************
+# Common
+# *****************************************************************************
+polygene.quick.fixes.family.name=Polygene
+polygene.action.group.title=Polygene
+polygene.action.group.description=Polygene
+polygene.inspections.name=Polygene issues
+polygene.file.template.group.title=Polygene
+
+# *****************************************************************************
+# Concern
+# *****************************************************************************
+
+# =========
+# Intention
+# =========
+add.concern.family.name=Add Polygene Concern
+add.concern.name=Add Polygene Concern
+
+# ==========
+# Inspection
+# ==========
+concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
+concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class.
+concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
+concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
+concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
+
+# =======
+# Actions
+# =======
+
+# -------------------------
+# Create concern in package
+# -------------------------
+createConcernOfInPackage.menu.action.text=Polygene Concern Of
+createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf
+createConcernOfInPackage.dlg.title=New Polygene ConcernOf
+createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
+createConcernOfInPackage.command.name=Create ConcernOf
+createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
+createConcernOfInPackage.error.title=Create concern fail
+
+# *****************************************************************************
+# Mixin
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+
+# ----------------------------
+# Mixins implements mixin type
+# ----------------------------
+mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
+mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
+mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
+mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
+mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
+mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
+
+# ------------------------------------------
+# Mixins declared on mixin type or composite
+# ------------------------------------------
+mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
+mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
+mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
+
+# *****************************************************************************
+# Side Effect
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
+side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class.
+side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
+side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
+side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
+
+# *****************************************************************************
+# Injections
+# *****************************************************************************
+
+# -----------------
+# Common Inspection
+# -----------------
+abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
+
+# -------------------
+# @Structure injection
+# -------------------
+
+# ==========
+# Inspection
+# ==========
+injections.structure.annotation.declared.correctly.name.display=@Structure Injection
+injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
+injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
+
+# -----------------
+# @Service injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.service.annotation.declared.correctly.name.display=@Service Injection
+injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
+injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
+
+# -----------------
+# @Invocation injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
+injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
+injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
+injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
+
+# *****************************************************************************
+# Applies To
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
+applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
+applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
+applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
+applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
deleted file mode 100644
index 8c5f29b..0000000
--- a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you 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.
-#
-#
-#
-
-# *****************************************************************************
-# Common
-# *****************************************************************************
-polygene.quick.fixes.family.name=Polygene
-polygene.action.group.title=Polygene
-polygene.action.group.description=Polygene
-polygene.inspections.name=Polygene issues
-polygene.file.template.group.title=Polygene
-
-# *****************************************************************************
-# Concern
-# *****************************************************************************
-
-# =========
-# Intention
-# =========
-add.concern.family.name=Add Polygene Concern
-add.concern.name=Add Polygene Concern
-
-# ==========
-# Inspection
-# ==========
-concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
-concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class.
-concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
-concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
-concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
-
-# =======
-# Actions
-# =======
-
-# -------------------------
-# Create concern in package
-# -------------------------
-createConcernOfInPackage.menu.action.text=Polygene Concern Of
-createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf
-createConcernOfInPackage.dlg.title=New Polygene ConcernOf
-createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
-createConcernOfInPackage.command.name=Create ConcernOf
-createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
-createConcernOfInPackage.error.title=Create concern fail
-
-# *****************************************************************************
-# Mixin
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-
-# ----------------------------
-# Mixins implements mixin type
-# ----------------------------
-mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
-mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
-mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
-mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
-mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
-mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
-
-# ------------------------------------------
-# Mixins declared on mixin type or composite
-# ------------------------------------------
-mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
-mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
-mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
-
-# *****************************************************************************
-# Side Effect
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
-side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class.
-side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
-side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
-side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
-
-# *****************************************************************************
-# Injections
-# *****************************************************************************
-
-# -----------------
-# Common Inspection
-# -----------------
-abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
-
-# -------------------
-# @Structure injection
-# -------------------
-
-# ==========
-# Inspection
-# ==========
-injections.structure.annotation.declared.correctly.name.display=@Structure Injection
-injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
-injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
-
-# -----------------
-# @Service injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.service.annotation.declared.correctly.name.display=@Service Injection
-injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
-injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
-
-# -----------------
-# @Invocation injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
-injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
-injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
-injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
-
-# *****************************************************************************
-# Applies To
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
-applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
-applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
-applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
-applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference


[64/81] [abbrv] zest-java git commit: ZEST-195 ; Fix file names.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/shell/src/dist/bin/polygene-boot
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/bin/polygene-boot b/tools/shell/src/dist/bin/polygene-boot
new file mode 100644
index 0000000..5c0306a
--- /dev/null
+++ b/tools/shell/src/dist/bin/polygene-boot
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+#
+# This files copies itself to $HOME/bin, renames itself to "polygene"
+# and from then on pretends to be the tools.shell script.
+#
+
+JARNAME=org.apache.polygene.tool.shell-@version@.jar
+
+MYNAME=`basename $0`
+
+# check if it is executing as boot script or regular script.
+if [ "$MYNAME" == "polygene-boot" ] ; then
+    mkdir $HOME/bin >/dev/null 2>&1
+    cp $0 $HOME/bin/polygene
+    if [ -f $HOME/bin/$JARNAME ] ; then
+        echo "JAR file exists."
+    else
+        JAR_URL=http://repo1.maven.org/maven2/org/apache/polygene/$JARNAME
+
+        # check for wget
+        WGET=`which wget`
+
+        if [ "$WGET" == "" ] ; then
+
+            # check for curl
+            CURL=`which curl`
+            if [ "$CURL" == "" ] ; then
+                echo "You need either wget or curl installed to use this script."
+                exit 1
+            else
+                curl --output $HOME/bin/ $JAR_URL
+            fi
+        else
+            wget --output-document=$HOME/bin/ $HOME/bin/polygene $JAR_URL
+        fi
+    fi
+else
+    # Capture current directory
+    CWD=`pwd`
+
+    # Goto directory where this script was started from.
+    cd `dirname $0`
+    # Up one level
+    cd ..
+    # Get the home directory of Polygene
+    POLYGENEPATH=`pwd`
+
+    # Figure out if we are executing from within the SDK or the QuickStart
+    if [ -f libs/$JARNAME ] ; then
+        JARFILE=libs/$JARNAME
+    else
+        if [ -f bin/$JARNAME ] ; then
+            JARFILE=bin/$JARNAME
+        else
+        fi
+    fi
+    # Restore the current directory
+    cd $CWD
+
+    java -Dpolygene.home=$POLYGENEPATH -jar $POLYGENEPATH/$JARFILE "$@"
+fi
+
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/shell/src/dist/bin/zest-boot
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/bin/zest-boot b/tools/shell/src/dist/bin/zest-boot
deleted file mode 100644
index 5c0306a..0000000
--- a/tools/shell/src/dist/bin/zest-boot
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you 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.
-#
-#
-# This files copies itself to $HOME/bin, renames itself to "polygene"
-# and from then on pretends to be the tools.shell script.
-#
-
-JARNAME=org.apache.polygene.tool.shell-@version@.jar
-
-MYNAME=`basename $0`
-
-# check if it is executing as boot script or regular script.
-if [ "$MYNAME" == "polygene-boot" ] ; then
-    mkdir $HOME/bin >/dev/null 2>&1
-    cp $0 $HOME/bin/polygene
-    if [ -f $HOME/bin/$JARNAME ] ; then
-        echo "JAR file exists."
-    else
-        JAR_URL=http://repo1.maven.org/maven2/org/apache/polygene/$JARNAME
-
-        # check for wget
-        WGET=`which wget`
-
-        if [ "$WGET" == "" ] ; then
-
-            # check for curl
-            CURL=`which curl`
-            if [ "$CURL" == "" ] ; then
-                echo "You need either wget or curl installed to use this script."
-                exit 1
-            else
-                curl --output $HOME/bin/ $JAR_URL
-            fi
-        else
-            wget --output-document=$HOME/bin/ $HOME/bin/polygene $JAR_URL
-        fi
-    fi
-else
-    # Capture current directory
-    CWD=`pwd`
-
-    # Goto directory where this script was started from.
-    cd `dirname $0`
-    # Up one level
-    cd ..
-    # Get the home directory of Polygene
-    POLYGENEPATH=`pwd`
-
-    # Figure out if we are executing from within the SDK or the QuickStart
-    if [ -f libs/$JARNAME ] ; then
-        JARFILE=libs/$JARNAME
-    else
-        if [ -f bin/$JARNAME ] ; then
-            JARFILE=bin/$JARNAME
-        else
-        fi
-    fi
-    # Restore the current directory
-    cd $CWD
-
-    java -Dpolygene.home=$POLYGENEPATH -jar $POLYGENEPATH/$JARFILE "$@"
-fi
-
-

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tutorials/introduction/src/docs/polygene-cop.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/src/docs/polygene-cop.txt b/tutorials/introduction/src/docs/polygene-cop.txt
new file mode 100644
index 0000000..2de1ed9
--- /dev/null
+++ b/tutorials/introduction/src/docs/polygene-cop.txt
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+///////////////////////////////////////////////////////////////
+
+[[polygene-cop,COP with Java and Polygene\u2122]]
+= COP with Java and Polygene\u2122 =
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tutorials/introduction/src/docs/zest-cop.txt
----------------------------------------------------------------------
diff --git a/tutorials/introduction/src/docs/zest-cop.txt b/tutorials/introduction/src/docs/zest-cop.txt
deleted file mode 100644
index 2de1ed9..0000000
--- a/tutorials/introduction/src/docs/zest-cop.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
-///////////////////////////////////////////////////////////////
-
-[[polygene-cop,COP with Java and Polygene\u2122]]
-= COP with Java and Polygene\u2122 =
-


[63/81] [abbrv] zest-java git commit: ZEST-195 ; Clean up the mistakes in the rename.

Posted by ni...@apache.org.
ZEST-195 ; Clean up the mistakes in the rename.


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

Branch: refs/heads/develop
Commit: b02063bd7482c61cead2211dae901cc0d78fe187
Parents: 54b69c4
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Wed Dec 14 09:38:03 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Wed Dec 14 09:38:07 2016 +0800

----------------------------------------------------------------------
 .../polygene/gradle/PolygeneExtension.groovy    |  79 ++++
 .../apache/polygene/gradle/ZestExtension.groovy |  79 ----
 .../gradle/publish/MavenMetadata.groovy         |   2 +-
 .../org/apache/polygene/api/PolygeneAPI.java    | 188 ++++++++++
 .../java/org/apache/polygene/api/ZestAPI.java   | 188 ----------
 .../DeclareConfigurationDefaultsTest.java       |   2 +-
 .../api/injection/scope/StateFieldTest.java     |   2 +-
 .../decoratorMixin/DecoratorMixinTest.java      |   2 +-
 .../api/property/PropertyErrorTest.java         |   2 +-
 .../api/unitofwork/UnitOfWorkTemplateTest.java  |   2 +-
 .../polygene/bootstrap/PolygeneRuntime.java     |  38 ++
 .../apache/polygene/bootstrap/ZestRuntime.java  |  38 --
 .../polygene/runtime/PolygeneRuntimeImpl.java   | 360 +++++++++++++++++++
 .../polygene/runtime/ZestRuntimeImpl.java       | 360 -------------------
 .../polygene/api/common/OptionalTest.java       |   2 +-
 .../polygene/api/common/PropertyErrorTest.java  |   2 +-
 .../polygene/api/common/PropertyTypeTest.java   |   2 +-
 .../polygene/api/common/ValueCompositeTest.java |   2 +-
 .../regression/qi230/Qi230IssueTest.java        |   2 +-
 ...faceCollisionWithRelatedReturnTypesTest.java |   2 +-
 .../polygene/regression/qi383/Qi383Test.java    |   2 +-
 .../polygene/regression/qi59/IssueTest.java     |   2 +-
 .../polygene/runtime/PolygeneAPITest.java       |  87 +++++
 .../polygene/runtime/PolygeneSPITest.java       | 129 +++++++
 .../apache/polygene/runtime/ZestAPITest.java    |  87 -----
 .../apache/polygene/runtime/ZestSPITest.java    | 129 -------
 .../runtime/appliesto/AppliesToFilterTest.java  |   2 +-
 .../AppliesToOrConditionQI241Test.java          |   2 +-
 .../association/AssociationEqualityTest.java    |   2 +-
 .../DereferenceForBootstrappedConcernsTest.java |   2 +-
 .../runtime/composite/AbstractMixinTest.java    |   2 +-
 .../composite/CompositeFactoryImplTest.java     |   2 +-
 .../runtime/composite/MapOverrideTest.java      |   2 +-
 .../polygene/runtime/composite/QI247Test2.java  |   2 +-
 .../runtime/composite/TransientAsClassTest.java |   2 +-
 .../runtime/concerns/GenericConcernTest.java    |   2 +-
 .../concerns/PropertyInheritanceTest.java       |   2 +-
 .../runtime/constraints/ConstraintsTest.java    |   2 +-
 .../polygene/runtime/entity/AggregatedTest.java |   2 +-
 .../entity/EntityCompositeEqualityTest.java     |   2 +-
 .../runtime/entity/EntityCreationTest.java      |   2 +-
 .../polygene/runtime/entity/EntityTypeTest.java |   2 +-
 .../polygene/runtime/entity/QI273Test.java      |   2 +-
 .../entity/associations/AssociationTest.java    |   2 +-
 .../associations/ImmutableAssociationTest.java  |   2 +-
 .../IllegalUnitOfWorkInjectionTest.java         |   2 +-
 .../runtime/injection/UsesGenericClassTest.java |   2 +-
 .../runtime/injection/UsesGraphTest.java        |   2 +-
 .../ServiceInstantiationTests.java              |   2 +-
 .../runtime/mixin/AssemblyMixinTest.java        |   2 +-
 .../InvokeServiceFromModuleAssemblyTest.java    |   2 +-
 .../mixin/MethodInterceptionMixinTest.java      |   2 +-
 .../runtime/mixin/PrivateMixinTest.java         |   2 +-
 .../polygene/runtime/mixin/Qi228Test.java       |   2 +-
 .../runtime/property/ImmutablePropertyTest.java |   2 +-
 .../property/PropertyStringArrayTest.java       |   2 +-
 .../polygene/runtime/property/PropertyTest.java |   2 +-
 .../query/QueryBuilderFactoryImplTest.java      |   2 +-
 .../runtime/service/ComplexActivatableTest.java |   2 +-
 .../runtime/service/ServiceFinderTest.java      |   2 +-
 .../sideeffects/GenericSideEffectTest.java      |   2 +-
 .../sideeffects/SampleTransientTest.java        |   2 +-
 .../runtime/threaded/ContextCompositeTest.java  |   2 +-
 .../unitofwork/AutoCloseableUoWTest.java        |   2 +-
 .../runtime/value/ValueCompositeBasicsTest.java |   2 +-
 .../service/importer/NewObjectImporterTest.java |   2 +-
 .../importer/ServiceInstanceImporterTest.java   |   2 +-
 .../test/composite/CleanStackTraceTest.java     |   2 +-
 .../org/apache/polygene/spi/PolygeneSPI.java    |  75 ++++
 .../java/org/apache/polygene/spi/ZestSPI.java   |  75 ----
 .../polygene/test/AbstractPolygeneBaseTest.java | 135 +++++++
 .../test/AbstractPolygeneScenarioTest.java      | 142 ++++++++
 .../polygene/test/AbstractPolygeneTest.java     | 120 +++++++
 .../polygene/test/AbstractZestBaseTest.java     | 135 -------
 .../polygene/test/AbstractZestScenarioTest.java | 142 --------
 .../apache/polygene/test/AbstractZestTest.java  | 120 -------
 .../test/cache/AbstractCachePoolTest.java       |   2 +-
 ...AbstractValueCompositeSerializationTest.java |   2 +-
 doap.rdf                                        |   2 +-
 .../entitystore/DocumentationSupport.java       |   2 +-
 .../postgresql/PostgreSQLDBIntegrityTest.java   |   2 +-
 .../library/alarm/AlarmHistoryImplTest.java     |   2 +-
 .../library/alarm/AlarmPointImplTest.java       |   2 +-
 .../library/alarm/SimpleAlarmModelTest.java     |   2 +-
 .../library/alarm/StandardAlarmModelTest.java   |   2 +-
 .../BreaksCircuitOnThrowableTest.java           |   2 +-
 .../library/constraints/ConstraintTest.java     |   2 +-
 .../library/http/AbstractJettyTest.java         |   3 +-
 .../library/http/JettyJMXStatisticsTest.java    |   2 +-
 libraries/http/src/test/resources/logback.xml   |   2 +-
 .../http/src/vhost-test/resources/logback.xml   |   2 +-
 .../polygene/library/jmx/PolygeneMBeans.java    |  39 ++
 .../apache/polygene/library/jmx/ZestMBeans.java |  39 --
 .../library/groovy/GroovyMixinTest.java         |   2 +-
 .../metrics/AbstractTimingCaptureTest.java      |   3 +-
 .../polygene/library/rdf/PolygeneEntity.java    |  39 ++
 .../library/rdf/PolygeneEntityType.java         |  39 ++
 .../polygene/library/rdf/PolygeneRdf.java       |  87 +++++
 .../apache/polygene/library/rdf/ZestEntity.java |  39 --
 .../polygene/library/rdf/ZestEntityType.java    |  39 --
 .../apache/polygene/library/rdf/ZestRdf.java    |  87 -----
 .../rdf/serializer/AbstractSerializer.java      |   2 +-
 .../library/rdf/ApplicationXmlTest.java         |   2 +-
 .../rdf/entity/EntitySerializerTest.java        |   2 +-
 .../rdf/entity/EntityTypeSerializerTest.java    |   2 +-
 .../rdf/repository/MemoryRepositoryTest.java    |   2 +-
 .../rest/client/ContinuousIntegrationTest.java  |   2 +-
 .../library/rest/admin/PolygeneFinder.java      |  45 +++
 .../rest/admin/PolygeneServerServlet.java       |  44 +++
 .../admin/PolygeneServerServletService.java     |  34 ++
 .../polygene/library/rest/admin/ZestFinder.java |  45 ---
 .../library/rest/admin/ZestServerServlet.java   |  44 ---
 .../rest/admin/ZestServerServletService.java    |  34 --
 .../library/restlet/PolygeneEntityRestlet.java  | 311 ++++++++++++++++
 .../library/restlet/PolygeneServerServlet.java  |  51 +++
 .../library/restlet/ZestEntityRestlet.java      | 311 ----------------
 .../library/restlet/ZestServerServlet.java      |  51 ---
 .../serialization/PolygeneConverter.java        | 268 ++++++++++++++
 .../restlet/serialization/ZestConverter.java    | 268 --------------
 .../library/servlet/PolygeneFilter.java         |  51 +++
 .../library/servlet/PolygeneServlet.java        |  56 +++
 .../library/servlet/PolygeneServletSupport.java |  44 +++
 .../polygene/library/servlet/ZestFilter.java    |  51 ---
 .../polygene/library/servlet/ZestServlet.java   |  56 ---
 .../library/servlet/ZestServletSupport.java     |  44 ---
 .../library/shiro/PasswordDomainTest.java       |   4 +-
 .../library/shiro/PermissionsDomainTest.java    |   4 +-
 .../library/shiro/RealmServiceTest.java         |   4 +-
 .../library/shiro/StandaloneShiroTest.java      |   4 +-
 .../library/shiro/web/WebHttpShiroTest.java     |   2 +-
 .../library/shiro/web/WebRealmServiceTest.java  |   2 +-
 .../library/spring/bootstrap/Constants.java     |   2 +-
 .../bootstrap/PolygeneApplicationBootstrap.java |  88 +++++
 .../bootstrap/ZestApplicationBootstrap.java     |  88 -----
 .../internal/PolygeneNamespaceHandler.java      |  34 ++
 .../internal/ZestNamespaceHandler.java          |  34 --
 .../PolygeneApplicationFactoryBean.java         | 119 ++++++
 .../PolygeneBootstrapBeanDefinitionParser.java  | 103 ++++++
 .../application/ZestApplicationFactoryBean.java | 119 ------
 .../ZestBootstrapBeanDefinitionParser.java      | 103 ------
 .../PolygeneServiceBeanDefinitionParser.java    |  55 +++
 .../ZestServiceBeanDefinitionParser.java        |  55 ---
 .../library/spring/MyPolygeneBootstrapper.java  |  50 +++
 .../library/spring/MyZestBootstrapper.java      |  50 ---
 .../bootstrap/PolygeneExportServiceTest.java    |  59 +++
 .../spring/bootstrap/PolygeneTestBootstrap.java |  57 +++
 .../spring/bootstrap/ZestExportServiceTest.java |  59 ---
 .../spring/bootstrap/ZestTestBootstrap.java     |  58 ---
 .../importer/PolygeneImportServiceTest.java     | 118 ++++++
 .../spring/importer/ZestImportServiceTest.java  | 118 ------
 .../sql/datasource/ExternalDataSourceTest.java  |   2 +-
 .../uid/sequence/PersistingSequencingTest.java  |   2 +-
 .../uid/sequence/TransientSequencingTest.java   |   2 +-
 .../library/uid/uuid/UuidServiceTest.java       |   2 +-
 .../src/docs/tutorials/howto-depend-on-zest.txt |  40 +--
 .../docs/tutorials/howto-releasing-apache.txt   |   8 +-
 .../README-for-regression-reporting.txt         |   2 +-
 .../idea/PolygeneApplicationComponent.java      | 133 +++++++
 .../plugin/idea/ZestApplicationComponent.java   | 133 -------
 .../common/inspections/AbstractInspection.java  |   4 +-
 .../ZestStructureAnnotationConstants.java       |   2 +-
 tools/shell/src/dist/bin/zest-boot              |   4 +-
 .../tutorials/cargo/step2/Step2TestCase.java    |   2 +-
 .../polygene/tutorials/hello/HelloTest.java     |   2 +-
 .../polygene/tutorials/hello/HelloTest4.java    |   2 +-
 .../tutorials/services/step2/LibraryTest.java   |   2 +-
 .../tutorials/services/step3/LibraryTest.java   |   2 +-
 .../tutorials/services/step4/LibraryTest.java   |   2 +-
 .../tutorials/services/step6/LibraryTest.java   |   2 +-
 169 files changed, 3409 insertions(+), 3410 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
new file mode 100644
index 0000000..41e472a
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/PolygeneExtension.groovy
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.gradle
+
+import groovy.transform.CompileStatic
+import org.gradle.api.Project
+import org.gradle.api.artifacts.Dependency
+
+@CompileStatic
+class PolygeneExtension
+{
+  private final Project project
+  final Core core
+
+  PolygeneExtension( Project project )
+  {
+    this.project = project
+    this.core = new Core()
+  }
+
+  boolean isDevelopmentVersion()
+  {
+    return project.version == '0' || project.version.toString().contains( 'SNAPSHOT' )
+  }
+
+  boolean isReleaseVersion()
+  {
+    return !isDevelopmentVersion()
+  }
+
+  class Core
+  {
+    Dependency api = core( 'api' )
+    Dependency spi = core( 'spi' )
+    Dependency runtime = core( 'runtime' )
+    Dependency bootstrap = core( 'bootstrap' )
+    Dependency testsupport = core( 'testsupport' )
+  }
+
+  private Dependency core( String name )
+  {
+    return dependency( 'org.apache.polygene.core', "org.apache.polygene.core.$name" )
+  }
+
+  Dependency library( String name )
+  {
+    return dependency( 'org.apache.polygene.libraries', "org.apache.polygene.library.$name" )
+  }
+
+  Dependency extension( String name )
+  {
+    return dependency( 'org.apache.polygene.extensions', "org.apache.polygene.extension.$name" )
+  }
+
+  Dependency tool( String name )
+  {
+    return dependency( 'org.apache.polygene.tools', "org.apache.polygene.tool.$name" )
+  }
+
+  private Dependency dependency( String group, String name )
+  {
+    project.dependencies.project( path: ":$group:$name" )
+  }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
deleted file mode 100644
index 41e472a..0000000
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/ZestExtension.groovy
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.gradle
-
-import groovy.transform.CompileStatic
-import org.gradle.api.Project
-import org.gradle.api.artifacts.Dependency
-
-@CompileStatic
-class PolygeneExtension
-{
-  private final Project project
-  final Core core
-
-  PolygeneExtension( Project project )
-  {
-    this.project = project
-    this.core = new Core()
-  }
-
-  boolean isDevelopmentVersion()
-  {
-    return project.version == '0' || project.version.toString().contains( 'SNAPSHOT' )
-  }
-
-  boolean isReleaseVersion()
-  {
-    return !isDevelopmentVersion()
-  }
-
-  class Core
-  {
-    Dependency api = core( 'api' )
-    Dependency spi = core( 'spi' )
-    Dependency runtime = core( 'runtime' )
-    Dependency bootstrap = core( 'bootstrap' )
-    Dependency testsupport = core( 'testsupport' )
-  }
-
-  private Dependency core( String name )
-  {
-    return dependency( 'org.apache.polygene.core', "org.apache.polygene.core.$name" )
-  }
-
-  Dependency library( String name )
-  {
-    return dependency( 'org.apache.polygene.libraries', "org.apache.polygene.library.$name" )
-  }
-
-  Dependency extension( String name )
-  {
-    return dependency( 'org.apache.polygene.extensions', "org.apache.polygene.extension.$name" )
-  }
-
-  Dependency tool( String name )
-  {
-    return dependency( 'org.apache.polygene.tools', "org.apache.polygene.tool.$name" )
-  }
-
-  private Dependency dependency( String group, String name )
-  {
-    project.dependencies.project( path: ":$group:$name" )
-  }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
index 74c5dcf..85f9ebd 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/MavenMetadata.groovy
@@ -33,7 +33,7 @@ class MavenMetadata
         inceptionYear '2007'
         issueManagement {
           system 'jira'
-          url 'https://issues.apache.org/jira/browse/ZEST'
+          url 'https://issues.apache.org/jira/browse/POLYGENE'
         }
         scm {
           url "https://github.com/apache/polygene-java"

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java b/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
new file mode 100644
index 0000000..ae03999
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
@@ -0,0 +1,188 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.function.Function;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * Encapsulation of the Polygene API.
+ */
+public interface PolygeneAPI
+{
+    /**
+     * If a Modifier gets a reference to the Composite using @This,
+     * then that reference must be dereferenced using this method
+     * before handing it out for others to use.
+     *
+     * @param <T>       Parameterized type of the Composite
+     * @param composite instance reference injected in Modified using @This
+     *
+     * @return the dereferenced Composite
+     */
+    <T> T dereference( T composite );
+
+    /**
+     * Returns the Module or UnitOfWork where the Composite belongs.
+     *
+     * @param compositeOrUow The Composite (Service, Value, Entity or Transient) or UnitOfWork to lookup the Module it
+     *                       belongs to.
+     *
+     * @return The Module instance where the Composite or UnitOfWork belongs to.
+     */
+    ModuleDescriptor moduleOf( Object compositeOrUow );
+
+    /**
+     * Returns the ModelDescriptor of the Composite.
+     *
+     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
+     *                                    ModelDescriptor
+     *
+     * @return The ModelDescriptor of the Composite
+     */
+    ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference );
+
+    /**
+     * Returns the CompositeDescriptor of the Composite.
+     *
+     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
+     *                                    CompositeDescriptor
+     *
+     * @return The CompositeDescriptor of the Composite
+     */
+    CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference );
+
+    /**
+     * Returns the TransientDescriptor of the TransientComposite.
+     *
+     * @param transsient The TransientComposite for which to lookup the TransientDescriptor
+     *
+     * @return The TransientDescriptor of the TransientComposite
+     */
+    TransientDescriptor transientDescriptorFor( Object transsient );
+
+    /**
+     * Returns the EntityDescriptor of the EntityComposite.
+     *
+     * @param entity The EntityComposite for which to lookup the EntityDescriptor
+     *
+     * @return The EntityDescriptor of the EntityComposite
+     */
+    EntityDescriptor entityDescriptorFor( Object entity );
+
+    /**
+     * Returns the ValueDescriptor of the ValueComposite.
+     *
+     * @param value The ValueComposite for which to lookup the ValueDescriptor
+     *
+     * @return The ValueDescriptor of the ValueComposite
+     */
+    ValueDescriptor valueDescriptorFor( Object value );
+
+    /**
+     * Returns the ServiceDescriptor of the ServiceComposite.
+     *
+     * @param service The ServiceComposite for which to lookup the ServiceDescriptor
+     *
+     * @return The ServiceDescriptor of the ServiceComposite
+     */
+    ServiceDescriptor serviceDescriptorFor( Object service );
+
+    /**
+     * Returns the PropertyDescriptor of the Property.
+     *
+     * @param property The Property for which to lookup the PropertyDescriptor
+     *
+     * @return The PropertyDescriptor of the Property
+     */
+    PropertyDescriptor propertyDescriptorFor( Property<?> property );
+
+    /**
+     * Returns the AssociationDescriptor of the Association.
+     *
+     * @param association The Association for which to lookup the AssociationDescriptor
+     *
+     * @return The AssociationDescriptor of the Association
+     */
+    AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
+
+    /**
+     * Function that returns the CompositeDescriptor of a Composite.
+     */
+    Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
+        if( composite instanceof Proxy )
+        {
+            InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
+            return ( (CompositeInstance) invocationHandler ).descriptor();
+        }
+        try
+        {
+            Class<? extends Composite> compositeClass = composite.getClass();
+            Field instanceField = compositeClass.getField( "_instance" );
+            Object instance = instanceField.get( composite );
+            return ( (CompositeInstance) instance ).descriptor();
+        }
+        catch( Exception e )
+        {
+            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
+            exception.initCause( e );
+            throw exception;
+        }
+    };
+
+    /**
+     * Function that returns the CompositeInstance of a Composite.
+     */
+    Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
+        if( composite instanceof Proxy )
+        {
+            return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) );
+        }
+        try
+        {
+            Class<? extends Composite> compositeClass = composite.getClass();
+            Field instanceField = compositeClass.getField( "_instance" );
+            Object instance = instanceField.get( composite );
+            return (CompositeInstance) instance;
+        }
+        catch( Exception e )
+        {
+            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
+            exception.initCause( e );
+            throw exception;
+        }
+    };
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java b/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
deleted file mode 100644
index ae03999..0000000
--- a/core/api/src/main/java/org/apache/polygene/api/ZestAPI.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.api;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-import java.util.function.Function;
-import org.apache.polygene.api.association.AbstractAssociation;
-import org.apache.polygene.api.association.AssociationDescriptor;
-import org.apache.polygene.api.composite.Composite;
-import org.apache.polygene.api.composite.CompositeDescriptor;
-import org.apache.polygene.api.composite.CompositeInstance;
-import org.apache.polygene.api.composite.InvalidCompositeException;
-import org.apache.polygene.api.composite.ModelDescriptor;
-import org.apache.polygene.api.composite.TransientDescriptor;
-import org.apache.polygene.api.entity.EntityDescriptor;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.property.PropertyDescriptor;
-import org.apache.polygene.api.service.ServiceDescriptor;
-import org.apache.polygene.api.structure.ModuleDescriptor;
-import org.apache.polygene.api.value.ValueDescriptor;
-
-/**
- * Encapsulation of the Polygene API.
- */
-public interface PolygeneAPI
-{
-    /**
-     * If a Modifier gets a reference to the Composite using @This,
-     * then that reference must be dereferenced using this method
-     * before handing it out for others to use.
-     *
-     * @param <T>       Parameterized type of the Composite
-     * @param composite instance reference injected in Modified using @This
-     *
-     * @return the dereferenced Composite
-     */
-    <T> T dereference( T composite );
-
-    /**
-     * Returns the Module or UnitOfWork where the Composite belongs.
-     *
-     * @param compositeOrUow The Composite (Service, Value, Entity or Transient) or UnitOfWork to lookup the Module it
-     *                       belongs to.
-     *
-     * @return The Module instance where the Composite or UnitOfWork belongs to.
-     */
-    ModuleDescriptor moduleOf( Object compositeOrUow );
-
-    /**
-     * Returns the ModelDescriptor of the Composite.
-     *
-     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
-     *                                    ModelDescriptor
-     *
-     * @return The ModelDescriptor of the Composite
-     */
-    ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference );
-
-    /**
-     * Returns the CompositeDescriptor of the Composite.
-     *
-     * @param compositeOrServiceReference The Composite (Service, Value, Entity or Transient) for which to lookup the
-     *                                    CompositeDescriptor
-     *
-     * @return The CompositeDescriptor of the Composite
-     */
-    CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference );
-
-    /**
-     * Returns the TransientDescriptor of the TransientComposite.
-     *
-     * @param transsient The TransientComposite for which to lookup the TransientDescriptor
-     *
-     * @return The TransientDescriptor of the TransientComposite
-     */
-    TransientDescriptor transientDescriptorFor( Object transsient );
-
-    /**
-     * Returns the EntityDescriptor of the EntityComposite.
-     *
-     * @param entity The EntityComposite for which to lookup the EntityDescriptor
-     *
-     * @return The EntityDescriptor of the EntityComposite
-     */
-    EntityDescriptor entityDescriptorFor( Object entity );
-
-    /**
-     * Returns the ValueDescriptor of the ValueComposite.
-     *
-     * @param value The ValueComposite for which to lookup the ValueDescriptor
-     *
-     * @return The ValueDescriptor of the ValueComposite
-     */
-    ValueDescriptor valueDescriptorFor( Object value );
-
-    /**
-     * Returns the ServiceDescriptor of the ServiceComposite.
-     *
-     * @param service The ServiceComposite for which to lookup the ServiceDescriptor
-     *
-     * @return The ServiceDescriptor of the ServiceComposite
-     */
-    ServiceDescriptor serviceDescriptorFor( Object service );
-
-    /**
-     * Returns the PropertyDescriptor of the Property.
-     *
-     * @param property The Property for which to lookup the PropertyDescriptor
-     *
-     * @return The PropertyDescriptor of the Property
-     */
-    PropertyDescriptor propertyDescriptorFor( Property<?> property );
-
-    /**
-     * Returns the AssociationDescriptor of the Association.
-     *
-     * @param association The Association for which to lookup the AssociationDescriptor
-     *
-     * @return The AssociationDescriptor of the Association
-     */
-    AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
-
-    /**
-     * Function that returns the CompositeDescriptor of a Composite.
-     */
-    Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
-        if( composite instanceof Proxy )
-        {
-            InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
-            return ( (CompositeInstance) invocationHandler ).descriptor();
-        }
-        try
-        {
-            Class<? extends Composite> compositeClass = composite.getClass();
-            Field instanceField = compositeClass.getField( "_instance" );
-            Object instance = instanceField.get( composite );
-            return ( (CompositeInstance) instance ).descriptor();
-        }
-        catch( Exception e )
-        {
-            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
-            exception.initCause( e );
-            throw exception;
-        }
-    };
-
-    /**
-     * Function that returns the CompositeInstance of a Composite.
-     */
-    Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
-        if( composite instanceof Proxy )
-        {
-            return ( (CompositeInstance) Proxy.getInvocationHandler( composite ) );
-        }
-        try
-        {
-            Class<? extends Composite> compositeClass = composite.getClass();
-            Field instanceField = compositeClass.getField( "_instance" );
-            Object instance = instanceField.get( composite );
-            return (CompositeInstance) instance;
-        }
-        catch( Exception e )
-        {
-            InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
-            exception.initCause( e );
-            throw exception;
-        }
-    };
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java b/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
index c088df7..d0384a8 100644
--- a/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/configuration/DeclareConfigurationDefaultsTest.java
@@ -31,7 +31,7 @@ import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 public class DeclareConfigurationDefaultsTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     @Mixins( FooServiceMixin.class )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java b/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
index 13c6e60..a4b8b30 100644
--- a/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/injection/scope/StateFieldTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.api.injection.scope;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
@@ -32,7 +33,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
index 4b658e5..40f59d3 100644
--- a/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
@@ -21,11 +21,11 @@ package org.apache.polygene.api.mixin.decoratorMixin;
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.core.IsEqual.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java b/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
index f0fe7a1..c299300 100644
--- a/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/property/PropertyErrorTest.java
@@ -20,13 +20,13 @@
 
 package org.apache.polygene.api.property;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java b/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
index 5f4b2ae..43bd5b7 100644
--- a/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplateTest.java
@@ -19,13 +19,13 @@
  */
 package org.apache.polygene.api.unitofwork;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityBuilderTemplate;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/PolygeneRuntime.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/PolygeneRuntime.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/PolygeneRuntime.java
new file mode 100644
index 0000000..c5c5386
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/PolygeneRuntime.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.spi.PolygeneSPI;
+
+/**
+ * This interface has to be implemented by Polygene runtimes.
+ */
+public interface PolygeneRuntime
+{
+    ApplicationAssemblyFactory applicationAssemblyFactory();
+
+    ApplicationModelFactory applicationModelFactory();
+
+    PolygeneAPI api();
+
+    PolygeneSPI spi();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
deleted file mode 100644
index c5c5386..0000000
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ZestRuntime.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.bootstrap;
-
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.spi.PolygeneSPI;
-
-/**
- * This interface has to be implemented by Polygene runtimes.
- */
-public interface PolygeneRuntime
-{
-    ApplicationAssemblyFactory applicationAssemblyFactory();
-
-    ApplicationModelFactory applicationModelFactory();
-
-    PolygeneAPI api();
-
-    PolygeneSPI spi();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
new file mode 100644
index 0000000..2a0be69
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
@@ -0,0 +1,360 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime;
+
+import java.lang.reflect.InvocationHandler;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.association.AbstractAssociation;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.AssociationWrapper;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.ManyAssociationWrapper;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.association.NamedAssociationWrapper;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.PropertyWrapper;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.api.value.ValueDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.ApplicationModelFactory;
+import org.apache.polygene.bootstrap.PolygeneRuntime;
+import org.apache.polygene.runtime.association.AbstractAssociationInstance;
+import org.apache.polygene.runtime.bootstrap.ApplicationAssemblyFactoryImpl;
+import org.apache.polygene.runtime.bootstrap.ApplicationModelFactoryImpl;
+import org.apache.polygene.runtime.composite.ProxyReferenceInvocationHandler;
+import org.apache.polygene.runtime.composite.TransientInstance;
+import org.apache.polygene.runtime.entity.EntityInstance;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.runtime.service.ImportedServiceReferenceInstance;
+import org.apache.polygene.runtime.service.ServiceInstance;
+import org.apache.polygene.runtime.service.ServiceReferenceInstance;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.value.ValueInstance;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.apache.polygene.spi.entity.EntityState;
+
+import static java.lang.reflect.Proxy.getInvocationHandler;
+import static org.apache.polygene.runtime.composite.TransientInstance.compositeInstanceOf;
+
+/**
+ * Incarnation of Polygene.
+ */
+public final class PolygeneRuntimeImpl
+    implements PolygeneSPI, PolygeneRuntime
+{
+    private final ApplicationAssemblyFactory applicationAssemblyFactory;
+    private final ApplicationModelFactory applicationModelFactory;
+
+    public PolygeneRuntimeImpl()
+    {
+        applicationAssemblyFactory = new ApplicationAssemblyFactoryImpl();
+        applicationModelFactory = new ApplicationModelFactoryImpl();
+    }
+
+    @Override
+    public ApplicationAssemblyFactory applicationAssemblyFactory()
+    {
+        return applicationAssemblyFactory;
+    }
+
+    @Override
+    public ApplicationModelFactory applicationModelFactory()
+    {
+        return applicationModelFactory;
+    }
+
+    @Override
+    public PolygeneAPI api()
+    {
+        return this;
+    }
+
+    @Override
+    public PolygeneSPI spi()
+    {
+        return this;
+    }
+
+    // API
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> T dereference( T composite )
+    {
+        InvocationHandler handler = getInvocationHandler( composite );
+        if( handler instanceof ProxyReferenceInvocationHandler )
+        {
+            return (T) ( (ProxyReferenceInvocationHandler) handler ).proxy();
+        }
+        if( handler instanceof CompositeInstance )
+        {
+            return composite;
+        }
+        return null;
+    }
+
+    @Override
+    public ModuleDescriptor moduleOf( Object compositeOrServiceReferenceOrUow )
+    {
+        if( compositeOrServiceReferenceOrUow instanceof TransientComposite )
+        {
+            TransientComposite composite = (TransientComposite) compositeOrServiceReferenceOrUow;
+            return TransientInstance.compositeInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof EntityComposite )
+        {
+            EntityComposite composite = (EntityComposite) compositeOrServiceReferenceOrUow;
+            return EntityInstance.entityInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ValueComposite )
+        {
+            ValueComposite composite = (ValueComposite) compositeOrServiceReferenceOrUow;
+            return ValueInstance.valueInstanceOf( composite ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) compositeOrServiceReferenceOrUow;
+            InvocationHandler handler = getInvocationHandler( composite );
+            if( handler instanceof ServiceInstance )
+            {
+                return ( (ServiceInstance) handler ).module();
+            }
+            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof UnitOfWork )
+        {
+            ModuleUnitOfWork unitOfWork = (ModuleUnitOfWork) compositeOrServiceReferenceOrUow;
+            return unitOfWork.module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
+            return reference.module();
+        }
+        else if( compositeOrServiceReferenceOrUow instanceof ImportedServiceReferenceInstance )
+        {
+            ImportedServiceReferenceInstance<?> importedServiceReference
+                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
+            return importedServiceReference.module();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be one of "
+                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
+                                                             ServiceComposite.class, ServiceReference.class,
+                                                             UnitOfWork.class ) );
+    }
+
+    @Override
+    public ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference )
+    {
+        if( compositeOrServiceReference instanceof TransientComposite )
+        {
+            TransientComposite composite = (TransientComposite) compositeOrServiceReference;
+            return TransientInstance.compositeInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof EntityComposite )
+        {
+            EntityComposite composite = (EntityComposite) compositeOrServiceReference;
+            return EntityInstance.entityInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ValueComposite )
+        {
+            ValueComposite composite = (ValueComposite) compositeOrServiceReference;
+            return ValueInstance.valueInstanceOf( composite ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) compositeOrServiceReference;
+            InvocationHandler handler = getInvocationHandler( composite );
+            if( handler instanceof ServiceInstance )
+            {
+                return ( (ServiceInstance) handler ).descriptor();
+            }
+            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).descriptor();
+        }
+        else if( compositeOrServiceReference instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReference;
+            return reference.serviceDescriptor();
+        }
+        else if( compositeOrServiceReference instanceof ImportedServiceReferenceInstance )
+        {
+            ImportedServiceReferenceInstance<?> importedServiceReference
+                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReference;
+            return importedServiceReference.serviceDescriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be one of "
+                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
+                                                             ServiceComposite.class, ServiceReference.class ) );
+    }
+
+    @Override
+    public CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference )
+    {
+        return (CompositeDescriptor) modelDescriptorFor( compositeOrServiceReference );
+    }
+
+    // Descriptors
+
+    @Override
+    public TransientDescriptor transientDescriptorFor( Object transsient )
+    {
+        if( transsient instanceof TransientComposite )
+        {
+            TransientInstance transientInstance = compositeInstanceOf( (Composite) transsient );
+            return (TransientDescriptor) transientInstance.descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + TransientComposite.class );
+    }
+
+    @Override
+    public StateHolder stateOf( TransientComposite composite )
+    {
+        return TransientInstance.compositeInstanceOf( composite ).state();
+    }
+
+    @Override
+    public EntityDescriptor entityDescriptorFor( Object entity )
+    {
+        if( entity instanceof EntityComposite )
+        {
+            EntityInstance entityInstance = (EntityInstance) getInvocationHandler( entity );
+            return entityInstance.entityModel();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + EntityComposite.class );
+    }
+
+    @Override
+    public AssociationStateHolder stateOf( EntityComposite composite )
+    {
+        return EntityInstance.entityInstanceOf( composite ).state();
+    }
+
+    @Override
+    public ValueDescriptor valueDescriptorFor( Object value )
+    {
+        if( value instanceof ValueComposite )
+        {
+            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
+            return valueInstance.descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + ValueComposite.class );
+    }
+
+    @Override
+    public AssociationStateHolder stateOf( ValueComposite composite )
+    {
+        return ValueInstance.valueInstanceOf( composite ).state();
+    }
+
+    @Override
+    public ServiceDescriptor serviceDescriptorFor( Object service )
+    {
+        if( service instanceof ServiceReferenceInstance )
+        {
+            ServiceReferenceInstance<?> ref = (ServiceReferenceInstance<?>) service;
+            return ref.serviceDescriptor();
+        }
+        if( service instanceof ServiceComposite )
+        {
+            ServiceComposite composite = (ServiceComposite) service;
+            return (ServiceDescriptor) ServiceInstance.serviceInstanceOf( composite ).descriptor();
+        }
+        throw new IllegalArgumentException( "Wrong type. Must be subtype of "
+                                            + ServiceComposite.class + " or " + ServiceReference.class );
+    }
+
+    @Override
+    public PropertyDescriptor propertyDescriptorFor( Property<?> property )
+    {
+        while( property instanceof PropertyWrapper )
+        {
+            property = ( (PropertyWrapper) property ).next();
+        }
+
+        return (PropertyDescriptor) ( (PropertyInstance<?>) property ).propertyInfo();
+    }
+
+    @Override
+    public AssociationDescriptor associationDescriptorFor( AbstractAssociation association )
+    {
+        while( association instanceof AssociationWrapper )
+        {
+            association = ( (AssociationWrapper) association ).next();
+        }
+
+        while( association instanceof ManyAssociationWrapper )
+        {
+            association = ( (ManyAssociationWrapper) association ).next();
+        }
+
+        while( association instanceof NamedAssociationWrapper )
+        {
+            association = ( (NamedAssociationWrapper) association ).next();
+        }
+
+        return (AssociationDescriptor) ( (AbstractAssociationInstance) association ).associationInfo();
+    }
+
+    // SPI
+    @Override
+    public EntityState entityStateOf( EntityComposite composite )
+    {
+        return EntityInstance.entityInstanceOf( composite ).entityState();
+    }
+
+    @Override
+    public EntityReference entityReferenceOf( Association<?> assoc )
+    {
+        return assoc.reference();
+    }
+
+    @Override
+    public Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc )
+    {
+        return assoc.references();
+    }
+
+    @Override
+    public Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc )
+    {
+        return assoc.references();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
deleted file mode 100644
index 2a0be69..0000000
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/ZestRuntimeImpl.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.runtime;
-
-import java.lang.reflect.InvocationHandler;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.polygene.api.PolygeneAPI;
-import org.apache.polygene.api.association.AbstractAssociation;
-import org.apache.polygene.api.association.Association;
-import org.apache.polygene.api.association.AssociationDescriptor;
-import org.apache.polygene.api.association.AssociationStateHolder;
-import org.apache.polygene.api.association.AssociationWrapper;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.association.ManyAssociationWrapper;
-import org.apache.polygene.api.association.NamedAssociation;
-import org.apache.polygene.api.association.NamedAssociationWrapper;
-import org.apache.polygene.api.composite.Composite;
-import org.apache.polygene.api.composite.CompositeDescriptor;
-import org.apache.polygene.api.composite.CompositeInstance;
-import org.apache.polygene.api.composite.ModelDescriptor;
-import org.apache.polygene.api.composite.TransientComposite;
-import org.apache.polygene.api.composite.TransientDescriptor;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.entity.EntityDescriptor;
-import org.apache.polygene.api.entity.EntityReference;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.property.PropertyDescriptor;
-import org.apache.polygene.api.property.PropertyWrapper;
-import org.apache.polygene.api.property.StateHolder;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.api.service.ServiceDescriptor;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.api.structure.ModuleDescriptor;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.api.value.ValueDescriptor;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.ApplicationModelFactory;
-import org.apache.polygene.bootstrap.PolygeneRuntime;
-import org.apache.polygene.runtime.association.AbstractAssociationInstance;
-import org.apache.polygene.runtime.bootstrap.ApplicationAssemblyFactoryImpl;
-import org.apache.polygene.runtime.bootstrap.ApplicationModelFactoryImpl;
-import org.apache.polygene.runtime.composite.ProxyReferenceInvocationHandler;
-import org.apache.polygene.runtime.composite.TransientInstance;
-import org.apache.polygene.runtime.entity.EntityInstance;
-import org.apache.polygene.runtime.property.PropertyInstance;
-import org.apache.polygene.runtime.service.ImportedServiceReferenceInstance;
-import org.apache.polygene.runtime.service.ServiceInstance;
-import org.apache.polygene.runtime.service.ServiceReferenceInstance;
-import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.polygene.runtime.value.ValueInstance;
-import org.apache.polygene.spi.PolygeneSPI;
-import org.apache.polygene.spi.entity.EntityState;
-
-import static java.lang.reflect.Proxy.getInvocationHandler;
-import static org.apache.polygene.runtime.composite.TransientInstance.compositeInstanceOf;
-
-/**
- * Incarnation of Polygene.
- */
-public final class PolygeneRuntimeImpl
-    implements PolygeneSPI, PolygeneRuntime
-{
-    private final ApplicationAssemblyFactory applicationAssemblyFactory;
-    private final ApplicationModelFactory applicationModelFactory;
-
-    public PolygeneRuntimeImpl()
-    {
-        applicationAssemblyFactory = new ApplicationAssemblyFactoryImpl();
-        applicationModelFactory = new ApplicationModelFactoryImpl();
-    }
-
-    @Override
-    public ApplicationAssemblyFactory applicationAssemblyFactory()
-    {
-        return applicationAssemblyFactory;
-    }
-
-    @Override
-    public ApplicationModelFactory applicationModelFactory()
-    {
-        return applicationModelFactory;
-    }
-
-    @Override
-    public PolygeneAPI api()
-    {
-        return this;
-    }
-
-    @Override
-    public PolygeneSPI spi()
-    {
-        return this;
-    }
-
-    // API
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public <T> T dereference( T composite )
-    {
-        InvocationHandler handler = getInvocationHandler( composite );
-        if( handler instanceof ProxyReferenceInvocationHandler )
-        {
-            return (T) ( (ProxyReferenceInvocationHandler) handler ).proxy();
-        }
-        if( handler instanceof CompositeInstance )
-        {
-            return composite;
-        }
-        return null;
-    }
-
-    @Override
-    public ModuleDescriptor moduleOf( Object compositeOrServiceReferenceOrUow )
-    {
-        if( compositeOrServiceReferenceOrUow instanceof TransientComposite )
-        {
-            TransientComposite composite = (TransientComposite) compositeOrServiceReferenceOrUow;
-            return TransientInstance.compositeInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof EntityComposite )
-        {
-            EntityComposite composite = (EntityComposite) compositeOrServiceReferenceOrUow;
-            return EntityInstance.entityInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ValueComposite )
-        {
-            ValueComposite composite = (ValueComposite) compositeOrServiceReferenceOrUow;
-            return ValueInstance.valueInstanceOf( composite ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) compositeOrServiceReferenceOrUow;
-            InvocationHandler handler = getInvocationHandler( composite );
-            if( handler instanceof ServiceInstance )
-            {
-                return ( (ServiceInstance) handler ).module();
-            }
-            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof UnitOfWork )
-        {
-            ModuleUnitOfWork unitOfWork = (ModuleUnitOfWork) compositeOrServiceReferenceOrUow;
-            return unitOfWork.module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
-            return reference.module();
-        }
-        else if( compositeOrServiceReferenceOrUow instanceof ImportedServiceReferenceInstance )
-        {
-            ImportedServiceReferenceInstance<?> importedServiceReference
-                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReferenceOrUow;
-            return importedServiceReference.module();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be one of "
-                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
-                                                             ServiceComposite.class, ServiceReference.class,
-                                                             UnitOfWork.class ) );
-    }
-
-    @Override
-    public ModelDescriptor modelDescriptorFor( Object compositeOrServiceReference )
-    {
-        if( compositeOrServiceReference instanceof TransientComposite )
-        {
-            TransientComposite composite = (TransientComposite) compositeOrServiceReference;
-            return TransientInstance.compositeInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof EntityComposite )
-        {
-            EntityComposite composite = (EntityComposite) compositeOrServiceReference;
-            return EntityInstance.entityInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ValueComposite )
-        {
-            ValueComposite composite = (ValueComposite) compositeOrServiceReference;
-            return ValueInstance.valueInstanceOf( composite ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) compositeOrServiceReference;
-            InvocationHandler handler = getInvocationHandler( composite );
-            if( handler instanceof ServiceInstance )
-            {
-                return ( (ServiceInstance) handler ).descriptor();
-            }
-            return ( (ServiceReferenceInstance.ServiceInvocationHandler) handler ).descriptor();
-        }
-        else if( compositeOrServiceReference instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> reference = (ServiceReferenceInstance<?>) compositeOrServiceReference;
-            return reference.serviceDescriptor();
-        }
-        else if( compositeOrServiceReference instanceof ImportedServiceReferenceInstance )
-        {
-            ImportedServiceReferenceInstance<?> importedServiceReference
-                = (ImportedServiceReferenceInstance<?>) compositeOrServiceReference;
-            return importedServiceReference.serviceDescriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be one of "
-                                            + Arrays.asList( TransientComposite.class, ValueComposite.class,
-                                                             ServiceComposite.class, ServiceReference.class ) );
-    }
-
-    @Override
-    public CompositeDescriptor compositeDescriptorFor( Object compositeOrServiceReference )
-    {
-        return (CompositeDescriptor) modelDescriptorFor( compositeOrServiceReference );
-    }
-
-    // Descriptors
-
-    @Override
-    public TransientDescriptor transientDescriptorFor( Object transsient )
-    {
-        if( transsient instanceof TransientComposite )
-        {
-            TransientInstance transientInstance = compositeInstanceOf( (Composite) transsient );
-            return (TransientDescriptor) transientInstance.descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + TransientComposite.class );
-    }
-
-    @Override
-    public StateHolder stateOf( TransientComposite composite )
-    {
-        return TransientInstance.compositeInstanceOf( composite ).state();
-    }
-
-    @Override
-    public EntityDescriptor entityDescriptorFor( Object entity )
-    {
-        if( entity instanceof EntityComposite )
-        {
-            EntityInstance entityInstance = (EntityInstance) getInvocationHandler( entity );
-            return entityInstance.entityModel();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + EntityComposite.class );
-    }
-
-    @Override
-    public AssociationStateHolder stateOf( EntityComposite composite )
-    {
-        return EntityInstance.entityInstanceOf( composite ).state();
-    }
-
-    @Override
-    public ValueDescriptor valueDescriptorFor( Object value )
-    {
-        if( value instanceof ValueComposite )
-        {
-            ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
-            return valueInstance.descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of " + ValueComposite.class );
-    }
-
-    @Override
-    public AssociationStateHolder stateOf( ValueComposite composite )
-    {
-        return ValueInstance.valueInstanceOf( composite ).state();
-    }
-
-    @Override
-    public ServiceDescriptor serviceDescriptorFor( Object service )
-    {
-        if( service instanceof ServiceReferenceInstance )
-        {
-            ServiceReferenceInstance<?> ref = (ServiceReferenceInstance<?>) service;
-            return ref.serviceDescriptor();
-        }
-        if( service instanceof ServiceComposite )
-        {
-            ServiceComposite composite = (ServiceComposite) service;
-            return (ServiceDescriptor) ServiceInstance.serviceInstanceOf( composite ).descriptor();
-        }
-        throw new IllegalArgumentException( "Wrong type. Must be subtype of "
-                                            + ServiceComposite.class + " or " + ServiceReference.class );
-    }
-
-    @Override
-    public PropertyDescriptor propertyDescriptorFor( Property<?> property )
-    {
-        while( property instanceof PropertyWrapper )
-        {
-            property = ( (PropertyWrapper) property ).next();
-        }
-
-        return (PropertyDescriptor) ( (PropertyInstance<?>) property ).propertyInfo();
-    }
-
-    @Override
-    public AssociationDescriptor associationDescriptorFor( AbstractAssociation association )
-    {
-        while( association instanceof AssociationWrapper )
-        {
-            association = ( (AssociationWrapper) association ).next();
-        }
-
-        while( association instanceof ManyAssociationWrapper )
-        {
-            association = ( (ManyAssociationWrapper) association ).next();
-        }
-
-        while( association instanceof NamedAssociationWrapper )
-        {
-            association = ( (NamedAssociationWrapper) association ).next();
-        }
-
-        return (AssociationDescriptor) ( (AbstractAssociationInstance) association ).associationInfo();
-    }
-
-    // SPI
-    @Override
-    public EntityState entityStateOf( EntityComposite composite )
-    {
-        return EntityInstance.entityInstanceOf( composite ).entityState();
-    }
-
-    @Override
-    public EntityReference entityReferenceOf( Association<?> assoc )
-    {
-        return assoc.reference();
-    }
-
-    @Override
-    public Stream<EntityReference> entityReferencesOf( ManyAssociation<?> assoc )
-    {
-        return assoc.references();
-    }
-
-    @Override
-    public Stream<Map.Entry<String, EntityReference>> entityReferencesOf( NamedAssociation<?> assoc )
-    {
-        return assoc.references();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/api/common/OptionalTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/OptionalTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/OptionalTest.java
index 5fc0c31..6a43690 100644
--- a/core/runtime/src/test/java/org/apache/polygene/api/common/OptionalTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/api/common/OptionalTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.api.common;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.composite.TransientBuilder;
@@ -32,7 +33,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.notNullValue;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyErrorTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyErrorTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyErrorTest.java
index 1f85ae5..97aba67 100644
--- a/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyErrorTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyErrorTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.api.common;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
 import org.apache.polygene.api.entity.EntityComposite;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyTypeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyTypeTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyTypeTest.java
index b200422..4f33076 100644
--- a/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyTypeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/api/common/PropertyTypeTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.api.common;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.composite.TransientComposite;
@@ -34,7 +35,6 @@ import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/api/common/ValueCompositeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/ValueCompositeTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/ValueCompositeTest.java
index ef90cea..0a6d1d3 100644
--- a/core/runtime/src/test/java/org/apache/polygene/api/common/ValueCompositeTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/api/common/ValueCompositeTest.java
@@ -21,6 +21,7 @@
 package org.apache.polygene.api.common;
 
 import java.util.List;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.polygene.api.constraint.ConstraintViolationException;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.api.value.ValueComposite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/regression/qi230/Qi230IssueTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi230/Qi230IssueTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi230/Qi230IssueTest.java
index f2130b4..271147f 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi230/Qi230IssueTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi230/Qi230IssueTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.regression.qi230;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.PolygeneAPI;
 import org.apache.polygene.api.composite.Composite;
@@ -33,7 +34,6 @@ import org.apache.polygene.api.mixin.NoopMixin;
 import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java
index fd6813d..f766590 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi377/InterfaceCollisionWithRelatedReturnTypesTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.regression.qi377;
 
 import org.apache.polygene.api.identity.HasIdentity;
 import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.association.Association;
 import org.apache.polygene.api.association.ManyAssociation;
@@ -30,7 +31,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.core.IsEqual.equalTo;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java
index c174c58..a44f20a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi383/Qi383Test.java
@@ -20,6 +20,7 @@
 package org.apache.polygene.regression.qi383;
 
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.unitofwork.EntityCompositeAlreadyExistsException;
@@ -29,7 +30,6 @@ import org.apache.polygene.api.value.ValueSerialization;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
 
 public class Qi383Test extends AbstractPolygeneTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/regression/qi59/IssueTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi59/IssueTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi59/IssueTest.java
index 9790b01..37f0dff 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi59/IssueTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi59/IssueTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.polygene.regression.qi59;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityComposite;
 import org.apache.polygene.api.property.Property;
@@ -27,7 +28,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.constraints.annotation.NotEmpty;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.fail;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneAPITest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneAPITest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneAPITest.java
new file mode 100644
index 0000000..24419d6
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/PolygeneAPITest.java
@@ -0,0 +1,87 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime;
+
+import org.junit.Test;
+import org.apache.polygene.api.composite.TransientComposite;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.service.ServiceComposite;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+/**
+ * JAVADOC
+ */
+public class PolygeneAPITest
+    extends AbstractPolygeneTest
+{
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        new EntityTestAssembler().assemble( module );
+        module.transients( TestTransient.class );
+        module.entities( TestEntity.class );
+        module.values( TestValue.class );
+        module.services( TestService.class );
+    }
+
+    @Test
+    public void testGetModuleOfComposite()
+        throws Exception
+    {
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        TestEntity testEntity = unitOfWork.newEntity( TestEntity.class );
+
+        api.moduleOf( testEntity );
+
+        unitOfWork.discard();
+
+        api.moduleOf( valueBuilderFactory.newValue( TestValue.class ) );
+
+        api.moduleOf( transientBuilderFactory.newTransient( TestTransient.class ) );
+
+        api.moduleOf( serviceFinder.findService( TestService.class ).get() );
+    }
+
+    public interface TestTransient
+        extends TransientComposite
+    {
+    }
+
+    public interface TestEntity
+        extends EntityComposite
+    {
+    }
+
+    public interface TestValue
+        extends ValueComposite
+    {
+    }
+
+    public interface TestService
+        extends ServiceComposite
+    {
+    }
+}
\ No newline at end of file


[35/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/InvalidCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/InvalidCompositeException.java b/core/api/src/main/java/org/apache/zest/api/composite/InvalidCompositeException.java
deleted file mode 100644
index aab1180..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/InvalidCompositeException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * This exception is thrown if a Composite is invalid.
- */
-public class InvalidCompositeException
-    extends RuntimeException
-{
-    public InvalidCompositeException( String message )
-    {
-        super( message );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/InvalidValueCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/InvalidValueCompositeException.java b/core/api/src/main/java/org/apache/zest/api/composite/InvalidValueCompositeException.java
deleted file mode 100644
index 2709c39..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/InvalidValueCompositeException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * This exception is thrown if a ValueComposite is invalid.
- */
-public class InvalidValueCompositeException
-    extends RuntimeException
-{
-    public InvalidValueCompositeException( String message )
-    {
-        super( message );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/MethodDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/MethodDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/MethodDescriptor.java
deleted file mode 100644
index 3a2a084..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/MethodDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.Method;
-
-/**
- * Composite Method Descriptor.
- */
-public interface MethodDescriptor
-{
-    Method method();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/MissingMethodException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/MissingMethodException.java b/core/api/src/main/java/org/apache/zest/api/composite/MissingMethodException.java
deleted file mode 100644
index 2ca801f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/MissingMethodException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * This exception is thrown if client code tries to invoke a non-existing Composite method.
- */
-public class MissingMethodException
-    extends RuntimeException
-{
-    public MissingMethodException( String message )
-    {
-        super( message );
-    }
-
-    public MissingMethodException( String message, NoSuchMethodException e )
-    {
-        super(message,e);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/ModelDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/ModelDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/ModelDescriptor.java
deleted file mode 100644
index e4a0a5f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/ModelDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.structure.MetaInfoHolder;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * Composite ModelDescriptor.
- */
-public interface ModelDescriptor extends HasTypes, MetaInfoHolder
-{
-    Visibility visibility();
-
-    /** The Module that the Model is declared in.
-     *
-     * @return The Module that this Model was declared in.
-     */
-    ModuleDescriptor module();
-
-    boolean isAssignableTo( Class<?> type );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index 1b87eee..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchCompositeException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import org.apache.zest.api.common.InvalidApplicationException;
-
-/**
- * This exception is thrown if client code tries to create a non-existing Composite type.
- */
-public class NoSuchCompositeException
-    extends InvalidApplicationException
-{
-    private static final long serialVersionUID = 1L;
-
-    private final String compositeType;
-    private final String moduleName;
-    private final String visibleTypes;
-
-    protected NoSuchCompositeException( String metaType, String compositeType, String moduleName, String visibleTypes )
-    {
-        super( "Could not find any visible " + metaType + " of type [" + compositeType + "] in module [" +
-               moduleName + "].\n" + visibleTypes );
-        this.compositeType = compositeType;
-        this.moduleName = moduleName;
-        this.visibleTypes = visibleTypes;
-    }
-
-    public String compositeType()
-    {
-        return compositeType;
-    }
-
-    public String moduleName()
-    {
-        return moduleName;
-    }
-
-    public String visibleTypes()
-    {
-        return visibleTypes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index a39a1f3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/NoSuchTransientException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.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, TypeLookup typeLookup )
-    {
-        super( "TransientComposite", typeName, moduleName, formatVisibleTypes( typeLookup ) );
-    }
-
-    private static String formatVisibleTypes( TypeLookup typeLookup )
-    {
-        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/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/PropertyMapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/PropertyMapper.java b/core/api/src/main/java/org/apache/zest/api/composite/PropertyMapper.java
deleted file mode 100644
index 271c724..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/PropertyMapper.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.time.Duration;
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.OffsetDateTime;
-import java.time.Period;
-import java.time.ZonedDateTime;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.property.GenericPropertyInfo;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * Transfer java.util.Properties to Composite properties
- */
-public final class PropertyMapper
-{
-
-    private final static Map<Type, MappingStrategy> STRATEGY;
-
-    static
-    {
-        STRATEGY = new HashMap<>();
-        STRATEGY.put( Integer.class, new IntegerMapper() );
-        STRATEGY.put( Long.class, new LongMapper() );
-        STRATEGY.put( Short.class, new ShortMapper() );
-        STRATEGY.put( Byte.class, new ByteMapper() );
-        STRATEGY.put( String.class, new StringMapper() );
-        STRATEGY.put( Character.class, new CharMapper() );
-        STRATEGY.put( Float.class, new FloatMapper() );
-        STRATEGY.put( Double.class, new DoubleMapper() );
-        STRATEGY.put( LocalDate.class, new LocalDateMapper() );
-        STRATEGY.put( LocalDateTime.class, new LocalDateTimeMapper() );
-        STRATEGY.put( ZonedDateTime.class, new ZonedDateTimeMapper() );
-        STRATEGY.put( OffsetDateTime.class, new OffsetDateTimeMapper() );
-        STRATEGY.put( Instant.class, new InstantMapper() );
-        STRATEGY.put( Duration.class, new DurationMapper() );
-        STRATEGY.put( Period.class, new PeriodMapper() );
-        STRATEGY.put( Boolean.class, new BooleanMapper() );
-        STRATEGY.put( BigDecimal.class, new BigDecimalMapper() );
-        STRATEGY.put( BigInteger.class, new BigIntegerMapper() );
-        STRATEGY.put( Enum.class, new EnumMapper() );
-        STRATEGY.put( Array.class, new ArrayMapper() );
-        STRATEGY.put( Map.class, new MapMapper() );
-        STRATEGY.put( List.class, new ListMapper() );
-        STRATEGY.put( Set.class, new SetMapper() );
-        STRATEGY.put( ValueComposite.class, new ValueCompositeMapper() );
-    }
-
-    /**
-     * Populate the Composite with properties from the given properties object.
-     *
-     * @param props     properties object
-     * @param composite the composite instance
-     *
-     * @throws IllegalArgumentException if properties could not be transferred to composite
-     */
-    public static void map( Properties props, Composite composite )
-        throws IllegalArgumentException
-    {
-        for( Map.Entry<Object, Object> objectObjectEntry : props.entrySet() )
-        {
-            try
-            {
-                String methodName = objectObjectEntry.getKey().toString();
-                Method propertyMethod = composite.getClass().getInterfaces()[ 0 ].getMethod( methodName );
-                propertyMethod.setAccessible( true );
-                Object value = objectObjectEntry.getValue();
-                Type propertyType = GenericPropertyInfo.propertyTypeOf( propertyMethod );
-
-                value = mapToType( composite, propertyType, value.toString() );
-
-                @SuppressWarnings( "unchecked" )
-                Property<Object> property = (Property<Object>) propertyMethod.invoke( composite );
-                property.set( value );
-            }
-            catch( NoSuchMethodException e )
-            {
-                throw new IllegalArgumentException( "Could not find any property named " + objectObjectEntry.getKey() );
-            }
-            catch( IllegalAccessException e )
-            {
-                //noinspection ThrowableInstanceNeverThrown
-                throw new IllegalArgumentException( "Could not populate property named " + objectObjectEntry.getKey(), e );
-            }
-            catch( InvocationTargetException e )
-            {
-                //noinspection ThrowableInstanceNeverThrown
-                String message = "Could not populate property named " + objectObjectEntry.getKey();
-                throw new IllegalArgumentException( message, e );
-            }
-        }
-    }
-
-    @SuppressWarnings( "raw" )
-    private static Object mapToType( Composite composite, Type propertyType, Object value )
-    {
-        final String stringValue = value.toString();
-        MappingStrategy strategy;
-        if( propertyType instanceof Class )
-        {
-            Class type = (Class) propertyType;
-            if( type.isArray() )
-            {
-                strategy = STRATEGY.get( Array.class );
-            }
-            else if( Enum.class.isAssignableFrom( Classes.RAW_CLASS.apply( propertyType ) ) )
-            {
-                strategy = STRATEGY.get( Enum.class );
-            }
-            else
-            {
-                strategy = STRATEGY.get( type );
-            }
-            if( strategy == null ) // If null, try with the ValueComposite Mapper...
-            {
-                strategy = STRATEGY.get( ValueComposite.class );
-            }
-        }
-        else if( propertyType instanceof ParameterizedType )
-        {
-            ParameterizedType type = ( (ParameterizedType) propertyType );
-
-            if( type.getRawType() instanceof Class )
-            {
-                Class clazz = (Class) type.getRawType();
-                if( List.class.isAssignableFrom( clazz ) )
-                {
-                    strategy = STRATEGY.get( List.class );
-                }
-                else if( Set.class.isAssignableFrom( clazz ) )
-                {
-                    strategy = STRATEGY.get( Set.class );
-                }
-                else if( Map.class.isAssignableFrom( clazz ) )
-                {
-                    strategy = STRATEGY.get( Map.class );
-                }
-                else
-                {
-                    throw new IllegalArgumentException( propertyType + " is not supported." );
-                }
-            }
-            else
-            {
-                throw new IllegalArgumentException( propertyType + " is not supported." );
-            }
-        }
-        else
-        {
-            throw new IllegalArgumentException( propertyType + " is not supported." );
-        }
-
-        if( strategy == null )
-        {
-            throw new IllegalArgumentException( propertyType + " is not supported." );
-        }
-
-        return strategy.map( composite, propertyType, stringValue );
-    }
-
-    /**
-     * Load a Properties object from the given stream, close it, and then populate
-     * the Composite with the properties.
-     *
-     * @param propertyInputStream properties input stream
-     * @param composite           the instance
-     *
-     * @throws IOException if the stream could not be read
-     */
-
-    public static void map( InputStream propertyInputStream, Composite composite )
-        throws IOException
-    {
-        if( propertyInputStream != null )
-        {
-            Properties configProps = new Properties();
-            try
-            {
-                configProps.load( propertyInputStream );
-            }
-            finally
-            {
-                propertyInputStream.close();
-            }
-            map( configProps, composite );
-        }
-    }
-
-    /**
-     * Create Properties object which is backed by the given Composite.
-     *
-     * @param composite the instance
-     *
-     * @return properties instance
-     */
-    public static Properties toJavaProperties( final Composite composite )
-    {
-        return new Properties()
-        {
-            private static final long serialVersionUID = 3550125427530538865L;
-
-            @Override
-            public Object get( Object o )
-            {
-                try
-                {
-                    Method propertyMethod = composite.getClass().getMethod( o.toString() );
-                    Property<?> property = (Property<?>) propertyMethod.invoke( composite );
-                    return property.get();
-                }
-                catch( NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
-                {
-                    return null;
-                }
-            }
-
-            @Override
-            public Object put( Object o, Object o1 )
-            {
-                Object oldValue = get( o );
-
-                try
-                {
-                    Method propertyMethod = composite.getClass().getMethod( o.toString(), Object.class );
-                    propertyMethod.invoke( composite, o1 );
-                }
-                catch( NoSuchMethodException | IllegalAccessException | InvocationTargetException e )
-                {
-                    e.printStackTrace();
-                }
-
-                return oldValue;
-            }
-        };
-    }
-
-    private static void tokenize( String valueString, boolean mapSyntax, TokenizerCallback callback )
-    {
-        char[] data = valueString.toCharArray();
-
-        int oldPos = 0;
-        for( int pos = 0; pos < data.length; pos++ )
-        {
-            char ch = data[ pos ];
-            if( ch == '\"' )
-            {
-                pos = resolveQuotes( valueString, callback, data, pos, '\"' );
-                oldPos = pos;
-            }
-            if( ch == '\'' )
-            {
-                pos = resolveQuotes( valueString, callback, data, pos, '\'' );
-                oldPos = pos;
-            }
-            if( ch == ',' || ( mapSyntax && ch == ':' ) )
-            {
-                String token = new String( data, oldPos, pos - oldPos );
-                callback.token( token );
-                oldPos = pos + 1;
-            }
-        }
-        String token = new String( data, oldPos, data.length - oldPos );
-        callback.token( token );
-    }
-
-    private static int resolveQuotes( String valueString,
-                                      TokenizerCallback callback,
-                                      char[] data,
-                                      int pos, char quote
-    )
-    {
-        boolean found = false;
-        for( int j = pos + 1; j < data.length; j++ )
-        {
-            if( !found )
-            {
-                if( data[ j ] == quote )
-                {
-                    String token = new String( data, pos + 1, j - pos - 1 );
-                    callback.token( token );
-                    found = true;
-                }
-            }
-            else
-            {
-                if( data[ j ] == ',' )
-                {
-                    return j + 1;
-                }
-            }
-        }
-        if( !found )
-        {
-            throw new IllegalArgumentException( "String is not quoted correctly: " + valueString );
-        }
-        return data.length;
-    }
-
-    private interface TokenizerCallback
-    {
-        void token( String token );
-    }
-
-    private interface MappingStrategy
-    {
-        Object map( Composite composite, Type type, String value );
-    }
-
-    private static class StringMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return value;
-        }
-    }
-
-    private static class IntegerMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Integer( value.trim() );
-        }
-    }
-
-    private static class FloatMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Float( value.trim() );
-        }
-    }
-
-    private static class DoubleMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Double( value.trim() );
-        }
-    }
-
-    private static class LongMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Long( value.trim() );
-        }
-    }
-
-    private static class ShortMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Short( value.trim() );
-        }
-    }
-
-    private static class ByteMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new Byte( value.trim() );
-        }
-    }
-
-    private static class CharMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return value.trim().charAt( 0 );
-        }
-    }
-
-    private static class BigDecimalMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new BigDecimal( value.trim() );
-        }
-    }
-
-    private static class BigIntegerMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return new BigInteger( value.trim() );
-        }
-    }
-
-    private static class EnumMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public Object map( Composite composite, Type type, String value )
-        {
-            return Enum.valueOf( (Class<Enum>) type, value );
-        }
-    }
-
-    private static class LocalDateMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return LocalDate.parse( value.trim() );
-        }
-    }
-
-    private static class LocalDateTimeMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return LocalDateTime.parse( value.trim() );
-        }
-    }
-
-    private static class ZonedDateTimeMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return ZonedDateTime.parse( value.trim() );
-        }
-    }
-
-    private static class OffsetDateTimeMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return OffsetDateTime.parse( value.trim() );
-        }
-    }
-
-    private static class InstantMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return Instant.parse( value.trim() );
-        }
-    }
-
-    private static class DurationMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return Duration.parse( value.trim() );
-        }
-    }
-
-    private static class PeriodMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( Composite composite, Type type, String value )
-        {
-            return Period.parse( value.trim() );
-        }
-    }
-
-    private static class ValueCompositeMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public Object map( Composite composite, Type type, String value )
-        {
-            return PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( composite )
-                .module()
-                .instance()
-                .newValueFromSerializedState( (Class<Object>) type, value );
-        }
-    }
-
-    private static class ArrayMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( { "raw", "unchecked" } )
-        public Object map( final Composite composite, Type type, String value )
-        {
-            final Class arrayType = ( (Class) type ).getComponentType();
-            final ArrayList result = new ArrayList();
-            tokenize( value, false, new TokenizerCallback()
-            {
-                @Override
-                public void token( String token )
-                {
-                    result.add( mapToType( composite, arrayType, token ) );
-                }
-            } );
-            return result.toArray( (Object[]) Array.newInstance( arrayType, result.size() ) );
-        }
-    }
-
-    private static class BooleanMapper
-        implements MappingStrategy
-    {
-        @Override
-        public Object map( final Composite composite, Type type, String value )
-        {
-            return Boolean.valueOf( value.trim() );
-        }
-    }
-
-    private static class ListMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( { "raw", "unchecked" } )
-        public Object map( final Composite composite, Type type, String value )
-        {
-            final Type dataType = ( (ParameterizedType) type ).getActualTypeArguments()[ 0 ];
-            final Collection result = new ArrayList();
-            tokenize( value, false, new TokenizerCallback()
-            {
-                @Override
-                public void token( String token )
-                {
-                    result.add( mapToType( composite, dataType, token ) );
-                }
-            } );
-            return result;
-        }
-    }
-
-    private static class SetMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( { "raw", "unchecked" } )
-        public Object map( final Composite composite, Type type, String value )
-        {
-            final Type dataType = ( (ParameterizedType) type ).getActualTypeArguments()[ 0 ];
-            final Collection result = new HashSet();
-            tokenize( value, false, new TokenizerCallback()
-            {
-                @Override
-                public void token( String token )
-                {
-                    result.add( mapToType( composite, dataType, token ) );
-                }
-            } );
-            return result;
-        }
-    }
-
-    private static class MapMapper
-        implements MappingStrategy
-    {
-        @Override
-        @SuppressWarnings( { "raw", "unchecked" } )
-        public Object map( final Composite composite, Type generictype, String value )
-        {
-            ParameterizedType type = (ParameterizedType) generictype;
-            final Type keyType = type.getActualTypeArguments()[ 0 ];
-            final Type valueType = type.getActualTypeArguments()[ 0 ];
-            final Map result = new HashMap();
-            tokenize( value, true, new TokenizerCallback()
-            {
-                boolean keyArrivingNext = true;
-                String key;
-
-                @Override
-                public void token( String token )
-                {
-                    if( keyArrivingNext )
-                    {
-                        key = token;
-                        keyArrivingNext = false;
-                    }
-                    else
-                    {
-                        result.put( mapToType( composite, keyType, key ), mapToType( composite, valueType, token ) );
-                        keyArrivingNext = true;
-                    }
-                }
-            } );
-            return result;
-        }
-    }
-
-    private PropertyMapper()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/StateDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/StateDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/StateDescriptor.java
deleted file mode 100644
index 8c98635..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/StateDescriptor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.util.stream.Stream;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.property.PropertyDescriptor;
-
-/**
- * Composite State Descriptor.
- */
-public interface StateDescriptor
-{
-    PropertyDescriptor findPropertyModelByName( String name )
-        throws IllegalArgumentException;
-
-    PropertyDescriptor findPropertyModelByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException;
-
-    Stream<? extends PropertyDescriptor> properties();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/StatefulCompositeDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/StatefulCompositeDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/StatefulCompositeDescriptor.java
deleted file mode 100644
index 585b98f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/StatefulCompositeDescriptor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * Stateful Composite Descriptor.
- */
-public interface StatefulCompositeDescriptor
-{
-    StateDescriptor state();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilder.java b/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilder.java
deleted file mode 100644
index abcbd87..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilder.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * TransientBuilders are used to instantiate TransientComposites. They can be acquired from
- * {@link TransientBuilderFactory#newTransientBuilder(Class)} and allows the client
- * to provide additional settings before instantiating the TransientComposite.
- */
-public interface TransientBuilder<T>
-{
-    /**
-     * Provide objects that can be injected into mixins that has the @Uses
-     * dependency injection annotation.
-     *
-     * @param usedObjects The objects that can be injected into mixins.
-     *
-     * @return the transient builder instance
-     *
-     * @see org.apache.zest.api.injection.scope.Uses
-     */
-    TransientBuilder<T> use( Object... usedObjects );
-
-    /**
-     * Get a representation of the state for the new Composite.
-     * It is possible to access and update properties and associations,
-     * even immutable ones since the builder represents the initial state.
-     *
-     * @return a proxy implementing the Composite type
-     */
-    T prototype();
-
-    /**
-     * Get a representation of the state of the given type for the new Composite.
-     * This is primarily used if you want to provide state for a private mixin type.
-     *
-     * @param mixinType the mixin which you want to provide state for
-     *
-     * @return a proxy implementing the given mixin type
-     */
-    <K> K prototypeFor( Class<K> mixinType );
-
-    /**
-     * Create a new Composite instance.
-     *
-     * @return a new Composite instance
-     *
-     * @throws ConstructionException thrown if it was not possible to instantiate the Composite
-     */
-    T newInstance()
-        throws ConstructionException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilderFactory.java b/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilderFactory.java
deleted file mode 100644
index f7b3dd5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/TransientBuilderFactory.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * This factory creates TransientComposites and the TransientBuilders.
- *
- * TransientComposite instances are very flexible in what it can reference, but are restricted in where they
- * can be used. So, TransientComposites are mainly recommended where Values, Entities and Services can not be used,
- * but they can also not be used to store state, be serialized across a network or have automatic equals/hashCode
- * calculations.
- */
-public interface TransientBuilderFactory
-{
-    /**
-     * Create a builder for creating new TransientComposites that implements the given TransientComposite type.
-     *
-     * @param mixinType an interface that describes the TransientComposite to be instantiated
-     *
-     * @return a TransientBuilder for creation of TransientComposites implementing the interface
-     *
-     * @throws NoSuchTransientException if no composite extending the mixinType has been registered
-     */
-    <T> TransientBuilder<T> newTransientBuilder( Class<T> mixinType )
-        throws NoSuchTransientException;
-
-    /**
-     * Instantiate a TransientComposite of the given type.
-     *
-     * @param mixinType the TransientComposite type to instantiate
-     *
-     * @return a new TransientComposite instance
-     *
-     * @throws NoSuchTransientException if no composite extending the mixinType has been registered
-     * @throws org.apache.zest.api.common.ConstructionException
-     *                                  if the composite could not be instantiated
-     */
-    <T> T newTransient( Class<T> mixinType, Object... uses )
-        throws NoSuchTransientException, ConstructionException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/TransientComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/TransientComposite.java b/core/api/src/main/java/org/apache/zest/api/composite/TransientComposite.java
deleted file mode 100644
index 68f7733..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/TransientComposite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * Transient Composite Type.
- *
- * TransientComposites have the following criteria;
- * <ul>
- * <li>Does not persist its state, and is not serializable</li>
- * <li>Can not be referenced from Properties, Associations, ValueComposites nor Entities</li>
- * <li>Can reference all types</li>
- * <li>No lifecycle</li>
- * <li>equals/hashCode is delegated to a single Mixin implementing the methods, like any other method</li>
- * </ul>
- */
-public interface TransientComposite
-    extends Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/TransientDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/TransientDescriptor.java b/core/api/src/main/java/org/apache/zest/api/composite/TransientDescriptor.java
deleted file mode 100644
index eeff62f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/TransientDescriptor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-/**
- * TransientComposite Descriptor.
- */
-public interface TransientDescriptor
-    extends CompositeDescriptor, StatefulCompositeDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/composite/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/composite/package.html b/core/api/src/main/java/org/apache/zest/api/composite/package.html
deleted file mode 100644
index 4c79ac8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/composite/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Composite API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/ConcernDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/ConcernDescriptor.java b/core/api/src/main/java/org/apache/zest/api/concern/ConcernDescriptor.java
deleted file mode 100644
index 3905a24..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/ConcernDescriptor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-/**
- * Concern descriptor.
- */
-public interface ConcernDescriptor
-{
-    Class modifierClass();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/ConcernOf.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/ConcernOf.java b/core/api/src/main/java/org/apache/zest/api/concern/ConcernOf.java
deleted file mode 100644
index cc828e3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/ConcernOf.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import org.apache.zest.api.concern.internal.ConcernFor;
-
-/**
- * Base class for Concerns. It introduces a typed "next" pointer
- * that Concerns can use to invoke the next Concern (or mixin) in
- * the chain.
- * <p>
- * Generic Concerns should subclass {@link GenericConcern} instead.
- * </p>
- * <p>
- * Concerns implementations must be thread-safe in their implementation,
- * as multiple threads may share instances.
- * </p>
- */
-public abstract class ConcernOf<T>
-{
-    /**
-     * The "next" pointer. This points to
-     * the next concern in the chain or the mixin
-     * to be invoked.
-     */
-    final
-    @ConcernFor
-    protected T next = null;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/Concerns.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/Concerns.java b/core/api/src/main/java/org/apache/zest/api/concern/Concerns.java
deleted file mode 100644
index 186a314..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/Concerns.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used by composites and mixins to declare what Concerns
- * should be applied to the type or specific method.
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface Concerns
-{
-    Class<?>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/ConcernsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/ConcernsDescriptor.java b/core/api/src/main/java/org/apache/zest/api/concern/ConcernsDescriptor.java
deleted file mode 100644
index 4fc242f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/ConcernsDescriptor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-/**
- * Concerns descriptor.
- */
-public interface ConcernsDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/GenericConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/GenericConcern.java b/core/api/src/main/java/org/apache/zest/api/concern/GenericConcern.java
deleted file mode 100644
index 9e47ba2..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/GenericConcern.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.reflect.InvocationHandler;
-
-/**
- * Base class for generic Concerns. Subclass
- * and implement the "invoke" method. Use the
- * "next" field in {@link ConcernOf} to continue the invocation
- * chain.
- */
-public abstract class GenericConcern
-    extends ConcernOf<InvocationHandler>
-    implements InvocationHandler
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/internal/ConcernFor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/internal/ConcernFor.java b/core/api/src/main/java/org/apache/zest/api/concern/internal/ConcernFor.java
deleted file mode 100644
index 54800d6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/internal/ConcernFor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern.internal;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import org.apache.zest.api.injection.InjectionScope;
-
-/**
- * This annotation is required once in each Concern, to mark the
- * field where the next element in the call sequence should be
- * injected.
- * <p>
- * The type of the field must be of the same type as the Concern
- * itself, or an InvocationHandler.
- * </p>
- * <p>
- * Example;
- * </p>
- * <pre><code>
- * public interface MyStuff
- * {
- *     void doSomething();
- * }
- *
- * public class MyStuffConcern
- *     implements MyStuff
- * {
- *     &#64;ConcernFor MyStuff next;
- *
- *     public void doSomething()
- *     {
- *         // HERE DO THE MODIFIER STUFF.
- *
- *         // Delegate to the underlying mixin/modifier.
- *         next.doSomething();
- *     }
- * }
- * </code></pre>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.FIELD, ElementType.PARAMETER } )
-@Documented
-@InjectionScope
-public @interface ConcernFor
-{
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/internal/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/internal/package.html b/core/api/src/main/java/org/apache/zest/api/concern/internal/package.html
deleted file mode 100644
index 7dcd3b6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/internal/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h1>Internal/Private package for the Concern API.</h1>
-        <p>
-            This is an internal package, and no classes in this package is part of the API and compatibility
-            with these classes will not be attempted.
-        </p>
-    </body>
-</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/concern/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/concern/package.html b/core/api/src/main/java/org/apache/zest/api/concern/package.html
deleted file mode 100644
index f9d5d0c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/concern/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Concern API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index 6a70705..0000000
--- a/core/api/src/main/java/org/apache/zest/api/configuration/Configuration.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import java.io.IOException;
-import java.io.InputStream;
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.composite.PropertyMapper;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.identity.Identity;
-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.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-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.NoSuchEntityTypeException;
-import org.apache.zest.api.unitofwork.NoSuchEntityException;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.Usecase;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.api.value.ValueSerialization;
-
-/**
- * Provide Configurations for Services. A Service that wants to be configurable
- * should inject a reference to Configuration with the Configuration type:
- * <pre><code>
- *  * &#64;This Configuration&#60;MyServiceConfiguration&#62; config;
- * </code></pre>
- * <p>
- * where MyServiceConfiguration extends {@link ConfigurationComposite}, which itself is an ordinary
- * {@link org.apache.zest.api.entity.EntityComposite}. The Configuration implementation
- * will either locate an instance of the given Configuration type in the
- * persistent store using the reference of the Service, or create a new such instance
- * if one doesn't already exist.
- * </p>
- * <p>
- * If a new Configuration instance is created then it will be populated with properties
- * from the properties file whose filesystem name is the same as the reference (e.g. "MyService.properties").
- * If a service is not given a name via the {@code org.apache.zest.bootstrap.ServiceDeclaration#identifiedBy(String)}, the
- * name will default to the FQCN of the ServiceComposite type.
- * </p>
- * <p>
- * The Configuration instance can be modified externally just like any other EntityComposite, but
- * its values will not be updated in the Service until {@link #refresh()} is called. This allows
- * safe reloads of Configuration state to ensure that it is not reloaded while the Service is handling
- * a request.
- * </p>
- * <p>
- * The Configuration will be automatically refreshed when the Service is activated by the Polygene runtime.
- * Any refreshes at other points will have to be done manually or triggered through some other
- * mechanism.
- * </p>
- * <p>
- * The user configuration entity is part of a long running {@link UnitOfWork}, and to persist changes to it the
- * {@link #save()} method must be called. No other actions are required. Example;
- * </p>
- * <pre><code>
- *
- * public interface MyConfiguration extends ConfigurationComposite
- * {
- *     Property&lt;Long&gt; timeout();
- * }
- *
- * :
- *
- * &#64;This Configuration&lt;MyConfiguration&gt; config;
- * :
- * private void setTimeoutConfiguration( long timeout )
- * {
- *     config.get().timeout().set( timeout );
- *     config.save();
- * }
- * </code></pre>
- * <p>
- * And even if a separate thread is using the {@code timeout()} configuration when this is happening, the
- * {@link UnitOfWork} isolation will ensure that the other thread is not affected. That thread, on the other hand
- * will need to do a {@link #refresh()} at an appropriate time to pick up the timeout change. For instance;
- * </p>
- * <pre><code>
- *
- * &#64;Service InventoryService remoteInventoryService;
- *
- * public void restockInventoryItem( InventoryItemId id, int itemCount )
- * {
- *     config.refresh();
- *     long timeout = config.get().timeout().get();
- *
- *     remoteInventoryService.restock( id, itemCount, timeout );
- *
- *     :
- *     :
- * }
- * </code></pre>
- */
-@SuppressWarnings( "JavadocReference" )
-@Mixins( Configuration.ConfigurationMixin.class )
-public interface Configuration<T>
-{
-    /**
-     * Retrieves the user configuration instance managed by this Configuration.
-     * <p>
-     * Even if the user configuration is initialized from properties file, the consistency rules of Polygene composites
-     * still applies. If the the properties file is missing a value, then the initialization will fail with a
-     * RuntimeException. If Constraints has been defined, those will need to be satisfied as well. The user
-     * configuration instance returned will fulfill the constraints and consistency normal to all composites, and
-     * can therefor safely be used with additional checks.
-     * </p>
-     *
-     * @return The fully initialized and ready-to-use user configuration instance.
-     */
-    T get();
-
-    /**
-     * Updates the values of the managed user ConfigurationComposite instance from the underlying
-     * {@code org.apache.zest.spi.entitystore.EntityStore}.  Any modified values in the current user configuration that
-     * has not been saved, via {@link #save()} method, will be lost.
-     */
-    void refresh();
-
-    /**
-     * Persists the modified values in the user configuration instance to the underlying store.
-     */
-    void save();
-
-    /**
-     * Implementation of Configuration.
-     * <p>
-     * This is effectively an internal class in Polygene and should never be used directly by user code.
-     * </p>
-     *
-     * @param <T>
-     */
-    public class ConfigurationMixin<T>
-        implements Configuration<T>
-    {
-        private T configuration;
-        private UnitOfWork uow;
-
-        @Structure
-        private PolygeneAPI api;
-
-        @This
-        private ServiceComposite me;
-
-        @Structure
-        private UnitOfWorkFactory uowf;
-
-        @Service
-        private Iterable<ServiceReference<ValueSerialization>> valueSerialization;
-
-
-        public ConfigurationMixin()
-        {
-        }
-
-        @Override
-        public synchronized T get()
-        {
-            if( configuration == null )
-            {
-                Usecase usecase = UsecaseBuilder.newUsecase( "Configuration:" + me.identity().get() );
-                uow = uowf.newUnitOfWork( usecase );
-                try
-                {
-                    configuration = this.findConfigurationInstanceFor( me, uow );
-                }
-                catch( InstantiationException e )
-                {
-                    throw new IllegalStateException( e );
-                }
-            }
-
-            return configuration;
-        }
-
-        @Override
-        public synchronized void refresh()
-        {
-            if( configuration != null )
-            {
-                configuration = null;
-                uow.discard();
-                uow = null;
-            }
-        }
-
-        @Override
-        public void save()
-        {
-            if( uow != null )
-            {
-                try
-                {
-                    uow.complete();
-                    uow = null;
-                }
-                catch( UnitOfWorkCompletionException e )
-                {
-                    // Should be impossible
-                    e.printStackTrace();
-                }
-
-                configuration = null; // Force refresh
-            }
-        }
-
-        @SuppressWarnings( "unchecked" )
-        public <V> V findConfigurationInstanceFor( ServiceComposite serviceComposite, UnitOfWork uow )
-            throws InstantiationException
-        {
-            ServiceDescriptor serviceModel = api.serviceDescriptorFor( serviceComposite );
-
-            V configuration;
-            try
-            {
-                configuration = uow.get( serviceModel.<V>configurationType(), serviceComposite.identity().get() );
-                uow.pause();
-            }
-            catch( NoSuchEntityException | NoSuchEntityTypeException e )
-            {
-                return (V) initializeConfigurationInstance( serviceComposite, uow, serviceModel, serviceComposite.identity().get() );
-            }
-            return configuration;
-        }
-
-        @SuppressWarnings( "unchecked" )
-        private <V extends HasIdentity> V initializeConfigurationInstance(ServiceComposite serviceComposite,
-                                                                          UnitOfWork uow,
-                                                                          ServiceDescriptor serviceModel,
-                                                                          Identity identity
-        )
-            throws InstantiationException
-        {
-            Module module = api.moduleOf( serviceComposite ).instance();
-            Usecase usecase = UsecaseBuilder.newUsecase( "Configuration:" + me.identity().get() );
-            UnitOfWork buildUow = module.unitOfWorkFactory().newUnitOfWork( usecase );
-
-            Class<?> type = api.serviceDescriptorFor( serviceComposite ).types().findFirst().orElse( null );
-            Class<V> configType = serviceModel.configurationType();
-
-            // Check for defaults
-            V config = tryLoadPropertiesFile( buildUow, type, configType, identity );
-            if( config == null )
-            {
-                config = tryLoadJsonFile( buildUow, type, configType, identity );
-                if( config == null )
-                {
-                    config = tryLoadYamlFile( buildUow, type, configType, identity );
-                    if( config == null )
-                    {
-                        config = tryLoadXmlFile( buildUow, type, configType, identity );
-                        if( config == null )
-                        {
-                            try
-                            {
-                                EntityBuilder<V> configBuilder = buildUow.newEntityBuilder( serviceModel.<V>configurationType(), identity );
-                                configBuilder.newInstance();
-                            }
-                            catch( ConstraintViolationException e )
-                            {
-                                throw new NoSuchConfigurationException( configType, identity, e );
-                            }
-                        }
-                    }
-                }
-            }
-
-            try
-            {
-                buildUow.complete();
-
-                // Try again
-                return (V) findConfigurationInstanceFor( serviceComposite, uow );
-            }
-            catch( Exception e1 )
-            {
-                InstantiationException ex = new InstantiationException(
-                    "Could not instantiate configuration, and no configuration initialization file was found (" + identity + ")" );
-                ex.initCause( e1 );
-                throw ex;
-            }
-        }
-
-        private <C, V> V tryLoadPropertiesFile( UnitOfWork buildUow,
-                                                Class<C> compositeType,
-                                                Class<V> configType,
-                                                Identity identity
-        )
-            throws InstantiationException
-        {
-            EntityBuilder<V> configBuilder = buildUow.newEntityBuilder( configType, identity );
-            String resourceName = identity + ".properties";
-            InputStream asStream = getResource( compositeType, resourceName );
-            if( asStream != null )
-            {
-                try
-                {
-                    PropertyMapper.map( asStream, (Composite) configBuilder.instance() );
-                    return configBuilder.newInstance();
-                }
-                catch( IOException e1 )
-                {
-                    InstantiationException exception = new InstantiationException(
-                        "Could not read underlying Properties file." );
-                    exception.initCause( e1 );
-                    throw exception;
-                }
-            }
-            return null;
-        }
-
-        private InputStream getResource( Class<?> type, String resourceName )
-        {
-            // Load defaults from classpath root if available
-            if( type.getResource( resourceName ) == null && type.getResource( "/" + resourceName ) != null )
-            {
-                resourceName = "/" + resourceName;
-            }
-            return type.getResourceAsStream( resourceName );
-        }
-
-        private <C, V extends HasIdentity> V tryLoadJsonFile(UnitOfWork uow,
-                                                             Class<C> compositeType,
-                                                             Class<V> configType,
-                                                             Identity identity
-        )
-        {
-            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.JSON, ".json" );
-        }
-
-        private <C, V extends HasIdentity> V tryLoadYamlFile(UnitOfWork uow,
-                                                             Class<C> compositeType,
-                                                             Class<V> configType,
-                                                             Identity identity
-        )
-        {
-            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.YAML, ".yaml" );
-        }
-
-        private <C, V extends HasIdentity> V tryLoadXmlFile(UnitOfWork uow,
-                                                            Class<C> compositeType,
-                                                            Class<V> configType,
-                                                            Identity identity
-        )
-        {
-            return readConfig( uow, compositeType, configType, identity, ValueSerialization.Formats.XML, ".xml" );
-        }
-
-        private <C, V extends HasIdentity> V readConfig(UnitOfWork uow,
-                                                        Class<C> compositeType,
-                                                        Class<V> configType,
-                                                        Identity identity,
-                                                        String format,
-                                                        String extension
-        )
-        {
-            for( ServiceReference<ValueSerialization> serializerRef : valueSerialization )
-            {
-                ServiceTags serviceTags = serializerRef.metaInfo( ServiceTags.class );
-                if( serviceTags.hasTag( format ) )
-                {
-                    String resourceName = identity + extension;
-                    InputStream asStream = getResource( compositeType, resourceName );
-                    if( asStream != null )
-                    {
-                        V configObject = serializerRef.get().deserialize( uow.module(), configType, asStream );
-                        return uow.toEntity( configType, configObject );
-                    }
-                }
-            }
-            return null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/configuration/ConfigurationComposite.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/configuration/ConfigurationComposite.java b/core/api/src/main/java/org/apache/zest/api/configuration/ConfigurationComposite.java
deleted file mode 100644
index 351be27..0000000
--- a/core/api/src/main/java/org/apache/zest/api/configuration/ConfigurationComposite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.entity.Queryable;
-
-/**
- * Services that want to be configurable should have a ConfigurationComposite that contains all the settings.
- * They are treated as EntityComposites, and are therefore stored in an EntityStore. There will be one instance
- * per service instance that uses each ConfigurationComposite, and the reference of the entity is the same as that
- * of the service.
- */
-@Queryable( false )
-public interface ConfigurationComposite
-    extends HasIdentity, Composite
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/configuration/Enabled.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/configuration/Enabled.java b/core/api/src/main/java/org/apache/zest/api/configuration/Enabled.java
deleted file mode 100644
index f23d98c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/configuration/Enabled.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.property.Property;
-
-/**
- * Common configuration for setting whether a service is enabled or not. A disabled service
- * is not considered to be available. Let your own ConfigurationComposite extend this interface to use.
- */
-public interface Enabled
-{
-    @UseDefaults
-    Property<Boolean> enabled();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/configuration/NoSuchConfigurationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/configuration/NoSuchConfigurationException.java b/core/api/src/main/java/org/apache/zest/api/configuration/NoSuchConfigurationException.java
deleted file mode 100644
index 0bfc3fe..0000000
--- a/core/api/src/main/java/org/apache/zest/api/configuration/NoSuchConfigurationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.identity.Identity;
-
-public class NoSuchConfigurationException extends RuntimeException
-{
-    private final Class<? extends HasIdentity> configType;
-    private final Identity identity;
-
-    public NoSuchConfigurationException( Class<? extends HasIdentity> configType,
-                                         Identity identity,
-                                         Exception cause
-    )
-    {
-        super( "No configuration found for '" + identity + "' and configuration " + configType.getName() + " has one or more non-Optional properties.", cause );
-        this.configType = configType;
-        this.identity = identity;
-    }
-
-    public Class<? extends HasIdentity> configType()
-    {
-        return configType;
-    }
-
-    public Identity identity()
-    {
-        return identity;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/configuration/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/configuration/package.html b/core/api/src/main/java/org/apache/zest/api/configuration/package.html
deleted file mode 100644
index b923bc3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/configuration/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Configuration API.</h2>
-    </body>
-</html>


[68/81] [abbrv] zest-java git commit: ZEST-195 ; Fix file names.

Posted by ni...@apache.org.
ZEST-195 ; Fix file names.


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

Branch: refs/heads/develop
Commit: b45402f28b6560cf1453d2dbd2d218b3dc5f7b4c
Parents: b02063b
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Wed Dec 14 10:24:43 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Wed Dec 14 10:24:43 2016 +0800

----------------------------------------------------------------------
 .../reference/AbstractPolygeneScenarioTest.txt  |  18 +
 .../src/docs/reference/AbstractPolygeneTest.txt |  18 +
 .../docs/reference/AbstractZestScenarioTest.txt |  18 -
 .../src/docs/reference/AbstractZestTest.txt     |  18 -
 etc/polygene-api-checkstyle.xml                 | 212 +++++
 etc/polygene-runtime-checkstyle.xml             | 208 +++++
 etc/polygene-tests-checkstyle.xml               | 196 +++++
 etc/zest-api-checkstyle.xml                     | 212 -----
 etc/zest-runtime-checkstyle.xml                 | 208 -----
 etc/zest-tests-checkstyle.xml                   | 196 -----
 .../metrics/AbstractPolygeneMetricsTest.java    | 338 ++++++++
 .../test/metrics/AbstractZestMetricsTest.java   | 338 --------
 .../http/polygene-lib-http-unittests-ca.jceks   | Bin 0 -> 1075 bytes
 ...olygene-lib-http-unittests-client-cert.jceks | Bin 0 -> 3395 bytes
 ...olygene-lib-http-unittests-server-cert.jceks | Bin 0 -> 3380 bytes
 .../http/zest-lib-http-unittests-ca.jceks       | Bin 1075 -> 0 bytes
 .../zest-lib-http-unittests-client-cert.jceks   | Bin 3395 -> 0 bytes
 .../zest-lib-http-unittests-server-cert.jceks   | Bin 3380 -> 0 bytes
 .../AbstractPolygeneServletBootstrap.java       | 143 ++++
 .../lifecycle/AbstractZestServletBootstrap.java | 143 ----
 .../PolygeneExportServiceTest-context.xml       |  36 +
 .../bootstrap/ZestExportServiceTest-context.xml |  36 -
 .../PolygeneImportServiceTest-context.xml       |  28 +
 .../importer/ZestImportServiceTest-context.xml  |  28 -
 .../docs/tutorials/howto-depend-on-polygene.txt | 193 +++++
 .../src/docs/tutorials/howto-depend-on-zest.txt | 193 -----
 .../src/docs/website/resources/css/polygene.css | 825 +++++++++++++++++++
 manual/src/docs/website/resources/css/zest.css  | 825 -------------------
 manual/src/resources/images/polygene-blue.png   | Bin 0 -> 853 bytes
 manual/src/resources/images/zest-blue.png       | Bin 853 -> 0 bytes
 .../common/PolygeneAppliesToConstants.java      |  33 +
 .../appliesTo/common/PolygeneAppliesToUtil.java | 138 ++++
 .../common/ZestAppliesToConstants.java          |  33 -
 .../appliesTo/common/ZestAppliesToUtil.java     | 138 ----
 .../actions/PolygeneCreateActionGroup.java      |  82 ++
 .../common/actions/ZestCreateActionGroup.java   |  82 --
 .../plugin/idea/common/facet/PolygeneFacet.java |  50 ++
 .../facet/PolygeneFacetConfiguration.java       |  56 ++
 .../idea/common/facet/PolygeneFacetType.java    | 122 +++
 .../ide/plugin/idea/common/facet/ZestFacet.java |  50 --
 .../common/facet/ZestFacetConfiguration.java    |  56 --
 .../plugin/idea/common/facet/ZestFacetType.java | 122 ---
 .../common/facet/ui/PolygeneFacetEditorTab.java |  72 ++
 .../common/facet/ui/ZestFacetEditorTab.java     |  72 --
 .../common/resource/PolygeneResourceBundle.java |  68 ++
 .../common/resource/ZestResourceBundle.java     |  68 --
 .../common/PolygeneConcernConstants.java        |  40 +
 .../concerns/common/PolygeneConcernUtil.java    | 228 +++++
 .../concerns/common/ZestConcernConstants.java   |  40 -
 .../idea/concerns/common/ZestConcernUtil.java   | 228 -----
 .../PolygeneInvocationAnnotationConstants.java  |  32 +
 .../PolygeneInvocationAnnotationUtil.java       | 129 +++
 .../ZestInvocationAnnotationConstants.java      |  32 -
 .../common/ZestInvocationAnnotationUtil.java    | 129 ---
 .../PolygeneServiceAnnotationConstants.java     |  32 +
 .../common/PolygeneServiceAnnotationUtil.java   |  99 +++
 .../common/ZestServiceAnnotationConstants.java  |  32 -
 .../common/ZestServiceAnnotationUtil.java       |  99 ---
 .../PolygeneStructureAnnotationConstants.java   |  53 ++
 .../common/PolygeneStructureAnnotationUtil.java | 124 +++
 .../ZestStructureAnnotationConstants.java       |  53 --
 .../common/ZestStructureAnnotationUtil.java     | 124 ---
 .../mixins/common/PolygeneMixinConstants.java   |  32 +
 .../idea/mixins/common/PolygeneMixinUtil.java   | 196 +++++
 .../idea/mixins/common/ZestMixinConstants.java  |  32 -
 .../idea/mixins/common/ZestMixinUtil.java       | 196 -----
 .../common/PolygeneSideEffectConstants.java     |  35 +
 .../common/PolygeneSideEffectUtil.java          | 188 +++++
 .../common/ZestSideEffectConstants.java         |  35 -
 .../sideEffects/common/ZestSideEffectUtil.java  | 188 -----
 .../resource/PolygeneResourceBundle.properties  | 164 ++++
 .../resource/ZestResourceBundle.properties      | 164 ----
 tools/shell/src/dist/bin/polygene-boot          |  79 ++
 tools/shell/src/dist/bin/zest-boot              |  79 --
 .../introduction/src/docs/polygene-cop.txt      |  22 +
 tutorials/introduction/src/docs/zest-cop.txt    |  22 -
 76 files changed, 4289 insertions(+), 4289 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt
----------------------------------------------------------------------
diff --git a/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt b/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt
new file mode 100644
index 0000000..fc7aac6
--- /dev/null
+++ b/core/testsupport/src/docs/reference/AbstractPolygeneScenarioTest.txt
@@ -0,0 +1,18 @@
+///////////////////////////////////////////////////////////////
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+///////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt
----------------------------------------------------------------------
diff --git a/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt b/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt
new file mode 100644
index 0000000..fc7aac6
--- /dev/null
+++ b/core/testsupport/src/docs/reference/AbstractPolygeneTest.txt
@@ -0,0 +1,18 @@
+///////////////////////////////////////////////////////////////
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+///////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt
----------------------------------------------------------------------
diff --git a/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt b/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt
deleted file mode 100644
index fc7aac6..0000000
--- a/core/testsupport/src/docs/reference/AbstractZestScenarioTest.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
-///////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/core/testsupport/src/docs/reference/AbstractZestTest.txt
----------------------------------------------------------------------
diff --git a/core/testsupport/src/docs/reference/AbstractZestTest.txt b/core/testsupport/src/docs/reference/AbstractZestTest.txt
deleted file mode 100644
index fc7aac6..0000000
--- a/core/testsupport/src/docs/reference/AbstractZestTest.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
-///////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-api-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/polygene-api-checkstyle.xml b/etc/polygene-api-checkstyle.xml
new file mode 100644
index 0000000..4db3ae8
--- /dev/null
+++ b/etc/polygene-api-checkstyle.xml
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!-- Documentation is availableService at
+     http://checkstyle.sourceforge.net/availablechecks.html
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="NewlineAtEndOfFile"/>
+  <module name="Translation"/>
+  <module name="JavadocPackage"/>
+  <module name="TreeWalker">
+    <module name="MutableException"/>
+
+    <module name="CyclomaticComplexity">
+      <property name="max" value="7"/>
+    </module>
+    <module name="Indentation"/>
+    <module name="CovariantEquals"/>
+    <module name="FileContentsHolder"/>
+    <module name="ArrayTypeStyle"/>
+    <!-- 2005-Oct-05
+         final in method arguments is just ugly in my opinion,
+         communicates very little, and is not preventing much
+         problem. Remove it for now.
+    <module name="FinalParameters">
+        <property name="severity" value="ignore"/>
+        <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
+    </module>
+    -->
+
+    <!--
+        <module name="GenericIllegalRegexp">
+          <property name="severity" value="ignore"/>
+          <property name="format" value="\s+$"/>
+          <property name="message" value="Line has trailing spaces."/>
+        </module>
+    -->
+
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier">
+      <property name="severity" value="ignore"/>
+      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
+    </module>
+
+    <module name="TodoComment"/>
+    <module name="UpperEll"/>
+    <module name="AvoidNestedBlocks"/>
+    <module name="EmptyBlock">
+      <property name="tokens"
+                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
+    </module>
+    <module name="LeftCurly">
+      <property name="option" value="nl"/>
+      <property name="tokens"
+                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
+
+    </module>
+    <module name="NeedBraces"/>
+    <module name="RightCurly">
+      <property name="option" value="alone"/>
+      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
+    </module>
+    <module name="AvoidInlineConditionals"/>
+    <module name="DoubleCheckedLocking"/>
+    <module name="EmptyStatement"/>
+
+    <module name="EqualsHashCode"/>
+    <!--<module name="HiddenField"/>-->
+    <module name="IllegalInstantiation"/>
+    <module name="InnerAssignment"/>
+    <module name="MagicNumber">
+      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
+      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
+    </module>
+    <module name="MissingSwitchDefault"/>
+
+    <!--
+         Niclas 2005-09-16:
+         This check seems somewhat broken, since
+         a = b == false;
+         is more readable in my view than
+         a = !b
+         but the former will trigger this rule. Therefor I disable it.
+         <module name="SimplifyBooleanExpression">
+         </module>
+    -->
+    <module name="SimplifyBooleanReturn"/>
+    <module name="StringLiteralEquality"/>
+    <module name="NestedIfDepth">
+      <property name="max" value="3"/>
+    </module>
+    <module name="NestedTryDepth">
+      <property name="max" value="2"/>
+    </module>
+
+    <module name="SuperClone"/>
+    <module name="SuperFinalize"/>
+    <module name="IllegalCatch">
+      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
+    </module>
+    <module name="IllegalThrows">
+      <property name="illegalClassNames"
+                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
+    </module>
+    <module name="PackageDeclaration"/>
+
+    <module name="JUnitTestCase"/>
+    <module name="DeclarationOrder"/>
+    <module name="ParameterAssignment"/>
+    <!--<module name="MissingCtor"/>-->
+    <module name="MultipleVariableDeclarations"/>
+    <module name="DesignForExtension">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="FinalClass"/>
+
+    <module name="HideUtilityClassConstructor"/>
+    <module name="VisibilityModifier"/>
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="ImportOrder">
+      <property name="groups" value=""/>
+      <property name="ordered" value="true"/>
+      <property name="option" value="under"/>
+      <property name="separated" value="true"/>
+      <property name="caseSensitive" value="true"/>
+    </module>
+
+    <!--TODO Removing this until Javadoc effort has picked up -->
+    <!--<module name="JavadocMethod"/>-->
+    <!--<module name="JavadocType"/>-->
+    <!--<module name="JavadocVariable">-->
+      <!--<property name="scope" value="package"/>-->
+    <!--</module>-->
+    <module name="ConstantName">
+      <property name="format" value="^[A-Z0-9_$]*$"/>
+    </module>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+
+    <module name="ParameterName"/>
+    <module name="StaticVariableName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="TypeName"/>
+    <module name="LineLength">
+
+      <property name="max" value="120"/>
+    </module>
+    <module name="MethodLength"/>
+    <module name="AnonInnerLength">
+      <property name="max" value="60"/>
+    </module>
+    <module name="ParameterNumber">
+      <property name="max" value="12"/>
+    </module>
+
+    <module name="EmptyForIteratorPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <!--<module name="OperatorWrap"/>-->
+    <module name="ParenPad">
+      <property name="option" value="space"/>
+      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
+    </module>
+
+    <!--
+        <module name="TabCharacter"/>
+    -->
+
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround">
+      <property name="tokens"
+                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
+    </module>
+  </module>
+
+  <module name="FileLength">
+    <property name="max" value="1000"/>
+  </module>
+
+</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-runtime-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/polygene-runtime-checkstyle.xml b/etc/polygene-runtime-checkstyle.xml
new file mode 100644
index 0000000..8d4b9f7
--- /dev/null
+++ b/etc/polygene-runtime-checkstyle.xml
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!-- Documentation is availableService at
+     http://checkstyle.sourceforge.net/availablechecks.html
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="NewlineAtEndOfFile"/>
+  <module name="Translation"/>
+  <!--TODO Removing this until Javadoc effort has picked up -->
+  <!--<module name="JavadocPackage"/>-->
+  <module name="TreeWalker">
+    <module name="MutableException"/>
+
+    <module name="CyclomaticComplexity">
+      <property name="max" value="7"/>
+    </module>
+    <module name="Indentation"/>
+    <module name="CovariantEquals"/>
+    <module name="FileContentsHolder"/>
+    <module name="ArrayTypeStyle"/>
+    <!-- 2005-Oct-05
+         final in method arguments is just ugly in my opinion,
+         communicates very little, and is not preventing much
+         problem. Remove it for now.
+    <module name="FinalParameters">
+        <property name="severity" value="ignore"/>
+        <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
+    </module>
+    -->
+
+    <!--
+        <module name="GenericIllegalRegexp">
+          <property name="severity" value="ignore"/>
+          <property name="format" value="\s+$"/>
+          <property name="message" value="Line has trailing spaces."/>
+        </module>
+    -->
+
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier">
+      <property name="severity" value="ignore"/>
+      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
+    </module>
+
+    <module name="TodoComment"/>
+    <module name="UpperEll"/>
+    <module name="AvoidNestedBlocks"/>
+    <module name="EmptyBlock">
+      <property name="tokens"
+                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
+    </module>
+    <module name="LeftCurly">
+      <property name="option" value="nl"/>
+      <property name="tokens"
+                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
+
+    </module>
+    <module name="NeedBraces"/>
+    <module name="RightCurly">
+      <property name="option" value="alone"/>
+      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
+    </module>
+    <module name="AvoidInlineConditionals"/>
+    <module name="DoubleCheckedLocking"/>
+    <module name="EmptyStatement"/>
+
+    <module name="EqualsHashCode"/>
+    <!--<module name="HiddenField"/>-->
+    <module name="IllegalInstantiation"/>
+    <module name="InnerAssignment"/>
+    <module name="MagicNumber">
+      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
+      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
+    </module>
+    <module name="MissingSwitchDefault"/>
+
+    <!--
+         Niclas 2005-09-16:
+         This check seems somewhat broken, since
+         a = b == false;
+         is more readable in my view than
+         a = !b
+         but the former will trigger this rule. Therefor I disable it.
+         <module name="SimplifyBooleanExpression">
+         </module>
+    -->
+    <module name="SimplifyBooleanReturn"/>
+    <module name="StringLiteralEquality"/>
+    <module name="NestedIfDepth">
+      <property name="max" value="3"/>
+    </module>
+    <module name="NestedTryDepth">
+      <property name="max" value="2"/>
+    </module>
+
+    <module name="SuperClone"/>
+    <module name="SuperFinalize"/>
+    <module name="IllegalCatch">
+      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
+    </module>
+    <module name="IllegalThrows">
+      <property name="illegalClassNames"
+                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
+    </module>
+    <module name="PackageDeclaration"/>
+
+    <module name="JUnitTestCase"/>
+    <module name="DeclarationOrder"/>
+    <module name="ParameterAssignment"/>
+    <!--<module name="MissingCtor"/>-->
+    <module name="MultipleVariableDeclarations"/>
+    <module name="DesignForExtension">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="FinalClass"/>
+
+    <module name="HideUtilityClassConstructor"/>
+    <module name="VisibilityModifier"/>
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="ImportOrder">
+      <property name="groups" value=""/>
+      <property name="ordered" value="true"/>
+      <property name="option" value="under"/>
+      <property name="separated" value="true"/>
+      <property name="caseSensitive" value="true"/>
+    </module>
+    <!--TODO Removing this until Javadoc effort has picked up -->
+    <!--<module name="JavadocType"/>-->
+    <module name="ConstantName">
+      <property name="format" value="^[A-Z0-9_$]*$"/>
+    </module>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+
+    <module name="ParameterName"/>
+    <module name="StaticVariableName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="TypeName"/>
+    <module name="LineLength">
+
+      <property name="max" value="120"/>
+    </module>
+    <module name="MethodLength"/>
+    <module name="AnonInnerLength">
+      <property name="max" value="60"/>
+    </module>
+    <module name="ParameterNumber">
+      <property name="max" value="12"/>
+    </module>
+
+    <module name="EmptyForIteratorPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <!--<module name="OperatorWrap"/>-->
+    <module name="ParenPad">
+      <property name="option" value="space"/>
+      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
+    </module>
+
+    <!--
+        <module name="TabCharacter"/>
+    -->
+
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround">
+      <property name="tokens"
+                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
+    </module>
+  </module>
+
+  <module name="FileLength">
+    <property name="max" value="1000"/>
+  </module>
+
+</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/polygene-tests-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/polygene-tests-checkstyle.xml b/etc/polygene-tests-checkstyle.xml
new file mode 100644
index 0000000..fc741ac
--- /dev/null
+++ b/etc/polygene-tests-checkstyle.xml
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+
+<!-- Documentation is availableService at
+     http://checkstyle.sourceforge.net/availablechecks.html
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="NewlineAtEndOfFile"/>
+  <module name="Translation"/>
+  <module name="TreeWalker">
+    <module name="MutableException"/>
+
+    <module name="CyclomaticComplexity">
+      <property name="max" value="7"/>
+    </module>
+    <module name="Indentation"/>
+    <module name="CovariantEquals"/>
+    <module name="FileContentsHolder"/>
+    <module name="ArrayTypeStyle"/>
+    <!--
+        <module name="GenericIllegalRegexp">
+          <property name="severity" value="ignore"/>
+          <property name="format" value="\s+$"/>
+          <property name="message" value="Line has trailing spaces."/>
+        </module>
+    -->
+
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier">
+      <property name="severity" value="ignore"/>
+      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
+    </module>
+
+    <module name="TodoComment"/>
+    <module name="UpperEll"/>
+    <module name="AvoidNestedBlocks"/>
+    <module name="EmptyBlock">
+      <property name="tokens"
+                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
+    </module>
+    <module name="LeftCurly">
+      <property name="option" value="nl"/>
+      <property name="tokens"
+                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
+
+    </module>
+    <module name="NeedBraces"/>
+    <module name="RightCurly">
+      <property name="option" value="alone"/>
+      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
+    </module>
+    <module name="AvoidInlineConditionals"/>
+    <module name="DoubleCheckedLocking"/>
+    <module name="EmptyStatement"/>
+
+    <module name="EqualsHashCode"/>
+    <!--<module name="HiddenField"/>-->
+    <module name="IllegalInstantiation"/>
+    <module name="InnerAssignment"/>
+    <module name="MagicNumber">
+      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
+      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
+    </module>
+    <module name="MissingSwitchDefault"/>
+
+    <!--
+         Niclas 2005-09-16:
+         This check seems somewhat broken, since
+         a = b == false;
+         is more readable in my view than
+         a = !b
+         but the former will trigger this rule. Therefor I disable it.
+         <module name="SimplifyBooleanExpression">
+         </module>
+    -->
+    <module name="SimplifyBooleanReturn"/>
+    <module name="StringLiteralEquality"/>
+    <module name="NestedIfDepth">
+      <property name="max" value="3"/>
+    </module>
+    <module name="NestedTryDepth">
+      <property name="max" value="2"/>
+    </module>
+
+    <module name="SuperClone"/>
+    <module name="SuperFinalize"/>
+    <!-- Ok in tests...
+    <module name="IllegalCatch">
+      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
+    </module>
+    <module name="IllegalThrows">
+      <property name="illegalClassNames"
+                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
+    </module>
+    -->
+    <module name="PackageDeclaration"/>
+
+    <module name="JUnitTestCase"/>
+    <module name="DeclarationOrder"/>
+    <module name="ParameterAssignment"/>
+    <!--<module name="MissingCtor"/>-->
+    <module name="MultipleVariableDeclarations"/>
+    <module name="DesignForExtension">
+      <property name="severity" value="ignore"/>
+    </module>
+    <module name="FinalClass"/>
+
+    <module name="HideUtilityClassConstructor"/>
+    <module name="VisibilityModifier"/>
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="ImportOrder">
+      <property name="groups" value=""/>
+      <property name="ordered" value="true"/>
+      <property name="separated" value="false"/>
+      <property name="caseSensitive" value="true"/>
+      <property name="option" value="under"/>
+    </module>
+    <module name="ConstantName">
+      <property name="format" value="^[A-Z0-9_$]*$"/>
+    </module>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+
+    <module name="ParameterName"/>
+    <module name="StaticVariableName">
+      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
+    </module>
+    <module name="TypeName"/>
+    <module name="LineLength">
+
+      <property name="max" value="120"/>
+    </module>
+    <module name="MethodLength"/>
+    <module name="AnonInnerLength">
+      <property name="max" value="60"/>
+    </module>
+    <module name="ParameterNumber">
+      <property name="max" value="12"/>
+    </module>
+
+    <module name="EmptyForIteratorPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <!--<module name="OperatorWrap"/>-->
+    <module name="ParenPad">
+      <property name="option" value="space"/>
+      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
+    </module>
+
+    <!--
+        <module name="TabCharacter"/>
+    -->
+
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround">
+      <property name="tokens"
+                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
+    </module>
+  </module>
+
+  <module name="FileLength">
+    <property name="max" value="1000"/>
+  </module>
+
+</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-api-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/zest-api-checkstyle.xml b/etc/zest-api-checkstyle.xml
deleted file mode 100644
index 4db3ae8..0000000
--- a/etc/zest-api-checkstyle.xml
+++ /dev/null
@@ -1,212 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!-- Documentation is availableService at
-     http://checkstyle.sourceforge.net/availablechecks.html
--->
-<module name="Checker">
-  <property name="severity" value="warning"/>
-  <module name="NewlineAtEndOfFile"/>
-  <module name="Translation"/>
-  <module name="JavadocPackage"/>
-  <module name="TreeWalker">
-    <module name="MutableException"/>
-
-    <module name="CyclomaticComplexity">
-      <property name="max" value="7"/>
-    </module>
-    <module name="Indentation"/>
-    <module name="CovariantEquals"/>
-    <module name="FileContentsHolder"/>
-    <module name="ArrayTypeStyle"/>
-    <!-- 2005-Oct-05
-         final in method arguments is just ugly in my opinion,
-         communicates very little, and is not preventing much
-         problem. Remove it for now.
-    <module name="FinalParameters">
-        <property name="severity" value="ignore"/>
-        <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
-    </module>
-    -->
-
-    <!--
-        <module name="GenericIllegalRegexp">
-          <property name="severity" value="ignore"/>
-          <property name="format" value="\s+$"/>
-          <property name="message" value="Line has trailing spaces."/>
-        </module>
-    -->
-
-    <module name="ModifierOrder"/>
-    <module name="RedundantModifier">
-      <property name="severity" value="ignore"/>
-      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
-    </module>
-
-    <module name="TodoComment"/>
-    <module name="UpperEll"/>
-    <module name="AvoidNestedBlocks"/>
-    <module name="EmptyBlock">
-      <property name="tokens"
-                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
-    </module>
-    <module name="LeftCurly">
-      <property name="option" value="nl"/>
-      <property name="tokens"
-                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
-
-    </module>
-    <module name="NeedBraces"/>
-    <module name="RightCurly">
-      <property name="option" value="alone"/>
-      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
-    </module>
-    <module name="AvoidInlineConditionals"/>
-    <module name="DoubleCheckedLocking"/>
-    <module name="EmptyStatement"/>
-
-    <module name="EqualsHashCode"/>
-    <!--<module name="HiddenField"/>-->
-    <module name="IllegalInstantiation"/>
-    <module name="InnerAssignment"/>
-    <module name="MagicNumber">
-      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
-      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
-    </module>
-    <module name="MissingSwitchDefault"/>
-
-    <!--
-         Niclas 2005-09-16:
-         This check seems somewhat broken, since
-         a = b == false;
-         is more readable in my view than
-         a = !b
-         but the former will trigger this rule. Therefor I disable it.
-         <module name="SimplifyBooleanExpression">
-         </module>
-    -->
-    <module name="SimplifyBooleanReturn"/>
-    <module name="StringLiteralEquality"/>
-    <module name="NestedIfDepth">
-      <property name="max" value="3"/>
-    </module>
-    <module name="NestedTryDepth">
-      <property name="max" value="2"/>
-    </module>
-
-    <module name="SuperClone"/>
-    <module name="SuperFinalize"/>
-    <module name="IllegalCatch">
-      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
-    </module>
-    <module name="IllegalThrows">
-      <property name="illegalClassNames"
-                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
-    </module>
-    <module name="PackageDeclaration"/>
-
-    <module name="JUnitTestCase"/>
-    <module name="DeclarationOrder"/>
-    <module name="ParameterAssignment"/>
-    <!--<module name="MissingCtor"/>-->
-    <module name="MultipleVariableDeclarations"/>
-    <module name="DesignForExtension">
-      <property name="severity" value="ignore"/>
-    </module>
-    <module name="FinalClass"/>
-
-    <module name="HideUtilityClassConstructor"/>
-    <module name="VisibilityModifier"/>
-    <module name="AvoidStarImport"/>
-    <module name="IllegalImport"/>
-    <module name="RedundantImport"/>
-    <module name="UnusedImports"/>
-    <module name="ImportOrder">
-      <property name="groups" value=""/>
-      <property name="ordered" value="true"/>
-      <property name="option" value="under"/>
-      <property name="separated" value="true"/>
-      <property name="caseSensitive" value="true"/>
-    </module>
-
-    <!--TODO Removing this until Javadoc effort has picked up -->
-    <!--<module name="JavadocMethod"/>-->
-    <!--<module name="JavadocType"/>-->
-    <!--<module name="JavadocVariable">-->
-      <!--<property name="scope" value="package"/>-->
-    <!--</module>-->
-    <module name="ConstantName">
-      <property name="format" value="^[A-Z0-9_$]*$"/>
-    </module>
-    <module name="LocalFinalVariableName"/>
-    <module name="LocalVariableName"/>
-    <module name="MemberName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="MethodName"/>
-    <module name="PackageName"/>
-
-    <module name="ParameterName"/>
-    <module name="StaticVariableName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="TypeName"/>
-    <module name="LineLength">
-
-      <property name="max" value="120"/>
-    </module>
-    <module name="MethodLength"/>
-    <module name="AnonInnerLength">
-      <property name="max" value="60"/>
-    </module>
-    <module name="ParameterNumber">
-      <property name="max" value="12"/>
-    </module>
-
-    <module name="EmptyForIteratorPad"/>
-    <module name="NoWhitespaceAfter">
-      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
-    </module>
-    <!--<module name="OperatorWrap"/>-->
-    <module name="ParenPad">
-      <property name="option" value="space"/>
-      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
-    </module>
-
-    <!--
-        <module name="TabCharacter"/>
-    -->
-
-    <module name="WhitespaceAfter"/>
-    <module name="WhitespaceAround">
-      <property name="tokens"
-                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
-    </module>
-  </module>
-
-  <module name="FileLength">
-    <property name="max" value="1000"/>
-  </module>
-
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-runtime-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/zest-runtime-checkstyle.xml b/etc/zest-runtime-checkstyle.xml
deleted file mode 100644
index 8d4b9f7..0000000
--- a/etc/zest-runtime-checkstyle.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!-- Documentation is availableService at
-     http://checkstyle.sourceforge.net/availablechecks.html
--->
-<module name="Checker">
-  <property name="severity" value="warning"/>
-  <module name="NewlineAtEndOfFile"/>
-  <module name="Translation"/>
-  <!--TODO Removing this until Javadoc effort has picked up -->
-  <!--<module name="JavadocPackage"/>-->
-  <module name="TreeWalker">
-    <module name="MutableException"/>
-
-    <module name="CyclomaticComplexity">
-      <property name="max" value="7"/>
-    </module>
-    <module name="Indentation"/>
-    <module name="CovariantEquals"/>
-    <module name="FileContentsHolder"/>
-    <module name="ArrayTypeStyle"/>
-    <!-- 2005-Oct-05
-         final in method arguments is just ugly in my opinion,
-         communicates very little, and is not preventing much
-         problem. Remove it for now.
-    <module name="FinalParameters">
-        <property name="severity" value="ignore"/>
-        <property name="tokens" value="METHOD_DEF, CTOR_DEF"/>
-    </module>
-    -->
-
-    <!--
-        <module name="GenericIllegalRegexp">
-          <property name="severity" value="ignore"/>
-          <property name="format" value="\s+$"/>
-          <property name="message" value="Line has trailing spaces."/>
-        </module>
-    -->
-
-    <module name="ModifierOrder"/>
-    <module name="RedundantModifier">
-      <property name="severity" value="ignore"/>
-      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
-    </module>
-
-    <module name="TodoComment"/>
-    <module name="UpperEll"/>
-    <module name="AvoidNestedBlocks"/>
-    <module name="EmptyBlock">
-      <property name="tokens"
-                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
-    </module>
-    <module name="LeftCurly">
-      <property name="option" value="nl"/>
-      <property name="tokens"
-                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
-
-    </module>
-    <module name="NeedBraces"/>
-    <module name="RightCurly">
-      <property name="option" value="alone"/>
-      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
-    </module>
-    <module name="AvoidInlineConditionals"/>
-    <module name="DoubleCheckedLocking"/>
-    <module name="EmptyStatement"/>
-
-    <module name="EqualsHashCode"/>
-    <!--<module name="HiddenField"/>-->
-    <module name="IllegalInstantiation"/>
-    <module name="InnerAssignment"/>
-    <module name="MagicNumber">
-      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
-      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
-    </module>
-    <module name="MissingSwitchDefault"/>
-
-    <!--
-         Niclas 2005-09-16:
-         This check seems somewhat broken, since
-         a = b == false;
-         is more readable in my view than
-         a = !b
-         but the former will trigger this rule. Therefor I disable it.
-         <module name="SimplifyBooleanExpression">
-         </module>
-    -->
-    <module name="SimplifyBooleanReturn"/>
-    <module name="StringLiteralEquality"/>
-    <module name="NestedIfDepth">
-      <property name="max" value="3"/>
-    </module>
-    <module name="NestedTryDepth">
-      <property name="max" value="2"/>
-    </module>
-
-    <module name="SuperClone"/>
-    <module name="SuperFinalize"/>
-    <module name="IllegalCatch">
-      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
-    </module>
-    <module name="IllegalThrows">
-      <property name="illegalClassNames"
-                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
-    </module>
-    <module name="PackageDeclaration"/>
-
-    <module name="JUnitTestCase"/>
-    <module name="DeclarationOrder"/>
-    <module name="ParameterAssignment"/>
-    <!--<module name="MissingCtor"/>-->
-    <module name="MultipleVariableDeclarations"/>
-    <module name="DesignForExtension">
-      <property name="severity" value="ignore"/>
-    </module>
-    <module name="FinalClass"/>
-
-    <module name="HideUtilityClassConstructor"/>
-    <module name="VisibilityModifier"/>
-    <module name="AvoidStarImport"/>
-    <module name="IllegalImport"/>
-    <module name="RedundantImport"/>
-    <module name="UnusedImports"/>
-    <module name="ImportOrder">
-      <property name="groups" value=""/>
-      <property name="ordered" value="true"/>
-      <property name="option" value="under"/>
-      <property name="separated" value="true"/>
-      <property name="caseSensitive" value="true"/>
-    </module>
-    <!--TODO Removing this until Javadoc effort has picked up -->
-    <!--<module name="JavadocType"/>-->
-    <module name="ConstantName">
-      <property name="format" value="^[A-Z0-9_$]*$"/>
-    </module>
-    <module name="LocalFinalVariableName"/>
-    <module name="LocalVariableName"/>
-    <module name="MemberName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="MethodName"/>
-    <module name="PackageName"/>
-
-    <module name="ParameterName"/>
-    <module name="StaticVariableName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="TypeName"/>
-    <module name="LineLength">
-
-      <property name="max" value="120"/>
-    </module>
-    <module name="MethodLength"/>
-    <module name="AnonInnerLength">
-      <property name="max" value="60"/>
-    </module>
-    <module name="ParameterNumber">
-      <property name="max" value="12"/>
-    </module>
-
-    <module name="EmptyForIteratorPad"/>
-    <module name="NoWhitespaceAfter">
-      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
-    </module>
-    <!--<module name="OperatorWrap"/>-->
-    <module name="ParenPad">
-      <property name="option" value="space"/>
-      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
-    </module>
-
-    <!--
-        <module name="TabCharacter"/>
-    -->
-
-    <module name="WhitespaceAfter"/>
-    <module name="WhitespaceAround">
-      <property name="tokens"
-                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
-    </module>
-  </module>
-
-  <module name="FileLength">
-    <property name="max" value="1000"/>
-  </module>
-
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/etc/zest-tests-checkstyle.xml
----------------------------------------------------------------------
diff --git a/etc/zest-tests-checkstyle.xml b/etc/zest-tests-checkstyle.xml
deleted file mode 100644
index fc741ac..0000000
--- a/etc/zest-tests-checkstyle.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
-  "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!-- Documentation is availableService at
-     http://checkstyle.sourceforge.net/availablechecks.html
--->
-<module name="Checker">
-  <property name="severity" value="warning"/>
-  <module name="NewlineAtEndOfFile"/>
-  <module name="Translation"/>
-  <module name="TreeWalker">
-    <module name="MutableException"/>
-
-    <module name="CyclomaticComplexity">
-      <property name="max" value="7"/>
-    </module>
-    <module name="Indentation"/>
-    <module name="CovariantEquals"/>
-    <module name="FileContentsHolder"/>
-    <module name="ArrayTypeStyle"/>
-    <!--
-        <module name="GenericIllegalRegexp">
-          <property name="severity" value="ignore"/>
-          <property name="format" value="\s+$"/>
-          <property name="message" value="Line has trailing spaces."/>
-        </module>
-    -->
-
-    <module name="ModifierOrder"/>
-    <module name="RedundantModifier">
-      <property name="severity" value="ignore"/>
-      <property name="tokens" value="METHOD_DEF, VARIABLE_DEF"/>
-    </module>
-
-    <module name="TodoComment"/>
-    <module name="UpperEll"/>
-    <module name="AvoidNestedBlocks"/>
-    <module name="EmptyBlock">
-      <property name="tokens"
-                value="LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, STATIC_INIT"/>
-    </module>
-    <module name="LeftCurly">
-      <property name="option" value="nl"/>
-      <property name="tokens"
-                value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, METHOD_DEF"/>
-
-    </module>
-    <module name="NeedBraces"/>
-    <module name="RightCurly">
-      <property name="option" value="alone"/>
-      <property name="tokens" value="LITERAL_CATCH, LITERAL_ELSE, LITERAL_TRY"/>
-    </module>
-    <module name="AvoidInlineConditionals"/>
-    <module name="DoubleCheckedLocking"/>
-    <module name="EmptyStatement"/>
-
-    <module name="EqualsHashCode"/>
-    <!--<module name="HiddenField"/>-->
-    <module name="IllegalInstantiation"/>
-    <module name="InnerAssignment"/>
-    <module name="MagicNumber">
-      <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT"/>
-      <property name="ignoreNumbers" value="-1, 0, 1, 2, 10, 50, 60, 100, 1000, 3600"/>
-    </module>
-    <module name="MissingSwitchDefault"/>
-
-    <!--
-         Niclas 2005-09-16:
-         This check seems somewhat broken, since
-         a = b == false;
-         is more readable in my view than
-         a = !b
-         but the former will trigger this rule. Therefor I disable it.
-         <module name="SimplifyBooleanExpression">
-         </module>
-    -->
-    <module name="SimplifyBooleanReturn"/>
-    <module name="StringLiteralEquality"/>
-    <module name="NestedIfDepth">
-      <property name="max" value="3"/>
-    </module>
-    <module name="NestedTryDepth">
-      <property name="max" value="2"/>
-    </module>
-
-    <module name="SuperClone"/>
-    <module name="SuperFinalize"/>
-    <!-- Ok in tests...
-    <module name="IllegalCatch">
-      <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.Error"/>
-    </module>
-    <module name="IllegalThrows">
-      <property name="illegalClassNames"
-                value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException, java.lang.Error"/>
-    </module>
-    -->
-    <module name="PackageDeclaration"/>
-
-    <module name="JUnitTestCase"/>
-    <module name="DeclarationOrder"/>
-    <module name="ParameterAssignment"/>
-    <!--<module name="MissingCtor"/>-->
-    <module name="MultipleVariableDeclarations"/>
-    <module name="DesignForExtension">
-      <property name="severity" value="ignore"/>
-    </module>
-    <module name="FinalClass"/>
-
-    <module name="HideUtilityClassConstructor"/>
-    <module name="VisibilityModifier"/>
-    <module name="AvoidStarImport"/>
-    <module name="IllegalImport"/>
-    <module name="RedundantImport"/>
-    <module name="UnusedImports"/>
-    <module name="ImportOrder">
-      <property name="groups" value=""/>
-      <property name="ordered" value="true"/>
-      <property name="separated" value="false"/>
-      <property name="caseSensitive" value="true"/>
-      <property name="option" value="under"/>
-    </module>
-    <module name="ConstantName">
-      <property name="format" value="^[A-Z0-9_$]*$"/>
-    </module>
-    <module name="LocalFinalVariableName"/>
-    <module name="LocalVariableName"/>
-    <module name="MemberName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="MethodName"/>
-    <module name="PackageName"/>
-
-    <module name="ParameterName"/>
-    <module name="StaticVariableName">
-      <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
-    </module>
-    <module name="TypeName"/>
-    <module name="LineLength">
-
-      <property name="max" value="120"/>
-    </module>
-    <module name="MethodLength"/>
-    <module name="AnonInnerLength">
-      <property name="max" value="60"/>
-    </module>
-    <module name="ParameterNumber">
-      <property name="max" value="12"/>
-    </module>
-
-    <module name="EmptyForIteratorPad"/>
-    <module name="NoWhitespaceAfter">
-      <property name="tokens" value="BNOT,DEC,DOT,INC,UNARY_MINUS,UNARY_PLUS"/>
-    </module>
-    <!--<module name="OperatorWrap"/>-->
-    <module name="ParenPad">
-      <property name="option" value="space"/>
-      <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/>
-    </module>
-
-    <!--
-        <module name="TabCharacter"/>
-    -->
-
-    <module name="WhitespaceAfter"/>
-    <module name="WhitespaceAround">
-      <property name="tokens"
-                value="BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_DO, LITERAL_RETURN, LITERAL_TRY, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
-    </module>
-  </module>
-
-  <module name="FileLength">
-    <property name="max" value="1000"/>
-  </module>
-
-</module>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
new file mode 100644
index 0000000..9616f91
--- /dev/null
+++ b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractPolygeneMetricsTest.java
@@ -0,0 +1,338 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.test.metrics;
+
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.concern.Concerns;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.service.ServiceActivation;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
+import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.library.metrics.TimingCapture;
+import org.apache.polygene.library.metrics.TimingCaptureAllConcern;
+import org.apache.polygene.library.metrics.TimingCaptureConcern;
+import org.apache.polygene.test.AbstractPolygeneBaseTest;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.util.JmxFixture;
+import org.junit.Test;
+
+import java.util.Collection;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY;
+import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
+import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.assertThat;
+
+// TODO Test errors
+public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest
+{
+    public interface Person
+    {
+        Property<String> name();
+    }
+
+    public interface PersonList
+    {
+        Identity LIST_ID = StringIdentity.fromString( "person-list" );
+
+        ManyAssociation<Person> all();
+    }
+
+    @Concerns( {TimingCaptureAllConcern.class, UnitOfWorkConcern.class} )
+    @Mixins( CommandsMixin.class )
+    public interface Commands extends ServiceActivation
+    {
+        @UnitOfWorkPropagation( MANDATORY )
+        Person create( Identity id, String name );
+
+        @UnitOfWorkPropagation( MANDATORY )
+        void rename( Identity id, String newName );
+
+        @UnitOfWorkPropagation( MANDATORY )
+        void delete( Identity id );
+    }
+
+    public static class CommandsMixin implements Commands
+    {
+        @Structure
+        private Module module;
+
+        @Override
+        public void activateService() throws Exception
+        {
+            try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
+            {
+                try
+                {
+                    uow.get( PersonList.class, PersonList.LIST_ID );
+                }
+                catch( NoSuchEntityException ex )
+                {
+                    uow.newEntity( PersonList.class, PersonList.LIST_ID );
+                    uow.complete();
+                }
+            }
+        }
+
+        @Override
+        public void passivateService()
+        {
+        }
+
+        @Override
+        public Person create( Identity id, String name )
+        {
+            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
+            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
+            EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
+            builder.instance().name().set( name );
+            Person person = builder.newInstance();
+            list.all().add( person );
+            return person;
+        }
+
+        @Override
+        public void rename( Identity id, String newName )
+        {
+            module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
+        }
+
+        @Override
+        public void delete( Identity id )
+        {
+            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
+            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
+            Person person = uow.get( Person.class, id );
+            list.all().remove( person );
+            uow.remove( person );
+        }
+    }
+
+    @Concerns( {TimingCaptureConcern.class, UnitOfWorkConcern.class} )
+    @Mixins( QueriesMixin.class )
+    public interface Queries
+    {
+        @UnitOfWorkPropagation( MANDATORY )
+        Person byId( Identity id );
+
+        @TimingCapture
+        @UnitOfWorkPropagation( MANDATORY )
+        Iterable<Person> all();
+    }
+
+    public static class QueriesMixin implements Queries
+    {
+        @Structure
+        private Module module;
+
+        @Override
+        public Person byId( Identity id )
+        {
+            return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
+        }
+
+        @Override
+        public Iterable<Person> all()
+        {
+            return module.unitOfWorkFactory().currentUnitOfWork()
+                    .get( PersonList.class, PersonList.LIST_ID )
+                    .all().toList();
+        }
+    }
+
+    @Override
+    protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException
+    {
+        app.setName( "app" );
+
+        LayerAssembly domain = app.layer( "domain" );
+        ModuleAssembly model = domain.module( "model" );
+        model.entities( Person.class, PersonList.class )
+                .visibleIn( Visibility.layer );
+        ModuleAssembly services = domain.module( "services" );
+        services.services( Commands.class, Queries.class )
+                .instantiateOnStartup()
+                .visibleIn( Visibility.application );
+
+        LayerAssembly config = app.layer( "config" );
+        ModuleAssembly configModule = config.module( "config" );
+        new EntityTestAssembler()
+                .visibleIn( Visibility.module )
+                .assemble( configModule );
+
+        LayerAssembly infra = app.layer( "infra" );
+        ModuleAssembly storage = infra.module( "storage" );
+        entityStoreAssembler( configModule, Visibility.application )
+                .visibleIn( Visibility.application )
+                .assemble( storage );
+        metricsAssembler()
+                .visibleIn( Visibility.application )
+                .assemble( infra.module( "metrics" ) );
+
+        domain.uses( infra );
+        infra.uses( config );
+    }
+
+    protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException
+    {
+        return new EntityTestAssembler();
+    }
+
+    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
+
+    protected Module metricsModule()
+    {
+        return application.findModule( "infra", "metrics" );
+    }
+
+    protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer";
+    protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all";
+    protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create";
+    protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename";
+    protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete";
+
+    protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException
+    {
+        Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME );
+        runScenario1();
+        assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) );
+        application.passivate();
+        application.activate();
+        assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) );
+    }
+
+    protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException
+    {
+        // Initial state
+        assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) );
+        assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) );
+        assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) );
+        assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) );
+
+        // Run scenario
+        runScenario1();
+
+        // Queries.byId() timings are not captured
+        assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) );
+
+        // Captured timings
+        assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) );
+        assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) );
+        assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) );
+        assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) );
+
+        // Reset on passivation
+        application.passivate();
+        application.activate();
+        assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) );
+        assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) );
+        assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) );
+        assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) );
+    }
+
+    protected final void runScenario1()
+    {
+        Module services = application.findModule( "domain", "services" );
+        Commands commands = services.findService( Commands.class ).get();
+        Queries queries = services.findService( Queries.class ).get();
+
+        Identity identity = StringIdentity.fromString( "1" );
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) )
+        {
+            assertThat( queries.all().iterator().hasNext(), is( false ) );
+            assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) );
+            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
+            uow.complete();
+        }
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2")))
+        {
+            assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) );
+            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
+            commands.rename( identity, "Nina Hagen" );
+            assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) );
+            uow.complete();
+        }
+
+        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3")))
+        {
+            commands.delete( identity );
+            assertThat( queries.all().iterator().hasNext(), is( false ) );
+            uow.complete();
+        }
+    }
+
+    protected static class JmxMetricTestAdapter implements MetricValuesProvider
+    {
+        private final JmxFixture jmx = new JmxFixture( "metrics:name=" );
+
+        @Override
+        public long timerCount( String name )
+        {
+            if( jmx.objectExists( name ) ) {
+                return jmx.attributeValue( name, "Count", Long.class );
+            }
+            return 0L;
+        }
+
+        @Override
+        public Collection<String> registeredMetricNames()
+        {
+            return jmx.allObjectNames().stream()
+                    .filter( objName -> objName.startsWith( jmx.prefix() ) )
+                    .map( objName -> objName.substring( jmx.prefix().length() ) )
+                    .collect( toList() );
+        }
+    }
+
+    @Test
+    public void uowTimerJmx() throws PassivationException, ActivationException
+    {
+        assertUowTimer( new JmxMetricTestAdapter() );
+    }
+
+    @Test
+    public void timingCaptureJmx() throws PassivationException, ActivationException
+    {
+        assertTimingCapture( new JmxMetricTestAdapter() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java b/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java
deleted file mode 100644
index 9616f91..0000000
--- a/extensions/metrics-codahale/src/test/java/org/apache/polygene/test/metrics/AbstractZestMetricsTest.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.test.metrics;
-
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.activation.PassivationException;
-import org.apache.polygene.api.association.ManyAssociation;
-import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.identity.Identity;
-import org.apache.polygene.api.identity.StringIdentity;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.property.Property;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.NoSuchEntityException;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkConcern;
-import org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.library.metrics.TimingCapture;
-import org.apache.polygene.library.metrics.TimingCaptureAllConcern;
-import org.apache.polygene.library.metrics.TimingCaptureConcern;
-import org.apache.polygene.test.AbstractPolygeneBaseTest;
-import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.test.util.JmxFixture;
-import org.junit.Test;
-
-import java.util.Collection;
-
-import static java.util.stream.Collectors.toList;
-import static org.apache.polygene.api.unitofwork.concern.UnitOfWorkPropagation.Propagation.MANDATORY;
-import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertThat;
-
-// TODO Test errors
-public abstract class AbstractPolygeneMetricsTest extends AbstractPolygeneBaseTest
-{
-    public interface Person
-    {
-        Property<String> name();
-    }
-
-    public interface PersonList
-    {
-        Identity LIST_ID = StringIdentity.fromString( "person-list" );
-
-        ManyAssociation<Person> all();
-    }
-
-    @Concerns( {TimingCaptureAllConcern.class, UnitOfWorkConcern.class} )
-    @Mixins( CommandsMixin.class )
-    public interface Commands extends ServiceActivation
-    {
-        @UnitOfWorkPropagation( MANDATORY )
-        Person create( Identity id, String name );
-
-        @UnitOfWorkPropagation( MANDATORY )
-        void rename( Identity id, String newName );
-
-        @UnitOfWorkPropagation( MANDATORY )
-        void delete( Identity id );
-    }
-
-    public static class CommandsMixin implements Commands
-    {
-        @Structure
-        private Module module;
-
-        @Override
-        public void activateService() throws Exception
-        {
-            try (UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( newUsecase( "Init Person List" ) ) )
-            {
-                try
-                {
-                    uow.get( PersonList.class, PersonList.LIST_ID );
-                }
-                catch( NoSuchEntityException ex )
-                {
-                    uow.newEntity( PersonList.class, PersonList.LIST_ID );
-                    uow.complete();
-                }
-            }
-        }
-
-        @Override
-        public void passivateService()
-        {
-        }
-
-        @Override
-        public Person create( Identity id, String name )
-        {
-            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
-            EntityBuilder<Person> builder = uow.newEntityBuilder( Person.class, id );
-            builder.instance().name().set( name );
-            Person person = builder.newInstance();
-            list.all().add( person );
-            return person;
-        }
-
-        @Override
-        public void rename( Identity id, String newName )
-        {
-            module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id ).name().set( newName );
-        }
-
-        @Override
-        public void delete( Identity id )
-        {
-            UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-            PersonList list = uow.get( PersonList.class, PersonList.LIST_ID );
-            Person person = uow.get( Person.class, id );
-            list.all().remove( person );
-            uow.remove( person );
-        }
-    }
-
-    @Concerns( {TimingCaptureConcern.class, UnitOfWorkConcern.class} )
-    @Mixins( QueriesMixin.class )
-    public interface Queries
-    {
-        @UnitOfWorkPropagation( MANDATORY )
-        Person byId( Identity id );
-
-        @TimingCapture
-        @UnitOfWorkPropagation( MANDATORY )
-        Iterable<Person> all();
-    }
-
-    public static class QueriesMixin implements Queries
-    {
-        @Structure
-        private Module module;
-
-        @Override
-        public Person byId( Identity id )
-        {
-            return module.unitOfWorkFactory().currentUnitOfWork().get( Person.class, id );
-        }
-
-        @Override
-        public Iterable<Person> all()
-        {
-            return module.unitOfWorkFactory().currentUnitOfWork()
-                    .get( PersonList.class, PersonList.LIST_ID )
-                    .all().toList();
-        }
-    }
-
-    @Override
-    protected final void defineApplication( ApplicationAssembly app ) throws AssemblyException
-    {
-        app.setName( "app" );
-
-        LayerAssembly domain = app.layer( "domain" );
-        ModuleAssembly model = domain.module( "model" );
-        model.entities( Person.class, PersonList.class )
-                .visibleIn( Visibility.layer );
-        ModuleAssembly services = domain.module( "services" );
-        services.services( Commands.class, Queries.class )
-                .instantiateOnStartup()
-                .visibleIn( Visibility.application );
-
-        LayerAssembly config = app.layer( "config" );
-        ModuleAssembly configModule = config.module( "config" );
-        new EntityTestAssembler()
-                .visibleIn( Visibility.module )
-                .assemble( configModule );
-
-        LayerAssembly infra = app.layer( "infra" );
-        ModuleAssembly storage = infra.module( "storage" );
-        entityStoreAssembler( configModule, Visibility.application )
-                .visibleIn( Visibility.application )
-                .assemble( storage );
-        metricsAssembler()
-                .visibleIn( Visibility.application )
-                .assemble( infra.module( "metrics" ) );
-
-        domain.uses( infra );
-        infra.uses( config );
-    }
-
-    protected Assemblers.Visible<? extends Assembler> entityStoreAssembler( ModuleAssembly configModule, Visibility configVisibility ) throws AssemblyException
-    {
-        return new EntityTestAssembler();
-    }
-
-    protected abstract Assemblers.Visible<? extends Assembler> metricsAssembler();
-
-    protected Module metricsModule()
-    {
-        return application.findModule( "infra", "metrics" );
-    }
-
-    protected static final String UOW_TIMER_NAME = "app.domain.services.UnitOfWork.timer";
-    protected static final String ALL_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Queries.all";
-    protected static final String CREATE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.create";
-    protected static final String RENAME_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.rename";
-    protected static final String DELETE_NAME = "app.domain.services.AbstractPolygeneMetricsTest.Commands.delete";
-
-    protected final void assertUowTimer( MetricValuesProvider metrics ) throws PassivationException, ActivationException
-    {
-        Long initialUowCount = metrics.timerCount( UOW_TIMER_NAME );
-        runScenario1();
-        assertThat( UOW_TIMER_NAME + " count incremented by 3", metrics.timerCount( UOW_TIMER_NAME ), is( initialUowCount + 3L ) );
-        application.passivate();
-        application.activate();
-        assertThat( UOW_TIMER_NAME + " count reset on passivation", metrics.timerCount( UOW_TIMER_NAME ), equalTo( initialUowCount ) );
-    }
-
-    protected final void assertTimingCapture( MetricValuesProvider metrics ) throws PassivationException, ActivationException
-    {
-        // Initial state
-        assertThat( ALL_NAME + " count is 0 at start", metrics.timerCount( ALL_NAME ), is( 0L ) );
-        assertThat( CREATE_NAME + " count is 0 at start", metrics.timerCount( CREATE_NAME ), is( 0L ) );
-        assertThat( RENAME_NAME + " count is 0 at start", metrics.timerCount( RENAME_NAME ), is( 0L ) );
-        assertThat( DELETE_NAME+ " count is 0 at start", metrics.timerCount( DELETE_NAME ), is( 0L ) );
-
-        // Run scenario
-        runScenario1();
-
-        // Queries.byId() timings are not captured
-        assertThat( "Queries.byId() has no timer", metrics.registeredMetricNames(), not( contains( containsString( "byId" ) ) ) );
-
-        // Captured timings
-        assertThat( ALL_NAME + " count is 4 after scenario", metrics.timerCount( ALL_NAME ), is( 4L ) );
-        assertThat( CREATE_NAME + " count is 1 after scenario", metrics.timerCount( CREATE_NAME ), is( 1L ) );
-        assertThat( RENAME_NAME + " count is 1 after scenario", metrics.timerCount( RENAME_NAME ), is( 1L ) );
-        assertThat( DELETE_NAME + " count is 1 after scenario", metrics.timerCount( DELETE_NAME ), is( 1L ) );
-
-        // Reset on passivation
-        application.passivate();
-        application.activate();
-        assertThat( ALL_NAME + " count is 0 after restart", metrics.timerCount( ALL_NAME ), is( 0L ) );
-        assertThat( CREATE_NAME + " count is 0 after restart", metrics.timerCount( CREATE_NAME ), is( 0L ) );
-        assertThat( RENAME_NAME + " count is 0 after restart", metrics.timerCount( RENAME_NAME ), is( 0L ) );
-        assertThat( DELETE_NAME + " count is 0 after restart", metrics.timerCount( DELETE_NAME ), is( 0L ) );
-    }
-
-    protected final void runScenario1()
-    {
-        Module services = application.findModule( "domain", "services" );
-        Commands commands = services.findService( Commands.class ).get();
-        Queries queries = services.findService( Queries.class ).get();
-
-        Identity identity = StringIdentity.fromString( "1" );
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork( newUsecase( "Step 1" ) ) )
-        {
-            assertThat( queries.all().iterator().hasNext(), is( false ) );
-            assertThat( commands.create( identity, "Bob Geldof" ).name().get(), equalTo( "Bob Geldof" ) );
-            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
-            uow.complete();
-        }
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 2")))
-        {
-            assertThat( queries.all().iterator().next().name().get(), equalTo( "Bob Geldof" ) );
-            assertThat( queries.byId( identity ).name().get(), equalTo( "Bob Geldof" ) );
-            commands.rename( identity, "Nina Hagen" );
-            assertThat( queries.all().iterator().next().name().get(), equalTo( "Nina Hagen" ) );
-            uow.complete();
-        }
-
-        try (UnitOfWork uow = services.unitOfWorkFactory().newUnitOfWork(newUsecase("Step 3")))
-        {
-            commands.delete( identity );
-            assertThat( queries.all().iterator().hasNext(), is( false ) );
-            uow.complete();
-        }
-    }
-
-    protected static class JmxMetricTestAdapter implements MetricValuesProvider
-    {
-        private final JmxFixture jmx = new JmxFixture( "metrics:name=" );
-
-        @Override
-        public long timerCount( String name )
-        {
-            if( jmx.objectExists( name ) ) {
-                return jmx.attributeValue( name, "Count", Long.class );
-            }
-            return 0L;
-        }
-
-        @Override
-        public Collection<String> registeredMetricNames()
-        {
-            return jmx.allObjectNames().stream()
-                    .filter( objName -> objName.startsWith( jmx.prefix() ) )
-                    .map( objName -> objName.substring( jmx.prefix().length() ) )
-                    .collect( toList() );
-        }
-    }
-
-    @Test
-    public void uowTimerJmx() throws PassivationException, ActivationException
-    {
-        assertUowTimer( new JmxMetricTestAdapter() );
-    }
-
-    @Test
-    public void timingCaptureJmx() throws PassivationException, ActivationException
-    {
-        assertTimingCapture( new JmxMetricTestAdapter() );
-    }
-}


[70/81] [abbrv] zest-java git commit: ZEST-195, ZEST-201 ; Rename of everything else from zest to polygene.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
deleted file mode 100644
index c334276..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneStructureAnnotationUtil
-{
-    /**
-     * Returns {@code Structure} annotation if exists.
-     *
-     * @param modifierListOwner Modifier list owner.
-     * @return @Structure annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION );
-    }
-
-    /**
-     * Create structure annotation.
-     *
-     * @param project project to create structure annotation.
-     * @param context the context to create structure annotation.
-     * @return @Structure annotation.
-     */
-    @NotNull
-    public static PsiAnnotation createStructureAnnotation( @NotNull Project project,
-                                                           @NotNull PsiElement context )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context );
-    }
-
-    /**
-     * @param variable variable to check.
-     * @return Look at {@link StructureAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation structureAnnotation = getStructureAnnotation( variable );
-        if( structureAnnotation == null )
-        {
-            return invalidStructureAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        if( !isInjecteableByStructureAnnotation( variable ) )
-        {
-            return invalidInjectionType;
-        }
-
-        return valid;
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation.
-     *
-     * @param variable variable to check.
-     * @return {@code true} if variable type is injecteable by @Structure annotation.
-     * @since 0.1
-     */
-    public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable )
-    {
-        PsiType type = variable.getType();
-        String fieldClassQualifiedName = type.getCanonicalText();
-        return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1;
-    }
-
-    private PolygeneStructureAnnotationUtil()
-    {
-    }
-
-    public enum StructureAnnotationDeclarationValidationResult
-    {
-        invalidStructureAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidInjectionType,
-        valid,
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
deleted file mode 100644
index 3659db3..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ReplaceWithStructureAnnotation.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.common;
-
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotation;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.createStructureAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class ReplaceWithStructureAnnotation extends AbstractFix
-{
-    private final PsiAnnotation annotation;
-
-    public ReplaceWithStructureAnnotation( @NotNull String fixMessage,
-                                           @NotNull PsiAnnotation annotationToReplace )
-    {
-        super( fixMessage );
-        this.annotation = annotationToReplace;
-    }
-
-    public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-    {
-        PsiAnnotation structureAnnotation = createStructureAnnotation( project, annotation );
-        annotation.replace( structureAnnotation );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index a972acd..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/inspections/StructureAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.structure.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiVariable;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.injections.common.inspections.AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.validateStructureAnnotationDeclaration;
-
-/**
- * {@code StructureAnnotationUsedCorrectly} validates {@code @Structure} injection annotation declaration.
- *
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public class StructureAnnotationDeclaredCorrectlyInspection
-    extends AbstractInjectionAnnotationDeclarationOnFieldAndConstructorInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "injections.structure.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "StructureAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @NotNull
-    protected final String getRemoveAnnotationMessageFix()
-    {
-        return message( "injections.structure.annotation.declared.correctly.fix.remove.annotation" );
-    }
-
-    @NotNull
-    protected final String getAnnotationToCheckQualifiedName()
-    {
-        return QUALIFIED_NAME_STRUCTURE_ANNOTATION;
-    }
-
-    @Nullable
-    protected final ProblemDescriptor[] verifyAnnotationDeclaredCorrectly( @NotNull PsiVariable psiVariable,
-                                                                           @NotNull PsiAnnotation structureAnnotation,
-                                                                           @NotNull InspectionManager manager )
-    {
-        StructureAnnotationDeclarationValidationResult annotationCheck =
-            validateStructureAnnotationDeclaration( psiVariable );
-        switch( annotationCheck )
-        {
-        case invalidInjectionType:
-            String message = message(
-                "injections.structure.annotation.declared.correctly.error.invalid.injection.type",
-                psiVariable.getType().getCanonicalText()
-            );
-            AbstractFix removeStructureAnnotationFix = createRemoveAnnotationFix( structureAnnotation );
-            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                structureAnnotation, message, removeStructureAnnotationFix, GENERIC_ERROR_OR_WARNING
-            );
-            return new ProblemDescriptor[]{ problemDescriptor };
-        }
-
-        return null;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
deleted file mode 100644
index c871b3d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneMixinConstants
-{
-    public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins";
-
-    private PolygeneMixinConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
deleted file mode 100644
index 729ff58..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-import java.util.Set;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.emptySet;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
-import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneMixinUtil
-{
-    /**
-     * Get all valid mixin types of given the {@code psiClass} argument.
-     *
-     * @param psiClass The psi class to check.
-     * @return all vlaid mixin types of the given {@code psiClass} argument.
-     * @since 0.1
-     */
-    @NotNull
-    public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass )
-    {
-        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
-        if( mixinsAnnotation == null )
-        {
-            return emptySet();
-        }
-
-        Set<PsiClass> validMixinsType = getExtendsDeep( psiClass );
-        validMixinsType.add( psiClass );
-        return validMixinsType;
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass )
-    {
-        return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) );
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation )
-    {
-        if( mixinsAnnotation == null )
-        {
-            return emptyList();
-        }
-
-        String mixinsQualifiedName = mixinsAnnotation.getQualifiedName();
-        if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( mixinsAnnotation );
-    }
-
-    @Nullable
-    public static PsiAnnotation getMixinsAnnotation( PsiElement element )
-    {
-        PsiClass psiClass = getPSIClass( element );
-        if( psiClass == null )
-        {
-            return null;
-        }
-
-        return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS );
-    }
-
-    @NotNull
-    public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
-                                                             @NotNull PsiClass mixinClassToAdd )
-    {
-        Project project = modifierListOwner.getProject();
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS );
-
-        boolean isReplace = false;
-        PsiAnnotation newMixinsAnnotation;
-        if( existingMixinsAnnotation != null )
-        {
-            // Check duplicate
-            List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation );
-            for( PsiAnnotationMemberValue mixinValue : mixinsValues )
-            {
-                PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue );
-                if( mixinClassReference == null )
-                {
-                    continue;
-                }
-
-                PsiElement mixinClass = mixinClassReference.resolve();
-                if( mixinClassToAdd.equals( mixinClass ) )
-                {
-                    return existingMixinsAnnotation;
-                }
-            }
-
-            isReplace = true;
-        }
-
-        String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd );
-        newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner );
-
-        if( isReplace )
-        {
-            // Replace @Mixins instead
-            existingMixinsAnnotation.replace( newMixinsAnnotation );
-        }
-        else
-        {
-            // @Mixins doesn't exists, add it as first child
-            PsiModifierList modifierList = modifierListOwner.getModifierList();
-            modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
-        }
-
-        // Shorten all class references if possible
-        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
-        codeStyleManager.shortenClassReferences( newMixinsAnnotation );
-
-        return newMixinsAnnotation;
-    }
-
-    @NotNull
-    private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase,
-                                                      @NotNull PsiClass mixinClassToAdd )
-    {
-        StringBuilder annotationTextBuilder = new StringBuilder();
-        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" );
-        List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase );
-        for( PsiAnnotationMemberValue mixinValue : mixinsValues )
-        {
-            annotationTextBuilder.append( mixinValue.getText() ).append( ", " );
-        }
-        annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" );
-        annotationTextBuilder.append( "} )" );
-
-        return annotationTextBuilder.toString();
-    }
-
-
-    @Nullable
-    public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Validate whether psiClass is a mixin.
-     *
-     * @param psiClass psi class to check.
-     * @return {@code true} if psiClass is a mixin, {@code false} otherwise.
-     */
-    public static boolean isAMixin( @NotNull PsiClass psiClass )
-    {
-        return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) );
-    }
-
-    private PolygeneMixinUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
deleted file mode 100644
index c74725b..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinImplementsMixinType.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiJavaCodeReferenceElement;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern;
-import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinUtil.*;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class MixinImplementsMixinType extends AbstractInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "mixin.implements.mixin.type";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "MixinImplementsMixinType";
-    }
-
-    @Override
-    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
-                                                 @NotNull InspectionManager manager,
-                                                 boolean isOnTheFly )
-    {
-        // If psiClass is not an interface, ignore
-        if( !psiClass.isInterface() )
-        {
-            return null;
-        }
-
-        // If @Mixins annotation is empty, ignore
-        List<PsiAnnotationMemberValue> mixinAnnotationValues = getMixinsAnnotationValue( psiClass );
-        if( mixinAnnotationValues.isEmpty() )
-        {
-            return null;
-        }
-
-        // Get all valid mixin type
-        Set<PsiClass> validMixinsType = getAllValidMixinTypes( psiClass );
-        if( validMixinsType.isEmpty() )
-        {
-            return null;
-        }
-
-        // For each mixin
-        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-        for( PsiAnnotationMemberValue mixinAnnotationValue : mixinAnnotationValues )
-        {
-            PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinAnnotationValue );
-
-            // If it's not a class reference, ignore
-            if( mixinClassReference == null )
-            {
-                continue;
-            }
-
-            // If class reference can't be resolved, ignore
-            PsiClass mixinClass = (PsiClass) mixinClassReference.resolve();
-            if( mixinClass == null )
-            {
-                continue;
-            }
-
-            String mixinQualifiedName = mixinClass.getQualifiedName();
-
-            boolean isMixinsDeclarationValid = false;
-            String message = "";
-            if( mixinClass.isInterface() )
-            {
-                // Mixin can't be an interface
-                message = message( "mixin.implements.mixin.type.error.mixin.is.an.interface", mixinQualifiedName );
-            }
-            else if( isAConcern( mixinClass ) )
-            {
-                // Mixin can't be a concern
-                message = message( "mixin.implements.mixin.type.error.mixin.is.a.concern", mixinQualifiedName );
-            }
-            else if( isASideEffect( mixinClass ) )
-            {
-                // Mixin can't be a side effect
-                message = message( "mixin.implements.mixin.type.error.mixin.is.a.side.effect", mixinQualifiedName );
-            }
-            else
-            {
-                // If doesn't implement any mixin type, it's a problem
-                if( !isImplementValidMixinType( mixinClass, validMixinsType ) )
-                {
-                    message = message(
-                        "mixin.implements.mixin.type.error.does.not.implement.any.mixin.type",
-                        mixinQualifiedName,
-                        psiClass.getQualifiedName()
-                    );
-                }
-                else
-                {
-                    isMixinsDeclarationValid = true;
-                }
-            }
-
-            if( !isMixinsDeclarationValid )
-            {
-                ProblemDescriptor problemDescriptor = createProblemDescriptor(
-                    manager, mixinAnnotationValue, mixinClassReference, message );
-                problems.add( problemDescriptor );
-            }
-        }
-
-        return problems.toArray( new ProblemDescriptor[problems.size()] );
-    }
-
-    private boolean isImplementValidMixinType( PsiClass mixinClass, Set<PsiClass> validMixinsType )
-    {
-        for( PsiClass validMixinTypeClass : validMixinsType )
-        {
-            if( mixinClass.isInheritor( validMixinTypeClass, true ) )
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    private ProblemDescriptor createProblemDescriptor( @NotNull InspectionManager manager,
-                                                       @NotNull PsiAnnotationMemberValue mixinAnnotationValue,
-                                                       @NotNull PsiJavaCodeReferenceElement mixinClassReference,
-                                                       @NotNull String message )
-    {
-        RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix(
-            mixinAnnotationValue, mixinClassReference
-        );
-        return manager.createProblemDescriptor( mixinAnnotationValue, message, fix, GENERIC_ERROR_OR_WARNING );
-    }
-
-    private static class RemoveInvalidMixinClassReferenceFix extends AbstractFix
-    {
-        private final PsiAnnotationMemberValue mixinClassAnnotationValue;
-
-        public RemoveInvalidMixinClassReferenceFix( @NotNull PsiAnnotationMemberValue mixinClassAnnotationValue,
-                                                    @NotNull PsiJavaCodeReferenceElement mixinClassReference )
-        {
-            super( message( "mixin.implements.mixin.type.fix.remove.class.reference", mixinClassReference.getQualifiedName() ) );
-            this.mixinClassAnnotationValue = mixinClassAnnotationValue;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            mixinClassAnnotationValue.delete();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
deleted file mode 100644
index 914823d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/inspections/MixinsAnnotationDeclaredOnMixinType.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.mixins.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.PsiClass;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinUtil.getMixinsAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class MixinsAnnotationDeclaredOnMixinType extends AbstractInspection
-{
-    @NotNull
-    public final String getShortName()
-    {
-        return "MixinsAnnotationDeclaredOnMixinType";
-    }
-
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "mixins.annotation.declared.on.mixin.type";
-    }
-
-    @Override
-    public ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
-                                           @NotNull InspectionManager manager,
-                                           boolean isOnTheFly )
-    {
-        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
-        if( mixinsAnnotation == null )
-        {
-            return null;
-        }
-
-        if( psiClass.isInterface() )
-        {
-            return null;
-        }
-
-        String message = message( "mixins.annotation.declared.on.mixin.type.error.declared.on.class" );
-        RemoveInvalidMixinClassReferenceFix fix = new RemoveInvalidMixinClassReferenceFix( mixinsAnnotation );
-        ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( mixinsAnnotation, message, fix,
-                                                                               GENERIC_ERROR_OR_WARNING );
-        return new ProblemDescriptor[]{ problemDescriptor };
-
-    }
-
-    private static class RemoveInvalidMixinClassReferenceFix extends AbstractFix
-    {
-        private final PsiAnnotationMemberValue mixinsAnnotation;
-
-        public RemoveInvalidMixinClassReferenceFix( @NotNull PsiAnnotationMemberValue mixinsAnnotation )
-        {
-            super( message( "mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation" ) );
-            this.mixinsAnnotation = mixinsAnnotation;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            mixinsAnnotation.delete();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
deleted file mode 100644
index d3c269f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneSideEffectConstants
-{
-    public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects";
-
-    public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf";
-    public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect";
-
-    private PolygeneSideEffectConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
deleted file mode 100644
index c1533fc..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.sideEffects.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneSideEffectUtil
-{
-    /**
-     * @param searchContext Search context.
-     * @return {@code GenericSideEffect} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getGenericSideEffectClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericSideEffectClass( @NotNull Project project,
-                                                      @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope );
-    }
-
-    /**
-     * @param searchContext Search context.
-     * @return {@code SideEffectOf} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getSideEffectOfClass( project, searchScope );
-    }
-
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getSideEffectOfClass( @NotNull Project project,
-                                                 @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope );
-    }
-
-    /**
-     * @param elementWithinJavaClass element within java class.
-     * @return {@code @SideEffects} annotation declaration of the class that contains the element.
-     *         Returns {@code null} if not found, or {@code element} is an invalid context.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass )
-    {
-        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
-        return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS );
-    }
-
-    /**
-     * @param annotation annotation to process.
-     * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
-     *         {@code null} or annotation is not a {@code @SideEffects} annotation.
-     * @since 0.1
-     */
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation )
-    {
-        if( annotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = annotation.getQualifiedName();
-        if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( annotation );
-    }
-
-    /**
-     * @param value annotation member value.
-     * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a
-     *         class reference.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect.
-     *
-     * @param psiClass class to check.
-     * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise.
-     * @since 0.1
-     */
-    public static boolean isASideEffect( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass );
-        return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if
-     *         {@code psiClass} does
-     *         not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found.
-     * @since 0.1
-     */
-    public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass genericSideEffect = getGenericSideEffectClass( psiClass );
-        return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true );
-    }
-
-    private PolygeneSideEffectUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
deleted file mode 100644
index bf46eb3..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/inspections/SideEffectsAnnotationDeclaredCorrectlyInspection.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.sideEffects.inspections;
-
-import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.ProblemDescriptor;
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiAnnotationMemberValue;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiJavaCodeReferenceElement;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractFix;
-import org.apache.polygene.ide.plugin.idea.common.inspections.AbstractInspection;
-import org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle;
-import org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import static com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class SideEffectsAnnotationDeclaredCorrectlyInspection extends AbstractInspection
-{
-    @NotNull
-    protected final String resourceBundlePrefixId()
-    {
-        return "side.effects.annotation.declared.correctly";
-    }
-
-    @NotNull
-    public final String getShortName()
-    {
-        return "SideEffectsAnnotationDeclaredCorrectlyInspection";
-    }
-
-    @Override
-    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
-                                                 @NotNull InspectionManager manager,
-                                                 boolean isOnTheFly )
-    {
-        // If class does not have @SideEffects, ignore
-        PsiAnnotation sideEffectsAnnotation = getSideEffectsAnnotation( psiClass );
-        if( sideEffectsAnnotation == null )
-        {
-            return null;
-        }
-
-        // If @SideEffects declared in class, suggest remove @SideEffects annotation
-        if( !psiClass.isInterface() )
-        {
-            String message = message( "side.effects.annotation.declared.correctly.error.annotation.declared.in.class" );
-            RemoveSideEffectsAnnotationFix fix = new RemoveSideEffectsAnnotationFix( sideEffectsAnnotation );
-            ProblemDescriptor problemDescriptor = manager.createProblemDescriptor( sideEffectsAnnotation, message, fix,
-                                                                                   GENERIC_ERROR_OR_WARNING );
-            return new ProblemDescriptor[]{ problemDescriptor };
-        }
-
-        // If @SideEffects annotation is empty, ignore
-        List<PsiAnnotationMemberValue> sideEffectsAnnotationValue =
-            getSideEffectsAnnotationValue( sideEffectsAnnotation );
-        if( sideEffectsAnnotationValue.isEmpty() )
-        {
-            return null;
-        }
-
-        // If SideEffectOf is not resolved, ignore
-        Project project = psiClass.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( psiClass );
-        PsiClass sideEffectOfClass = PolygeneSideEffectUtil.getGenericSideEffectClass( project, searchScope );
-        if( sideEffectOfClass == null )
-        {
-            return null;
-        }
-
-        List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
-        for( PsiAnnotationMemberValue sideEffectClassReferenceWrapper : sideEffectsAnnotationValue )
-        {
-            PsiJavaCodeReferenceElement sideEffectClassReference =
-                getSideEffectClassReference( sideEffectClassReferenceWrapper );
-
-            // If it's not a class reference, ignore
-            if( sideEffectClassReference == null )
-            {
-                continue;
-            }
-
-            // If class reference can't be resolved, ignore
-            PsiClass sideEffectClass = (PsiClass) sideEffectClassReference.resolve();
-            if( sideEffectClass == null )
-            {
-                continue;
-            }
-
-            // If side effect class does not inherit SideEffectOf class, suggest remove that reference.
-            if( !sideEffectClass.isInheritor( sideEffectOfClass, true ) )
-            {
-                String message = PolygeneResourceBundle.message(
-                    "side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of",
-                    sideEffectClass.getQualifiedName()
-                );
-
-                RemoveAnnotationValueFix fix = new RemoveAnnotationValueFix(
-                    sideEffectClassReferenceWrapper, sideEffectClassReference
-                );
-                ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
-                    sideEffectClassReferenceWrapper, message, fix, GENERIC_ERROR_OR_WARNING );
-                problems.add( problemDescriptor );
-            }
-            else
-            {
-                // TODO: Test whether it is a generic side effect
-                // TODO: Test whether it is a specific side effect
-            }
-        }
-
-        return problems.toArray( new ProblemDescriptor[problems.size()] );
-    }
-
-    private static class RemoveSideEffectsAnnotationFix extends AbstractFix
-    {
-        private final PsiAnnotation sideEffectsAnnotation;
-
-        private RemoveSideEffectsAnnotationFix( @NotNull PsiAnnotation sideEffectsAnnotation )
-        {
-            super( message( "side.effects.annotation.declared.correctly.fix.remove.annotation" ) );
-            this.sideEffectsAnnotation = sideEffectsAnnotation;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            sideEffectsAnnotation.delete();
-        }
-    }
-
-    private static class RemoveAnnotationValueFix extends AbstractFix
-    {
-        private final PsiAnnotationMemberValue annotationValueToRemove;
-
-        private RemoveAnnotationValueFix( @NotNull PsiAnnotationMemberValue annotationValueToRemove,
-                                          @NotNull PsiJavaCodeReferenceElement sideEffectClassReference )
-        {
-            super( message( "side.effects.annotation.declared.correctly.fix.remove.class.reference",
-                            sideEffectClassReference.getQualifiedName() ) );
-            this.annotationValueToRemove = annotationValueToRemove;
-        }
-
-        public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
-        {
-            annotationValueToRemove.delete();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/resources/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
new file mode 100644
index 0000000..8c5f29b
--- /dev/null
+++ b/tools/qidea/src/main/resources/org/apache/polygene/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
@@ -0,0 +1,164 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+#
+#
+#
+
+# *****************************************************************************
+# Common
+# *****************************************************************************
+polygene.quick.fixes.family.name=Polygene
+polygene.action.group.title=Polygene
+polygene.action.group.description=Polygene
+polygene.inspections.name=Polygene issues
+polygene.file.template.group.title=Polygene
+
+# *****************************************************************************
+# Concern
+# *****************************************************************************
+
+# =========
+# Intention
+# =========
+add.concern.family.name=Add Polygene Concern
+add.concern.name=Add Polygene Concern
+
+# ==========
+# Inspection
+# ==========
+concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
+concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class.
+concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
+concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
+concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
+
+# =======
+# Actions
+# =======
+
+# -------------------------
+# Create concern in package
+# -------------------------
+createConcernOfInPackage.menu.action.text=Polygene Concern Of
+createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf
+createConcernOfInPackage.dlg.title=New Polygene ConcernOf
+createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
+createConcernOfInPackage.command.name=Create ConcernOf
+createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
+createConcernOfInPackage.error.title=Create concern fail
+
+# *****************************************************************************
+# Mixin
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+
+# ----------------------------
+# Mixins implements mixin type
+# ----------------------------
+mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
+mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
+mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
+mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
+mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
+mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
+
+# ------------------------------------------
+# Mixins declared on mixin type or composite
+# ------------------------------------------
+mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
+mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
+mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
+
+# *****************************************************************************
+# Side Effect
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
+side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class.
+side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
+side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
+side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
+
+# *****************************************************************************
+# Injections
+# *****************************************************************************
+
+# -----------------
+# Common Inspection
+# -----------------
+abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
+
+# -------------------
+# @Structure injection
+# -------------------
+
+# ==========
+# Inspection
+# ==========
+injections.structure.annotation.declared.correctly.name.display=@Structure Injection
+injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
+injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
+
+# -----------------
+# @Service injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.service.annotation.declared.correctly.name.display=@Service Injection
+injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
+injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
+
+# -----------------
+# @Invocation injection
+# -----------------
+
+# ==========
+# Inspection
+# ==========
+injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
+injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
+injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
+injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
+injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
+
+# *****************************************************************************
+# Applies To
+# *****************************************************************************
+
+# ==========
+# Inspection
+# ==========
+applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
+applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
+applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
+applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
+applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
+applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
+applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference

http://git-wip-us.apache.org/repos/asf/zest-java/blob/e0e1d7d4/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
deleted file mode 100644
index 8c5f29b..0000000
--- a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you 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.
-#
-#
-#
-
-# *****************************************************************************
-# Common
-# *****************************************************************************
-polygene.quick.fixes.family.name=Polygene
-polygene.action.group.title=Polygene
-polygene.action.group.description=Polygene
-polygene.inspections.name=Polygene issues
-polygene.file.template.group.title=Polygene
-
-# *****************************************************************************
-# Concern
-# *****************************************************************************
-
-# =========
-# Intention
-# =========
-add.concern.family.name=Add Polygene Concern
-add.concern.name=Add Polygene Concern
-
-# ==========
-# Inspection
-# ==========
-concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class
-concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class.
-concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference.
-concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface
-concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation
-
-# =======
-# Actions
-# =======
-
-# -------------------------
-# Create concern in package
-# -------------------------
-createConcernOfInPackage.menu.action.text=Polygene Concern Of
-createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf
-createConcernOfInPackage.dlg.title=New Polygene ConcernOf
-createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf
-createConcernOfInPackage.command.name=Create ConcernOf
-createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class
-createConcernOfInPackage.error.title=Create concern fail
-
-# *****************************************************************************
-# Mixin
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-
-# ----------------------------
-# Mixins implements mixin type
-# ----------------------------
-mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class
-mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference.
-mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}''
-mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface
-mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern
-mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect
-
-# ------------------------------------------
-# Mixins declared on mixin type or composite
-# ------------------------------------------
-mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface
-mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface
-mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation
-
-# *****************************************************************************
-# Side Effect
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly
-side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class.
-side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
-side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface
-side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation
-
-# *****************************************************************************
-# Injections
-# *****************************************************************************
-
-# -----------------
-# Common Inspection
-# -----------------
-abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field.
-
-# -------------------
-# @Structure injection
-# -------------------
-
-# ==========
-# Inspection
-# ==========
-injections.structure.annotation.declared.correctly.name.display=@Structure Injection
-injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type.
-injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation
-
-# -----------------
-# @Service injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.service.annotation.declared.correctly.name.display=@Service Injection
-injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation
-injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation
-
-# -----------------
-# @Invocation injection
-# -----------------
-
-# ==========
-# Inspection
-# ==========
-injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection
-injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure
-injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation
-injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation
-injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation
-
-# *****************************************************************************
-# Applies To
-# *****************************************************************************
-
-# ==========
-# Inspection
-# ==========
-applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class
-applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern
-applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect''
-applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface
-applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface
-applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation
-applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference


[04/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationDelegate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationDelegate.java b/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationDelegate.java
deleted file mode 100644
index 0db2d57..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationDelegate.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.activation;
-
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.stream.Stream;
-import org.apache.zest.api.activation.Activation;
-import org.apache.zest.api.activation.ActivationEvent;
-import org.apache.zest.api.activation.ActivationEventListener;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.activation.PassivationException;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.service.ServiceReference;
-
-import static org.apache.zest.api.activation.ActivationEvent.EventType.ACTIVATED;
-import static org.apache.zest.api.activation.ActivationEvent.EventType.ACTIVATING;
-import static org.apache.zest.api.activation.ActivationEvent.EventType.PASSIVATED;
-import static org.apache.zest.api.activation.ActivationEvent.EventType.PASSIVATING;
-
-/**
- * This class manage Activation of a target and propagates to children.
- */
-@SuppressWarnings( "raw" )
-public final class ActivationDelegate
-    extends ActivationEventListenerSupport
-{
-    private final Object target;
-    private final boolean fireEvents;
-    private ActivatorsInstance targetActivators = null;
-    private final LinkedList<Activation> activeChildren = new LinkedList<>();
-
-    /**
-     * Create a new ActivationDelegate that will fire events.
-     * @param target target of Activation
-     */
-    public ActivationDelegate( Object target )
-    {
-        this( target, true );
-    }
-
-    /**
-     * Create a new ActivationDelegate.
-     * @param target target of Activation
-     * @param fireEvents if {@link ActivationEvent}s should be fired
-     */
-    public ActivationDelegate( Object target, boolean fireEvents )
-    {
-        super();
-        this.target = target;
-        this.fireEvents = fireEvents;
-    }
-
-    public void activate( ActivatorsInstance targetActivators, Activation child )
-        throws Exception
-    {
-        activate( targetActivators, Collections.singleton( child ), null );
-    }
-
-    public void activate( ActivatorsInstance targetActivators, Activation child, Runnable callback )
-        throws Exception
-    {
-        activate( targetActivators, Collections.singleton( child ), callback );
-    }
-
-    public void activate( ActivatorsInstance targetActivators, Iterable<? extends Activation> children )
-        throws ActivationException
-    {
-        activate( targetActivators, children, null );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public void activate( ActivatorsInstance targetActivators, Iterable<? extends Activation> children, Runnable callback )
-        throws ActivationException
-    {
-        if( this.targetActivators != null )
-        {
-            throw new IllegalStateException( "Activation.activate() called multiple times "
-                                             + "or without calling passivate() first!" );
-        }
-
-        try
-        {
-            // Before Activation Events
-            if( fireEvents )
-            {
-                fireEvent( new ActivationEvent( target, ACTIVATING ) );
-            }
-
-            // Before Activation for Activators
-            targetActivators.beforeActivation( target instanceof ServiceReference
-                                               ? new PassiveServiceReference( (ServiceReference) target )
-                                               : target );
-
-            // Activation
-            for( Activation child : children )
-            {
-                if( !activeChildren.contains( child ) )
-                {
-                    child.activate();
-                }
-                activeChildren.addFirst( child );
-            }
-
-            // Internal Activation Callback
-            if( callback != null )
-            {
-                callback.run();
-            }
-
-            // After Activation
-            targetActivators.afterActivation( target );
-
-            // After Activation Events
-            if( fireEvents )
-            {
-                fireEvent( new ActivationEvent( target, ACTIVATED ) );
-            }
-
-            // Activated
-            this.targetActivators = targetActivators;
-        }
-        catch( Exception e )
-        {
-            // Passivate actives
-            try
-            {
-                passivate();
-            }
-            catch( PassivationException e1 )
-            {
-                ActivationException activationEx = new ActivationException( "Unable to Activate application.", e );
-                activationEx.addSuppressed( e1 );
-                throw activationEx;
-            }
-            if( e instanceof ActivationException )
-            {
-                throw ( (ActivationException) e );
-            }
-            throw new ActivationException( "Unable to Activate application.", e );
-        }
-    }
-
-    public void passivate()
-        throws PassivationException
-    {
-        passivate( null );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public void passivate( Runnable callback )
-        throws PassivationException
-    {
-        Set<Exception> exceptions = new LinkedHashSet<>();
-
-        // Before Passivation Events
-        if( fireEvents )
-        {
-            ActivationEvent event = new ActivationEvent( target, PASSIVATING );
-            for( ActivationEventListener listener : listeners )
-            {
-                try
-                {
-                    listener.onEvent( event );
-                }
-                catch( Exception ex )
-                {
-                    if( ex instanceof PassivationException )
-                    {
-                        exceptions.addAll( ( (PassivationException) ex ).causes() );
-                    }
-                    else
-                    {
-                        exceptions.add( ex );
-                    }
-                }
-            }
-        }
-
-        // Before Passivation for Activators
-        if( targetActivators != null )
-        {
-            try
-            {
-                targetActivators.beforePassivation( target );
-            }
-            catch( PassivationException ex )
-            {
-                exceptions.addAll( ex.causes() );
-            }
-            catch( Exception ex )
-            {
-                exceptions.add( ex );
-            }
-        }
-
-        // Passivation
-        while( !activeChildren.isEmpty() )
-        {
-            passivateOneChild( exceptions );
-        }
-
-        // Internal Passivation Callback
-        if( callback != null )
-        {
-            try
-            {
-                callback.run();
-            }
-            catch( Exception ex )
-            {
-                exceptions.add( ex );
-            }
-        }
-
-        // After Passivation for Activators
-        if( targetActivators != null )
-        {
-            try
-            {
-                targetActivators.afterPassivation( target instanceof ServiceReference
-                                                   ? new PassiveServiceReference( (ServiceReference) target )
-                                                   : target );
-            }
-            catch( PassivationException ex )
-            {
-                exceptions.addAll( ex.causes() );
-            }
-            catch( Exception ex )
-            {
-                exceptions.add( ex );
-            }
-        }
-        targetActivators = null;
-
-        // After Passivation Events
-        if( fireEvents )
-        {
-            ActivationEvent event = new ActivationEvent( target, PASSIVATED );
-            for( ActivationEventListener listener : listeners )
-            {
-                try
-                {
-                    listener.onEvent( event );
-                }
-                catch( Exception ex )
-                {
-                    if( ex instanceof PassivationException )
-                    {
-                        exceptions.addAll( ( (PassivationException) ex ).causes() );
-                    }
-                    else
-                    {
-                        exceptions.add( ex );
-                    }
-                }
-            }
-        }
-
-        // Error handling
-        if( exceptions.isEmpty() )
-        {
-            return;
-        }
-        throw new PassivationException( exceptions );
-    }
-
-    @SuppressWarnings( "TooBroadCatch" )
-    private void passivateOneChild( Set<Exception> exceptions )
-    {
-        Activation activeChild = activeChildren.removeFirst();
-        try
-        {
-            activeChild.passivate();
-        }
-        catch( PassivationException ex )
-        {
-            exceptions.addAll( ex.causes() );
-        }
-        catch( Exception ex )
-        {
-            exceptions.add( ex );
-        }
-    }
-
-    @SuppressWarnings( "raw" )
-    private static class PassiveServiceReference
-        implements ServiceReference
-    {
-
-        private final ServiceReference reference;
-
-        private PassiveServiceReference( ServiceReference reference )
-        {
-            this.reference = reference;
-        }
-
-        @Override
-        public Identity identity()
-        {
-            return reference.identity();
-        }
-
-        @Override
-        public Object get()
-        {
-            throw new IllegalStateException( "Service is passive, either activating and"
-                                             + " cannot be used yet or passivating and cannot be used anymore." );
-        }
-
-        @Override
-        public boolean isActive()
-        {
-            return false;
-        }
-
-        @Override
-        public boolean isAvailable()
-        {
-            return false;
-        }
-
-        @Override
-        public ModelDescriptor model()
-        {
-            return reference.model();
-        }
-
-        @Override
-        public Stream<Class<?>> types()
-        {
-            return reference.types();
-        }
-
-        @Override
-        public <T> T metaInfo( Class<T> infoType )
-        {
-            return reference.metaInfo( infoType );
-        }
-
-        @Override
-        public void registerActivationEventListener( ActivationEventListener listener )
-        {
-            reference.registerActivationEventListener( listener );
-        }
-
-        @Override
-        public void deregisterActivationEventListener( ActivationEventListener listener )
-        {
-            reference.deregisterActivationEventListener( listener );
-        }
-
-        @Override
-        public int hashCode()
-        {
-            return identity().hashCode();
-        }
-
-        @Override
-        public boolean equals( Object obj )
-        {
-            if( obj == null )
-            {
-                return false;
-            }
-            if( getClass() != obj.getClass() )
-            {
-                return false;
-            }
-            final ServiceReference other = (ServiceReference) obj;
-            return identity().equals( other.identity() );
-        }
-
-        @Override
-        public String toString()
-        {
-            return reference.toString();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationEventListenerSupport.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationEventListenerSupport.java b/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationEventListenerSupport.java
deleted file mode 100644
index e0643b7..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivationEventListenerSupport.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.activation;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.activation.ActivationEvent;
-import org.apache.zest.api.activation.ActivationEventListener;
-import org.apache.zest.api.activation.ActivationEventListenerRegistration;
-
-/**
- * Internal helper for managing registrations and firing events
- */
-/* package */ class ActivationEventListenerSupport
-    implements ActivationEventListenerRegistration, ActivationEventListener
-{
-    protected List<ActivationEventListener> listeners = new ArrayList<>();
-
-    @Override
-    public void registerActivationEventListener( ActivationEventListener listener )
-    {
-        List<ActivationEventListener> newListeners = new ArrayList<>();
-        newListeners.addAll( listeners );
-        newListeners.add( listener );
-        listeners = newListeners;
-    }
-
-    @Override
-    public void deregisterActivationEventListener( ActivationEventListener listener )
-    {
-        List<ActivationEventListener> newListeners = new ArrayList<>();
-        newListeners.addAll( listeners );
-        newListeners.remove( listener );
-        listeners = newListeners;
-    }
-
-    /* package */ void fireEvent( ActivationEvent event )
-        throws Exception
-    {
-        for( ActivationEventListener listener : listeners )
-        {
-            listener.onEvent( event );
-        }
-    }
-
-    @Override
-    public void onEvent( ActivationEvent event )
-        throws Exception
-    {
-        fireEvent( event );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorModel.java
deleted file mode 100644
index fa7a3c5..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorModel.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.activation;
-
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.activation.ActivatorDescriptor;
-import org.apache.zest.api.common.ConstructionException;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.api.util.VisitableHierarchy;
-import org.apache.zest.runtime.composite.ConstructorsModel;
-import org.apache.zest.runtime.injection.InjectedFieldsModel;
-import org.apache.zest.runtime.injection.InjectedMethodsModel;
-import org.apache.zest.runtime.injection.InjectionContext;
-
-/**
- * Model for a single Activator.
- *
- * @param <ActivateeType> Type of the activation target
- */
-public class ActivatorModel<ActivateeType>
-    implements ActivatorDescriptor, VisitableHierarchy<Object, Object>
-{
-    private final Class<? extends Activator<ActivateeType>> activatorType;
-    private final ConstructorsModel constructorsModel;
-    private final InjectedFieldsModel injectedFieldsModel;
-    private final InjectedMethodsModel injectedMethodsModel;
-
-    public ActivatorModel( Class<? extends Activator<ActivateeType>> activatorType )
-    {
-        this.activatorType = activatorType;
-        this.constructorsModel = new ConstructorsModel( activatorType );
-        this.injectedFieldsModel = new InjectedFieldsModel( activatorType );
-        this.injectedMethodsModel = new InjectedMethodsModel( activatorType );
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        if( visitor.visitEnter( this ) )
-        {
-            if( constructorsModel.accept( visitor ) )
-            {
-                if( injectedFieldsModel.accept( visitor ) )
-                {
-                    injectedMethodsModel.accept( visitor );
-                }
-            }
-        }
-        return visitor.visitLeave( this );
-    }
-
-    public Activator<ActivateeType> newInstance()
-    {
-        try
-        {
-            return activatorType.newInstance();
-        }
-        catch( InstantiationException | IllegalAccessException ex )
-        {
-            throw new ConstructionException( "Could not instantiate " + activatorType.getName(), ex );
-        }
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public Activator<ActivateeType> newInstance( InjectionContext injectionContext )
-    {
-        try
-        {
-            Activator<ActivateeType> instance = (Activator<ActivateeType>) constructorsModel.newInstance( injectionContext );
-            injectionContext = new InjectionContext( injectionContext.module(), injectionContext.uses(), instance );
-            inject( injectionContext, instance );
-            return instance;
-        }
-        catch( Exception ex )
-        {
-            throw new ConstructionException( "Could not instantiate " + activatorType.getName(), ex );
-        }
-    }
-
-    public void inject( InjectionContext injectionContext, Activator<ActivateeType> instance )
-    {
-        injectedFieldsModel.inject( injectionContext, instance );
-        injectedMethodsModel.inject( injectionContext, instance );
-    }
-
-    @Override
-    public String toString()
-    {
-        return activatorType.getName();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsInstance.java
deleted file mode 100644
index 83631fc..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsInstance.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.activation;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.stream.StreamSupport;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.activation.PassivationException;
-
-import static java.util.stream.Collectors.toCollection;
-
-/**
- * Instance of a Polygene Activators of one Activation target. Contains ordered
- * Activators and roll the Activation on the target.
- *
- * @param <ActivateeType> Type of the activation target
- */
-public class ActivatorsInstance<ActivateeType>
-    implements Activator<ActivateeType>
-{
-    @SuppressWarnings( { "raw", "unchecked" } )
-    public static final ActivatorsInstance EMPTY = new ActivatorsInstance( Collections.emptyList() );
-
-    private final Iterable<Activator<ActivateeType>> activators;
-
-    public ActivatorsInstance( Iterable<Activator<ActivateeType>> activators )
-    {
-        this.activators = activators;
-    }
-
-    @Override
-    public void beforeActivation( ActivateeType activating )
-        throws Exception
-    {
-        for( Activator<ActivateeType> activator : activators )
-        {
-            activator.beforeActivation( activating );
-        }
-    }
-
-    @Override
-    public void afterActivation( ActivateeType activated )
-        throws Exception
-    {
-        for( Activator<ActivateeType> activator : activators )
-        {
-            activator.afterActivation( activated );
-        }
-    }
-
-    @Override
-    public void beforePassivation( ActivateeType passivating )
-        throws Exception
-    {
-        Set<Exception> exceptions = new LinkedHashSet<>();
-        Iterator<Activator<ActivateeType>> iterator = reverseActivatorsIterator();
-        while( iterator.hasNext() )
-        {
-            Activator<ActivateeType> activator = iterator.next();
-            try
-            {
-                activator.beforePassivation( passivating );
-            }
-            catch( Exception ex )
-            {
-                exceptions.add( ex );
-            }
-        }
-        if( !exceptions.isEmpty() )
-        {
-            throw new PassivationException( exceptions );
-        }
-    }
-
-    @Override
-    public void afterPassivation( ActivateeType passivated )
-        throws Exception
-    {
-        Set<Exception> exceptions = new LinkedHashSet<>();
-        Iterator<Activator<ActivateeType>> iterator = reverseActivatorsIterator();
-        while( iterator.hasNext() )
-        {
-            Activator<ActivateeType> activator = iterator.next();
-            try
-            {
-                activator.afterPassivation( passivated );
-            }
-            catch( Exception ex )
-            {
-                exceptions.add( ex );
-            }
-        }
-        if( !exceptions.isEmpty() )
-        {
-            throw new PassivationException( exceptions );
-        }
-    }
-
-    private Iterator<Activator<ActivateeType>> reverseActivatorsIterator()
-    {
-        return StreamSupport.stream( activators.spliterator(), false )
-                            .collect( toCollection( LinkedList::new ) )
-                            .descendingIterator();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsModel.java
deleted file mode 100644
index 6aa25c7..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/activation/ActivatorsModel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.activation;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.api.util.VisitableHierarchy;
-import org.apache.zest.runtime.composite.UsesInstance;
-import org.apache.zest.runtime.injection.InjectionContext;
-
-/**
- * Activators Model.
- *
- * @param <ActivateeType> Type of the activation target
- */
-public class ActivatorsModel<ActivateeType>
-    implements VisitableHierarchy<Object, Object>
-{
-
-    private final List<ActivatorModel<ActivateeType>> activatorModels = new ArrayList<>();
-    private final Iterable<Class<? extends Activator<ActivateeType>>> activatorsClasses;
-
-    public ActivatorsModel( Iterable<Class<? extends Activator<ActivateeType>>> activatorsClasses )
-    {
-        this.activatorsClasses = activatorsClasses;
-        for( Class<? extends Activator<ActivateeType>> activatorClass : activatorsClasses )
-        {
-            activatorModels.add( new ActivatorModel<>( activatorClass ) );
-        }
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        if( visitor.visitEnter( this ) )
-        {
-            for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
-            {
-                if( !activatorModel.accept( visitor ) )
-                {
-                    break;
-                }
-            }
-        }
-        return visitor.visitLeave( this );
-    }
-
-    public Iterable<ActivatorModel<ActivateeType>> models()
-    {
-        return activatorModels;
-    }
-
-    public Iterable<Activator<ActivateeType>> newInstances()
-        throws ActivationException
-    {
-        List<Activator<ActivateeType>> activators = new ArrayList<>();
-        for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
-        {
-            activators.add( activatorModel.newInstance() );
-        }
-        return activators;
-    }
-
-    public Iterable<Activator<ActivateeType>> newInstances( ModuleDescriptor module )
-        throws ActivationException
-    {
-        List<Activator<ActivateeType>> activators = new ArrayList<>();
-        for( ActivatorModel<ActivateeType> activatorModel : activatorModels )
-        {
-            InjectionContext injectionContext = new InjectionContext( module, UsesInstance.EMPTY_USES );
-            activators.add( activatorModel.newInstance( injectionContext ) );
-        }
-        return activators;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
deleted file mode 100644
index 6175cd4..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AbstractAssociationInstance.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.Type;
-import java.util.function.BiFunction;
-import org.apache.zest.api.association.AbstractAssociation;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.identity.HasIdentity;
-
-/**
- * Implementation of AbstractAssociation. Includes helper methods for subclasses
- */
-public abstract class AbstractAssociationInstance<T>
-    implements AbstractAssociation
-{
-    protected AssociationInfo associationInfo;
-    private final BiFunction<EntityReference, Type, Object> entityFunction;
-
-    public AbstractAssociationInstance( AssociationInfo associationInfo,
-                                        BiFunction<EntityReference, Type, Object> entityFunction
-    )
-    {
-        this.associationInfo = associationInfo;
-        this.entityFunction = entityFunction;
-    }
-
-    public AssociationInfo associationInfo()
-    {
-        return associationInfo;
-    }
-
-    public void setAssociationInfo( AssociationInfo newInfo )
-    {
-        this.associationInfo = newInfo;
-    }
-
-    @SuppressWarnings( "unchecked" )
-    protected T getEntity( EntityReference entityId )
-    {
-        if( entityId == null )
-        {
-            return null;
-        }
-
-        return (T) entityFunction.apply( entityId, associationInfo.type() );
-    }
-
-    protected EntityReference getEntityReference( Object composite )
-    {
-        if( composite == null )
-        {
-            return null;
-        }
-
-        return EntityReference.create(((HasIdentity) composite).identity().get());
-    }
-
-    protected void checkType( Object instance )
-    {
-
-        if( instance instanceof HasIdentity || instance == null )
-        {
-            return;
-        }
-        throw new IllegalArgumentException( "Object must be a subtype of org.apache.zest.api.reference.Identity: " + instance.getClass() );
-    }
-
-    protected void checkImmutable()
-        throws IllegalStateException
-    {
-        if( associationInfo.isImmutable() )
-        {
-            throw new IllegalStateException( "Association [" + associationInfo.qualifiedName() + "] is immutable." );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInfo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInfo.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInfo.java
deleted file mode 100644
index 2e79fe1..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInfo.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.Type;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.runtime.composite.ConstraintsCheck;
-
-/**
- * TODO
- */
-public interface AssociationInfo
-    extends ConstraintsCheck
-{
-    boolean isImmutable();
-
-    QualifiedName qualifiedName();
-
-    Type type();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInstance.java
deleted file mode 100644
index ae7729e..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationInstance.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.Type;
-import java.util.function.BiFunction;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.AssociationWrapper;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.property.Property;
-
-/**
- * Implementation of Association to a single Entity.
- */
-public final class AssociationInstance<T>
-    extends AbstractAssociationInstance<T>
-    implements Association<T>
-{
-    private Property<EntityReference> associationState;
-
-    public AssociationInstance( AssociationInfo associationInfo,
-                                BiFunction<EntityReference, Type, Object> entityFunction,
-                                Property<EntityReference> associationState
-    )
-    {
-        super( associationInfo, entityFunction );
-        this.associationState = associationState;
-    }
-
-    // Association implementation
-    @Override
-    public T get()
-    {
-        return getEntity( associationState.get() );
-    }
-
-    @Override
-    public void set( T newValue )
-        throws IllegalArgumentException
-    {
-        checkImmutable();
-        checkType( newValue );
-
-        associationInfo.checkConstraints( newValue );
-
-        // Change association
-        associationState.set( EntityReference.create( ((HasIdentity) newValue ).identity().get()));
-    }
-
-    @Override
-    public EntityReference reference()
-    {
-        return associationState.get();
-    }
-
-    public Property<EntityReference> getAssociationState()
-    {
-        return associationState;
-    }
-
-    @Override
-    public String toString()
-    {
-        if( associationState.get() == null )
-        {
-            return "";
-        }
-        else
-        {
-            return associationState.get().toString();
-        }
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int hash = associationInfo.hashCode() * 39; // Descriptor
-        if( associationState.get() != null )
-        {
-            hash = hash * 997 + associationState.get().hashCode(); // State
-        }
-        return hash;
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-        Association<?> that = (Association) o;
-        // Unwrap if needed
-        while( that instanceof AssociationWrapper )
-        {
-            that = ( (AssociationWrapper) that ).next();
-        }
-        // Descriptor equality
-        AssociationInstance<?> thatInstance = (AssociationInstance) that;
-        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
-        if( !associationInfo.equals( thatDescriptor ) )
-        {
-            return false;
-        }
-        // State equality
-        if( associationState.get() != null
-            ? !associationState.get().equals( thatInstance.associationState.get() )
-            : thatInstance.associationState.get() != null )
-        {
-            return false;
-        }
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
deleted file mode 100644
index b0edd8b..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationModel.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.Aggregated;
-import org.apache.zest.api.entity.Queryable;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.util.Visitable;
-import org.apache.zest.api.util.Visitor;
-import org.apache.zest.bootstrap.BindingException;
-import org.apache.zest.runtime.composite.ValueConstraintsInstance;
-import org.apache.zest.runtime.model.Binder;
-import org.apache.zest.runtime.model.Resolution;
-
-/**
- * Model for an Association.
- *
- * <p>Equality is based on the Association accessor object (associated type and name), not on the QualifiedName.</p>
- */
-public final class AssociationModel
-    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<AssociationModel>
-{
-    private MetaInfo metaInfo;
-    private Type type;
-    private AccessibleObject accessor;
-    private QualifiedName qualifiedName;
-    private ValueConstraintsInstance constraints;
-    private ValueConstraintsInstance associationConstraints;
-    private boolean queryable;
-    private boolean immutable;
-    private boolean aggregated;
-    private AssociationInfo builderInfo;
-
-    public AssociationModel( AccessibleObject accessor,
-                             ValueConstraintsInstance valueConstraintsInstance,
-                             ValueConstraintsInstance associationConstraintsInstance,
-                             MetaInfo metaInfo
-    )
-    {
-        this.metaInfo = metaInfo;
-        this.constraints = valueConstraintsInstance;
-        this.associationConstraints = associationConstraintsInstance;
-        this.accessor = accessor;
-        initialize();
-    }
-
-    private void initialize()
-    {
-        this.type = GenericAssociationInfo.associationTypeOf( accessor );
-        this.qualifiedName = QualifiedName.fromAccessor( accessor );
-        this.immutable = metaInfo.get( Immutable.class ) != null;
-        this.aggregated = metaInfo.get( Aggregated.class ) != null;
-
-        final Queryable queryable = accessor.getAnnotation( Queryable.class );
-        this.queryable = queryable == null || queryable.value();
-    }
-
-    @Override
-    public <T> T metaInfo( Class<T> infoType )
-    {
-        return metaInfo.get( infoType );
-    }
-
-    @Override
-    public QualifiedName qualifiedName()
-    {
-        return qualifiedName;
-    }
-
-    @Override
-    public Type type()
-    {
-        return type;
-    }
-
-    @Override
-    public boolean isImmutable()
-    {
-        return immutable;
-    }
-
-    @Override
-    public boolean isAggregated()
-    {
-        return aggregated;
-    }
-
-    @Override
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public boolean queryable()
-    {
-        return queryable;
-    }
-
-    public AssociationInfo getBuilderInfo()
-    {
-        return builderInfo;
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( Visitor<? super AssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        return visitor.visit( this );
-    }
-
-    @Override
-    public void checkConstraints( Object value )
-        throws ConstraintViolationException
-    {
-        constraints.checkConstraints( value, accessor );
-    }
-
-    public void checkAssociationConstraints( Association<?> association )
-        throws ConstraintViolationException
-    {
-        associationConstraints.checkConstraints( association, accessor );
-    }
-
-    @Override
-    public void bind( Resolution resolution )
-        throws BindingException
-    {
-        builderInfo = new AssociationInfo()
-        {
-            @Override
-            public boolean isImmutable()
-            {
-                return false;
-            }
-
-            @Override
-            public QualifiedName qualifiedName()
-            {
-                return qualifiedName;
-            }
-
-            @Override
-            public Type type()
-            {
-                return type;
-            }
-
-            @Override
-            public void checkConstraints( Object value )
-                throws ConstraintViolationException
-            {
-                AssociationModel.this.checkConstraints( value );
-            }
-        };
-
-        if( type instanceof TypeVariable )
-        {
-
-            Class mainType = resolution.model().types().findFirst().orElse( null );
-            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
-        }
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-        AssociationModel that = (AssociationModel) o;
-        return accessor.equals( that.accessor );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return accessor.hashCode();
-    }
-
-    @Override
-    public String toString()
-    {
-        if( accessor instanceof Field )
-        {
-            return ( (Field) accessor ).toGenericString();
-        }
-        else
-        {
-            return ( (Method) accessor ).toGenericString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationsModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationsModel.java
deleted file mode 100644
index 8f5aa46..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/AssociationsModel.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.api.util.VisitableHierarchy;
-
-/**
- * Model for Associations.
- */
-public final class AssociationsModel
-    implements VisitableHierarchy<AssociationsModel, AssociationModel>
-{
-    private final Map<AccessibleObject, AssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
-
-    public AssociationsModel()
-    {
-    }
-
-    public Stream<AssociationModel> associations()
-    {
-        return mapAccessorAssociationModel.values().stream();
-    }
-
-    public void addAssociation( AssociationModel associationModel )
-    {
-        mapAccessorAssociationModel.put( associationModel.accessor(), associationModel );
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super AssociationsModel, ? super AssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        if( visitor.visitEnter( this ) )
-        {
-            for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
-            {
-                if( !associationModel.accept( visitor ) )
-                {
-                    break;
-                }
-            }
-        }
-        return visitor.visitLeave( this );
-    }
-
-    public AssociationModel getAssociation( AccessibleObject accessor )
-        throws IllegalArgumentException
-    {
-        AssociationModel associationModel = mapAccessorAssociationModel.get( accessor );
-        if( associationModel == null )
-        {
-            throw new IllegalArgumentException( "No association found with name:" + ( (Member) accessor ).getName() );
-        }
-        return associationModel;
-    }
-
-    public AssociationDescriptor getAssociationByName( String name )
-        throws IllegalArgumentException
-    {
-        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().name().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No association found with name:" + name );
-    }
-
-    public AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException
-    {
-        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No association found with qualified name:" + name );
-    }
-
-    public void checkConstraints( AssociationStateHolder state )
-    {
-        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            Association<Object> association = state.<Object>associationFor( associationModel.accessor() );
-            associationModel.checkAssociationConstraints( association );
-            associationModel.checkConstraints( association.get() );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationInstance.java
deleted file mode 100644
index 6a50ee9..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationInstance.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.function.BiFunction;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.ManyAssociationWrapper;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.util.NullArgumentException;
-import org.apache.zest.spi.entity.ManyAssociationState;
-
-/**
- * JAVADOC
- */
-public class ManyAssociationInstance<T>
-    extends AbstractAssociationInstance<T>
-    implements ManyAssociation<T>
-{
-    private ManyAssociationState manyAssociationState;
-
-    public ManyAssociationInstance( AssociationInfo associationInfo,
-                                    BiFunction<EntityReference, Type, Object> associationFunction,
-                                    ManyAssociationState manyAssociationState
-    )
-    {
-        super( associationInfo, associationFunction );
-        this.manyAssociationState = manyAssociationState;
-    }
-
-    @Override
-    public int count()
-    {
-        return manyAssociationState.count();
-    }
-
-    @Override
-    public boolean contains( T entity )
-    {
-        return manyAssociationState.contains( getEntityReference( entity ) );
-    }
-
-    @Override
-    public boolean add( int i, T entity )
-    {
-        NullArgumentException.validateNotNull( "entity", entity );
-        checkImmutable();
-        checkType( entity );
-        associationInfo.checkConstraints( entity );
-        return manyAssociationState.add( i, EntityReference.create( ((HasIdentity) entity ).identity().get()) );
-    }
-
-    @Override
-    public boolean add( T entity )
-    {
-        return add( manyAssociationState.count(), entity );
-    }
-
-    @Override
-    public boolean remove( T entity )
-    {
-        NullArgumentException.validateNotNull( "entity", entity );
-        checkImmutable();
-        checkType( entity );
-
-        return manyAssociationState.remove( EntityReference.create( ((HasIdentity) entity).identity().get() ) );
-    }
-
-    @Override
-    public T get( int i )
-    {
-        return getEntity( manyAssociationState.get( i ) );
-    }
-
-    @Override
-    public List<T> toList()
-    {
-        ArrayList<T> list = new ArrayList<>();
-        for( EntityReference entityReference : manyAssociationState )
-        {
-            list.add( getEntity( entityReference ) );
-        }
-
-        return list;
-    }
-
-    @Override
-    public Set<T> toSet()
-    {
-        Set<T> set = new HashSet<>();
-        for( EntityReference entityReference : manyAssociationState )
-        {
-            set.add( getEntity( entityReference ) );
-        }
-
-        return set;
-    }
-
-    @Override
-    public Stream<EntityReference> references()
-    {
-        return manyAssociationState.stream();
-    }
-
-    @Override
-    public String toString()
-    {
-        return manyAssociationState.toString();
-    }
-
-    @Override
-    public Iterator<T> iterator()
-    {
-        return new ManyAssociationIterator( manyAssociationState.iterator() );
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-        ManyAssociation<?> that = (ManyAssociation) o;
-        // Unwrap if needed
-        while( that instanceof ManyAssociationWrapper )
-        {
-            that = ( (ManyAssociationWrapper) that ).next();
-        }
-        // Descriptor equality
-        ManyAssociationInstance<?> thatInstance = (ManyAssociationInstance) that;
-        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
-        if( !associationInfo.equals( thatDescriptor ) )
-        {
-            return false;
-        }
-        // State equality
-        if( manyAssociationState.count() != thatInstance.manyAssociationState.count() )
-        {
-            return false;
-        }
-        for( EntityReference ref : manyAssociationState )
-        {
-            if( !thatInstance.manyAssociationState.contains( ref ) )
-            {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int hash = associationInfo.hashCode() * 31; // Descriptor
-        for( EntityReference ref : manyAssociationState )
-        {
-            hash += ref.hashCode() * 7; // State
-        }
-        return hash;
-    }
-
-    public ManyAssociationState getManyAssociationState()
-    {
-        return manyAssociationState;
-    }
-
-    protected class ManyAssociationIterator
-        implements Iterator<T>
-    {
-        private final Iterator<EntityReference> idIterator;
-
-        public ManyAssociationIterator( Iterator<EntityReference> idIterator )
-        {
-            this.idIterator = idIterator;
-        }
-
-        @Override
-        public boolean hasNext()
-        {
-            return idIterator.hasNext();
-        }
-
-        @Override
-        public T next()
-        {
-            return getEntity( idIterator.next() );
-        }
-
-        @Override
-        public void remove()
-        {
-            checkImmutable();
-            idIterator.remove();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationModel.java
deleted file mode 100644
index 1db4d4f..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationModel.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.List;
-import java.util.function.BiFunction;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.constraint.ConstraintViolation;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.Aggregated;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.entity.Queryable;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.util.Visitable;
-import org.apache.zest.api.util.Visitor;
-import org.apache.zest.bootstrap.BindingException;
-import org.apache.zest.runtime.composite.ValueConstraintsInstance;
-import org.apache.zest.runtime.model.Binder;
-import org.apache.zest.runtime.model.Resolution;
-import org.apache.zest.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.zest.runtime.unitofwork.BuilderEntityState;
-import org.apache.zest.spi.entity.EntityState;
-
-/**
- * Model for a ManyAssociation.
- *
- * <p>Equality is based on the ManyAssociation accessor object (associated type and name), not on the QualifiedName.</p>
- */
-public final class ManyAssociationModel
-    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<ManyAssociationModel>
-{
-    private final ValueConstraintsInstance associationConstraints;
-    private final MetaInfo metaInfo;
-    private Type type;
-    private final AccessibleObject accessor;
-    private QualifiedName qualifiedName;
-    private final ValueConstraintsInstance constraints;
-    private boolean queryable;
-    private boolean immutable;
-    private boolean aggregated;
-    private AssociationInfo builderInfo;
-
-    public ManyAssociationModel( AccessibleObject accessor,
-                                 ValueConstraintsInstance valueConstraintsInstance,
-                                 ValueConstraintsInstance associationConstraintsInstance,
-                                 MetaInfo metaInfo
-    )
-    {
-        this.metaInfo = metaInfo;
-        this.constraints = valueConstraintsInstance;
-        this.associationConstraints = associationConstraintsInstance;
-        this.accessor = accessor;
-        initialize();
-    }
-
-    private void initialize()
-    {
-        this.type = GenericAssociationInfo.associationTypeOf( accessor );
-        this.qualifiedName = QualifiedName.fromAccessor( accessor );
-        this.immutable = metaInfo.get( Immutable.class ) != null;
-        this.aggregated = metaInfo.get( Aggregated.class ) != null;
-
-        final Queryable queryable = accessor.getAnnotation( Queryable.class );
-        this.queryable = queryable == null || queryable.value();
-    }
-
-    @Override
-    public <T> T metaInfo( Class<T> infoType )
-    {
-        return metaInfo.get( infoType );
-    }
-
-    @Override
-    public QualifiedName qualifiedName()
-    {
-        return qualifiedName;
-    }
-
-    @Override
-    public Type type()
-    {
-        return type;
-    }
-
-    @Override
-    public boolean isImmutable()
-    {
-        return immutable;
-    }
-
-    @Override
-    public boolean isAggregated()
-    {
-        return aggregated;
-    }
-
-    @Override
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public boolean queryable()
-    {
-        return queryable;
-    }
-
-    public AssociationInfo getBuilderInfo()
-    {
-        return builderInfo;
-    }
-
-    public <T> ManyAssociation<T> newInstance( final ModuleUnitOfWork uow, EntityState state )
-    {
-        return new ManyAssociationInstance<>( state instanceof BuilderEntityState ? builderInfo : this, new BiFunction<EntityReference, Type, Object>()
-        {
-            @Override
-            public Object apply( EntityReference entityReference, Type type )
-            {
-                return uow.get( Classes.RAW_CLASS.apply( type ), entityReference.identity() );
-            }
-        }, state.manyAssociationValueOf( qualifiedName ) );
-    }
-
-    @Override
-    public void checkConstraints( Object composite )
-        throws ConstraintViolationException
-    {
-        if( constraints != null )
-        {
-            List<ConstraintViolation> violations = constraints.checkConstraints( composite );
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
-            }
-        }
-    }
-
-    public void checkAssociationConstraints( ManyAssociation manyAssociation )
-        throws ConstraintViolationException
-    {
-        if( associationConstraints != null )
-        {
-            List<ConstraintViolation> violations = associationConstraints.checkConstraints( manyAssociation );
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
-            }
-        }
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( Visitor<? super ManyAssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        return visitor.visit( this );
-    }
-
-    @Override
-    public void bind( Resolution resolution )
-        throws BindingException
-    {
-        builderInfo = new AssociationInfo()
-        {
-            @Override
-            public boolean isImmutable()
-            {
-                return false;
-            }
-
-            @Override
-            public QualifiedName qualifiedName()
-            {
-                return qualifiedName;
-            }
-
-            @Override
-            public Type type()
-            {
-                return type;
-            }
-
-            @Override
-            public void checkConstraints( Object value )
-                throws ConstraintViolationException
-            {
-                ManyAssociationModel.this.checkConstraints( value );
-            }
-        };
-
-        if( type instanceof TypeVariable )
-        {
-            Class mainType = resolution.model().types().findFirst().orElse( null );
-            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
-        }
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        ManyAssociationModel that = (ManyAssociationModel) o;
-
-        return accessor.equals( that.accessor );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return accessor.hashCode();
-    }
-
-    @Override
-    public String toString()
-    {
-        if( accessor instanceof Field )
-        {
-            return ( (Field) accessor ).toGenericString();
-        }
-        else
-        {
-            return ( (Method) accessor ).toGenericString();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationsModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationsModel.java
deleted file mode 100644
index cde6d79..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/ManyAssociationsModel.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.api.util.VisitableHierarchy;
-import org.apache.zest.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.zest.runtime.value.ValueStateInstance;
-import org.apache.zest.spi.entity.EntityState;
-
-/**
- * Model for ManyAssociations.
- */
-public final class ManyAssociationsModel
-    implements VisitableHierarchy<ManyAssociationsModel, ManyAssociationModel>
-{
-    private final Map<AccessibleObject, ManyAssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
-
-    public ManyAssociationsModel()
-    {
-    }
-
-    public Stream<ManyAssociationModel> manyAssociations()
-    {
-        return mapAccessorAssociationModel.values().stream();
-    }
-
-    public void addManyAssociation( ManyAssociationModel model )
-    {
-        mapAccessorAssociationModel.put( model.accessor(), model );
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super ManyAssociationsModel, ? super ManyAssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        if( visitor.visitEnter( this ) )
-        {
-            for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
-            {
-                if( !associationModel.accept( visitor ) )
-                {
-                    break;
-                }
-            }
-        }
-        return visitor.visitLeave( this );
-    }
-
-    public <T> ManyAssociation<T> newInstance( AccessibleObject accessor,
-                                               EntityState entityState,
-                                               ModuleUnitOfWork uow )
-    {
-        return mapAccessorAssociationModel.get( accessor ).newInstance( uow, entityState );
-    }
-
-    public ManyAssociationModel getManyAssociation( AccessibleObject accessor )
-        throws IllegalArgumentException
-    {
-        ManyAssociationModel manyAssociationModel = mapAccessorAssociationModel.get( accessor );
-        if( manyAssociationModel == null )
-        {
-            throw new IllegalArgumentException( "No many-association found with name:" + ( (Member) accessor ).getName() );
-        }
-        return manyAssociationModel;
-    }
-
-    public AssociationDescriptor getManyAssociationByName( String name )
-        throws IllegalArgumentException
-    {
-        for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().name().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No many-association found with name:" + name );
-    }
-
-    public AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException
-    {
-        for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No many-association found with qualified name:" + name );
-    }
-
-    public void checkConstraints( ValueStateInstance state )
-    {
-        for( ManyAssociationModel manyAssociationModel : mapAccessorAssociationModel.values() )
-        {
-            manyAssociationModel.checkAssociationConstraints( state.manyAssociationFor( manyAssociationModel.accessor() ) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationInstance.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationInstance.java
deleted file mode 100644
index 27e2826..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationInstance.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.association.NamedAssociationWrapper;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.util.NullArgumentException;
-import org.apache.zest.spi.entity.NamedAssociationState;
-
-public class NamedAssociationInstance<T>
-    extends AbstractAssociationInstance<T>
-    implements NamedAssociation<T>
-{
-
-    private final NamedAssociationState namedAssociationState;
-
-    public NamedAssociationInstance( AssociationInfo associationInfo,
-                                     BiFunction<EntityReference, Type, Object> associationFunction,
-                                     NamedAssociationState namedAssociationState
-    )
-    {
-        super( associationInfo, associationFunction );
-        this.namedAssociationState = namedAssociationState;
-    }
-
-    @Override
-    public Iterator<String> iterator()
-    {
-        return namedAssociationState.iterator();
-    }
-
-    @Override
-    public int count()
-    {
-        return namedAssociationState.count();
-    }
-
-    @Override
-    public boolean containsName( String name )
-    {
-        return namedAssociationState.containsName( name );
-    }
-
-    @Override
-    public boolean put( String name, T entity )
-    {
-        NullArgumentException.validateNotNull( "entity", entity );
-        checkImmutable();
-        checkType( entity );
-        associationInfo.checkConstraints( entity );
-        return namedAssociationState.put( name, EntityReference.create( ((HasIdentity) entity).identity().get() ) );
-    }
-
-    @Override
-    public boolean remove( String name )
-    {
-        checkImmutable();
-        return namedAssociationState.remove( name );
-    }
-
-    @Override
-    public T get( String name )
-    {
-        return getEntity( namedAssociationState.get( name ) );
-    }
-
-    @Override
-    public String nameOf( T entity )
-    {
-        return namedAssociationState.nameOf( getEntityReference( entity ) );
-    }
-
-    @Override
-    public Map<String, T> toMap()
-    {
-        Map<String, T> map = new HashMap<>();
-        for( String name : namedAssociationState )
-        {
-            map.put( name, getEntity( namedAssociationState.get( name ) ) );
-        }
-        return map;
-    }
-
-    @Override
-    public Stream<Map.Entry<String, EntityReference>> references()
-    {
-        return namedAssociationState.stream();
-    }
-
-    @Override
-    public EntityReference referenceOf( String name )
-    {
-        return namedAssociationState.get( name );
-    }
-
-    public Iterable<Map.Entry<String, EntityReference>> getEntityReferences()
-    {
-        return Collections.unmodifiableMap(
-            StreamSupport.stream( namedAssociationState.spliterator(), false )
-                         .collect( Collectors.toMap( Function.identity(), namedAssociationState::get ) )
-        ).entrySet();
-    }
-
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-        NamedAssociation<?> that = (NamedAssociation) o;
-        // Unwrap if needed
-        while( that instanceof NamedAssociationWrapper )
-        {
-            that = ( (NamedAssociationWrapper) that ).next();
-        }
-        // Descriptor equality
-        NamedAssociationInstance<?> thatInstance = (NamedAssociationInstance) that;
-        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
-        if( !associationInfo.equals( thatDescriptor ) )
-        {
-            return false;
-        }
-        // State equality
-        if( namedAssociationState.count() != thatInstance.namedAssociationState.count() )
-        {
-            return false;
-        }
-        for( String name : namedAssociationState )
-        {
-            if( !thatInstance.namedAssociationState.containsName( name ) )
-            {
-                return false;
-            }
-            EntityReference thisReference = namedAssociationState.get( name );
-            EntityReference thatReference = thatInstance.namedAssociationState.get( name );
-            if( !thisReference.equals( thatReference ) )
-            {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        int hash = associationInfo.hashCode() * 31; // Descriptor
-        for( String name : namedAssociationState )
-        {
-            hash += name.hashCode();
-            hash += namedAssociationState.get( name ).hashCode() * 7; // State
-        }
-        return hash;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationModel.java
deleted file mode 100644
index 29e1165..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationModel.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.List;
-import java.util.function.BiFunction;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.constraint.ConstraintViolation;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.Aggregated;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.entity.Queryable;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.util.Visitable;
-import org.apache.zest.api.util.Visitor;
-import org.apache.zest.bootstrap.BindingException;
-import org.apache.zest.runtime.composite.ValueConstraintsInstance;
-import org.apache.zest.runtime.model.Binder;
-import org.apache.zest.runtime.model.Resolution;
-import org.apache.zest.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.zest.runtime.unitofwork.BuilderEntityState;
-import org.apache.zest.spi.entity.EntityState;
-
-/**
- * Model for a NamedAssociation.
- *
- * <p>Equality is based on the NamedAssociation accessor object (associated type and name), not on the QualifiedName.</p>
- */
-public final class NamedAssociationModel
-    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<NamedAssociationModel>
-{
-    private final ValueConstraintsInstance associationConstraints;
-    private final MetaInfo metaInfo;
-    private Type type;
-    private final AccessibleObject accessor;
-    private QualifiedName qualifiedName;
-    private final ValueConstraintsInstance constraints;
-    private boolean queryable;
-    private boolean immutable;
-    private boolean aggregated;
-    private AssociationInfo builderInfo;
-
-    public NamedAssociationModel( AccessibleObject accessor,
-                                  ValueConstraintsInstance valueConstraintsInstance,
-                                  ValueConstraintsInstance associationConstraintsInstance,
-                                  MetaInfo metaInfo
-    )
-    {
-        this.metaInfo = metaInfo;
-        this.constraints = valueConstraintsInstance;
-        this.associationConstraints = associationConstraintsInstance;
-        this.accessor = accessor;
-        initialize();
-    }
-
-    private void initialize()
-    {
-        this.type = GenericAssociationInfo.associationTypeOf( accessor );
-        this.qualifiedName = QualifiedName.fromAccessor( accessor );
-        this.immutable = metaInfo.get( Immutable.class ) != null;
-        this.aggregated = metaInfo.get( Aggregated.class ) != null;
-
-        final Queryable queryable = accessor.getAnnotation( Queryable.class );
-        this.queryable = queryable == null || queryable.value();
-    }
-
-    @Override
-    public <T> T metaInfo( Class<T> infoType )
-    {
-        return metaInfo.get( infoType );
-    }
-
-    @Override
-    public QualifiedName qualifiedName()
-    {
-        return qualifiedName;
-    }
-
-    @Override
-    public Type type()
-    {
-        return type;
-    }
-
-    @Override
-    public boolean isImmutable()
-    {
-        return immutable;
-    }
-
-    @Override
-    public boolean isAggregated()
-    {
-        return aggregated;
-    }
-
-    @Override
-    public AccessibleObject accessor()
-    {
-        return accessor;
-    }
-
-    @Override
-    public boolean queryable()
-    {
-        return queryable;
-    }
-
-    public AssociationInfo getBuilderInfo()
-    {
-        return builderInfo;
-    }
-
-    public <T> NamedAssociation<T> newInstance( final ModuleUnitOfWork uow, EntityState state )
-    {
-        return new NamedAssociationInstance<>( state instanceof BuilderEntityState ? builderInfo : this, new BiFunction<EntityReference, Type, Object>()
-        {
-            @Override
-            public Object apply( EntityReference entityReference, Type type )
-            {
-                return uow.get( Classes.RAW_CLASS.apply( type ), entityReference.identity() );
-            }
-        }, state.namedAssociationValueOf( qualifiedName ) );
-    }
-
-    @Override
-    public void checkConstraints( Object composite )
-        throws ConstraintViolationException
-    {
-        if( constraints != null )
-        {
-            List<ConstraintViolation> violations = constraints.checkConstraints( composite );
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
-            }
-        }
-    }
-
-    public void checkAssociationConstraints( NamedAssociation association )
-        throws ConstraintViolationException
-    {
-        if( associationConstraints != null )
-        {
-            List<ConstraintViolation> violations = associationConstraints.checkConstraints( association );
-            if( !violations.isEmpty() )
-            {
-                Stream<Class<?>> empty = Stream.empty();
-                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
-            }
-        }
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( Visitor<? super NamedAssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        return visitor.visit( this );
-    }
-
-    @Override
-    public void bind( Resolution resolution )
-        throws BindingException
-    {
-        builderInfo = new AssociationInfo()
-        {
-            @Override
-            public boolean isImmutable()
-            {
-                return false;
-            }
-
-            @Override
-            public QualifiedName qualifiedName()
-            {
-                return qualifiedName;
-            }
-
-            @Override
-            public Type type()
-            {
-                return type;
-            }
-
-            @Override
-            public void checkConstraints( Object value )
-                throws ConstraintViolationException
-            {
-                NamedAssociationModel.this.checkConstraints( value );
-            }
-        };
-
-        if( type instanceof TypeVariable )
-        {
-            Class mainType = resolution.model().types().findFirst().orElse( null );
-            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
-        }
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if( this == o )
-        {
-            return true;
-        }
-        if( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        NamedAssociationModel that = (NamedAssociationModel) o;
-
-        return accessor.equals( that.accessor );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return accessor.hashCode();
-    }
-
-    @Override
-    public String toString()
-    {
-        if( accessor instanceof Field )
-        {
-            return ( (Field) accessor ).toGenericString();
-        }
-        else
-        {
-            return ( (Method) accessor ).toGenericString();
-        }
-    }
-}


[69/81] [abbrv] zest-java git commit: Merge remote-tracking branch 'origin/develop' into develop

Posted by ni...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	buildSrc/src/main/groovy/org/apache/zest/gradle/doc/XsltTask.groovy
	buildSrc/src/main/groovy/org/apache/zest/gradle/release/ModuleReleaseSpec.groovy


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

Branch: refs/heads/develop
Commit: e08a8d8284ad2855640e9985162fd0022bc4bca9
Parents: b45402f 05439b7
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Dec 17 11:26:58 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Dec 17 11:26:58 2016 +0800

----------------------------------------------------------------------
 buildSrc/build.gradle                           |  11 +-
 .../org/apache/zest/gradle/doc/XsltTask.groovy  | 100 ++++++++++++++++
 .../gradle/release/ModuleReleaseSpec.groovy     |  53 +++++++++
 .../gradle/release/ModuleReleaseSpecTest.groovy | 118 +++++++++++++++++++
 4 files changed, 280 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[23/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/util/ClassesTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/util/ClassesTest.java b/core/api/src/test/java/org/apache/zest/api/util/ClassesTest.java
deleted file mode 100644
index 3ee4357..0000000
--- a/core/api/src/test/java/org/apache/zest/api/util/ClassesTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.HashSet;
-import java.util.Set;
-import org.junit.Test;
-
-import static org.apache.zest.api.util.Classes.interfacesOf;
-import static org.apache.zest.api.util.Classes.interfacesWithMethods;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Tests for Classes
- */
-public class ClassesTest
-{
-
-    @Test
-    public void givenClassWithInterfacesWhenInterfacesOfThenGetCorrectSet()
-    {
-        assertThat( "one interface returned", interfacesOf( A.class ).count(), equalTo( 1L ) );
-        assertThat( "two interface returned", interfacesOf( B.class ).count(), equalTo( 2L ) );
-        assertThat( "tree interface returned", interfacesOf( C.class ).count(), equalTo( 4L ) );
-    }
-
-    @Test
-    public void givenClassWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet()
-    {
-        HashSet<Class<?>> interfaces = new HashSet<Class<?>>();
-        interfaces.add( B.class );
-        Set<Class<?>> types = interfacesWithMethods( interfaces );
-        assertThat( "one interface returned", types.size(), equalTo( 1 ) );
-        assertThat( "correct interface returned", types.contains( B.class ), is( true ) );
-    }
-
-    @Test
-    public void givenClassesWithInterfacesWhenGetInterfacesWithMethodsThenGetCorrectSet()
-    {
-        assertThat( "one interface returned", interfacesOf( C.class ).filter( Methods.HAS_METHODS )
-            .count(), equalTo( 1L ) );
-        boolean isIn = interfacesOf( C.class ).filter( Methods.HAS_METHODS )
-            .anyMatch( B.class::equals );
-        assertThat( "correct interface returned", isIn, is( true ) );
-    }
-
-    @Test
-    public void givenClassNameWhenToUriThenUriIsReturned()
-    {
-        assertThat( "URI is correct", Classes.toURI( A.class ), equalTo( "urn:zest:type:org.apache.zest.api.util.ClassesTest-A" ) );
-    }
-
-    @Test
-    public void givenUriWhenToClassNameThenClassNameIsReturned()
-    {
-        assertThat( "Class name is correct", Classes.toClassName( "urn:zest:type:org.apache.zest.api.util.ClassesTest-A" ), equalTo( "org.apache.zest.api.util.ClassesTest$A" ) );
-    }
-
-    @Test
-    public void givenGenericTypeWithWildCardWhenGetRawClassThenCorrectTypeIsReturned()
-        throws NoSuchMethodException
-    {
-        Type returnType = Generics.class.getMethod( "wildcard" ).getGenericReturnType();
-        Type wildcardType = ( (ParameterizedType) returnType ).getActualTypeArguments()[ 0 ];
-        assertThat( "Return type is A", Classes.RAW_CLASS.apply( wildcardType ), equalTo( (Class) A.class ) );
-    }
-
-    @Test
-    public void givenTypeVariableWhenResolveThenResolved()
-    {
-        for( Method method : Type1.class.getMethods() )
-        {
-            Type type = method.getGenericReturnType();
-            TypeVariable typeVariable = (TypeVariable) type;
-            Type resolvedType = Classes.resolveTypeVariable( typeVariable, method.getDeclaringClass(), Type1.class );
-            System.out.println( type + "=" + resolvedType );
-            switch( method.getName() )
-            {
-            case "type":
-                assertThat( resolvedType, equalTo( (Type) String.class ) );
-                break;
-            case "type1":
-                assertThat( resolvedType, equalTo( (Type) String.class ) );
-                break;
-            case "type2":
-                assertThat( resolvedType, equalTo( (Type) Long.class ) );
-                break;
-            }
-        }
-    }
-
-    @Test
-    public void givenGenericTypeWhenGetSimpleGenericNameThenCorrectStringIsReturned()
-        throws NoSuchMethodException
-    {
-        assertThat( "Simple Generic Name is 'A'",
-                    Classes.simpleGenericNameOf( A.class ),
-                    equalTo( "A" ) );
-        assertThat( "Simple Generic Name is 'B'",
-                    Classes.simpleGenericNameOf( B.class ),
-                    equalTo( "B" ) );
-        assertThat( "Simple Generic Name is 'C'",
-                    Classes.simpleGenericNameOf( C.class ),
-                    equalTo( "C" ) );
-
-        assertThat( "Simple Generic Name is 'Generics'",
-                    Classes.simpleGenericNameOf( Generics.class ),
-                    equalTo( "Generics" ) );
-        assertThat( "Simple Generic Name is 'Iterable<? extends A>'",
-                    Classes.simpleGenericNameOf( Generics.class.getMethod( "wildcard" ).getGenericReturnType() ),
-                    equalTo( "Iterable<? extends A>" ) );
-
-        assertThat( "Simple Generic Name is 'Type1'",
-                    Classes.simpleGenericNameOf( Type1.class ),
-                    equalTo( "Type1" ) );
-        assertThat( "Simple Generic Name is 'TYPE'",
-                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type" ).getGenericReturnType() ),
-                    equalTo( "TYPE" ) );
-        assertThat( "Simple Generic Name is 'TYPE1'",
-                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type1" ).getGenericReturnType() ),
-                    equalTo( "TYPE1" ) );
-        assertThat( "Simple Generic Name is 'TYPE2'",
-                    Classes.simpleGenericNameOf( Type1.class.getMethod( "type2" ).getGenericReturnType() ),
-                    equalTo( "TYPE2" ) );
-
-        assertThat( "Simple Generic Name is 'Type2'",
-                    Classes.simpleGenericNameOf( Type2.class ),
-                    equalTo( "Type2" ) );
-        assertThat( "Simple Generic Name is 'TYPE'",
-                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type" ).getGenericReturnType() ),
-                    equalTo( "TYPE" ) );
-        assertThat( "Simple Generic Name is 'TYPE1'",
-                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type1" ).getGenericReturnType() ),
-                    equalTo( "TYPE1" ) );
-        assertThat( "Simple Generic Name is 'TYPE2'",
-                    Classes.simpleGenericNameOf( Type2.class.getMethod( "type2" ).getGenericReturnType() ),
-                    equalTo( "TYPE2" ) );
-
-        assertThat( "Simple Generic Name is 'Type3'",
-                    Classes.simpleGenericNameOf( Type3.class ),
-                    equalTo( "Type3" ) );
-        assertThat( "Simple Generic Name is 'TYPE'",
-                    Classes.simpleGenericNameOf( Type3.class.getMethod( "type" ).getGenericReturnType() ),
-                    equalTo( "TYPE" ) );
-    }
-
-    interface A
-    {
-    }
-
-    interface B
-        extends A
-    {
-
-        public void doStuff();
-    }
-
-    interface C
-        extends A, B
-    {
-    }
-
-    interface Generics
-    {
-
-        Iterable<? extends A> wildcard();
-    }
-
-    interface Type1
-        extends Type2<String, Long>
-    {
-    }
-
-    interface Type2<TYPE1, TYPE2>
-        extends Type3<TYPE1>
-    {
-
-        TYPE1 type1();
-
-        TYPE2 type2();
-    }
-
-    interface Type3<TYPE>
-    {
-
-        TYPE type();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/util/CollectorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/util/CollectorsTest.java b/core/api/src/test/java/org/apache/zest/api/util/CollectorsTest.java
deleted file mode 100644
index 7d9ade2..0000000
--- a/core/api/src/test/java/org/apache/zest/api/util/CollectorsTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.util;
-
-import java.util.Optional;
-import java.util.stream.Stream;
-import org.junit.Test;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-public class CollectorsTest
-{
-    @Test
-    public void single()
-    {
-        assertThat( Stream.of( 1L ).collect( Collectors.single() ), is( 1L ) );
-
-        try
-        {
-            Stream.of().collect( Collectors.single() );
-            fail( "Should have failed" );
-        }
-        catch( IllegalArgumentException ex ) {}
-        try
-        {
-            Stream.of( 1, 1 ).collect( Collectors.single() );
-            fail( "Should have failed" );
-        }
-        catch( IllegalArgumentException ex ) {}
-        try
-        {
-            Stream.of( 1, 1, 1 ).collect( Collectors.single() );
-            fail( "Should have failed" );
-        }
-        catch( IllegalArgumentException ex ) {}
-    }
-
-    @Test
-    public void singleOrEmpty()
-    {
-        assertEquals( Optional.empty(), Stream.of().collect( Collectors.singleOrEmpty() ) );
-        assertEquals( Optional.of( 1 ), Stream.of( 1 ).collect( Collectors.singleOrEmpty() ) );
-
-        try
-        {
-            Stream.of( 1, 1 ).collect( Collectors.singleOrEmpty() );
-            fail( "Should have failed" );
-        }
-        catch( IllegalArgumentException ex ) {}
-        try
-        {
-            Stream.of( 1, 1, 1 ).collect( Collectors.singleOrEmpty() );
-            fail( "Should have failed" );
-        }
-        catch( IllegalArgumentException ex ) {}
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
deleted file mode 100644
index e0f829e..0000000
--- a/core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Stream;
-import org.apache.zest.api.injection.scope.Service;
-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.type.CollectionType;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
-import org.junit.Test;
-
-import static java.util.stream.Collectors.toList;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-/**
- * Snippets:
- * - default : default ValueSerialization
- * - service : assembled service ValueSerialization
- * - lookup  : ValueSerialization values module finder
- */
-public class DocumentationSupport
-    extends AbstractPolygeneTest
-{
-
-    // START SNIPPET: default
-    // START SNIPPET: service
-    public interface SomeValue // (1)
-    {
-
-        Property<String> foo();
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.values( SomeValue.class ); // (2)
-        // END SNIPPET: default
-        new OrgJsonValueSerializationAssembler().assemble( module ); // (3)
-        new DefaultUnitOfWorkAssembler().assemble( module );
-        // START SNIPPET: default
-    }
-    // END SNIPPET: default
-    // END SNIPPET: service
-
-    @Test
-    // START SNIPPET: default
-    public void defaultValueSerialization()
-    {
-        SomeValue someValue = someNewValueInstance(); // (3)
-        String json = someValue.toString(); // (4)
-        SomeValue someNewValue = valueBuilderFactory.newValueFromSerializedState( SomeValue.class, json ); // (5)
-        // END SNIPPET: default
-
-        assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
-        assertThat( someNewValue, equalTo( someValue ) );
-
-        // START SNIPPET: default
-    }
-
-    // END SNIPPET: default
-    // START SNIPPET: service
-    @Service
-    private ValueSerializer valueSerializer; // (4)
-    @Service
-    private ValueDeserializer valueDeserializer; // (4)
-
-    // END SNIPPET: service
-    @Test
-    // START SNIPPET: service
-    public void assembledDefaultServiceSerialization()
-    {
-        SomeValue someValue = someNewValueInstance(); // (5)
-        String json = valueSerializer.serialize( someValue ); // (6)
-        SomeValue someNewValue = valueDeserializer.deserialize( module, SomeValue.class, json ); // (7)
-        // END SNIPPET: service
-
-        assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
-        assertThat( someNewValue, equalTo( someValue ) );
-
-        // START SNIPPET: service
-    }
-    // END SNIPPET: service
-
-    static enum AcmeValue
-    {
-
-        foo, bar
-    }
-
-    @Test
-    // START SNIPPET: stream
-    public void assembledServiceStreamingSerialization()
-    {
-        // END SNIPPET: stream
-
-        List<AcmeValue> dataSource = Arrays.asList( AcmeValue.values() );
-        ByteArrayOutputStream targetStream = new ByteArrayOutputStream();
-
-        // START SNIPPET: stream
-        // (1)
-        Iterable<AcmeValue> data = dataSource; // Eg. Entities converted to Values
-        OutputStream output = targetStream; // Eg. streaming JSON over HTTP
-
-        // (2)
-        valueSerializer.serialize( data, output );
-        // END SNIPPET: stream
-
-        byte[] serialized = targetStream.toByteArray();
-        ByteArrayInputStream sourceStream = new ByteArrayInputStream( serialized );
-
-        // START SNIPPET: stream
-        // (3)
-        InputStream input = sourceStream; // Eg. reading incoming JSON
-
-        // (4)
-        List<AcmeValue> values = valueDeserializer.deserialize( module, CollectionType.listOf( AcmeValue.class ), input );
-        // END SNIPPET: stream
-
-        assertThat( values, equalTo( dataSource ) );
-
-        // START SNIPPET: stream
-    }
-    // END SNIPPET: stream
-
-    @Test
-    // START SNIPPET: io
-    public void assembledServiceIOSerialization()
-        throws IOException
-    {
-        // END SNIPPET: io
-
-        List<AcmeValue> dataSource = Arrays.asList( AcmeValue.values() );
-        StringWriter stringOutput = new StringWriter();
-        PrintWriter output = new PrintWriter( stringOutput );
-
-
-        // START SNIPPET: io
-        // (1)
-        // Eg. Entities converted to Values
-        Stream<AcmeValue> queryResult = dataSource.stream();
-
-        // (2)
-        Function<AcmeValue, String> serialize = valueSerializer.serialize();
-
-        // (3)
-        // Eg. pipe data to another process or to a file
-        queryResult.map( serialize ).forEach( output::println );
-        // END SNIPPET: io
-
-        output.flush();
-        String string = stringOutput.toString();
-        List<String> input = Arrays.asList( string.split( System.lineSeparator() ) );
-
-        // START SNIPPET: io
-        // (4)
-        Stream<String> lines = input.stream();
-
-        // (5)
-        Function<String, AcmeValue> deserialize = valueDeserializer.deserialize( module, AcmeValue.class );
-
-        // Deserialization of a collection of AcmeValue from a String.
-        // One serialized AcmeValue per line.
-        // (6)
-        List<AcmeValue> values = lines.map( deserialize ).collect( toList() );
-        // END SNIPPET: io
-
-        assertThat( dataSource, equalTo( values ) );
-
-        // START SNIPPET: io
-    }
-    // END SNIPPET: io
-
-    @Test
-    // TODO Move to SPI !
-    // TODO Include in each ValueSerialization extensions documentation
-    public void assembledWithValuesModuleSerialization()
-        throws Exception
-    {
-        Application app = new Energy4Java().newApplication( applicationFactory -> {
-            Assembler[][][] pancakes = new Assembler[][][]
-                {
-                    {
-                        {
-                            valuesModule -> {
-                                valuesModule.layer().setName( "SINGLE-Layer" );
-                                valuesModule.setName( "VALUES-Module" );
-
-                                valuesModule.values( SomeValue.class );
-                                new DefaultUnitOfWorkAssembler().assemble( valuesModule );
-                            }
-                        },
-                        {
-                            servicesModule -> {
-                                servicesModule.setName( "SERVICES-Module" );
-
-                                Function<Application, Module> valuesModuleFinder = new Function<Application, Module>()
-                                {
-                                    @Override
-                                    public Module apply( Application app1 )
-                                    {
-                                        return app1.findModule( "SINGLE-Layer", "VALUES-Module" );
-                                    }
-                                };
-                                new OrgJsonValueSerializationAssembler().
-                                    withValuesModuleFinder( valuesModuleFinder ).
-                                    assemble( servicesModule );
-                            }
-                        }
-                    }
-                };
-            return applicationFactory.newApplicationAssembly( pancakes );
-        } );
-        app.activate();
-        try
-        {
-            Module valuesModule = app.findModule( "SINGLE-Layer", "VALUES-Module" );
-            SomeValue someValue = someNewValueInstance();
-
-            Module servicesModule = app.findModule( "SINGLE-Layer", "SERVICES-Module" );
-            ValueSerialization valueSerialization = servicesModule.findService( ValueSerialization.class ).get();
-
-            String json = valueSerialization.serialize( someValue );
-            assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
-
-            SomeValue someNewValue = valueSerialization.deserialize( module, SomeValue.class, json );
-            assertThat( someNewValue, equalTo( someValue ) );
-        }
-        finally
-        {
-            app.passivate();
-        }
-    }
-
-    private SomeValue someNewValueInstance(  )
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        builder.prototype().foo().set( "bar" );
-        return builder.newInstance();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/value/ValueBuilderTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/value/ValueBuilderTemplateTest.java b/core/api/src/test/java/org/apache/zest/api/value/ValueBuilderTemplateTest.java
deleted file mode 100644
index 27fef11..0000000
--- a/core/api/src/test/java/org/apache/zest/api/value/ValueBuilderTemplateTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import org.junit.Test;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-
-/**
- * TODO
- */
-public class ValueBuilderTemplateTest
-    extends AbstractPolygeneTest
-{
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.values( TestValue.class );
-    }
-
-    @Test
-    public void testTemplate()
-    {
-        new TestBuilder( "Rickard" ).newInstance( module );
-    }
-
-    @Test
-    public void testAnonymousTemplate()
-    {
-        new ValueBuilderTemplate<TestValue>( TestValue.class )
-        {
-            @Override
-            protected void build( TestValue prototype )
-            {
-                prototype.name().set( "Rickard" );
-            }
-        }.newInstance( module );
-    }
-
-    interface TestValue
-        extends ValueComposite
-    {
-        Property<String> name();
-    }
-
-    class TestBuilder
-        extends ValueBuilderTemplate<TestValue>
-    {
-        String name;
-
-        TestBuilder( String name )
-        {
-            super( TestValue.class );
-            this.name = name;
-        }
-
-        @Override
-        protected void build( TestValue prototype )
-        {
-            prototype.name().set( name );
-        }
-    }
-
-    ;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/value/ValueCompositeTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/value/ValueCompositeTest.java b/core/api/src/test/java/org/apache/zest/api/value/ValueCompositeTest.java
deleted file mode 100644
index fad1082..0000000
--- a/core/api/src/test/java/org/apache/zest/api/value/ValueCompositeTest.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.value;
-
-import java.util.List;
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.library.constraints.annotation.MaxLength;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Tests for ValueComposites
- */
-public class ValueCompositeTest
-    extends AbstractPolygeneTest
-{
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.values( SomeValue.class, AnotherValue.class, AssociationValue.class );
-        module.entities( SomeEntity.class );
-        new EntityTestAssembler().assemble( module );
-    }
-
-    @Test( expected = IllegalStateException.class )
-    public void testImmutabilityOfValueComposite()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue some = builder.prototype();
-        some.other().set( "test" );
-        some = builder.newInstance();
-        some.other().set( "test2" );
-    }
-
-    @Test
-    public void testCreationOfValueComposite()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue some = builder.prototype();
-        some.other().set( "test" );
-        builder.newInstance();
-
-        // Check that @UseDefaults works for ValueComposites
-        assertEquals( "{\"val1\":\"\"}", some.another().get().toString() );
-    }
-
-    @Test
-    public void testEqualityOfValueComposite()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue prototype = builder.prototype();
-        prototype.other().set( "test" );
-        SomeValue instance = builder.newInstance();
-        SomeValue other = builder.newInstance();
-        Assert.assertFalse( "Instances should not be the same.", instance == other );
-        Assert.assertEquals( "Equal values.", instance, other );
-    }
-
-    @Test
-    public void testHashcodeOfValueComposite()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue prototype = builder.prototype();
-        prototype.other().set( "test" );
-        SomeValue instance = builder.newInstance();
-        SomeValue other = builder.newInstance();
-        Assert.assertFalse( "Instances should not be the same.", instance == other );
-        Assert.assertEquals( "Equal values.", instance.hashCode(), other.hashCode() );
-    }
-
-    @Test
-    public void testModifyValue()
-    {
-        ValueBuilder<AnotherValue> anotherBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
-        anotherBuilder.prototype().val1().set( "Val1" );
-        AnotherValue anotherValue = anotherBuilder.newInstance();
-
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue prototype = builder.prototype();
-        prototype.some().set( "foo" );
-        prototype.other().set( "test" );
-        prototype.xyzzyList().get().add( "blah" );
-        prototype.another().set( anotherValue );
-        SomeValue instance = builder.newInstance();
-
-        assertThat( "List has value blah", instance.xyzzyList().get().get( 0 ), equalTo( "blah" ) );
-
-        // Modify value
-        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
-        builder.prototype().some().set( "bar" );
-        instance = builder.newInstance();
-
-        assertThat( "Other is set to test", instance.other().get(), equalTo( "test" ) );
-        assertThat( "List has value blah", instance.xyzzyList().get().get( 0 ), equalTo( "blah" ) );
-        assertThat( "AnotherValue.val1 has value Val1", instance.another().get().val1().get(), equalTo( "Val1" ) );
-
-        // Modify value again using method 2
-        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
-        builder.prototype().other().set( "test2" );
-        instance = builder.newInstance();
-
-        assertThat( "Other is set to test2", instance.other().get(), equalTo( "test2" ) );
-        assertThat( "Some is set to bar", instance.some().get(), equalTo( "bar" ) );
-    }
-
-    @Test( expected = ConstraintViolationException.class )
-    public void givenValueWhenModifyToIncorrectValueThenThrowConstraintException()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        SomeValue prototype = builder.prototype();
-        prototype.some().set( "foo" );
-        SomeValue instance = builder.newInstance();
-
-        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
-        builder.prototype().some().set( "123456" );
-    }
-
-    @Test
-    public void givenValueWithListOfValueWhenPrototypeThenListedValuesAreEditable()
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
-        SomeValue some = builder.newInstance();
-
-        builder = valueBuilderFactory.newValueBuilderWithPrototype( some );
-        builder.prototype().anotherList().get().get( 0 ).val1().set( "Foo" );
-        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
-        some = builder.newInstance();
-
-        assertThat( "Val1 has been set", some.anotherList().get().get( 0 ).val1().get(), equalTo( "Foo" ) );
-
-        try
-        {
-            some.anotherList().get().get( 0 ).val1().set( "Bar" );
-            Assert.fail( "Should not be allowed to modify value" );
-        }
-        catch( IllegalStateException e )
-        {
-            // Ok
-        }
-    }
-
-    @Test
-    public void givenEntityWhenUpdateValueThenValueIsSet()
-        throws UnitOfWorkCompletionException
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
-        ValueBuilder<AnotherValue> valueBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
-        valueBuilder.prototype().val1().set( "Foo" );
-        builder.prototype().another().set( valueBuilder.newInstance() );
-        builder.prototype().number().set( 42L );
-        SomeValue some = builder.newInstance();
-
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        try
-        {
-            EntityBuilder<SomeEntity> entityBuilder = unitOfWork.newEntityBuilder( SomeEntity.class );
-            entityBuilder.instance().someValue().set( some );
-            SomeEntity entity = entityBuilder.newInstance();
-
-            assertThat( "Value has been set", entity.someValue().get().another().get().val1().get(), equalTo( "Foo" ) );
-
-            unitOfWork.complete();
-        }
-        finally
-        {
-            unitOfWork.discard();
-        }
-    }
-
-    @Test
-    public void givenValueWithAssociationsWhenNewUoWThenCanRead()
-        throws UnitOfWorkCompletionException
-    {
-        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
-        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
-        ValueBuilder<AnotherValue> valueBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
-        valueBuilder.prototype().val1().set( "Foo" );
-        builder.prototype().another().set( valueBuilder.newInstance() );
-        builder.prototype().number().set( 42L );
-        SomeValue some = builder.newInstance();
-
-        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
-        AssociationValue associationValue;
-        try
-        {
-            EntityBuilder<SomeEntity> entityBuilder = unitOfWork.newEntityBuilder( SomeEntity.class );
-            entityBuilder.instance().someValue().set( some );
-            SomeEntity entity = entityBuilder.newInstance();
-
-            ValueBuilder<AssociationValue> associationBuilder = valueBuilderFactory.newValueBuilder( AssociationValue.class );
-            associationBuilder.prototype().some().set( entity );
-            associationValue = associationBuilder.newInstance();
-
-            String json = associationValue.toString();
-
-            unitOfWork.complete();
-
-            unitOfWork = unitOfWorkFactory.newUnitOfWork();
-
-            AssociationValue newAssociationValue = valueBuilderFactory.newValueFromSerializedState( AssociationValue.class, json );
-
-            Assert.assertEquals( associationValue.some().get(), newAssociationValue.some().get() );
-        }
-        finally
-        {
-            unitOfWork.discard();
-        }
-
-        // Should allow the toString() to print the entityRefs.
-        System.out.println( associationValue.toString() );
-        try
-        {
-            associationValue.some().get();
-            fail( "Should have thrown an exception" );
-        }
-        catch( Exception e )
-        {
-            // Ok
-        }
-    }
-
-    public enum TestEnum
-    {
-        somevalue, anothervalue
-    }
-
-    public interface SomeValue
-        extends ValueComposite
-    {
-        @UseDefaults
-        @MaxLength( 5 )
-        Property<String> some();
-
-        @UseDefaults
-        Property<String> other();
-
-        @UseDefaults
-        Property<Long> number();
-
-        @UseDefaults
-        Property<List<String>> xyzzyList();
-
-        @UseDefaults
-        Property<AnotherValue> another();
-
-        @UseDefaults
-        Property<List<AnotherValue>> anotherList();
-
-        @UseDefaults
-        Property<TestEnum> testEnum();
-    }
-
-    public interface AnotherValue
-        extends ValueComposite
-    {
-        @UseDefaults
-        Property<String> val1();
-    }
-
-    public interface AssociationValue
-        extends ValueComposite
-    {
-        @Optional
-        Association<SomeEntity> some();
-
-        ManyAssociation<SomeEntity> manySome();
-    }
-
-    public interface SomeEntity
-        extends EntityComposite
-    {
-        Property<SomeValue> someValue();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/resources/org/apache/polygene/api/configuration/MyService.properties
----------------------------------------------------------------------
diff --git a/core/api/src/test/resources/org/apache/polygene/api/configuration/MyService.properties b/core/api/src/test/resources/org/apache/polygene/api/configuration/MyService.properties
new file mode 100644
index 0000000..600ed6f
--- /dev/null
+++ b/core/api/src/test/resources/org/apache/polygene/api/configuration/MyService.properties
@@ -0,0 +1,21 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you 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.
+#
+#
+#
+
+me = { name : Niclas, address={ street1 : "Henan Lu 555", street2 : "Block 15", city : { cityName : "Shanghai", country : { countryName : "China" } } } }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/resources/org/apache/zest/api/configuration/MyService.properties
----------------------------------------------------------------------
diff --git a/core/api/src/test/resources/org/apache/zest/api/configuration/MyService.properties b/core/api/src/test/resources/org/apache/zest/api/configuration/MyService.properties
deleted file mode 100644
index 600ed6f..0000000
--- a/core/api/src/test/resources/org/apache/zest/api/configuration/MyService.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you 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.
-#
-#
-#
-
-me = { name : Niclas, address={ street1 : "Henan Lu 555", street2 : "Block 15", city : { cityName : "Shanghai", country : { countryName : "China" } } } }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
new file mode 100644
index 0000000..37f4f5b
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Implement this interface to create the root class that
+ * is responsible for assembling your entire application.
+ *
+ * Model introspectors will instantiate this class and call assemble
+ * to create the application, which will then be visited to get
+ * information about its structure.
+ *
+ * Application deployment servers will instantiate this, call assemble,
+ * and then activate the created application, which will be the runtime
+ * instance that forms your application.
+ */
+public interface ApplicationAssembler
+{
+    ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblerAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblerAdapter.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblerAdapter.java
new file mode 100644
index 0000000..22fe614
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblerAdapter.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Helper base class for application assemblers that
+ * want to either create applications using only one layer/module,
+ * or that wants to create pancake-layered applications.
+ */
+public class ApplicationAssemblerAdapter
+    implements ApplicationAssembler
+{
+    private final Assembler[][][] assemblers;
+
+    protected ApplicationAssemblerAdapter( Assembler assembler )
+    {
+        this.assemblers = new Assembler[][][]{ { { assembler } } };
+    }
+
+    protected ApplicationAssemblerAdapter( Assembler[][][] assemblers )
+    {
+        this.assemblers = assemblers;
+    }
+
+    @Override
+    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+        throws AssemblyException
+    {
+        return applicationFactory.newApplicationAssembly( assemblers );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembly.java
new file mode 100644
index 0000000..5996f1a
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembly.java
@@ -0,0 +1,111 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.structure.Application;
+
+/**
+ * An application assembly. This can be used by Assemblers to programmatically
+ * set the name of the application and create new layers.
+ */
+public interface ApplicationAssembly
+{
+    /**
+     * Create a new layer assembly
+     *
+     * @param name of the new layer
+     *
+     * @return a LayerAssembly instance
+     */
+    LayerAssembly layer( String name );
+
+    /**
+     * Get an assembly for a particular Module. If this is called many times with the same names, then the same module
+     * is affected.
+     *
+     * @param layerName The name of the Layer
+     * @param moduleName The name of the Module to retrieve or create.
+     * @return The ModuleAssembly for the Module.
+     */
+    ModuleAssembly module( String layerName, String moduleName );
+    
+    /**
+     * Get the currently set name of the application
+     *
+     * @return the name of the application
+     */
+    String name();
+
+    /**
+     * Get the currently set mode of the application
+     *
+     * @return the application mode
+     */
+    Application.Mode mode();
+
+    /**
+     * Set the name of the application
+     *
+     * @param name of the application
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setName( String name );
+
+    /**
+     * Set the version of the application. This can be in any format, but
+     * most likely will follow the Dewey format, i.e. x.y.z.
+     *
+     * @param version of the application
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setVersion( String version );
+
+    /**
+     * Set the application mode. This will be set to "production" by default. You can
+     * set the system property "mode" to either "development", "satisfiedBy" or "production"
+     * to explicitly set the mode. If that is not an option, then call this method
+     * during assembly to set the mode. The mode may then be queried by assemblers,
+     * and they may assemble the application differentlly depending on this setting.
+     *
+     * @param mode the application mode
+     *
+     * @return the assembly
+     */
+    ApplicationAssembly setMode( Application.Mode mode );
+
+    ApplicationAssembly setMetaInfo( Object info );
+
+    /**
+     * Set the application activators. Activators are executed in order around the
+     * Application activation and passivation.
+     *
+     * @param activators the application activators
+     * @return the assembly
+     */
+    @SuppressWarnings( { "unchecked","varargs" } )
+    ApplicationAssembly withActivators( Class<? extends Activator<Application>>... activators );
+
+    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblyFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblyFactory.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblyFactory.java
new file mode 100644
index 0000000..1622686
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssemblyFactory.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Factory for creating new Polygene application assemblies. Typically
+ * you will implement one or more Assemblers, wrap them in an ApplicationAssembler,
+ * which then uses this factory to assemble and create applications.
+ */
+public interface ApplicationAssemblyFactory
+{
+    /**
+     * Create a new application with one layer and one module.
+     *
+     * @param assembler the assembler for the single module
+     *
+     * @return the application instance
+     *
+     * @throws AssemblyException if the application could not be assembled
+     */
+    ApplicationAssembly newApplicationAssembly( Assembler assembler )
+        throws AssemblyException;
+
+    /**
+     * Create a new application with the same amount of layers
+     * as the first array size, with modules according to the second array size,
+     * and then use the third array for assemblers of each module. This gives you
+     * a simple way to create "pancake" layered applications.
+     *
+     * @param assemblers the set of assemblers for the application
+     *
+     * @return the application instance
+     *
+     * @throws AssemblyException if the application could not be assembled
+     */
+    ApplicationAssembly newApplicationAssembly( Assembler[][][] assemblers )
+        throws AssemblyException;
+
+    /**
+     * Create a new ApplicationAssembly that can be used for the above method.
+     *
+     * @return a new ApplicationAssembly
+     */
+    ApplicationAssembly newApplicationAssembly();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationModelFactory.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationModelFactory.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationModelFactory.java
new file mode 100644
index 0000000..6d7c32d
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationModelFactory.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+
+/**
+ * Factory for ApplicationModelSPI's. Takes an ApplicationAssembly, executes it,
+ * and builds an application model from it, which can then be instantiated and activated.
+ */
+public interface ApplicationModelFactory
+{
+    ApplicationDescriptor newApplicationModel( ApplicationAssembly assembly )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationName.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationName.java
new file mode 100644
index 0000000..2e1e553
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationName.java
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Set the name of the application
+ */
+public final class ApplicationName
+    implements Assembler
+{
+    private String name;
+
+    public ApplicationName( String name )
+    {
+        this.name = name;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.layer().application().setName( name );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assembler.java
new file mode 100644
index 0000000..901f8d9
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assembler.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * ModuleAssemblies are configured by Assemblers. This
+ * is the interface you would implement in order to provide
+ * all configuration and additional metainfo that is needed
+ * to instantiate a Polygene application.
+ */
+public interface Assembler
+{
+    /**
+     * Assemblers receive a callback to the ModuleAssembly
+     * they are supposed to configure. They can use this
+     * to register objects, composites, services etc. and
+     * the additional metadata that may exist for these
+     * artifacts.
+     * <p>
+     * An Assembler may create new Modules by calling
+     * {@link org.apache.polygene.bootstrap.ModuleAssembly#layer()} and
+     * then {@link LayerAssembly#module(String)} (String)}.
+     * This allows an Assembler to bootstrap an entire Layer with
+     * more Modules.
+     * </p>
+     * @param module the Module to assemble
+     *
+     * @throws AssemblyException thrown if the assembler tries to do something illegal
+     */
+    void assemble( ModuleAssembly module )
+        throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblerCollection.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblerCollection.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblerCollection.java
new file mode 100644
index 0000000..8bee7cb
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblerCollection.java
@@ -0,0 +1,76 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+/**
+ * Assembler that delegates to a collection of Assemblers.
+ * <p>
+ * Makes it easy to collect and compose assemblers into bigger assemblers.
+ * </p>
+ */
+public final class AssemblerCollection
+    implements Assembler
+{
+    Collection<Assembler> assemblers;
+
+    public AssemblerCollection( Assembler... assemblers )
+    {
+        this.assemblers = Arrays.asList( assemblers );
+    }
+
+    @SafeVarargs
+    public AssemblerCollection( Class<? extends Assembler>... assemblyClasses )
+        throws AssemblyException
+    {
+        assemblers = new ArrayList<>();
+        for( Class<? extends Assembler> assemblyClass : assemblyClasses )
+        {
+            try
+            {
+                Assembler assembler = assemblyClass.newInstance();
+                assemblers.add( assembler );
+            }
+            catch( Exception e )
+            {
+                throw new AssemblyException( "Could not instantiate assembly with class " + assemblyClass.getName(), e );
+            }
+        }
+    }
+
+    public AssemblerCollection( Collection<Assembler> assemblers )
+    {
+        this.assemblers = assemblers;
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        for( Assembler assembler : assemblers )
+        {
+            assembler.assemble( module );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assemblers.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assemblers.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assemblers.java
new file mode 100644
index 0000000..b24a5e6
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Assemblers.java
@@ -0,0 +1,448 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Assembler adapters for common use cases (visibility, reference, configuration).
+ */
+public class Assemblers
+{
+    private Assemblers()
+    {
+    }
+
+    /**
+     * Assembler with Visibility interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Visible<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Visibility.
+         * @param visibility Visibility
+         * @return This Assembler instance
+         */
+        AssemblerType visibleIn( org.apache.polygene.api.common.Visibility visibility );
+
+        /**
+         * Get Visibility.
+         * <p>Default to {@link org.apache.polygene.api.common.Visibility#module}.</p>
+         * @return Visibility
+         */
+        org.apache.polygene.api.common.Visibility visibility();
+    }
+
+    /**
+     * Assembler with Identity interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Identifiable<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Identity.
+         * @param identity Identity
+         * @return This Assembler instance
+         */
+        AssemblerType identifiedBy( String identity );
+
+        /**
+         * @return {@literal true} if {@link #identity()} do not return null, {@literal false} otherwise
+         */
+        boolean hasIdentity();
+
+        /**
+         * Get Identity.
+         * <p>Default to {@literal null}.</p>
+         * @return Identity
+         */
+        String identity();
+    }
+
+    /**
+     * Assembler with Configuration interface.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public interface Configurable<AssemblerType>
+        extends Assembler
+    {
+        /**
+         * Set Configuration Module and Visibility.
+         * @param configModule Configuration Module
+         * @param configVisibility Configuration Visiblity
+         * @return This Assembler instance
+         */
+        AssemblerType withConfig( ModuleAssembly configModule,
+                                  org.apache.polygene.api.common.Visibility configVisibility );
+
+        /**
+         * @return {@literal true} if {@link #configModule() ()} do not return null, {@literal false} otherwise
+         */
+        boolean hasConfig();
+
+        /**
+         * Get Configuration Module.
+         * <p>Default to {@literal null}.</p>
+         * @return Configuration Module
+         */
+        ModuleAssembly configModule();
+
+        /**
+         * Get Configuration Visibility.
+         * <p>Default to {@link org.apache.polygene.api.common.Visibility#module}.</p>
+         * @return Configuration Visibility
+         */
+        org.apache.polygene.api.common.Visibility configVisibility();
+    }
+
+    /**
+     * Assembler with Visibility adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Visibility<AssemblerType>
+        implements Visible<AssemblerType>
+    {
+        private org.apache.polygene.api.common.Visibility visibility = org.apache.polygene.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.polygene.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+    }
+
+    /**
+     * Assembler with Identity adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Identity<AssemblerType>
+        implements Identifiable<AssemblerType>
+    {
+        private String identity;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+    }
+
+    /**
+     * Assembler with Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class Config<AssemblerType>
+        implements Configurable<AssemblerType>
+    {
+        private ModuleAssembly configModule = null;
+        private org.apache.polygene.api.common.Visibility configVisibility = org.apache.polygene.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.polygene.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Visibility and Identity adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityIdentity<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Identifiable<AssemblerType>
+    {
+        private org.apache.polygene.api.common.Visibility visibility = org.apache.polygene.api.common.Visibility.module;
+        private String identity;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.polygene.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identityString )
+        {
+            this.identity = identityString;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+    }
+
+    /**
+     * Assembler with Visibility and Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityConfig<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private org.apache.polygene.api.common.Visibility visibility = org.apache.polygene.api.common.Visibility.module;
+        private ModuleAssembly configModule = null;
+        private org.apache.polygene.api.common.Visibility configVisibility = org.apache.polygene.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.polygene.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.polygene.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Identity and Configuration adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class IdentityConfig<AssemblerType>
+        implements Identifiable<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private String identity;
+        private ModuleAssembly configModule = null;
+        private org.apache.polygene.api.common.Visibility configVisibility = org.apache.polygene.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.polygene.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+    /**
+     * Assembler with Visibility, Identity and Configuation adapter.
+     * @param <AssemblerType> Parameterized type of Assembler
+     */
+    public static abstract class VisibilityIdentityConfig<AssemblerType>
+        implements Visible<AssemblerType>,
+                   Identifiable<AssemblerType>,
+                   Configurable<AssemblerType>
+    {
+        private org.apache.polygene.api.common.Visibility visibility = org.apache.polygene.api.common.Visibility.module;
+        private String identity;
+        private ModuleAssembly configModule = null;
+        private org.apache.polygene.api.common.Visibility configVisibility = org.apache.polygene.api.common.Visibility.module;
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType visibleIn( org.apache.polygene.api.common.Visibility visibility )
+        {
+            this.visibility = visibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility visibility()
+        {
+            return visibility;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType identifiedBy( String identity )
+        {
+            this.identity = identity;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasIdentity()
+        {
+            return identity != null;
+        }
+
+        @Override
+        public final String identity()
+        {
+            return identity;
+        }
+
+        @Override
+        @SuppressWarnings( "unchecked" )
+        public final AssemblerType withConfig( ModuleAssembly configModule,
+                                               org.apache.polygene.api.common.Visibility configVisibility )
+        {
+            this.configModule = configModule;
+            this.configVisibility = configVisibility;
+            return (AssemblerType) this;
+        }
+
+        @Override
+        public final boolean hasConfig()
+        {
+            return configModule != null;
+        }
+
+        @Override
+        public final ModuleAssembly configModule()
+        {
+            return configModule;
+        }
+
+        @Override
+        public final org.apache.polygene.api.common.Visibility configVisibility()
+        {
+            return configVisibility;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyException.java
new file mode 100644
index 0000000..0f88b72
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyException.java
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Thrown by ModuleAssembly if the Assembler tries to make an invalid assembly.
+ */
+public class AssemblyException extends RuntimeException
+{
+    public AssemblyException()
+    {
+    }
+
+    public AssemblyException( String string )
+    {
+        super( string );
+    }
+
+    public AssemblyException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+
+    public AssemblyException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblySpecifications.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblySpecifications.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblySpecifications.java
new file mode 100644
index 0000000..756d496
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblySpecifications.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.util.Arrays;
+import java.util.function.Predicate;
+import org.apache.polygene.api.type.HasTypes;
+
+/**
+ * Utility specifications for Assemblies.
+ */
+public class AssemblySpecifications
+{
+    public static Predicate<HasTypes> ofAnyType( final Class... types )
+    {
+        return item -> item.types().anyMatch( a -> Arrays.stream( types ).anyMatch( a::equals ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitor.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitor.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitor.java
new file mode 100644
index 0000000..a04e8f8
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitor.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Visitor interface to visit the whole or parts of an assembly.
+ * <p>
+ * Implement this interface and call visit() on ApplicationAssembly, LayerAssembly or ModuleAssembly.
+ * </p>
+ * <p>
+ * This can be used to, for example, add metadata to all entities, add concerns on composites, or similar.
+ * </p>
+ */
+public interface AssemblyVisitor<ThrowableType extends Throwable>
+{
+    public void visitApplication( ApplicationAssembly assembly )
+        throws ThrowableType;
+
+    public void visitLayer( LayerAssembly assembly )
+        throws ThrowableType;
+
+    public void visitModule( ModuleAssembly assembly )
+        throws ThrowableType;
+
+    public void visitComposite( TransientDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitEntity( EntityDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitService( ServiceDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitImportedService( ImportedServiceDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitValue( ValueDeclaration declaration )
+        throws ThrowableType;
+
+    public void visitObject( ObjectDeclaration declaration )
+        throws ThrowableType;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitorAdapter.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitorAdapter.java
new file mode 100644
index 0000000..019f4ad
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyVisitorAdapter.java
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Base class for assembly visitors. Subclass and override
+ * the particular methods you are interested in.
+ */
+public class AssemblyVisitorAdapter<ThrowableType extends Throwable>
+    implements AssemblyVisitor<ThrowableType>
+{
+    @Override
+    public void visitApplication( ApplicationAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitLayer( LayerAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitModule( ModuleAssembly assembly )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitComposite( TransientDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitEntity( EntityDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitService( ServiceDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitImportedService( ImportedServiceDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitValue( ValueDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+
+    @Override
+    public void visitObject( ObjectDeclaration declaration )
+        throws ThrowableType
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssociationDeclarations.java
new file mode 100644
index 0000000..b7a6d8d
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssociationDeclarations.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.polygene.api.common.MetaInfo;
+
+/**
+ * This provides declared {@link org.apache.polygene.api.association.Association} information that the runtime can use.
+ */
+public interface AssociationDeclarations
+{
+    MetaInfo metaInfoFor( AccessibleObject accessor );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BindingException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BindingException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BindingException.java
new file mode 100644
index 0000000..bbd2dd1
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/BindingException.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.bootstrap;
+
+/**
+ * Thrown by the Polygene runtime if a dependency can not be bound.
+ */
+public class BindingException
+    extends Exception
+{
+    public BindingException( String s )
+    {
+        super( s );
+    }
+
+    public BindingException( String s, InvalidInjectionException ex )
+    {
+        super( s, ex );
+    }
+}


[03/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationsModel.java b/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationsModel.java
deleted file mode 100644
index 5cf8ab3..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/association/NamedAssociationsModel.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.association;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.api.util.VisitableHierarchy;
-import org.apache.zest.runtime.unitofwork.ModuleUnitOfWork;
-import org.apache.zest.runtime.value.ValueStateInstance;
-import org.apache.zest.spi.entity.EntityState;
-
-/**
- * Model for NamedAssociations.
- */
-public final class NamedAssociationsModel
-    implements VisitableHierarchy<NamedAssociationsModel, NamedAssociationModel>
-{
-    private final Map<AccessibleObject, NamedAssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
-
-    public NamedAssociationsModel()
-    {
-    }
-
-    public Stream<NamedAssociationModel> namedAssociations()
-    {
-        return mapAccessorAssociationModel.values().stream();
-    }
-
-    public void addNamedAssociation( NamedAssociationModel model )
-    {
-        mapAccessorAssociationModel.put( model.accessor(), model );
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super NamedAssociationsModel, ? super NamedAssociationModel, ThrowableType> visitor )
-        throws ThrowableType
-    {
-        if( visitor.visitEnter( this ) )
-        {
-            for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
-            {
-                if( !associationModel.accept( visitor ) )
-                {
-                    break;
-                }
-            }
-        }
-        return visitor.visitLeave( this );
-    }
-
-    public <T> NamedAssociation<T> newInstance( AccessibleObject accessor,
-                                                EntityState entityState,
-                                                ModuleUnitOfWork uow )
-    {
-        return mapAccessorAssociationModel.get( accessor ).newInstance( uow, entityState );
-    }
-
-    public NamedAssociationModel getNamedAssociation( AccessibleObject accessor )
-        throws IllegalArgumentException
-    {
-        if( false )
-        {
-            return (NamedAssociationModel) getNamedAssociationByName( QualifiedName.fromAccessor( accessor ).name() );
-        }
-        NamedAssociationModel namedAssociationModel = mapAccessorAssociationModel.get( accessor );
-        if( namedAssociationModel == null )
-        {
-            throw new IllegalArgumentException( "No named-association found with name:" + ( (Member) accessor ).getName() );
-        }
-        return namedAssociationModel;
-    }
-
-    public AssociationDescriptor getNamedAssociationByName( String name )
-        throws IllegalArgumentException
-    {
-        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().name().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No named-association found with name:" + name );
-    }
-
-    public AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
-        throws IllegalArgumentException
-    {
-        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            if( associationModel.qualifiedName().equals( name ) )
-            {
-                return associationModel;
-            }
-        }
-        throw new IllegalArgumentException( "No named-association found with qualified name:" + name );
-    }
-
-    public void checkConstraints( ValueStateInstance state )
-    {
-        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
-        {
-            associationModel.checkAssociationConstraints( state.namedAssociationFor( associationModel.accessor() ) );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AndAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AndAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AndAppliesToFilter.java
deleted file mode 100644
index 162c7ca..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AndAppliesToFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class AndAppliesToFilter
-    implements AppliesToFilter
-{
-    private final AppliesToFilter left;
-    private final AppliesToFilter right;
-
-    AndAppliesToFilter( AppliesToFilter left, AppliesToFilter right )
-    {
-        this.left = left;
-        this.right = right;
-    }
-
-    @Override
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return left.appliesTo( method, mixin, compositeType, fragmentClass ) &&
-               right.appliesTo( method, mixin, compositeType, fragmentClass );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AnnotationAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AnnotationAppliesToFilter.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AnnotationAppliesToFilter.java
deleted file mode 100644
index 17912b0..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AnnotationAppliesToFilter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesToFilter;
-
-/**
- * JAVADOC
- */
-final class AnnotationAppliesToFilter
-    implements AppliesToFilter
-{
-    @SuppressWarnings( "raw" )
-    private final Class annotationType;
-
-    @SuppressWarnings( "raw" )
-    AnnotationAppliesToFilter( Class type )
-    {
-        this.annotationType = type;
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
-    {
-        return method.getAnnotation( annotationType ) != null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
deleted file mode 100644
index 20c4fe1..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-/**
- * Factory for ApplicationAssembly.
- */
-public final class ApplicationAssemblyFactoryImpl
-    implements ApplicationAssemblyFactory
-{
-    @Override
-    public ApplicationAssembly newApplicationAssembly( Assembler assembler )
-        throws AssemblyException
-    {
-        return newApplicationAssembly( new Assembler[][][]{ { { assembler } } } );
-    }
-
-    @Override
-    public ApplicationAssembly newApplicationAssembly( Assembler[][][] assemblers )
-        throws AssemblyException
-    {
-        ApplicationAssembly applicationAssembly = newApplicationAssembly();
-
-        // Build all layers bottom-up
-        LayerAssembly below = null;
-        for( int layer = assemblers.length - 1; layer >= 0; layer-- )
-        {
-            // Create Layer
-            LayerAssembly layerAssembly = applicationAssembly.layer( "Layer " + ( layer + 1 ) );
-            for( int module = 0; module < assemblers[ layer ].length; module++ )
-            {
-                // Create Module
-                ModuleAssembly moduleAssembly = layerAssembly.module( "Module " + ( module + 1 ) );
-                for( Assembler assembler : assemblers[ layer ][ module ] )
-                {
-                    // Register Assembler
-                    assembler.assemble( moduleAssembly );
-                }
-            }
-            if( below != null )
-            {
-                layerAssembly.uses( below ); // Link layers
-            }
-            below = layerAssembly;
-        }
-        return applicationAssembly;
-    }
-
-    @Override
-    public ApplicationAssembly newApplicationAssembly()
-    {
-        return new ApplicationAssemblyImpl();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyImpl.java
deleted file mode 100644
index 02476f9..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationAssemblyImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.AssemblyVisitor;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-
-/**
- * The representation of an entire application. From
- * this you can set information about the application
- * and create LayerAssemblies.
- */
-public final class ApplicationAssemblyImpl
-    implements ApplicationAssembly
-{
-    private final Map<String, LayerAssemblyImpl> layerAssemblies = new LinkedHashMap<>();
-    private String name = "Application";
-    private String version = "1.0"; // Default version
-    private Application.Mode mode;
-    private final MetaInfo metaInfo = new MetaInfo();
-    private final List<Class<? extends Activator<Application>>> activators = new ArrayList<>();
-
-    public ApplicationAssemblyImpl()
-    {
-        mode = Application.Mode.valueOf( System.getProperty( "mode", "production" ) );
-    }
-
-    @Override
-    public LayerAssembly layer( String name )
-    {
-        if( name != null )
-        {
-            LayerAssemblyImpl existing = layerAssemblies.get( name );
-            if( existing != null )
-            {
-                return existing;
-            }
-        }
-        LayerAssemblyImpl layerAssembly = new LayerAssemblyImpl( this, name );
-        layerAssemblies.put( name, layerAssembly );
-        return layerAssembly;
-    }
-
-    @Override
-    public ModuleAssembly module( String layerName, String moduleName )
-    {
-        return layer( layerName ).module( moduleName );
-    }
-
-    @Override
-    public ApplicationAssembly setName( String name )
-    {
-        this.name = name;
-        return this;
-    }
-
-    @Override
-    public ApplicationAssembly setVersion( String version )
-    {
-        this.version = version;
-        return this;
-    }
-
-    @Override
-    public ApplicationAssembly setMode( Application.Mode mode )
-    {
-        this.mode = mode;
-        return this;
-    }
-
-    @Override
-    public ApplicationAssembly setMetaInfo( Object info )
-    {
-        metaInfo.set( info );
-        return this;
-    }
-
-    @Override
-    @SafeVarargs
-    public final ApplicationAssembly withActivators( Class<? extends Activator<Application>>... activators )
-    {
-        this.activators.addAll( Arrays.asList( activators ) );
-        return this;
-    }
-
-    @Override
-    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
-        throws ThrowableType
-    {
-        visitor.visitApplication( this );
-        for( LayerAssemblyImpl layerAssembly : layerAssemblies.values() )
-        {
-            layerAssembly.visit( visitor );
-        }
-    }
-
-    public Collection<LayerAssemblyImpl> layerAssemblies()
-    {
-        return layerAssemblies.values();
-    }
-
-    public List<Class<? extends Activator<Application>>> activators()
-    {
-        return activators;
-    }
-
-    public MetaInfo metaInfo()
-    {
-        return metaInfo;
-    }
-
-    @Override
-    public String name()
-    {
-        return name;
-    }
-
-    public String version()
-    {
-        return version;
-    }
-
-    @Override
-    public Application.Mode mode()
-    {
-        return mode;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationModelFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationModelFactoryImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationModelFactoryImpl.java
deleted file mode 100644
index ed22f92..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ApplicationModelFactoryImpl.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.zest.api.composite.ModelDescriptor;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.api.structure.Layer;
-import org.apache.zest.api.util.HierarchicalVisitor;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationModelFactory;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.BindingException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.runtime.activation.ActivatorsModel;
-import org.apache.zest.runtime.composite.CompositeMethodModel;
-import org.apache.zest.runtime.injection.InjectedFieldModel;
-import org.apache.zest.runtime.model.Binder;
-import org.apache.zest.runtime.model.Resolution;
-import org.apache.zest.runtime.structure.ApplicationModel;
-import org.apache.zest.runtime.structure.LayerModel;
-import org.apache.zest.runtime.structure.ModuleModel;
-import org.apache.zest.runtime.structure.UsedLayersModel;
-
-/**
- * Factory for Applications.
- */
-public final class ApplicationModelFactoryImpl
-    implements ApplicationModelFactory
-{
-    @Override
-    public ApplicationDescriptor newApplicationModel( ApplicationAssembly assembly )
-        throws AssemblyException
-    {
-        AssemblyHelper helper = createAssemblyHelper( assembly );
-
-        ApplicationAssemblyImpl applicationAssembly = (ApplicationAssemblyImpl) assembly;
-        ActivatorsModel<Application> applicationActivators = new ActivatorsModel<>( applicationAssembly.activators() );
-        List<LayerModel> layerModels = new ArrayList<>();
-        final ApplicationModel applicationModel = new ApplicationModel( applicationAssembly.name(),
-                                                                        applicationAssembly.version(),
-                                                                        applicationAssembly.mode(),
-                                                                        applicationAssembly.metaInfo(),
-                                                                        applicationActivators,
-                                                                        layerModels );
-        Map<LayerAssembly, LayerModel> mapAssemblyModel = new HashMap<>();
-        Map<LayerAssembly, List<LayerModel>> mapUsedLayers = new HashMap<>();
-
-        // Build all layers
-        List<LayerAssemblyImpl> layerAssemblies = new ArrayList<>( applicationAssembly.layerAssemblies() );
-        for( LayerAssemblyImpl layerAssembly : layerAssemblies )
-        {
-            List<LayerModel> usedLayers = new ArrayList<>();
-            mapUsedLayers.put( layerAssembly, usedLayers );
-
-            UsedLayersModel usedLayersModel = new UsedLayersModel( usedLayers );
-            List<ModuleModel> moduleModels = new ArrayList<>();
-            String name = layerAssembly.name();
-            if( name == null )
-            {
-                throw new AssemblyException( "Layer must have name set" );
-            }
-            ActivatorsModel<Layer> layerActivators = new ActivatorsModel<>( layerAssembly.activators() );
-            LayerModel layerModel = new LayerModel( name, layerAssembly.metaInfo(), usedLayersModel, layerActivators, moduleModels );
-
-            for( ModuleAssemblyImpl moduleAssembly : layerAssembly.moduleAssemblies() )
-            {
-                moduleModels.add( moduleAssembly.assembleModule( layerModel, helper ) );
-            }
-            mapAssemblyModel.put( layerAssembly, layerModel );
-            layerModels.add( layerModel );
-        }
-
-        // Populate used layer lists
-        for( LayerAssemblyImpl layerAssembly : layerAssemblies )
-        {
-            Set<LayerAssembly> usesLayers = layerAssembly.uses();
-            List<LayerModel> usedLayers = mapUsedLayers.get( layerAssembly );
-            for( LayerAssembly usesLayer : usesLayers )
-            {
-                LayerModel layerModel = mapAssemblyModel.get( usesLayer );
-                usedLayers.add( layerModel );
-            }
-        }
-
-        // Bind model
-        // This will resolve all dependencies
-        try
-        {
-//            applicationModel.bind();
-            applicationModel.accept( new BindingVisitor( applicationModel ) );
-        }
-        catch( BindingException e )
-        {
-            throw new AssemblyException( "Unable to bind: " + applicationModel, e );
-        }
-
-        return applicationModel;
-    }
-
-    private AssemblyHelper createAssemblyHelper( ApplicationAssembly assembly )
-    {
-        if( assembly instanceof ApplicationAssemblyImpl )
-        {
-            ApplicationAssemblyImpl impl = (ApplicationAssemblyImpl) assembly;
-            AssemblyHelper helper = impl.metaInfo().get( AssemblyHelper.class );
-            if( helper != null )
-            {
-                return helper;
-            }
-        }
-        return new AssemblyHelper();
-    }
-
-    private static class BindingVisitor
-        implements HierarchicalVisitor<Object, Object, BindingException>
-    {
-        private LayerModel layer;
-        private ModuleModel module;
-        private ModelDescriptor objectDescriptor;
-        private CompositeMethodModel compositeMethodModel;
-
-        private Resolution resolution;
-        private final ApplicationModel applicationModel;
-
-        private BindingVisitor( ApplicationModel applicationModel )
-        {
-            this.applicationModel = applicationModel;
-        }
-
-        @Override
-        public boolean visitEnter( Object visited )
-            throws BindingException
-        {
-            if( visited instanceof Binder )
-            {
-                Binder binder = (Binder) visited;
-                binder.bind( resolution );
-
-                return false;
-            }
-            else if( visited instanceof CompositeMethodModel )
-            {
-                compositeMethodModel = (CompositeMethodModel) visited;
-                resolution = new Resolution( applicationModel, layer, module, objectDescriptor, compositeMethodModel, null );
-            }
-            else if( visited instanceof ModelDescriptor )
-            {
-                objectDescriptor = (ModelDescriptor) visited;
-                resolution = new Resolution( applicationModel, layer, module, objectDescriptor, null, null );
-            }
-            else if( visited instanceof InjectedFieldModel )
-            {
-                InjectedFieldModel fieldModel = (InjectedFieldModel) visited;
-                fieldModel.bind( new Resolution( applicationModel, layer, module,
-                                                 objectDescriptor, compositeMethodModel, fieldModel.field() ) );
-            }
-            else if( visited instanceof ModuleModel )
-            {
-                module = (ModuleModel) visited;
-            }
-            else if( visited instanceof LayerModel )
-            {
-                layer = (LayerModel) visited;
-            }
-
-            return true;
-        }
-
-        @Override
-        public boolean visitLeave( Object visited )
-            throws BindingException
-        {
-            return true;
-        }
-
-        @Override
-        public boolean visit( Object visited )
-            throws BindingException
-        {
-            if( visited instanceof Binder )
-            {
-                ( (Binder) visited ).bind( resolution );
-            }
-            return true;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AssemblyHelper.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AssemblyHelper.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AssemblyHelper.java
deleted file mode 100644
index e181c8b..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/AssemblyHelper.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.common.ConstructionException;
-import org.apache.zest.api.constraint.Constraint;
-import org.apache.zest.runtime.composite.ConcernModel;
-import org.apache.zest.runtime.composite.ConstraintDeclaration;
-import org.apache.zest.runtime.composite.FragmentClassLoader;
-import org.apache.zest.runtime.composite.MixinModel;
-import org.apache.zest.runtime.composite.SideEffectModel;
-
-/**
- * This helper is used when building the application model. It keeps track
- * of already created classloaders and various models
- */
-@SuppressWarnings("WeakerAccess")
-public class AssemblyHelper
-{
-    private Map<Class, Class> instantiationClasses = new HashMap<>();
-    private Map<Class, ConstraintDeclaration> constraintDeclarations = new HashMap<>();
-    private Map<ClassLoader, FragmentClassLoader> modifierClassLoaders = new HashMap<>();
-    private Map<Class<?>, AppliesToFilter> appliesToInstances = new HashMap<>();
-
-    protected MixinModel getMixinModel(Class mixinClass)
-    {
-        return new MixinModel( mixinClass, instantiationClass( mixinClass ) );
-    }
-
-    protected ConcernModel getConcernModel(Class concernClass)
-    {
-        return new ConcernModel( concernClass, instantiationClass( concernClass ) );
-    }
-
-    protected SideEffectModel getSideEffectModel(Class sideEffectClass)
-    {
-        return new SideEffectModel( sideEffectClass, instantiationClass( sideEffectClass ) );
-    }
-
-    protected Class instantiationClass(Class fragmentClass)
-    {
-        Class instantiationClass = fragmentClass;
-        if( !InvocationHandler.class.isAssignableFrom( fragmentClass ) )
-        {
-            instantiationClass = instantiationClasses.get( fragmentClass );
-
-            if( instantiationClass == null )
-            {
-                try
-                {
-                    FragmentClassLoader fragmentLoader = getModifierClassLoader( fragmentClass.getClassLoader() );
-                    instantiationClass = fragmentLoader.loadFragmentClass( fragmentClass );
-                    instantiationClasses.put( fragmentClass, instantiationClass );
-                }
-                catch( ClassNotFoundException | VerifyError e )
-                {
-                    throw new ConstructionException( "Could not generate mixin subclass " + fragmentClass.getName(), e );
-                }
-            }
-        }
-        return instantiationClass;
-    }
-
-    protected FragmentClassLoader getModifierClassLoader( ClassLoader classLoader )
-    {
-        FragmentClassLoader cl = modifierClassLoaders.get( classLoader );
-        if( cl == null )
-        {
-            cl = instantiateFragmentClassLoader( classLoader );
-            modifierClassLoaders.put( classLoader, cl );
-        }
-        return cl;
-    }
-
-    protected FragmentClassLoader instantiateFragmentClassLoader( ClassLoader classLoader )
-    {
-        return new FragmentClassLoader( classLoader );
-    }
-
-    public boolean appliesTo( Class<?> fragmentClass, Method method, Iterable<Class<?>> types, Class<?> mixinClass )
-    {
-        AppliesToFilter appliesToFilter = appliesToInstances.get( fragmentClass );
-        if( appliesToFilter == null )
-        {
-            appliesToFilter = createAppliesToFilter( fragmentClass );
-            appliesToInstances.put( fragmentClass, appliesToFilter );
-        }
-        for( Class<?> compositeType : types )
-        {
-            if( appliesToFilter.appliesTo( method, mixinClass, compositeType, fragmentClass ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    protected AppliesToFilter createAppliesToFilter( Class<?> fragmentClass )
-    {
-        AppliesToFilter result = null;
-        if( !InvocationHandler.class.isAssignableFrom( fragmentClass ) )
-        {
-            result = new TypedFragmentAppliesToFilter();
-            if( Modifier.isAbstract( fragmentClass.getModifiers() ) )
-            {
-                result = new AndAppliesToFilter( result, new ImplementsMethodAppliesToFilter() );
-            }
-        }
-        result = applyAppliesTo( result, fragmentClass );
-        if( result == null )
-        {
-            return AppliesToFilter.ALWAYS;
-        }
-        return result;
-    }
-
-    protected AppliesToFilter applyAppliesTo( AppliesToFilter existing, Class<?> modifierClass )
-    {
-        AppliesTo appliesTo = modifierClass.getAnnotation( AppliesTo.class );
-        if( appliesTo != null )
-        {
-            // Use "or" for all filters specified in the annotation
-            AppliesToFilter appliesToAnnotation = null;
-            for( Class<?> appliesToClass : appliesTo.value() )
-            {
-                AppliesToFilter filter;
-                if( AppliesToFilter.class.isAssignableFrom( appliesToClass ) )
-                {
-                    try
-                    {
-                        @SuppressWarnings("unchecked")
-                        Constructor<AppliesToFilter> cons = (Constructor<AppliesToFilter>) appliesToClass.getDeclaredConstructor();
-                        cons.setAccessible(true);
-                        filter = cons.newInstance();
-                    }
-                    catch( Exception e )
-                    {
-                        throw new ConstructionException( e );
-                    }
-                }
-                else if( Annotation.class.isAssignableFrom( appliesToClass ) )
-                {
-                    filter = new AnnotationAppliesToFilter( appliesToClass );
-                }
-                else // Type check
-                {
-                    filter = new TypeCheckAppliesToFilter( appliesToClass );
-                }
-
-                if( appliesToAnnotation == null )
-                {
-                    appliesToAnnotation = filter;
-                }
-                else
-                {
-                    appliesToAnnotation = new OrAppliesToFilter( appliesToAnnotation, filter );
-                }
-            }
-            // Add to the rest of the rules using "and"
-            if( existing == null )
-            {
-                return appliesToAnnotation;
-            }
-            else
-            {
-                return new AndAppliesToFilter( existing, appliesToAnnotation );
-            }
-        }
-        return existing;
-    }
-
-    public boolean appliesTo( Class<? extends Constraint<?, ?>> constraint,
-                              Class<? extends Annotation> annotationType,
-                              Type valueType
-    )
-    {
-        ConstraintDeclaration constraintDeclaration = constraintDeclarations.get( constraint );
-        if( constraintDeclaration == null )
-        {
-            constraintDeclaration = new ConstraintDeclaration( constraint );
-            constraintDeclarations.put( constraint, constraintDeclaration );
-        }
-
-        return constraintDeclaration.appliesTo( annotationType, valueType );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
deleted file mode 100644
index c9ee5b3..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/CompositeAssemblyImpl.java
+++ /dev/null
@@ -1,909 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.association.GenericAssociationInfo;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.composite.InvalidCompositeException;
-import org.apache.zest.api.concern.Concerns;
-import org.apache.zest.api.constraint.Constraint;
-import org.apache.zest.api.constraint.ConstraintDeclaration;
-import org.apache.zest.api.constraint.Constraints;
-import org.apache.zest.api.constraint.Name;
-import org.apache.zest.api.entity.Lifecycle;
-import org.apache.zest.api.injection.scope.State;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Initializable;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.GenericPropertyInfo;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.sideeffect.SideEffects;
-import org.apache.zest.api.type.HasTypes;
-import org.apache.zest.api.util.Annotations;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.util.Fields;
-import org.apache.zest.api.util.HierarchicalVisitorAdapter;
-import org.apache.zest.bootstrap.StateDeclarations;
-import org.apache.zest.runtime.association.AssociationModel;
-import org.apache.zest.runtime.association.AssociationsModel;
-import org.apache.zest.runtime.association.ManyAssociationModel;
-import org.apache.zest.runtime.association.ManyAssociationsModel;
-import org.apache.zest.runtime.association.NamedAssociationModel;
-import org.apache.zest.runtime.association.NamedAssociationsModel;
-import org.apache.zest.runtime.composite.AbstractConstraintModel;
-import org.apache.zest.runtime.composite.CompositeConstraintModel;
-import org.apache.zest.runtime.composite.CompositeMethodModel;
-import org.apache.zest.runtime.composite.CompositeMethodsModel;
-import org.apache.zest.runtime.composite.ConcernModel;
-import org.apache.zest.runtime.composite.ConcernsModel;
-import org.apache.zest.runtime.composite.ConstraintModel;
-import org.apache.zest.runtime.composite.ConstraintsModel;
-import org.apache.zest.runtime.composite.Genericpredicate;
-import org.apache.zest.runtime.composite.MixinModel;
-import org.apache.zest.runtime.composite.MixinsModel;
-import org.apache.zest.runtime.composite.SideEffectModel;
-import org.apache.zest.runtime.composite.SideEffectsModel;
-import org.apache.zest.runtime.composite.StateModel;
-import org.apache.zest.runtime.composite.ValueConstraintsInstance;
-import org.apache.zest.runtime.composite.ValueConstraintsModel;
-import org.apache.zest.runtime.injection.Dependencies;
-import org.apache.zest.runtime.injection.DependencyModel;
-import org.apache.zest.runtime.property.PropertiesModel;
-import org.apache.zest.runtime.property.PropertyModel;
-
-import static java.util.stream.Stream.concat;
-import static org.apache.zest.api.util.Annotations.isType;
-import static org.apache.zest.api.util.Annotations.typeHasAnnotation;
-import static org.apache.zest.api.util.Classes.classHierarchy;
-import static org.apache.zest.api.util.Classes.interfacesOf;
-import static org.apache.zest.api.util.Classes.isAssignableFrom;
-import static org.apache.zest.api.util.Classes.typeOf;
-import static org.apache.zest.api.util.Classes.typesOf;
-import static org.apache.zest.api.util.Classes.wrapperClass;
-
-/**
- * Declaration of a Composite.
- */
-public abstract class CompositeAssemblyImpl
-    implements HasTypes
-{
-    protected List<Class<?>> concerns = new ArrayList<>();
-    protected List<Class<?>> sideEffects = new ArrayList<>();
-    protected List<Class<?>> mixins = new ArrayList<>();
-    protected List<Class<?>> types = new ArrayList<>();
-    protected MetaInfo metaInfo = new MetaInfo();
-    protected Visibility visibility = Visibility.module;
-
-    protected boolean immutable;
-    protected PropertiesModel propertiesModel;
-    protected StateModel stateModel;
-    protected MixinsModel mixinsModel;
-    protected CompositeMethodsModel compositeMethodsModel;
-    private AssemblyHelper helper;
-    protected StateDeclarations stateDeclarations;
-
-    protected Set<String> registeredStateNames = new HashSet<>();
-
-    public CompositeAssemblyImpl( Class<?> mainType )
-    {
-        types.add( mainType );
-    }
-
-    @Override
-    public Stream<Class<?>> types()
-    {
-        return types.stream();
-    }
-
-    protected StateModel createStateModel()
-    {
-        return new StateModel( propertiesModel );
-    }
-
-    protected MixinsModel createMixinsModel()
-    {
-        return new MixinsModel();
-    }
-
-    protected void buildComposite( AssemblyHelper helper,
-                                   StateDeclarations stateDeclarations
-    )
-    {
-        this.stateDeclarations = stateDeclarations;
-        this.helper = helper;
-        for( Class<?> compositeType : types )
-        {
-            metaInfo = new MetaInfo( metaInfo ).withAnnotations( compositeType );
-            addAnnotationsMetaInfo( compositeType, metaInfo );
-        }
-
-        immutable = metaInfo.get( Immutable.class ) != null;
-        propertiesModel = new PropertiesModel();
-        stateModel = createStateModel();
-        mixinsModel = createMixinsModel();
-//        compositeMethodsModel = new CompositeMethodsModel();
-        compositeMethodsModel = new CompositeMethodsModel( mixinsModel );
-
-        // Implement composite methods
-        List<Class<?>> constraintClasses = toList( constraintDeclarations( getAllTypes() ) );
-        List<Class<?>> concernClasses = toList( concat( concerns.stream(), concernDeclarations( getAllTypes() ) ) );
-        List<Class<?>> sideEffectClasses = toList( concat( sideEffects.stream(), sideEffectDeclarations( getAllTypes() ) ) );
-        List<Class<?>> mixinClasses = toList( concat( mixins.stream(), mixinDeclarations( getAllTypes() ) ) );
-        //noinspection unchecked
-        implementMixinType( types,
-                            constraintClasses,
-                            concernClasses,
-                            sideEffectClasses,
-                            mixinClasses
-        );
-
-        // Add state from methods and fields
-        //noinspection unchecked
-        addState( constraintClasses );
-    }
-
-    private List<Class<?>> toList( Stream<Class<?>> stream )
-    {
-        return stream.collect( Collectors.toList() );
-    }
-
-    protected void addAnnotationsMetaInfo( Class<?> type, MetaInfo compositeMetaInfo )
-    {
-        Class[] declaredInterfaces = type.getInterfaces();
-        for( int i = declaredInterfaces.length - 1; i >= 0; i-- )
-        {
-            addAnnotationsMetaInfo( declaredInterfaces[ i ], compositeMetaInfo );
-        }
-        compositeMetaInfo.withAnnotations( type );
-    }
-
-    protected void implementMixinType( List<? extends Class<?>> types,
-                                       List<Class<?>> constraintClasses,
-                                       List<Class<?>> concernClasses,
-                                       List<Class<?>> sideEffectClasses,
-                                       List<Class<?>> mixinClasses
-    )
-    {
-        Set<Class<?>> thisDependencies = new HashSet<>();
-        types.forEach( mixinType -> {
-            for( Method method : mixinType.getMethods() )
-            {
-                if( !compositeMethodsModel.isImplemented( method )
-                    && !Proxy.class.equals( method.getDeclaringClass().getSuperclass() )
-                    && !Proxy.class.equals( method.getDeclaringClass() )
-                    && !Modifier.isStatic( method.getModifiers() ) )
-                {
-                    MixinModel mixinModel = implementMethod( method, mixinClasses );
-                    ConcernsModel concernsModel = concernsFor(
-                        method,
-                        mixinModel.mixinClass(),
-                        concat( concernDeclarations( mixinModel.mixinClass() ),
-                                concernClasses.stream() )
-                    );
-                    SideEffectsModel sideEffectsModel = sideEffectsFor(
-                        method,
-                        mixinModel.mixinClass(),
-                        concat( sideEffectDeclarations( mixinModel.mixinClass() ),
-                                sideEffectClasses.stream() )
-                    );
-                    method.setAccessible( true );
-                    ConstraintsModel constraints = constraintsFor(
-                        method,
-                        toList( concat( constraintDeclarations( mixinModel.mixinClass() ),
-                                        constraintClasses.stream() ) )
-                    );
-                    CompositeMethodModel methodComposite = new CompositeMethodModel(
-                        method,
-                        constraints,
-                        concernsModel,
-                        sideEffectsModel,
-                        mixinsModel
-                    );
-
-                    Stream<? extends Dependencies> source = Stream.of( methodComposite, mixinModel );
-                    source.flatMap( Dependencies::dependencies )
-                          .filter( new DependencyModel.ScopeSpecification( This.class ) )
-                          .map( DependencyModel::rawInjectionType )
-                          .forEach( thisDependencies::add );
-
-                    interfacesOf( mixinModel.mixinClass() )
-                        .map( Classes.RAW_CLASS )
-                        .filter( clazz -> Stream.of( Initializable.class, Lifecycle.class, InvocationHandler.class )
-                                                .noneMatch( c -> c.equals( clazz ) ) )
-                        .forEach( thisDependencies::add );
-
-                    compositeMethodsModel.addMethod( methodComposite );
-                }
-            }
-            // Add type to set of mixin types
-            mixinsModel.addMixinType( mixinType );
-        } );
-
-        // Implement all @This dependencies that were found
-        thisDependencies.forEach( thisDependency -> {
-            // Add additional declarations from the @This type
-            Stream<Class<?>> typeConstraintClasses = concat(
-                constraintClasses.stream(),
-                constraintDeclarations( thisDependency ) );
-            Stream<Class<?>> typeConcernClasses = concat(
-                concernClasses.stream(),
-                concernDeclarations( thisDependency ) );
-            Stream<Class<?>> typeSideEffectClasses = concat(
-                sideEffectClasses.stream(),
-                sideEffectDeclarations( thisDependency ) );
-            Stream<Class<?>> typeMixinClasses = concat(
-                mixinClasses.stream(),
-                mixinDeclarations( thisDependency ) );
-            List<? extends Class<?>> singleton = Collections.singletonList( thisDependency );
-            implementMixinType( singleton,
-                                toList( typeConstraintClasses ),
-                                toList( typeConcernClasses ),
-                                toList( typeSideEffectClasses ),
-                                toList( typeMixinClasses )
-            );
-        } );
-    }
-
-    @SuppressWarnings( "raw" )
-    protected MixinModel implementMethod( Method method, List<Class<?>> mixinDeclarations )
-    {
-        MixinModel implementationModel = mixinsModel.mixinFor( method );
-        if( implementationModel != null )
-        {
-            return implementationModel;
-        }
-        Class mixinClass = findTypedImplementation( method, mixinDeclarations.stream() );
-        if( mixinClass != null )
-        {
-            return implementMethodWithClass( method, mixinClass );
-        }
-
-        // Check generic implementations
-        mixinClass = findGenericImplementation( method, mixinDeclarations.stream() );
-        if( mixinClass != null )
-        {
-            return implementMethodWithClass( method, mixinClass );
-        }
-
-        throw new InvalidCompositeException( "No implementation found for method \n    " + method.toGenericString()
-                                             + "\nin\n    " + types );
-    }
-
-    private Class<?> findTypedImplementation( final Method method, Stream<Class<?>> mixins )
-    {
-        // Check if mixinClass implements the method. If so, check if the mixinClass is generic or if the filter passes.
-        // If a mixinClass is both generic AND non-generic at the same time, then the filter applies to the non-generic
-        // side only.
-        Predicate<Class<?>> appliesToSpec = item -> helper.appliesTo( item, method, types, item );
-        return mixins.filter( isAssignableFrom( method.getDeclaringClass() )
-                                  .and( Genericpredicate.INSTANCE.or( appliesToSpec ) ) )
-                     .findFirst().orElse( null );
-    }
-
-    private Class<?> findGenericImplementation( final Method method, Stream<Class<?>> mixins )
-    {
-        // Check if mixinClass is generic and the applies-to filter passes
-        Predicate<Class<?>> appliesToSpec = item -> helper.appliesTo( item, method, types, item );
-        return mixins.filter( Genericpredicate.INSTANCE.and( appliesToSpec ) ).findFirst().orElse( null );
-    }
-
-    private MixinModel implementMethodWithClass( Method method, Class mixinClass )
-    {
-        MixinModel mixinModel = mixinsModel.getMixinModel( mixinClass );
-        if( mixinModel == null )
-        {
-            mixinModel = helper.getMixinModel( mixinClass );
-            mixinsModel.addMixinModel( mixinModel );
-        }
-
-        mixinsModel.addMethodMixin( method, mixinModel );
-
-        return mixinModel;
-    }
-
-    protected void addState( final List<Class<?>> constraintClasses )
-    {
-        // Add method state
-        compositeMethodsModel.accept( new HierarchicalVisitorAdapter<Object, Object, RuntimeException>()
-        {
-            @Override
-            public boolean visitEnter( Object visited )
-                throws RuntimeException
-            {
-                if( visited instanceof CompositeMethodModel )
-                {
-                    CompositeMethodModel methodModel = (CompositeMethodModel) visited;
-                    if( methodModel.method().getParameterTypes().length == 0 )
-                    {
-                        addStateFor( methodModel.method(), constraintClasses );
-                    }
-
-                    return false;
-                }
-
-                return super.visitEnter( visited );
-            }
-        } );
-
-        // Add field state
-        mixinsModel.accept( new HierarchicalVisitorAdapter<Object, Object, RuntimeException>()
-        {
-            @Override
-            public boolean visitEnter( Object visited )
-                throws RuntimeException
-            {
-                if( visited instanceof MixinModel )
-                {
-                    MixinModel model = (MixinModel) visited;
-                    Consumer<Field> addState = field -> addStateFor( field, constraintClasses );
-                    Fields.FIELDS_OF.apply( model.mixinClass() )
-                        .filter( Annotations.hasAnnotation( State.class ) )
-                        .forEach( addState );
-                    return false;
-                }
-                return super.visitEnter( visited );
-            }
-        } );
-    }
-
-    protected void addStateFor( AccessibleObject accessor, List<Class<?>> constraintClasses )
-    {
-        String stateName = QualifiedName.fromAccessor( accessor ).name();
-
-        if( registeredStateNames.contains( stateName ) )
-        {
-            return; // Skip already registered names
-        }
-
-        Class<?> accessorType = Classes.RAW_CLASS.apply( typeOf( accessor ) );
-        if( Property.class.isAssignableFrom( accessorType ) )
-        {
-            propertiesModel.addProperty( newPropertyModel( accessor, constraintClasses ) );
-            registeredStateNames.add( stateName );
-        }
-        else if( Association.class.isAssignableFrom( accessorType ) )
-        {
-            associationsModel().addAssociation( newAssociationModel( accessor, constraintClasses ) );
-            registeredStateNames.add( stateName );
-        }
-        else if( ManyAssociation.class.isAssignableFrom( accessorType ) )
-        {
-            manyAssociationsModel().addManyAssociation( newManyAssociationModel( accessor, constraintClasses ) );
-            registeredStateNames.add( stateName );
-        }
-        else if( NamedAssociation.class.isAssignableFrom( accessorType ) )
-        {
-            namedAssociationsModel().addNamedAssociation( newNamedAssociationModel( accessor, constraintClasses ) );
-            registeredStateNames.add( stateName );
-        }
-    }
-
-    protected AssociationsModel associationsModel()
-    {
-        return null;
-    }
-
-    protected ManyAssociationsModel manyAssociationsModel()
-    {
-        return null;
-    }
-
-    protected NamedAssociationsModel namedAssociationsModel()
-    {
-        return null;
-    }
-
-    protected PropertyModel newPropertyModel( AccessibleObject accessor,
-                                              List<Class<?>> constraintClasses
-    )
-    {
-        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
-        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
-        ValueConstraintsModel valueConstraintsModel = constraintsFor(
-            annotations.stream(),
-            GenericPropertyInfo.propertyTypeOf( accessor ),
-            ( (Member) accessor ).getName(),
-            optional,
-            constraintClasses,
-            accessor );
-        ValueConstraintsInstance valueConstraintsInstance = null;
-        if( valueConstraintsModel.isConstrained() )
-        {
-            valueConstraintsInstance = valueConstraintsModel.newInstance();
-        }
-        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
-        UseDefaults useDefaultsDeclaration = metaInfo.get( UseDefaults.class );
-        Object initialValue = stateDeclarations.initialValueOf( accessor );
-        if( initialValue == null && useDefaultsDeclaration != null )
-        {
-            initialValue = useDefaultsDeclaration.value();
-        }
-        boolean useDefaults = useDefaultsDeclaration != null || stateDeclarations.useDefaults( accessor );
-        boolean immutable = this.immutable || metaInfo.get( Immutable.class ) != null;
-        return new PropertyModel(
-            accessor,
-            immutable,
-            useDefaults,
-            valueConstraintsInstance,
-            metaInfo,
-            initialValue
-        );
-    }
-
-    // Model
-    private ConstraintsModel constraintsFor( Method method,
-                                             List<Class<?>> constraintClasses
-    )
-    {
-        List<ValueConstraintsModel> parameterConstraintModels = Collections.emptyList();
-        Annotation[][] parameterAnnotations = method.getParameterAnnotations();
-        Type[] parameterTypes = method.getGenericParameterTypes();
-        boolean constrained = false;
-        for( int i = 0; i < parameterAnnotations.length; i++ )
-        {
-            Annotation[] parameterAnnotation = parameterAnnotations[ i ];
-
-            Name nameAnnotation = (Name) Stream.of( parameterAnnotation ).filter( isType( Name.class ) )
-                                               .findFirst().orElse( null );
-            String name = nameAnnotation == null ? "param" + ( i + 1 ) : nameAnnotation.value();
-
-            boolean optional = Stream.of( parameterAnnotation ).filter( isType( Optional.class ) )
-                                     .findFirst().isPresent();
-            ValueConstraintsModel parameterConstraintsModel = constraintsFor(
-                Arrays.stream( parameterAnnotation ),
-                parameterTypes[ i ],
-                name,
-                optional,
-                constraintClasses,
-                method );
-            if( parameterConstraintsModel.isConstrained() )
-            {
-                constrained = true;
-            }
-
-            if( parameterConstraintModels.isEmpty() )
-            {
-                parameterConstraintModels = new ArrayList<>();
-            }
-            parameterConstraintModels.add( parameterConstraintsModel );
-        }
-
-        if( !constrained )
-        {
-            return new ConstraintsModel( Collections.<ValueConstraintsModel>emptyList() );
-        }
-        else
-        {
-            return new ConstraintsModel( parameterConstraintModels );
-        }
-    }
-
-    protected ValueConstraintsModel constraintsFor(
-        Stream<Annotation> constraintAnnotations,
-        Type valueType,
-        String name,
-        boolean optional,
-        Iterable<Class<?>> constraintClasses,
-        AccessibleObject accessor
-    )
-    {
-        valueType = wrapperClass( valueType );
-
-        List<AbstractConstraintModel> constraintModels = new ArrayList<>();
-        List<Annotation> filtered = constraintAnnotations
-            .filter( typeHasAnnotation( ConstraintDeclaration.class ) )
-            .collect( Collectors.toList() );
-
-        // TODO: This massive block below should be cleaned up.
-        nextConstraint:
-        for( Annotation constraintAnnotation : filtered )
-        {
-            // Check composite declarations first
-            Class<? extends Annotation> annotationType = constraintAnnotation.annotationType();
-            for( Class<?> constraint : constraintClasses )
-            {
-                Class<? extends Constraint<?, ?>> constraintType = (Class<? extends Constraint<?, ?>>) constraint;
-                if( helper.appliesTo( constraintType, annotationType, valueType ) )
-                {
-                    constraintModels.add( new ConstraintModel( constraintAnnotation, constraintType ) );
-                    continue nextConstraint;
-                }
-            }
-
-            // Check the annotation itself
-            Constraints constraints = annotationType.getAnnotation( Constraints.class );
-            if( constraints != null )
-            {
-                for( Class<? extends Constraint<?, ?>> constraintClass : constraints.value() )
-                {
-                    if( helper.appliesTo( constraintClass, annotationType, valueType ) )
-                    {
-                        constraintModels.add( new ConstraintModel( constraintAnnotation, constraintClass ) );
-                        continue nextConstraint;
-                    }
-                }
-            }
-
-            // No implementation found!
-            // Check if if it's a composite constraints
-            if( Arrays.stream( annotationType.getAnnotations() )
-                .anyMatch( typeHasAnnotation( ConstraintDeclaration.class ) ) )
-            {
-                ValueConstraintsModel valueConstraintsModel = constraintsFor(
-                    Arrays.stream( annotationType.getAnnotations() ),
-                    valueType,
-                    name,
-                    optional,
-                    constraintClasses,
-                    accessor );
-                CompositeConstraintModel compositeConstraintModel = new CompositeConstraintModel(
-                    constraintAnnotation,
-                    valueConstraintsModel );
-                constraintModels.add( compositeConstraintModel );
-            }
-            else
-            {
-                throw new InvalidCompositeException(
-                    "Cannot find implementation of constraint @"
-                    + annotationType.getSimpleName()
-                    + " for "
-                    + valueType
-                    + " in method "
-                    + ( (Member) accessor ).getName()
-                    + " of composite " + types );
-            }
-        }
-        return new ValueConstraintsModel( constraintModels, name, optional );
-    }
-
-    private ConcernsModel concernsFor( Method method,
-                                       Class<?> mixinClass,
-                                       Stream<Class<?>> concernClasses
-    )
-    {
-        List<ConcernModel> concernsFor = new ArrayList<>();
-        concernClasses.forEach( concern -> {
-            if( helper.appliesTo( concern, method, types, mixinClass ) )
-            {
-                addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
-            }
-            else
-            {
-                // Lookup method in mixin
-                if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
-                {
-                    try
-                    {
-                        Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
-                        if( helper.appliesTo( concern, mixinMethod, types, mixinClass ) )
-                        {
-                            addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
-                        }
-                    }
-                    catch( NoSuchMethodException e )
-                    {
-                        // Ignore
-                    }
-                }
-            }
-        } );
-
-        // Check annotations on method that have @Concerns annotations themselves
-        for( Annotation annotation : method.getAnnotations() )
-        {
-            @SuppressWarnings( "raw" )
-            Concerns concerns = annotation.annotationType().getAnnotation( Concerns.class );
-            if( concerns != null )
-            {
-                for( Class<?> concern : concerns.value() )
-                {
-                    if( helper.appliesTo( concern, method, types, mixinClass ) )
-                    {
-                        ConcernModel concernModel = helper.getConcernModel( concern );
-                        addConcernOrRepositionIfExists( concernsFor, concernModel );
-                    }
-                }
-            }
-        }
-
-        if( concernsFor.isEmpty() )
-        {
-            return ConcernsModel.EMPTY_CONCERNS;
-        }
-        else
-        {
-            return new ConcernsModel( concernsFor );
-        }
-    }
-
-    private void addConcernOrRepositionIfExists( List<ConcernModel> concernsFor, ConcernModel concernModel )
-    {
-        // This remove/add is to allow re-ordering of the concerns
-        concernsFor.remove( concernModel );
-        concernsFor.add( concernModel );
-    }
-
-    private SideEffectsModel sideEffectsFor( Method method,
-                                             Class<?> mixinClass,
-                                             Stream<Class<?>> sideEffectClasses
-    )
-    {
-        List<SideEffectModel> sideEffectsFor = new ArrayList<>();
-        sideEffectClasses.forEach( sideEffect -> {
-            SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
-            if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
-            {
-                addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
-            }
-            else
-            {
-                // Lookup method in mixin
-                if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
-                {
-                    try
-                    {
-                        Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
-                        if( helper.appliesTo( sideEffect, mixinMethod, types, mixinClass ) )
-                        {
-                            addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
-                        }
-                    }
-                    catch( NoSuchMethodException e )
-                    {
-                        // Ignore
-                    }
-                }
-            }
-        } );
-
-        // Check annotations on method that have @Concerns annotations themselves
-        for( Annotation annotation : method.getAnnotations() )
-        {
-            @SuppressWarnings( "raw" )
-            SideEffects sideEffects = annotation.annotationType().getAnnotation( SideEffects.class );
-            if( sideEffects != null )
-            {
-                for( Class<?> sideEffect : sideEffects.value() )
-                {
-                    if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
-                    {
-                        SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
-                        addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
-                    }
-                }
-            }
-        }
-
-        if( sideEffectsFor.isEmpty() )
-        {
-            return SideEffectsModel.EMPTY_SIDEEFFECTS;
-        }
-        else
-        {
-            return new SideEffectsModel( sideEffectsFor );
-        }
-    }
-
-    private void addSideEffectOrRepositionIfExists( List<SideEffectModel> sideEffectsFor,
-                                                    SideEffectModel sideEffectModel
-    )
-    {
-        // This add/remove is to allow reording of SideEffects.
-        sideEffectsFor.remove( sideEffectModel );
-        sideEffectsFor.add( sideEffectModel );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    private Stream<Class<?>> constraintDeclarations( Class<?> type )
-    {
-        Stream<? extends Type> types = getTypes( type );
-        return constraintDeclarations( types );
-    }
-
-    private Stream<Class<?>> constraintDeclarations( Stream<? extends Type> types )
-    {
-        return types
-            .filter( mixinType -> Annotations.annotationOn( mixinType, Constraints.class ) != null )
-            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Constraints.class ).value() ) );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    private Stream<Class<?>> concernDeclarations( Class<?> type )
-    {
-        Stream<? extends Type> types = getTypes( type );
-        return concernDeclarations( types );
-    }
-
-    private Stream<Class<?>> concernDeclarations( Stream<? extends Type> types )
-    {
-        return types
-            .filter( mixinType -> Annotations.annotationOn( mixinType, Concerns.class ) != null )
-            .flatMap( new Function<Type, Stream<? extends Class<?>>>()
-            {
-                @Override
-                public Stream<? extends Class<?>> apply( Type mixinType )
-                {
-                    return Arrays.stream( Annotations.annotationOn( mixinType, Concerns.class ).value() );
-                }
-            } );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    protected Stream<Class<?>> sideEffectDeclarations( Class<?> type )
-    {
-        Stream<? extends Type> types = getTypes( type );
-        return sideEffectDeclarations( types );
-    }
-
-    private Stream<Class<?>> sideEffectDeclarations( Stream<? extends Type> types )
-    {
-        return types
-            .filter( mixinType -> Annotations.annotationOn( mixinType, SideEffects.class ) != null )
-            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, SideEffects.class ).value() ) );
-    }
-
-    protected Stream<Class<?>> mixinDeclarations( Class<?> type )
-    {
-        //Stream<? extends Type> types = typesOf( type );
-        return mixinDeclarations( Stream.of( type ) );
-    }
-
-    private Stream<Class<?>> mixinDeclarations( Stream<? extends Class> types )
-    {
-        return types.flatMap( this::getTypes ).flatMap( Classes::typesOf )
-            .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
-            .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
-    }
-
-    private Stream<Class> getAllTypes()
-    {
-        return this.types.stream().flatMap( this::getTypes );
-    }
-
-    private Stream<Class> getTypes( Class<?> clazz )
-    {
-        if( clazz.isInterface() )
-        {
-            return typesOf( clazz ).map( Classes.RAW_CLASS );
-        }
-        else
-        {
-            return classHierarchy( clazz ).map( Classes.RAW_CLASS );
-        }
-    }
-
-    public AssociationModel newAssociationModel( AccessibleObject accessor,
-                                                 List<Class<?>> constraintClasses
-    )
-    {
-        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
-        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
-
-        // Constraints for Association references
-        ValueConstraintsModel constraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
-            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance valueConstraintsInstance;
-        if( constraintsModel.isConstrained() )
-        {
-            valueConstraintsInstance = constraintsModel.newInstance();
-        }
-        else
-        {
-            valueConstraintsInstance = new ValueConstraintsInstance( Collections.emptyList(), ( (Member) accessor ).getName(), true );
-        }
-
-        // Constraints for the Association itself
-        constraintsModel = constraintsFor( annotations.stream(), Association.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance associationValueConstraintsInstance;
-        if( constraintsModel.isConstrained() )
-        {
-            associationValueConstraintsInstance = constraintsModel.newInstance();
-        }
-        else
-        {
-            associationValueConstraintsInstance = new ValueConstraintsInstance( Collections.emptyList(), ( (Member) accessor ).getName(), true );
-        }
-
-        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
-        return new AssociationModel( accessor, valueConstraintsInstance, associationValueConstraintsInstance, metaInfo );
-    }
-
-    public ManyAssociationModel newManyAssociationModel( AccessibleObject accessor,
-                                                         List<Class<?>> constraintClasses
-    )
-    {
-        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
-        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
-
-        // Constraints for entities in ManyAssociation
-        ValueConstraintsModel valueConstraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
-            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance valueConstraintsInstance = null;
-        if( valueConstraintsModel.isConstrained() )
-        {
-            valueConstraintsInstance = valueConstraintsModel.newInstance();
-        }
-
-        // Constraints for the ManyAssociation itself
-        valueConstraintsModel = constraintsFor( annotations.stream(), ManyAssociation.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance manyValueConstraintsInstance = null;
-        if( valueConstraintsModel.isConstrained() )
-        {
-            manyValueConstraintsInstance = valueConstraintsModel.newInstance();
-        }
-        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
-        return new ManyAssociationModel( accessor, valueConstraintsInstance, manyValueConstraintsInstance, metaInfo );
-    }
-
-    public NamedAssociationModel newNamedAssociationModel( AccessibleObject accessor,
-                                                           List<Class<?>> constraintClasses
-    )
-    {
-        List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
-        boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
-
-        // Constraints for entities in NamedAssociation
-        ValueConstraintsModel valueConstraintsModel = constraintsFor( annotations.stream(), GenericAssociationInfo
-            .associationTypeOf( accessor ), ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance valueConstraintsInstance = null;
-        if( valueConstraintsModel.isConstrained() )
-        {
-            valueConstraintsInstance = valueConstraintsModel.newInstance();
-        }
-
-        // Constraints for the NamedAssociation itself
-        valueConstraintsModel = constraintsFor( annotations.stream(), NamedAssociation.class, ( (Member) accessor ).getName(), optional, constraintClasses, accessor );
-        ValueConstraintsInstance namedValueConstraintsInstance = null;
-        if( valueConstraintsModel.isConstrained() )
-        {
-            namedValueConstraintsInstance = valueConstraintsModel.newInstance();
-        }
-        MetaInfo metaInfo = stateDeclarations.metaInfoFor( accessor );
-        return new NamedAssociationModel( accessor, valueConstraintsInstance, namedValueConstraintsInstance, metaInfo );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationAssemblyImpl.java
deleted file mode 100644
index 4fc466a..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationAssemblyImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import java.util.stream.Stream;
-import org.apache.zest.bootstrap.ConfigurationAssembly;
-
-/**
- * Declaration of a EntityComposite.
- */
-public final class ConfigurationAssemblyImpl
-    implements ConfigurationAssembly
-{
-    private ValueAssemblyImpl value;
-    private EntityAssemblyImpl entity;
-
-    public ConfigurationAssemblyImpl( Class<?> mainType )
-    {
-        value = new ValueAssemblyImpl( mainType );
-        entity = new EntityAssemblyImpl( mainType );
-    }
-
-    @Override
-    public Stream<Class<?>> types()
-    {
-        return value.types();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationDeclarationImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationDeclarationImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationDeclarationImpl.java
deleted file mode 100644
index 761f820..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/ConfigurationDeclarationImpl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.bootstrap.ConfigurationDeclaration;
-
-import static java.util.Arrays.asList;
-
-/**
- * Declaration of a Composite. Created by {@link org.apache.zest.bootstrap.ModuleAssembly#configurations(Class[])}.
- */
-public final class ConfigurationDeclarationImpl
-    implements ConfigurationDeclaration
-{
-    private final Iterable<EntityAssemblyImpl> entities;
-    private final Iterable<ValueAssemblyImpl> values;
-
-    public ConfigurationDeclarationImpl( Iterable<EntityAssemblyImpl> entities, Iterable<ValueAssemblyImpl> values  )
-    {
-        this.entities = entities;
-        this.values = values;
-    }
-
-    @Override
-    public ConfigurationDeclaration setMetaInfo( Object info )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.metaInfo.set( info );
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.metaInfo.set( info );
-        }
-        return this;
-    }
-
-    @Override
-    public ConfigurationDeclaration visibleIn( Visibility visibility )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.visibility = visibility;
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.visibility = visibility;
-        }
-        return this;
-    }
-
-    @Override
-    public ConfigurationDeclaration withConcerns( Class<?>... concerns )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.concerns.addAll( asList( concerns ) );
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.concerns.addAll( asList( concerns ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ConfigurationDeclaration withSideEffects( Class<?>... sideEffects )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.sideEffects.addAll( asList( sideEffects ) );
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.sideEffects.addAll( asList( sideEffects ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ConfigurationDeclaration withMixins( Class<?>... mixins )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.mixins.addAll( asList( mixins ) );
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.mixins.addAll( asList( mixins ) );
-        }
-        return this;
-    }
-
-    @Override
-    public ConfigurationDeclaration withTypes( Class<?>... types )
-    {
-        for( EntityAssemblyImpl entity : entities )
-        {
-            entity.types.addAll( asList( types ) );
-        }
-        for( ValueAssemblyImpl value : values )
-        {
-            value.types.addAll( asList( types ) );
-        }
-        return this;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityAssemblyImpl.java b/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityAssemblyImpl.java
deleted file mode 100644
index 4a775f9..0000000
--- a/core/runtime/src/main/java/org/apache/zest/runtime/bootstrap/EntityAssemblyImpl.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.runtime.bootstrap;
-
-import org.apache.zest.api.common.InvalidApplicationException;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.bootstrap.AssociationDeclarations;
-import org.apache.zest.bootstrap.EntityAssembly;
-import org.apache.zest.bootstrap.ManyAssociationDeclarations;
-import org.apache.zest.bootstrap.NamedAssociationDeclarations;
-import org.apache.zest.bootstrap.StateDeclarations;
-import org.apache.zest.runtime.association.AssociationsModel;
-import org.apache.zest.runtime.association.ManyAssociationsModel;
-import org.apache.zest.runtime.association.NamedAssociationsModel;
-import org.apache.zest.runtime.composite.MixinsModel;
-import org.apache.zest.runtime.composite.StateModel;
-import org.apache.zest.runtime.entity.EntityMixinsModel;
-import org.apache.zest.runtime.entity.EntityModel;
-import org.apache.zest.runtime.entity.EntityStateModel;
-
-/**
- * Declaration of a EntityComposite.
- */
-public final class EntityAssemblyImpl
-    extends CompositeAssemblyImpl
-    implements EntityAssembly
-{
-    private AssociationDeclarations associationDeclarations;
-    private ManyAssociationDeclarations manyAssociationDeclarations;
-    private NamedAssociationDeclarations namedAssociationDeclarations;
-    private AssociationsModel associationsModel;
-    private ManyAssociationsModel manyAssociationsModel;
-    private NamedAssociationsModel namedAssociationsModel;
-
-    public EntityAssemblyImpl( Class<?> entityType )
-    {
-        super( entityType );
-        // The composite must always implement EntityComposite, as a marker interface
-        if( !EntityComposite.class.isAssignableFrom( entityType ) )
-        {
-            types.add( EntityComposite.class );
-        }
-    }
-
-    @Override
-    protected MixinsModel createMixinsModel()
-    {
-        return new EntityMixinsModel();
-    }
-
-    @Override
-    protected AssociationsModel associationsModel()
-    {
-        return associationsModel;
-    }
-
-    @Override
-    protected ManyAssociationsModel manyAssociationsModel()
-    {
-        return manyAssociationsModel;
-    }
-
-    @Override
-    protected NamedAssociationsModel namedAssociationsModel()
-    {
-        return namedAssociationsModel;
-    }
-
-    @Override
-    protected StateModel createStateModel()
-    {
-        return new EntityStateModel( propertiesModel, associationsModel, manyAssociationsModel, namedAssociationsModel );
-    }
-
-    EntityModel newEntityModel(
-        ModuleDescriptor module,
-        StateDeclarations stateDeclarations,
-        AssociationDeclarations associationDecs,
-        ManyAssociationDeclarations manyAssociationDecs,
-        NamedAssociationDeclarations namedAssociationDecs,
-        AssemblyHelper helper
-    )
-    {
-        this.associationDeclarations = associationDecs;
-        this.manyAssociationDeclarations = manyAssociationDecs;
-        this.namedAssociationDeclarations = namedAssociationDecs;
-        try
-        {
-            associationsModel = new AssociationsModel();
-            manyAssociationsModel = new ManyAssociationsModel();
-            namedAssociationsModel = new NamedAssociationsModel();
-            buildComposite( helper, stateDeclarations );
-
-            return new EntityModel( module, types, visibility, metaInfo,
-                                    (EntityMixinsModel) mixinsModel,
-                                    (EntityStateModel) stateModel, compositeMethodsModel );
-        }
-        catch( Exception e )
-        {
-            throw new InvalidApplicationException( "Could not register " + types, e );
-        }
-    }
-}


[25/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java b/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
new file mode 100644
index 0000000..67abae9
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
@@ -0,0 +1,277 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.type.CollectionType;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.Test;
+
+import static java.util.stream.Collectors.toList;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+/**
+ * Snippets:
+ * - default : default ValueSerialization
+ * - service : assembled service ValueSerialization
+ * - lookup  : ValueSerialization values module finder
+ */
+public class DocumentationSupport
+    extends AbstractPolygeneTest
+{
+
+    // START SNIPPET: default
+    // START SNIPPET: service
+    public interface SomeValue // (1)
+    {
+
+        Property<String> foo();
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.values( SomeValue.class ); // (2)
+        // END SNIPPET: default
+        new OrgJsonValueSerializationAssembler().assemble( module ); // (3)
+        new DefaultUnitOfWorkAssembler().assemble( module );
+        // START SNIPPET: default
+    }
+    // END SNIPPET: default
+    // END SNIPPET: service
+
+    @Test
+    // START SNIPPET: default
+    public void defaultValueSerialization()
+    {
+        SomeValue someValue = someNewValueInstance(); // (3)
+        String json = someValue.toString(); // (4)
+        SomeValue someNewValue = valueBuilderFactory.newValueFromSerializedState( SomeValue.class, json ); // (5)
+        // END SNIPPET: default
+
+        assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
+        assertThat( someNewValue, equalTo( someValue ) );
+
+        // START SNIPPET: default
+    }
+
+    // END SNIPPET: default
+    // START SNIPPET: service
+    @Service
+    private ValueSerializer valueSerializer; // (4)
+    @Service
+    private ValueDeserializer valueDeserializer; // (4)
+
+    // END SNIPPET: service
+    @Test
+    // START SNIPPET: service
+    public void assembledDefaultServiceSerialization()
+    {
+        SomeValue someValue = someNewValueInstance(); // (5)
+        String json = valueSerializer.serialize( someValue ); // (6)
+        SomeValue someNewValue = valueDeserializer.deserialize( module, SomeValue.class, json ); // (7)
+        // END SNIPPET: service
+
+        assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
+        assertThat( someNewValue, equalTo( someValue ) );
+
+        // START SNIPPET: service
+    }
+    // END SNIPPET: service
+
+    static enum AcmeValue
+    {
+
+        foo, bar
+    }
+
+    @Test
+    // START SNIPPET: stream
+    public void assembledServiceStreamingSerialization()
+    {
+        // END SNIPPET: stream
+
+        List<AcmeValue> dataSource = Arrays.asList( AcmeValue.values() );
+        ByteArrayOutputStream targetStream = new ByteArrayOutputStream();
+
+        // START SNIPPET: stream
+        // (1)
+        Iterable<AcmeValue> data = dataSource; // Eg. Entities converted to Values
+        OutputStream output = targetStream; // Eg. streaming JSON over HTTP
+
+        // (2)
+        valueSerializer.serialize( data, output );
+        // END SNIPPET: stream
+
+        byte[] serialized = targetStream.toByteArray();
+        ByteArrayInputStream sourceStream = new ByteArrayInputStream( serialized );
+
+        // START SNIPPET: stream
+        // (3)
+        InputStream input = sourceStream; // Eg. reading incoming JSON
+
+        // (4)
+        List<AcmeValue> values = valueDeserializer.deserialize( module, CollectionType.listOf( AcmeValue.class ), input );
+        // END SNIPPET: stream
+
+        assertThat( values, equalTo( dataSource ) );
+
+        // START SNIPPET: stream
+    }
+    // END SNIPPET: stream
+
+    @Test
+    // START SNIPPET: io
+    public void assembledServiceIOSerialization()
+        throws IOException
+    {
+        // END SNIPPET: io
+
+        List<AcmeValue> dataSource = Arrays.asList( AcmeValue.values() );
+        StringWriter stringOutput = new StringWriter();
+        PrintWriter output = new PrintWriter( stringOutput );
+
+
+        // START SNIPPET: io
+        // (1)
+        // Eg. Entities converted to Values
+        Stream<AcmeValue> queryResult = dataSource.stream();
+
+        // (2)
+        Function<AcmeValue, String> serialize = valueSerializer.serialize();
+
+        // (3)
+        // Eg. pipe data to another process or to a file
+        queryResult.map( serialize ).forEach( output::println );
+        // END SNIPPET: io
+
+        output.flush();
+        String string = stringOutput.toString();
+        List<String> input = Arrays.asList( string.split( System.lineSeparator() ) );
+
+        // START SNIPPET: io
+        // (4)
+        Stream<String> lines = input.stream();
+
+        // (5)
+        Function<String, AcmeValue> deserialize = valueDeserializer.deserialize( module, AcmeValue.class );
+
+        // Deserialization of a collection of AcmeValue from a String.
+        // One serialized AcmeValue per line.
+        // (6)
+        List<AcmeValue> values = lines.map( deserialize ).collect( toList() );
+        // END SNIPPET: io
+
+        assertThat( dataSource, equalTo( values ) );
+
+        // START SNIPPET: io
+    }
+    // END SNIPPET: io
+
+    @Test
+    // TODO Move to SPI !
+    // TODO Include in each ValueSerialization extensions documentation
+    public void assembledWithValuesModuleSerialization()
+        throws Exception
+    {
+        Application app = new Energy4Java().newApplication( applicationFactory -> {
+            Assembler[][][] pancakes = new Assembler[][][]
+                {
+                    {
+                        {
+                            valuesModule -> {
+                                valuesModule.layer().setName( "SINGLE-Layer" );
+                                valuesModule.setName( "VALUES-Module" );
+
+                                valuesModule.values( SomeValue.class );
+                                new DefaultUnitOfWorkAssembler().assemble( valuesModule );
+                            }
+                        },
+                        {
+                            servicesModule -> {
+                                servicesModule.setName( "SERVICES-Module" );
+
+                                Function<Application, Module> valuesModuleFinder = new Function<Application, Module>()
+                                {
+                                    @Override
+                                    public Module apply( Application app1 )
+                                    {
+                                        return app1.findModule( "SINGLE-Layer", "VALUES-Module" );
+                                    }
+                                };
+                                new OrgJsonValueSerializationAssembler().
+                                    withValuesModuleFinder( valuesModuleFinder ).
+                                    assemble( servicesModule );
+                            }
+                        }
+                    }
+                };
+            return applicationFactory.newApplicationAssembly( pancakes );
+        } );
+        app.activate();
+        try
+        {
+            Module valuesModule = app.findModule( "SINGLE-Layer", "VALUES-Module" );
+            SomeValue someValue = someNewValueInstance();
+
+            Module servicesModule = app.findModule( "SINGLE-Layer", "SERVICES-Module" );
+            ValueSerialization valueSerialization = servicesModule.findService( ValueSerialization.class ).get();
+
+            String json = valueSerialization.serialize( someValue );
+            assertThat( json, equalTo( "{\"foo\":\"bar\"}" ) );
+
+            SomeValue someNewValue = valueSerialization.deserialize( module, SomeValue.class, json );
+            assertThat( someNewValue, equalTo( someValue ) );
+        }
+        finally
+        {
+            app.passivate();
+        }
+    }
+
+    private SomeValue someNewValueInstance(  )
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        builder.prototype().foo().set( "bar" );
+        return builder.newInstance();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/value/ValueBuilderTemplateTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/value/ValueBuilderTemplateTest.java b/core/api/src/test/java/org/apache/polygene/api/value/ValueBuilderTemplateTest.java
new file mode 100644
index 0000000..f52d103
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/value/ValueBuilderTemplateTest.java
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import org.junit.Test;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+
+/**
+ * TODO
+ */
+public class ValueBuilderTemplateTest
+    extends AbstractPolygeneTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.values( TestValue.class );
+    }
+
+    @Test
+    public void testTemplate()
+    {
+        new TestBuilder( "Rickard" ).newInstance( module );
+    }
+
+    @Test
+    public void testAnonymousTemplate()
+    {
+        new ValueBuilderTemplate<TestValue>( TestValue.class )
+        {
+            @Override
+            protected void build( TestValue prototype )
+            {
+                prototype.name().set( "Rickard" );
+            }
+        }.newInstance( module );
+    }
+
+    interface TestValue
+        extends ValueComposite
+    {
+        Property<String> name();
+    }
+
+    class TestBuilder
+        extends ValueBuilderTemplate<TestValue>
+    {
+        String name;
+
+        TestBuilder( String name )
+        {
+            super( TestValue.class );
+            this.name = name;
+        }
+
+        @Override
+        protected void build( TestValue prototype )
+        {
+            prototype.name().set( name );
+        }
+    }
+
+    ;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/polygene/api/value/ValueCompositeTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/value/ValueCompositeTest.java b/core/api/src/test/java/org/apache/polygene/api/value/ValueCompositeTest.java
new file mode 100644
index 0000000..ffe500c
--- /dev/null
+++ b/core/api/src/test/java/org/apache/polygene/api/value/ValueCompositeTest.java
@@ -0,0 +1,314 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.value;
+
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.common.UseDefaults;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.library.constraints.annotation.MaxLength;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.apache.polygene.test.EntityTestAssembler;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+/**
+ * Tests for ValueComposites
+ */
+public class ValueCompositeTest
+    extends AbstractPolygeneTest
+{
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        module.values( SomeValue.class, AnotherValue.class, AssociationValue.class );
+        module.entities( SomeEntity.class );
+        new EntityTestAssembler().assemble( module );
+    }
+
+    @Test( expected = IllegalStateException.class )
+    public void testImmutabilityOfValueComposite()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue some = builder.prototype();
+        some.other().set( "test" );
+        some = builder.newInstance();
+        some.other().set( "test2" );
+    }
+
+    @Test
+    public void testCreationOfValueComposite()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue some = builder.prototype();
+        some.other().set( "test" );
+        builder.newInstance();
+
+        // Check that @UseDefaults works for ValueComposites
+        assertEquals( "{\"val1\":\"\"}", some.another().get().toString() );
+    }
+
+    @Test
+    public void testEqualityOfValueComposite()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue prototype = builder.prototype();
+        prototype.other().set( "test" );
+        SomeValue instance = builder.newInstance();
+        SomeValue other = builder.newInstance();
+        Assert.assertFalse( "Instances should not be the same.", instance == other );
+        Assert.assertEquals( "Equal values.", instance, other );
+    }
+
+    @Test
+    public void testHashcodeOfValueComposite()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue prototype = builder.prototype();
+        prototype.other().set( "test" );
+        SomeValue instance = builder.newInstance();
+        SomeValue other = builder.newInstance();
+        Assert.assertFalse( "Instances should not be the same.", instance == other );
+        Assert.assertEquals( "Equal values.", instance.hashCode(), other.hashCode() );
+    }
+
+    @Test
+    public void testModifyValue()
+    {
+        ValueBuilder<AnotherValue> anotherBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
+        anotherBuilder.prototype().val1().set( "Val1" );
+        AnotherValue anotherValue = anotherBuilder.newInstance();
+
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue prototype = builder.prototype();
+        prototype.some().set( "foo" );
+        prototype.other().set( "test" );
+        prototype.xyzzyList().get().add( "blah" );
+        prototype.another().set( anotherValue );
+        SomeValue instance = builder.newInstance();
+
+        assertThat( "List has value blah", instance.xyzzyList().get().get( 0 ), equalTo( "blah" ) );
+
+        // Modify value
+        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
+        builder.prototype().some().set( "bar" );
+        instance = builder.newInstance();
+
+        assertThat( "Other is set to test", instance.other().get(), equalTo( "test" ) );
+        assertThat( "List has value blah", instance.xyzzyList().get().get( 0 ), equalTo( "blah" ) );
+        assertThat( "AnotherValue.val1 has value Val1", instance.another().get().val1().get(), equalTo( "Val1" ) );
+
+        // Modify value again using method 2
+        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
+        builder.prototype().other().set( "test2" );
+        instance = builder.newInstance();
+
+        assertThat( "Other is set to test2", instance.other().get(), equalTo( "test2" ) );
+        assertThat( "Some is set to bar", instance.some().get(), equalTo( "bar" ) );
+    }
+
+    @Test( expected = ConstraintViolationException.class )
+    public void givenValueWhenModifyToIncorrectValueThenThrowConstraintException()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        SomeValue prototype = builder.prototype();
+        prototype.some().set( "foo" );
+        SomeValue instance = builder.newInstance();
+
+        builder = valueBuilderFactory.newValueBuilderWithPrototype( instance );
+        builder.prototype().some().set( "123456" );
+    }
+
+    @Test
+    public void givenValueWithListOfValueWhenPrototypeThenListedValuesAreEditable()
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
+        SomeValue some = builder.newInstance();
+
+        builder = valueBuilderFactory.newValueBuilderWithPrototype( some );
+        builder.prototype().anotherList().get().get( 0 ).val1().set( "Foo" );
+        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
+        some = builder.newInstance();
+
+        assertThat( "Val1 has been set", some.anotherList().get().get( 0 ).val1().get(), equalTo( "Foo" ) );
+
+        try
+        {
+            some.anotherList().get().get( 0 ).val1().set( "Bar" );
+            Assert.fail( "Should not be allowed to modify value" );
+        }
+        catch( IllegalStateException e )
+        {
+            // Ok
+        }
+    }
+
+    @Test
+    public void givenEntityWhenUpdateValueThenValueIsSet()
+        throws UnitOfWorkCompletionException
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
+        ValueBuilder<AnotherValue> valueBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
+        valueBuilder.prototype().val1().set( "Foo" );
+        builder.prototype().another().set( valueBuilder.newInstance() );
+        builder.prototype().number().set( 42L );
+        SomeValue some = builder.newInstance();
+
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        try
+        {
+            EntityBuilder<SomeEntity> entityBuilder = unitOfWork.newEntityBuilder( SomeEntity.class );
+            entityBuilder.instance().someValue().set( some );
+            SomeEntity entity = entityBuilder.newInstance();
+
+            assertThat( "Value has been set", entity.someValue().get().another().get().val1().get(), equalTo( "Foo" ) );
+
+            unitOfWork.complete();
+        }
+        finally
+        {
+            unitOfWork.discard();
+        }
+    }
+
+    @Test
+    public void givenValueWithAssociationsWhenNewUoWThenCanRead()
+        throws UnitOfWorkCompletionException
+    {
+        ValueBuilder<SomeValue> builder = valueBuilderFactory.newValueBuilder( SomeValue.class );
+        builder.prototype().anotherList().get().add( valueBuilderFactory.newValue( AnotherValue.class ) );
+        ValueBuilder<AnotherValue> valueBuilder = valueBuilderFactory.newValueBuilder( AnotherValue.class );
+        valueBuilder.prototype().val1().set( "Foo" );
+        builder.prototype().another().set( valueBuilder.newInstance() );
+        builder.prototype().number().set( 42L );
+        SomeValue some = builder.newInstance();
+
+        UnitOfWork unitOfWork = unitOfWorkFactory.newUnitOfWork();
+        AssociationValue associationValue;
+        try
+        {
+            EntityBuilder<SomeEntity> entityBuilder = unitOfWork.newEntityBuilder( SomeEntity.class );
+            entityBuilder.instance().someValue().set( some );
+            SomeEntity entity = entityBuilder.newInstance();
+
+            ValueBuilder<AssociationValue> associationBuilder = valueBuilderFactory.newValueBuilder( AssociationValue.class );
+            associationBuilder.prototype().some().set( entity );
+            associationValue = associationBuilder.newInstance();
+
+            String json = associationValue.toString();
+
+            unitOfWork.complete();
+
+            unitOfWork = unitOfWorkFactory.newUnitOfWork();
+
+            AssociationValue newAssociationValue = valueBuilderFactory.newValueFromSerializedState( AssociationValue.class, json );
+
+            Assert.assertEquals( associationValue.some().get(), newAssociationValue.some().get() );
+        }
+        finally
+        {
+            unitOfWork.discard();
+        }
+
+        // Should allow the toString() to print the entityRefs.
+        System.out.println( associationValue.toString() );
+        try
+        {
+            associationValue.some().get();
+            fail( "Should have thrown an exception" );
+        }
+        catch( Exception e )
+        {
+            // Ok
+        }
+    }
+
+    public enum TestEnum
+    {
+        somevalue, anothervalue
+    }
+
+    public interface SomeValue
+        extends ValueComposite
+    {
+        @UseDefaults
+        @MaxLength( 5 )
+        Property<String> some();
+
+        @UseDefaults
+        Property<String> other();
+
+        @UseDefaults
+        Property<Long> number();
+
+        @UseDefaults
+        Property<List<String>> xyzzyList();
+
+        @UseDefaults
+        Property<AnotherValue> another();
+
+        @UseDefaults
+        Property<List<AnotherValue>> anotherList();
+
+        @UseDefaults
+        Property<TestEnum> testEnum();
+    }
+
+    public interface AnotherValue
+        extends ValueComposite
+    {
+        @UseDefaults
+        Property<String> val1();
+    }
+
+    public interface AssociationValue
+        extends ValueComposite
+    {
+        @Optional
+        Association<SomeEntity> some();
+
+        ManyAssociation<SomeEntity> manySome();
+    }
+
+    public interface SomeEntity
+        extends EntityComposite
+    {
+        Property<SomeValue> someValue();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/OperatorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/OperatorsTest.java b/core/api/src/test/java/org/apache/zest/api/OperatorsTest.java
deleted file mode 100644
index 86151a0..0000000
--- a/core/api/src/test/java/org/apache/zest/api/OperatorsTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-import java.util.Collections;
-import java.util.function.Predicate;
-import org.apache.zest.api.activation.ActivationException;
-import org.apache.zest.api.composite.Composite;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.identity.StringIdentity;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.query.QueryBuilder;
-import org.apache.zest.api.query.QueryExpressions;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
-import org.apache.zest.test.EntityTestAssembler;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * TODO
- */
-public class OperatorsTest
-{
-    @Test
-    public void testOperators()
-        throws UnitOfWorkCompletionException, ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                new EntityTestAssembler().assemble( module );
-
-                module.entities( TestEntity.class );
-                module.values( TestValue.class );
-                module.forMixin( TestEntity.class ).declareDefaults().foo().set( "Bar" );
-                module.forMixin( TestValue.class ).declareDefaults().bar().set( "Xyz" );
-                new DefaultUnitOfWorkAssembler().assemble( module );
-            }
-        };
-
-        UnitOfWorkFactory uowf = assembler.module().unitOfWorkFactory();
-        UnitOfWork uow = uowf.newUnitOfWork();
-
-        try
-        {
-            EntityBuilder<TestEntity> entityBuilder = uow.newEntityBuilder( TestEntity.class, new StringIdentity( "123" ) );
-            entityBuilder.instance().value().set( assembler.module().newValue( TestValue.class ) );
-            TestEntity testEntity = entityBuilder.newInstance();
-
-            uow.complete();
-            uow = uowf.newUnitOfWork();
-
-            Iterable<TestEntity> entities = Collections.singleton( testEntity = uow.get( testEntity ) );
-
-            QueryBuilder<TestEntity> builder = assembler.module().newQueryBuilder( TestEntity.class );
-
-            {
-                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
-                                                                          .foo(), "Bar" );
-                Assert.assertTrue( where.test( testEntity ) );
-                System.out.println( where );
-            }
-            {
-                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
-                                                                          .value()
-                                                                          .get()
-                                                                          .bar(), "Xyz" );
-                Assert.assertTrue( where.test( testEntity ) );
-                System.out.println( where );
-
-                Assert.assertTrue( builder.where( where ).newQuery( entities ).find().equals( testEntity ) );
-            }
-        }
-        finally
-        {
-            uow.discard();
-        }
-    }
-
-    public interface TestEntity
-        extends EntityComposite
-    {
-        Property<String> foo();
-
-        Property<TestValue> value();
-    }
-
-    public interface TestValue
-        extends ValueComposite
-    {
-        Property<String> bar();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/activation/ActivationEventsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/activation/ActivationEventsTest.java b/core/api/src/test/java/org/apache/zest/api/activation/ActivationEventsTest.java
deleted file mode 100644
index a9ce44a..0000000
--- a/core/api/src/test/java/org/apache/zest/api/activation/ActivationEventsTest.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.junit.Test;
-import org.apache.zest.api.activation.ActivationEvent.EventType;
-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.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.SingletonAssembler;
-
-import static org.junit.Assert.*;
-import static org.apache.zest.api.activation.ActivationEvent.EventType.*;
-
-public class ActivationEventsTest
-{
-
-    public static interface TestService
-    {
-        void test();
-    }
-
-    public static class TestServiceInstance
-            implements TestService
-    {
-
-        @Override
-        public void test()
-        {
-        }
-
-    }
-
-    @Mixins( TestServiceInstance.class )
-    public static interface TestServiceComposite
-        extends TestService, ServiceComposite
-    {
-    }
-
-    @Test
-    public void testSingleModuleSingleService()
-        throws Exception
-    {
-        final List<ActivationEvent> events = new ArrayList<>();
-
-        new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( TestServiceComposite.class ).instantiateOnStartup();
-            }
-
-            @Override
-            protected void beforeActivation( Application application )
-            {
-                application.registerActivationEventListener( new EventsRecorder( events ) );
-            }
-
-
-        }.application().passivate();
-
-        Iterator<ActivationEvent> it = events.iterator();
-
-        // Activation
-        assertEvent( it.next(), ACTIVATING, "Application" );
-        assertEvent( it.next(), ACTIVATING, "Layer" );
-        assertEvent( it.next(), ACTIVATING, "Module" );
-        assertEvent( it.next(), ACTIVATING, "TestService" );
-        assertEvent( it.next(), ACTIVATED, "TestService" );
-        assertEvent( it.next(), ACTIVATED, "Module" );
-        assertEvent( it.next(), ACTIVATED, "Layer" );
-        assertEvent( it.next(), ACTIVATED, "Application" );
-
-        // Passivation
-        assertEvent( it.next(), PASSIVATING, "Application" );
-        assertEvent( it.next(), PASSIVATING, "Layer" );
-        assertEvent( it.next(), PASSIVATING, "Module" );
-        assertEvent( it.next(), PASSIVATING, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "Module" );
-        assertEvent( it.next(), PASSIVATED, "Layer" );
-        assertEvent( it.next(), PASSIVATED, "Application" );
-
-        assertFalse( it.hasNext() );
-    }
-
-    @Test
-    public void testSingleModuleSingleImportedService()
-            throws Exception
-    {
-        final List<ActivationEvent> events = new ArrayList<>();
-
-        new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.importedServices( TestService.class ).
-                        setMetaInfo( new TestServiceInstance() ).
-                        importOnStartup();
-            }
-
-            @Override
-            protected void beforeActivation( Application application )
-            {
-                application.registerActivationEventListener( new EventsRecorder( events ) );
-            }
-
-
-        }.application().passivate();
-
-        Iterator<ActivationEvent> it = events.iterator();
-
-        // Activation
-        assertEvent( it.next(), ACTIVATING, "Application" );
-        assertEvent( it.next(), ACTIVATING, "Layer" );
-        assertEvent( it.next(), ACTIVATING, "Module" );
-        assertEvent( it.next(), ACTIVATING, "TestService" );
-        assertEvent( it.next(), ACTIVATED, "TestService" );
-        assertEvent( it.next(), ACTIVATED, "Module" );
-        assertEvent( it.next(), ACTIVATED, "Layer" );
-        assertEvent( it.next(), ACTIVATED, "Application" );
-
-        // Passivation
-        assertEvent( it.next(), PASSIVATING, "Application" );
-        assertEvent( it.next(), PASSIVATING, "Layer" );
-        assertEvent( it.next(), PASSIVATING, "Module" );
-        assertEvent( it.next(), PASSIVATING, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "Module" );
-        assertEvent( it.next(), PASSIVATED, "Layer" );
-        assertEvent( it.next(), PASSIVATED, "Application" );
-
-        assertFalse( it.hasNext() );
-    }
-
-    @Test
-    public void testSingleModuleSingleLazyService()
-            throws Exception
-    {
-        final List<ActivationEvent> events = new ArrayList<>();
-
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                module.services( TestServiceComposite.class );
-            }
-
-            @Override
-            protected void beforeActivation( Application application )
-            {
-                application.registerActivationEventListener( new EventsRecorder( events ) );
-            }
-
-        };
-        Application application = assembler.application();
-        application.passivate();
-
-        Iterator<ActivationEvent> it = events.iterator();
-
-        // Activation
-        assertEvent( it.next(), ACTIVATING, "Application" );
-        assertEvent( it.next(), ACTIVATING, "Layer" );
-        assertEvent( it.next(), ACTIVATING, "Module" );
-        // Lazy Service NOT activated
-        assertEvent( it.next(), ACTIVATED, "Module" );
-        assertEvent( it.next(), ACTIVATED, "Layer" );
-        assertEvent( it.next(), ACTIVATED, "Application" );
-
-        // Passivation
-        assertEvent( it.next(), PASSIVATING, "Application" );
-        assertEvent( it.next(), PASSIVATING, "Layer" );
-        assertEvent( it.next(), PASSIVATING, "Module" );
-        // Lazy Service NOT passivated
-        assertEvent( it.next(), PASSIVATED, "Module" );
-        assertEvent( it.next(), PASSIVATED, "Layer" );
-        assertEvent( it.next(), PASSIVATED, "Application" );
-
-        assertFalse( it.hasNext() );
-
-        events.clear();
-        application.activate();
-        Module module = assembler.module();
-        module.findService( TestService.class ).get().test();
-        application.passivate();
-
-        for( ActivationEvent event : events ) {
-            System.out.println( event );
-        }
-
-        it = events.iterator();
-
-        // Activation
-        assertEvent( it.next(), ACTIVATING, "Application" );
-        assertEvent( it.next(), ACTIVATING, "Layer" );
-        assertEvent( it.next(), ACTIVATING, "Module" );
-        assertEvent( it.next(), ACTIVATED, "Module" );
-        assertEvent( it.next(), ACTIVATED, "Layer" );
-        assertEvent( it.next(), ACTIVATED, "Application" );
-
-        // Lazy Service Activation
-        assertEvent( it.next(), ACTIVATING, "TestService" );
-        assertEvent( it.next(), ACTIVATED, "TestService" );
-
-        // Passivation
-        assertEvent( it.next(), PASSIVATING, "Application" );
-        assertEvent( it.next(), PASSIVATING, "Layer" );
-        assertEvent( it.next(), PASSIVATING, "Module" );
-        assertEvent( it.next(), PASSIVATING, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "TestService" );
-        assertEvent( it.next(), PASSIVATED, "Module" );
-        assertEvent( it.next(), PASSIVATED, "Layer" );
-        assertEvent( it.next(), PASSIVATED, "Application" );
-
-        assertFalse( it.hasNext() );
-    }
-
-    private static class EventsRecorder
-            implements ActivationEventListener
-    {
-
-        private final List<ActivationEvent> events;
-
-        private EventsRecorder( List<ActivationEvent> events )
-        {
-            this.events = events;
-        }
-
-        @Override
-        public void onEvent( ActivationEvent event )
-        {
-            events.add( event );
-        }
-
-    }
-
-    // WARN This assertion depends on ApplicationInstance, LayerInstance, ModuleInstance and ServiceReferenceInstance toString() method.
-    private static void assertEvent( ActivationEvent event, EventType expectedType, String expected )
-    {
-        boolean wrongEvent = expectedType != event.type();
-        boolean wrongMessage = ! event.message().contains( expected );
-        if( wrongEvent || wrongMessage )
-        {
-            StringBuilder sb = new StringBuilder();
-            sb.append("Event (").append( event ).append( ") has");
-            if( wrongEvent )
-            {
-                sb.append( " wrong type (expected:'" ).append( expectedType ).
-                        append( "' but was:'" ).append( event.type() ).append( "')" );
-                if( wrongMessage )
-                {
-                    sb.append( ";" );
-                }
-            }
-            if( wrongMessage )
-            {
-                sb.append( " wrong message (expected:'" ).append( expected ).
-                        append( "' but was:'" ).append( event.message() ).append( "')" );
-            }
-            fail( sb.toString() );
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/activation/PassivationExceptionTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/activation/PassivationExceptionTest.java b/core/api/src/test/java/org/apache/zest/api/activation/PassivationExceptionTest.java
deleted file mode 100644
index 079ea58..0000000
--- a/core/api/src/test/java/org/apache/zest/api/activation/PassivationExceptionTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.activation;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Collections;
-import org.junit.Test;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Layer;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.bootstrap.Assembler;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.bootstrap.builder.ApplicationBuilder;
-
-import static org.hamcrest.core.StringContains.containsString;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-public class PassivationExceptionTest
-{
-    private static String stack( Exception ex )
-    {
-        StringWriter writer = new StringWriter();
-        ex.printStackTrace( new PrintWriter( writer ) );
-        return writer.toString();
-    }
-
-    @Test
-    public void testEmptyPassivationException()
-    {
-        PassivationException empty = new PassivationException( Collections.<Exception>emptyList() );
-        assertThat( empty.getMessage(), containsString( "has 0 cause" ) );
-    }
-
-    @Test
-    public void testSinglePassivationException()
-    {
-        PassivationException single = new PassivationException( Collections.singletonList( new Exception( "single" ) ) );
-        String stack = stack( single );
-        assertThat( single.getMessage(), containsString( "has 1 cause" ) );
-        assertThat( stack, containsString( "Suppressed: java.lang.Exception: single" ) );
-    }
-
-    @Test
-    public void testMultiplePassivationException()
-    {
-        PassivationException multi = new PassivationException( Arrays.asList( new Exception( "one" ),
-                                                                              new Exception( "two" ),
-                                                                              new Exception( "three" ) ) );
-        String stack = stack( multi );
-        assertThat( multi.getMessage(), containsString( "has 3 cause(s)" ) );
-        assertThat( stack, containsString( "Suppressed: java.lang.Exception: one" ) );
-        assertThat( stack, containsString( "Suppressed: java.lang.Exception: two" ) );
-        assertThat( stack, containsString( "Suppressed: java.lang.Exception: three" ) );
-    }
-
-    @Test
-    public void testPassivationExceptionsAccrossStructure()
-        throws AssemblyException, ActivationException
-    {
-        ApplicationBuilder appBuilder = new ApplicationBuilder( "TestApplication" );
-        appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler( new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( TestService.class ).
-                    identifiedBy( "TestService_Module.A" ).
-                    withActivators( FailBeforePassivationServiceActivator.class ).
-                    instantiateOnStartup();
-            }
-        } );
-        appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler( new Assembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( TestService.class ).
-                    identifiedBy( "TestService_Module.B" ).
-                    withActivators( FailAfterPassivationServiceActivator.class ).
-                    instantiateOnStartup();
-            }
-        } );
-        appBuilder.registerActivationEventListener( new TestActivationEventListener() );
-
-        Application app = appBuilder.newApplication();
-
-        try
-        {
-            Module moduleA = app.findModule( "Layer 1", "Module A" );
-            TestService service = moduleA.findService( TestService.class ).get();
-            assertThat( service.hello(), equalTo( "Hello Polygene!" ) );
-        }
-        finally
-        {
-            try
-            {
-                app.passivate();
-                fail( "No PassivationException" );
-            }
-            catch( PassivationException ex )
-            {
-                ex.printStackTrace();
-                String stack = stack( ex );
-                assertThat( ex.getMessage(), containsString( "has 12 cause(s)" ) );
-                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for TestApplication" ) );
-                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 2" ) );
-                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module B" ) );
-                assertThat( stack, containsString( "ACTIVATOR: FAIL AFTER PASSIVATION for TestService_Module.B(active=false,module='Module B')" ) );
-                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module B" ) );
-                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 2" ) );
-                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 1" ) );
-                assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module A" ) );
-                assertThat( stack, containsString( "ACTIVATOR: FAIL BEFORE PASSIVATION for TestService_Module.A(active=true,module='Module A')" ) );
-                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module A" ) );
-                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 1" ) );
-                assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for TestApplication" ) );
-            }
-        }
-    }
-
-    @Mixins( TestService.Mixin.class )
-    public interface TestService
-    {
-        String hello();
-
-        static class Mixin
-            implements TestService
-        {
-            @Structure
-            private Module module;
-
-            @Override
-            public String hello()
-            {
-                module.name();
-                return "Hello Polygene!";
-            }
-        }
-
-    }
-
-    public static class FailBeforePassivationServiceActivator
-        extends ActivatorAdapter<ServiceReference<TestService>>
-    {
-        @Override
-        public void beforePassivation( ServiceReference<TestService> passivated )
-            throws Exception
-        {
-            throw new Exception( "ACTIVATOR: FAIL BEFORE PASSIVATION for " + passivated );
-        }
-    }
-
-    public static class FailAfterPassivationServiceActivator
-        extends ActivatorAdapter<ServiceReference<TestService>>
-    {
-        @Override
-        public void afterPassivation( ServiceReference<TestService> passivated )
-            throws Exception
-        {
-            throw new Exception( "ACTIVATOR: FAIL AFTER PASSIVATION for " + passivated );
-        }
-    }
-
-    public static class TestActivationEventListener
-        implements ActivationEventListener
-    {
-        @Override
-        public void onEvent( ActivationEvent event )
-            throws Exception
-        {
-            if( !( event.source() instanceof Application )
-                && !( event.source() instanceof Layer )
-                && !( event.source() instanceof Module ) )
-            {
-                return;
-            }
-            switch( event.type() )
-            {
-                case PASSIVATING:
-                    throw new Exception( "EVENT: FAIL BEFORE PASSIVATION for " + event.source() );
-                case PASSIVATED:
-                    throw new Exception( "EVENT: FAIL AFTER PASSIVATION for " + event.source() );
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/annotation/MixinsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/annotation/MixinsTest.java b/core/api/src/test/java/org/apache/zest/api/annotation/MixinsTest.java
deleted file mode 100644
index f274697..0000000
--- a/core/api/src/test/java/org/apache/zest/api/annotation/MixinsTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.annotation;
-
-import java.lang.annotation.Annotation;
-import org.junit.Test;
-import org.apache.zest.api.mixin.Mixins;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests public api exposed by Mixins annotation.
- * This will ensure that the public api does not get changed by mistake.
- */
-public class MixinsTest
-{
-
-    @Test
-    public void retention()
-    {
-        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
-        assertNotNull( "annotations should not be null", annotations );
-        assertEquals( "number of annotations", 1, annotations.length );
-        assertEquals( "annotation type", Mixins.class, annotations[ 0 ].annotationType() );
-    }
-
-    @Mixins( Object.class )
-    private static class Annotated
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/annotation/ModifiedByTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/annotation/ModifiedByTest.java b/core/api/src/test/java/org/apache/zest/api/annotation/ModifiedByTest.java
deleted file mode 100644
index b886121..0000000
--- a/core/api/src/test/java/org/apache/zest/api/annotation/ModifiedByTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.annotation;
-
-import java.lang.annotation.Annotation;
-import org.junit.Test;
-import org.apache.zest.api.concern.Concerns;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests public api exposed by Concerns annotation.
- * This will ensure that the public api does not get changed by mistake.
- */
-public class ModifiedByTest
-{
-
-    @Test
-    public void retention()
-    {
-        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
-        assertNotNull( "annotations should not be null", annotations );
-        assertEquals( "number of annotations", 1, annotations.length );
-        assertEquals( "annotation type", Concerns.class, annotations[ 0 ].annotationType() );
-    }
-
-    @Concerns( Object.class )
-    private static class Annotated
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/annotation/scope/ModifiesTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/annotation/scope/ModifiesTest.java b/core/api/src/test/java/org/apache/zest/api/annotation/scope/ModifiesTest.java
deleted file mode 100644
index 1a2170c..0000000
--- a/core/api/src/test/java/org/apache/zest/api/annotation/scope/ModifiesTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.annotation.scope;
-
-import java.lang.annotation.Annotation;
-import org.junit.Test;
-import org.apache.zest.api.concern.internal.ConcernFor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests public api exposed by Modified annotation.
- * This will ensure that the public api does not get changed by mistake.
- */
-public class ModifiesTest
-{
-
-    @Test
-    public void retention()
-        throws NoSuchFieldException
-    {
-        Annotation[] annotations = Annotated.class.getDeclaredField( "modified" ).getDeclaredAnnotations();
-        assertNotNull( "annotations should not be null", annotations );
-        assertEquals( "number of annotations", 1, annotations.length );
-        assertEquals( "annotation type", ConcernFor.class, annotations[ 0 ].annotationType() );
-    }
-
-    private static class Annotated
-    {
-        @ConcernFor
-        String modified;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/common/AppliesToTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/common/AppliesToTest.java b/core/api/src/test/java/org/apache/zest/api/common/AppliesToTest.java
deleted file mode 100644
index 8a3755a..0000000
--- a/core/api/src/test/java/org/apache/zest/api/common/AppliesToTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import java.lang.annotation.Annotation;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests public api exposed by AppliesTo annotation.
- * This will ensure that the public api does not get changed by mistake.
- */
-public class AppliesToTest
-{
-
-    @Test
-    public void retention()
-    {
-        Annotation[] annotations = Annotated.class.getDeclaredAnnotations();
-        assertNotNull( "annotations should not be null", annotations );
-        assertEquals( "number of annotations", 1, annotations.length );
-        assertEquals( "annotation type", AppliesTo.class, annotations[ 0 ].annotationType() );
-    }
-
-    @AppliesTo( Object.class )
-    private static class Annotated
-    {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/common/QualifiedNameTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/common/QualifiedNameTest.java b/core/api/src/test/java/org/apache/zest/api/common/QualifiedNameTest.java
deleted file mode 100644
index 85e2106..0000000
--- a/core/api/src/test/java/org/apache/zest/api/common/QualifiedNameTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.common;
-
-import org.junit.Test;
-import org.apache.zest.api.util.NullArgumentException;
-
-import static org.junit.Assert.assertEquals;
-
-public class QualifiedNameTest
-{
-    @Test
-    public void testQualifiedNameWithDollar()
-    {
-        assertEquals( "Name containing dollar is modified", "Test-Test",
-                      new QualifiedName( TypeName.nameOf( "Test$Test" ), "satisfiedBy" ).type() );
-    }
-
-    @Test
-    public void testQualifiedNameFromQNWithDollar()
-    {
-        assertEquals( "Name containing dollar is cleaned up", "Test-Test",
-                      QualifiedName.fromFQN( "Test$Test:satisfiedBy" ).type() );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments1()
-    {
-        new QualifiedName( TypeName.nameOf( "Test" ), null );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments2()
-    {
-        new QualifiedName( null, "satisfiedBy" );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments3()
-    {
-        new QualifiedName( null, null );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments4()
-    {
-        QualifiedName.fromFQN( null );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments5()
-    {
-        QualifiedName.fromAccessor( null );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments6()
-    {
-        QualifiedName.fromClass( null, "satisfiedBy" );
-    }
-
-    @Test( expected = NullArgumentException.class )
-    public void nonNullArguments7()
-    {
-        QualifiedName.fromClass( null, null );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/composite/PropertyMapperTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/composite/PropertyMapperTest.java b/core/api/src/test/java/org/apache/zest/api/composite/PropertyMapperTest.java
deleted file mode 100644
index 22464b1..0000000
--- a/core/api/src/test/java/org/apache/zest/api/composite/PropertyMapperTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.composite;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class PropertyMapperTest
-{
-    private final static Method MAP_TO_TYPE;
-
-    static
-    {
-        try
-        {
-            MAP_TO_TYPE = PropertyMapper.class.getDeclaredMethod( "mapToType", Composite.class, Type.class, Object.class );
-            MAP_TO_TYPE.setAccessible( true );
-        }
-        catch( NoSuchMethodException e )
-        {
-            InternalError error = new InternalError();
-            error.initCause( e );
-            throw error;
-        }
-    }
-
-    @Test
-    public void testMappingOfInteger()
-        throws Exception
-    {
-        assertEquals( 5, mapToType( null, Integer.class, "5" ) );
-        assertEquals( -5, mapToType( null, Integer.class, "-5" ) );
-        assertEquals( Integer.class, mapToType( null, Integer.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfLong()
-        throws Exception
-    {
-        assertEquals( 5L, mapToType( null, Long.class, "5" ) );
-        assertEquals( 5876328476238746238L, mapToType( null, Long.class, "5876328476238746238" ) );
-        assertEquals( Long.class, mapToType( null, Long.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfBoolean()
-        throws Exception
-    {
-        assertEquals( false, mapToType( null, Boolean.class, "false" ) );
-        assertEquals( true, mapToType( null, Boolean.class, "true" ) );
-        assertEquals( Boolean.class, mapToType( null, Boolean.class, "false" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfFloat()
-        throws Exception
-    {
-        assertEquals( 5.1234f, mapToType( null, Float.class, "5.1234" ) );
-        assertEquals( 5876328476.6238f, mapToType( null, Float.class, "5876328476.6238" ) );
-        assertEquals( Float.class, mapToType( null, Float.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfDouble()
-        throws Exception
-    {
-        assertEquals( 5.1234, mapToType( null, Double.class, "5.1234" ) );
-        assertEquals( 5876328476.623823, mapToType( null, Double.class, "5876328476.623823" ) );
-        assertEquals( Double.class, mapToType( null, Double.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfBigDecimal()
-        throws Exception
-    {
-        assertEquals( new BigDecimal( 3 ), mapToType( null, BigDecimal.class, "3" ) );
-        assertEquals( new BigDecimal( "12345.67891011" ), mapToType( null, BigDecimal.class, "12345.67891011" ) );
-        assertEquals( BigDecimal.class, mapToType( null, BigDecimal.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfBigInteger()
-        throws Exception
-    {
-        assertEquals( new BigInteger( "20", 16 ), mapToType( null, BigInteger.class, "32" ) );
-        assertEquals( new BigInteger( "1234567891011" ), mapToType( null, BigInteger.class, "1234567891011" ) );
-        assertEquals( BigInteger.class, mapToType( null, BigInteger.class, "5" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfEnum()
-        throws Exception
-    {
-        assertEquals( TestEnum.FIRST, mapToType( null, TestEnum.class, "FIRST" ) );
-        assertEquals( TestEnum.SECOND, mapToType( null, TestEnum.class, "SECOND" ) );
-        assertEquals( TestEnum.class, mapToType( null, TestEnum.class, "SECOND" ).getClass() );
-    }
-
-    @Test
-    public void testMappingOfIntegerArray()
-        throws Exception
-    {
-        Object[] value = (Object[]) mapToType( null, Integer[].class, "5,4 , 3   ,2,1" );
-        assertEquals( 5, value.length );
-        assertEquals( 5, value[ 0 ] );
-        assertEquals( 4, value[ 1 ] );
-        assertEquals( 3, value[ 2 ] );
-        assertEquals( 2, value[ 3 ] );
-        assertEquals( 1, value[ 4 ] );
-    }
-
-    @Test
-    public void testMappingOfStringArray()
-        throws Exception
-    {
-        {
-            Object[] value = (Object[]) mapToType( null, String[].class, "5,4 , 3   ,2,1" );
-            assertEquals( 5, value.length );
-            assertEquals( "5", value[ 0 ] );
-            assertEquals( "4 ", value[ 1 ] );
-            assertEquals( " 3   ", value[ 2 ] );
-            assertEquals( "2", value[ 3 ] );
-            assertEquals( "1", value[ 4 ] );
-        }
-        {
-            Object[] value = (Object[]) mapToType( null, String[].class, "5,4 ,\" 3,   \",  \" 2\" ,1" );
-            assertEquals( "5", value[ 0 ] );
-            assertEquals( "4 ", value[ 1 ] );
-            assertEquals( " 3,   ", value[ 2 ] );
-            assertEquals( " 2", value[ 3 ] );
-            assertEquals( "1", value[ 4 ] );
-            assertEquals( 5, value.length );
-        }
-    }
-
-    @Test
-    public void testMappingOfBooleanArray()
-        throws Exception
-    {
-        Object[] value = (Object[]) mapToType( null, Boolean[].class, " true,false,  false, true ,true,false" );
-        assertEquals( true, value[ 0 ] );
-        assertEquals( false, value[ 1 ] );
-        assertEquals( false, value[ 2 ] );
-        assertEquals( true, value[ 3 ] );
-        assertEquals( true, value[ 4 ] );
-        assertEquals( false, value[ 5 ] );
-        assertEquals( 6, value.length );
-    }
-
-    @Test
-    public void testMappingOfList()
-        throws Exception
-    {
-        Type type = Testing.class.getDeclaredMethod( "list" ).getGenericReturnType();
-        List<String> value = (List<String>) mapToType( null, type, "5,4 ,\" 3,   \",  \" 2\" ,1" );
-        assertEquals( "5", value.get( 0 ) );
-        assertEquals( "4 ", value.get( 1 ) );
-        assertEquals( " 3,   ", value.get( 2 ) );
-        assertEquals( " 2", value.get( 3 ) );
-        assertEquals( "1", value.get( 4 ) );
-        assertEquals( 5, value.size() );
-    }
-
-    @Test
-    public void testMappingOfSet()
-        throws Exception
-    {
-        Type type = Testing.class.getDeclaredMethod( "set" ).getGenericReturnType();
-        Set<String> value = (Set<String>) mapToType( null, type, "5,4 ,\" 3,   \",  \" 2\" ,1" );
-        assertTrue( value.contains( "5" ) );
-        assertTrue( value.contains( "4 " ) );
-        assertTrue( value.contains( " 3,   " ) );
-        assertTrue( value.contains( " 2" ) );
-        assertTrue( value.contains( "1" ) );
-        assertEquals( 5, value.size() );
-    }
-
-    @Test
-    public void testMappingOfMap()
-        throws Exception
-    {
-        Type type = Testing.class.getDeclaredMethod( "map" ).getGenericReturnType();
-        Map<String, String> value = (Map<String, String>) mapToType( null, type, "first:5,second:4 , third:\" 3,   \", fourth:  \" 2\" ,fifth : 1" );
-        assertEquals( "5", value.get( "first" ) );
-        assertEquals( "4 ", value.get( "second" ) );
-        assertEquals( " 3,   ", value.get( " third" ) );
-        assertEquals( " 2", value.get( " fourth" ) );
-        assertEquals( " 1", value.get( "fifth " ) );
-        assertEquals( 5, value.size() );
-    }
-
-    private Object mapToType( Composite composite, Type propertyType, Object value )
-        throws IllegalAccessException, InvocationTargetException
-    {
-        return MAP_TO_TYPE.invoke( null, composite, propertyType, value );
-    }
-
-    interface Testing
-    {
-        List<String> list();
-
-        Set<String> set();
-
-        Map<String, String> map();
-    }
-
-    enum TestEnum
-    {
-        FIRST,
-        SECOND
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java b/core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
deleted file mode 100644
index 1a46b2c..0000000
--- a/core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.InjectionScope;
-
-public class DocumentationSupport
-{
-// START SNIPPET: class
-    @AppliesTo( java.sql.Connection.class )
-    public class CacheConcern extends GenericConcern
-        implements InvocationHandler
-    {
-// END SNIPPET: class
-        @Override
-        public Object invoke( Object proxy, Method method, Object[] args )
-            throws Throwable
-        {
-            return null;
-        }
-    }
-
-// START SNIPPET: filter
-    @AppliesTo( BusinessAppliesToFilter.class )
-    public class BusinessConcern extends GenericConcern
-        implements InvocationHandler
-    {
-// END SNIPPET: filter
-        @Override
-        public Object invoke( Object proxy, Method method, Object[] args )
-            throws Throwable
-        {
-            return null;
-        }
-    }
-
-// START SNIPPET: filter
-    public class BusinessAppliesToFilter
-        implements AppliesToFilter
-    {
-
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass
-        )
-        {
-            return true; // Some criteria for when a method is wrapped with the concern.
-        }
-    }
-// END SNIPPET: filter
-
-
-// START SNIPPET: annotation
-    @AppliesTo( Audited.class )
-    public class AuditConcern extends GenericConcern
-        implements InvocationHandler
-    {
-// START SNIPPET: annotation
-        @Override
-        public Object invoke( Object proxy, Method method, Object[] args )
-            throws Throwable
-        {
-            return null;
-        }
-    }
-
-// START SNIPPET: annotation
-    @Retention( RetentionPolicy.RUNTIME )
-    @Target( { ElementType.METHOD } )
-    @Documented
-    @InjectionScope
-    public @interface Audited
-    {
-    }
-// END SNIPPET: annotation
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/configuration/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/configuration/ConfigurationTest.java b/core/api/src/test/java/org/apache/zest/api/configuration/ConfigurationTest.java
deleted file mode 100644
index 4d29164..0000000
--- a/core/api/src/test/java/org/apache/zest/api/configuration/ConfigurationTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.junit.Test;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class ConfigurationTest extends AbstractPolygeneTest
-{
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.services( MyService.class ).instantiateOnStartup();
-        module.entities( MyConfig.class );
-        module.values( PersonDetails.class, Address.class, City.class, Country.class );
-        new EntityTestAssembler().assemble( module );
-    }
-
-    @Test
-    public void testConfiguration()
-        throws Exception
-    {
-        MyService service = serviceFinder.findService( MyService.class ).get();
-        PersonDetails details = service.details();
-        assertThat(details.name().get(), equalTo( "Niclas" ) );
-        assertThat(details.address().get().street1().get(), equalTo( "Henan Lu 555" ) );
-        assertThat(details.address().get().street2().get(), equalTo( "Block 15" ) );
-        assertThat(details.address().get().city().get().cityName().get(), equalTo( "Shanghai" ) );
-        assertThat(details.address().get().city().get().country().get().countryName().get(), equalTo( "China" ) );
-    }
-
-    @Mixins(MyServiceMixin.class)
-    public interface MyService extends ServiceComposite
-    {
-        PersonDetails details();
-    }
-
-    public abstract class MyServiceMixin
-        implements MyService
-    {
-        @This
-        Configuration<MyConfig> myconf;
-
-        @Override
-        public PersonDetails details()
-        {
-            return myconf.get().me().get();
-        }
-    }
-
-    public interface MyConfig extends ConfigurationComposite
-    {
-        Property<PersonDetails> me();
-    }
-
-    public interface PersonDetails extends ValueComposite
-    {
-        Property<String> name();
-        Property<Address> address();
-
-    }
-
-    public interface Address extends ValueComposite
-    {
-        Property<String> street1();
-        Property<String> street2();
-        Property<City> city();
-    }
-
-    public interface City extends ValueComposite
-    {
-        Property<String> cityName();
-        Property<Country> country();
-    }
-
-    public interface Country extends ValueComposite
-    {
-        Property<String> countryName();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/configuration/DeclareConfigurationDefaultsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/configuration/DeclareConfigurationDefaultsTest.java b/core/api/src/test/java/org/apache/zest/api/configuration/DeclareConfigurationDefaultsTest.java
deleted file mode 100644
index cf6217c..0000000
--- a/core/api/src/test/java/org/apache/zest/api/configuration/DeclareConfigurationDefaultsTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.test.AbstractPolygeneTest;
-import org.apache.zest.test.EntityTestAssembler;
-
-public class DeclareConfigurationDefaultsTest
-        extends AbstractPolygeneTest
-{
-
-    @Mixins( FooServiceMixin.class )
-    public static interface FooServiceComposite
-            extends ServiceComposite
-    {
-
-        String configuredFoo();
-
-    }
-
-    public static abstract class FooServiceMixin
-            implements FooServiceComposite
-    {
-
-        @This
-        private Configuration<FooConfigurationComposite> config;
-
-        public String configuredFoo()
-        {
-            return config.get().foo().get();
-        }
-
-    }
-
-    public static interface FooConfigurationComposite
-            extends ConfigurationComposite
-    {
-
-        Property<String> foo();
-
-    }
-
-    public void assemble( ModuleAssembly module )
-            throws AssemblyException
-    {
-        module.services( FooServiceComposite.class ).identifiedBy( "bazar" );
-        module.entities( FooConfigurationComposite.class );
-        new EntityTestAssembler().assemble( module );
-        FooConfigurationComposite config = module.forMixin( FooConfigurationComposite.class ).declareDefaults();
-        config.foo().set( "bar" );
-    }
-
-    @Test
-    public void testConfigurationDefaults()
-    {
-        FooServiceComposite fooService = serviceFinder.findService( FooServiceComposite.class ).get();
-        Assert.assertEquals( "bar", fooService.configuredFoo() );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/configuration/MailService.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/configuration/MailService.java b/core/api/src/test/java/org/apache/zest/api/configuration/MailService.java
deleted file mode 100644
index 7392be5..0000000
--- a/core/api/src/test/java/org/apache/zest/api/configuration/MailService.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.library.constraints.annotation.Email;
-import org.apache.zest.library.constraints.annotation.MinLength;
-
-// Documentation Support
-@Mixins( MailService.MailServiceMixin.class )
-public interface MailService
-{
-    void sendMail( @Email String to, @MinLength( 8 ) String subject, String body );
-    
-    // START SNIPPET: write
-    void changeExternalMailService( String hostName, int port );
-    // END SNIPPET: write
-    
-    public class MailServiceMixin
-        implements MailService
-    {
-        // START SNIPPET: read        
-        @This
-        private Configuration<MailServiceConfiguration> config;
-
-        @Override
-        public void sendMail( @Email String to, @MinLength( 8 ) String subject, String body )
-        {
-            config.refresh();
-            MailServiceConfiguration conf = config.get();
-            String hostName = conf.hostName().get();
-            int port = conf.port().get();
-            // END SNIPPET: read
-
-            // START SNIPPET: read        
-        }
-        // END SNIPPET: read        
-
-        // START SNIPPET: write        
-        @Override
-        public void changeExternalMailService( String hostName, int port )
-        {
-            MailServiceConfiguration conf = config.get();
-            conf.hostName().set( hostName );
-            conf.port().set( port );
-            config.save();
-        }
-        // START SNIPPET: write        
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java b/core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java
deleted file mode 100644
index 8da6b69..0000000
--- a/core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.configuration;
-
-import org.apache.zest.api.property.Property;
-
-// Documentation Support class
-// START SNIPPET: configuration
-public interface MailServiceConfiguration extends ConfigurationComposite
-{
-    Property<String> hostName();
-
-    Property<Integer> port();
-}
-// END SNIPPET: configuration


[11/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateResolver.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateResolver.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateResolver.java
new file mode 100644
index 0000000..64bc165
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/StateResolver.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.PropertyDescriptor;
+
+/**
+ * StateResolver.
+ */
+public interface StateResolver
+{
+    Object getPropertyState( PropertyDescriptor propertyDescriptor );
+
+    EntityReference getAssociationState( AssociationDescriptor associationDescriptor );
+
+    Stream<EntityReference> getManyAssociationState( AssociationDescriptor associationDescriptor );
+
+    Stream<Map.Entry<String, EntityReference>> getNamedAssociationState( AssociationDescriptor associationDescriptor );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SynchronizedCompositeMethodInstancePool.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SynchronizedCompositeMethodInstancePool.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SynchronizedCompositeMethodInstancePool.java
new file mode 100644
index 0000000..01025cf
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/SynchronizedCompositeMethodInstancePool.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+/**
+ * Method instance pool that keeps a linked list. Uses synchronization
+ * to ensure that instances are acquired and returned in a thread-safe
+ * manner.
+ */
+public final class SynchronizedCompositeMethodInstancePool
+    implements InstancePool<CompositeMethodInstance>
+{
+    private CompositeMethodInstance first = null;
+
+    @Override
+    public synchronized CompositeMethodInstance obtainInstance()
+    {
+        CompositeMethodInstance instance = first;
+        if( instance != null )
+        {
+            first = instance.getNext();
+        }
+        return instance;
+    }
+
+    @Override
+    public synchronized void releaseInstance( CompositeMethodInstance instance )
+    {
+        instance.setNext( first );
+        first = instance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientBuilderInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientBuilderInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientBuilderInstance.java
new file mode 100644
index 0000000..a622a57
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientBuilderInstance.java
@@ -0,0 +1,102 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.composite.TransientBuilder;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.runtime.property.PropertyInstance;
+
+/**
+ * JAVADOC
+ */
+public final class TransientBuilderInstance<T>
+    implements TransientBuilder<T>
+{
+    private TransientModel model;
+
+    // lazy initialized in accessor
+    private UsesInstance uses = UsesInstance.EMPTY_USES;
+
+    // lazy initialized in accessor
+    private CompositeInstance prototypeInstance;
+
+    private TransientStateInstance state;
+
+    public TransientBuilderInstance( TransientDescriptor model,
+                                     TransientStateInstance state,
+                                     UsesInstance uses
+    )
+    {
+        this.model = (TransientModel) model;
+        this.state = state;
+        this.uses = uses;
+    }
+
+    @Override
+    public TransientBuilder<T> use( Object... usedObjects )
+    {
+        uses = uses.use( usedObjects );
+        return this;
+    }
+
+    @Override
+    public T prototype()
+    {
+        // Instantiate given value type
+        if( prototypeInstance == null )
+        {
+            prototypeInstance = model.newInstance( uses, state );
+        }
+
+        return prototypeInstance.<T>proxy();
+    }
+
+    @Override
+    public <K> K prototypeFor( Class<K> mixinType )
+    {
+        // Instantiate given value type
+        if( prototypeInstance == null )
+        {
+            prototypeInstance = model.newInstance( uses, state );
+        }
+
+        return prototypeInstance.newProxy( mixinType );
+    }
+
+    @Override
+    public T newInstance()
+        throws ConstructionException
+    {
+        // Set correct info's (immutable) on the state
+        model.state().properties()
+            .forEach(
+                propertyDescriptor ->
+                    ( (PropertyInstance<Object>) state.propertyFor( propertyDescriptor.accessor() ) )
+                        .setPropertyInfo( propertyDescriptor ) );
+
+        model.checkConstraints( state );
+
+        CompositeInstance compositeInstance = model.newInstance( uses, state );
+        return compositeInstance.<T>proxy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
new file mode 100644
index 0000000..c909e33
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
@@ -0,0 +1,789 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.entity.Lifecycle;
+import org.apache.polygene.api.mixin.Initializable;
+import org.apache.polygene.api.util.Methods;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+
+import static org.apache.polygene.api.util.Classes.RAW_CLASS;
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+import static org.objectweb.asm.Opcodes.AASTORE;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
+import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ACC_SUPER;
+import static org.objectweb.asm.Opcodes.ACONST_NULL;
+import static org.objectweb.asm.Opcodes.ALOAD;
+import static org.objectweb.asm.Opcodes.ANEWARRAY;
+import static org.objectweb.asm.Opcodes.ARETURN;
+import static org.objectweb.asm.Opcodes.ASTORE;
+import static org.objectweb.asm.Opcodes.ATHROW;
+import static org.objectweb.asm.Opcodes.BIPUSH;
+import static org.objectweb.asm.Opcodes.CHECKCAST;
+import static org.objectweb.asm.Opcodes.DLOAD;
+import static org.objectweb.asm.Opcodes.DRETURN;
+import static org.objectweb.asm.Opcodes.DUP;
+import static org.objectweb.asm.Opcodes.FLOAD;
+import static org.objectweb.asm.Opcodes.FRETURN;
+import static org.objectweb.asm.Opcodes.GETFIELD;
+import static org.objectweb.asm.Opcodes.GETSTATIC;
+import static org.objectweb.asm.Opcodes.GOTO;
+import static org.objectweb.asm.Opcodes.ICONST_0;
+import static org.objectweb.asm.Opcodes.ICONST_1;
+import static org.objectweb.asm.Opcodes.ICONST_2;
+import static org.objectweb.asm.Opcodes.ICONST_3;
+import static org.objectweb.asm.Opcodes.ICONST_4;
+import static org.objectweb.asm.Opcodes.ICONST_5;
+import static org.objectweb.asm.Opcodes.ILOAD;
+import static org.objectweb.asm.Opcodes.INVOKEINTERFACE;
+import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
+import static org.objectweb.asm.Opcodes.INVOKESTATIC;
+import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
+import static org.objectweb.asm.Opcodes.IRETURN;
+import static org.objectweb.asm.Opcodes.LLOAD;
+import static org.objectweb.asm.Opcodes.LRETURN;
+import static org.objectweb.asm.Opcodes.POP;
+import static org.objectweb.asm.Opcodes.PUTSTATIC;
+import static org.objectweb.asm.Opcodes.RETURN;
+import static org.objectweb.asm.Type.getInternalName;
+
+/**
+ * Generate subclasses of classes used for transients. All methods delegate to CompositeInvoker.
+ */
+@SuppressWarnings( "raw" )
+/* package */ final class TransientClassLoader
+    extends ClassLoader
+{
+    private static final int JDK_VERSION;
+    public static final String GENERATED_POSTFIX = "_Proxy";
+
+    static
+    {
+        String jdkString = System.getProperty( "java.specification.version" );
+        switch( jdkString )
+        {
+        case "1.8":
+            JDK_VERSION = Opcodes.V1_8;
+            break;
+        case "1.7":
+        default:
+            JDK_VERSION = Opcodes.V1_7;
+            break;
+        }
+    }
+
+    /* package */ TransientClassLoader( ClassLoader parent )
+    {
+        super( parent );
+    }
+
+    @Override
+    protected Class findClass( String name )
+        throws ClassNotFoundException
+    {
+        if( name.endsWith( GENERATED_POSTFIX ) )
+        {
+            Class baseClass;
+            String baseName = name.substring( 0, name.length() - 6 );
+            try
+            {
+                baseClass = loadClass( baseName );
+            }
+            catch( ClassNotFoundException e )
+            {
+                // Try replacing the last _ with $
+                while( true )
+                {
+                    int idx = baseName.lastIndexOf( "_" );
+                    if( idx != -1 )
+                    {
+                        baseName = baseName.substring( 0, idx ) + "$" + baseName.substring( idx + 1 );
+                        try
+                        {
+                            baseClass = loadClass( baseName );
+                            break;
+                        }
+                        catch( ClassNotFoundException e1 )
+                        {
+                            // Try again
+                        }
+                    }
+                    else
+                    {
+                        throw e;
+                    }
+                }
+            }
+
+            byte[] b = generateClass( name, baseClass );
+            return defineClass( name, b, 0, b.length, baseClass.getProtectionDomain() );
+        }
+
+        // Try the classloader of this classloader -> get classes in Polygene such as CompositeInvoker
+        return getClass().getClassLoader().loadClass( name );
+    }
+
+    public static byte[] generateClass( String name, Class baseClass )
+        throws ClassNotFoundException
+    {
+        String classSlash = name.replace( '.', '/' );
+        String baseClassSlash = getInternalName( baseClass );
+
+        ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
+
+        // Class definition start
+        cw.visit( JDK_VERSION, ACC_PUBLIC + ACC_SUPER, classSlash, null, baseClassSlash, new String[] { "org/apache/zest/api/composite/Composite" } );
+
+        // Composite reference
+        {
+            cw.visitField( ACC_PUBLIC, "_instance", "Lorg/apache/polygene/api/composite/CompositeInvoker;", null, null )
+                .visitEnd();
+        }
+
+        // Static Method references
+        {
+            int idx = 1;
+            for( Method method : baseClass.getMethods() )
+            {
+                if( isOverloaded( method, baseClass ) )
+                {
+                    cw.visitField( ACC_PRIVATE + ACC_STATIC, "m" + idx++, "Ljava/lang/reflect/Method;", null, null )
+                        .visitEnd();
+                }
+            }
+        }
+
+        // Constructors
+        for( Constructor constructor : baseClass.getDeclaredConstructors() )
+        {
+            if( Modifier.isPublic( constructor.getModifiers() ) || Modifier.isProtected( constructor.getModifiers() ) )
+            {
+                String desc = org.objectweb.asm.commons.Method.getMethod( constructor ).getDescriptor();
+                MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "<init>", desc, null, null );
+                mv.visitCode();
+                mv.visitVarInsn( ALOAD, 0 );
+
+                int idx = 1;
+                for( Class aClass : constructor.getParameterTypes() )
+                {
+                    // TODO Handle other types than objects (?)
+                    mv.visitVarInsn( ALOAD, idx++ );
+                }
+
+                mv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, "<init>", desc, false );
+                mv.visitInsn( RETURN );
+                mv.visitMaxs( idx, idx );
+                mv.visitEnd();
+            }
+        }
+
+        // Overloaded and unimplemented methods
+        Method[] methods = baseClass.getMethods();
+        int idx = 0;
+        List<Label> exceptionLabels = new ArrayList<>();
+        for( Method method : methods )
+        {
+            if( isOverloaded( method, baseClass ) )
+            {
+                idx++;
+                String methodName = method.getName();
+                String desc = org.objectweb.asm.commons.Method.getMethod( method ).getDescriptor();
+
+                String[] exceptions = null;
+                {
+                    MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, methodName, desc, null, exceptions );
+                    if( isInternalPolygeneMethod( method, baseClass ) )
+                    {
+                        // generate a NoOp method...
+                        mv.visitInsn( RETURN );
+                    }
+                    else
+                    {
+                        Label endLabel = null; // Use this if return type is void
+                        if( method.getExceptionTypes().length > 0 )
+                        {
+                            exceptions = new String[ method.getExceptionTypes().length ];
+                            for( int i = 0; i < method.getExceptionTypes().length; i++ )
+                            {
+                                Class<?> aClass = method.getExceptionTypes()[ i ];
+                                exceptions[ i ] = getInternalName( aClass );
+                            }
+                        }
+                        mv.visitCode();
+                        Label l0 = new Label();
+                        Label l1 = new Label();
+
+                        exceptionLabels.clear();
+                        for( Class<?> declaredException : method.getExceptionTypes() )
+                        {
+                            Label ld = new Label();
+                            mv.visitTryCatchBlock( l0, l1, ld, getInternalName( declaredException ) );
+                            exceptionLabels.add( ld ); // Reuse this further down for the catch
+                        }
+
+                        Label lruntime = new Label();
+                        mv.visitTryCatchBlock( l0, l1, lruntime, "java/lang/RuntimeException" );
+                        Label lerror = new Label();
+                        mv.visitTryCatchBlock( l0, l1, lerror, "java/lang/Throwable" );
+
+                        mv.visitLabel( l0 );
+                        mv.visitVarInsn( ALOAD, 0 );
+                        mv.visitFieldInsn( GETFIELD, classSlash, "_instance",
+                                           "Lorg/apache/polygene/api/composite/CompositeInvoker;" );
+                        mv.visitFieldInsn( GETSTATIC, classSlash, "m" + idx, "Ljava/lang/reflect/Method;" );
+
+                        int paramCount = method.getParameterTypes().length;
+                        int stackIdx = 0;
+                        if( paramCount == 0 )
+                        {
+                            // Send in null as parameter
+                            mv.visitInsn( ACONST_NULL );
+                        }
+                        else
+                        {
+                            insn( mv, paramCount );
+                            mv.visitTypeInsn( ANEWARRAY, "java/lang/Object" );
+                            int pidx = 0;
+                            for( Class<?> aClass : method.getParameterTypes() )
+                            {
+                                mv.visitInsn( DUP );
+                                insn( mv, pidx++ );
+                                stackIdx = wrapParameter( mv, aClass, stackIdx + 1 );
+                                mv.visitInsn( AASTORE );
+                            }
+                        }
+
+                        // Call method
+                        mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/api/composite/CompositeInvoker",
+                                            "invokeComposite",
+                                            "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
+
+                        // Return value
+                        if( !method.getReturnType().equals( Void.TYPE ) )
+                        {
+                            unwrapResult( mv, method.getReturnType(), l1 );
+                        }
+                        else
+                        {
+                            mv.visitInsn( POP );
+                            mv.visitLabel( l1 );
+                            endLabel = new Label();
+                            mv.visitJumpInsn( GOTO, endLabel );
+                        }
+
+                        // Increase stack to beyond method args
+                        stackIdx++;
+
+                        // Declared exceptions
+                        int exceptionIdx = 0;
+                        for( Class<?> aClass : method.getExceptionTypes() )
+                        {
+                            mv.visitLabel( exceptionLabels.get( exceptionIdx++ ) );
+                            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ getInternalName( aClass ) } );
+                            mv.visitVarInsn( ASTORE, stackIdx );
+                            mv.visitVarInsn( ALOAD, stackIdx );
+                            mv.visitInsn( ATHROW );
+                        }
+
+                        // RuntimeException and Error catch-all
+                        mv.visitLabel( lruntime );
+                        mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/RuntimeException" } );
+                        mv.visitVarInsn( ASTORE, stackIdx );
+                        mv.visitVarInsn( ALOAD, stackIdx );
+                        mv.visitInsn( ATHROW );
+
+                        mv.visitLabel( lerror );
+                        mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/Throwable" } );
+                        mv.visitVarInsn( ASTORE, stackIdx );
+                        mv.visitVarInsn( ALOAD, stackIdx );
+                        mv.visitTypeInsn( CHECKCAST, "java/lang/Error" );
+                        mv.visitInsn( ATHROW );
+
+                        // Return type = void
+                        if( endLabel != null )
+                        {
+                            mv.visitLabel( endLabel );
+                            mv.visitFrame( Opcodes.F_SAME, 0, null, 0, null );
+                            mv.visitInsn( RETURN );
+                        }
+
+                        mv.visitMaxs( 0, 0 );
+                        mv.visitEnd();
+                    }
+                }
+
+                if( !Modifier.isAbstract( method.getModifiers() ) )
+                {
+                    // Add method with _ as prefix
+                    MethodVisitor mv = cw.visitMethod( ACC_PUBLIC, "_" + method.getName(), desc, null, exceptions );
+                    mv.visitCode();
+                    mv.visitVarInsn( ALOAD, 0 );
+
+                    // Parameters
+                    int stackIdx = 1;
+                    for( Class<?> aClass : method.getParameterTypes() )
+                    {
+                        stackIdx = loadParameter( mv, aClass, stackIdx ) + 1;
+                    }
+
+                    // Call method
+                    mv.visitMethodInsn( INVOKESPECIAL, baseClassSlash, method.getName(), desc, false );
+
+                    // Return value
+                    if( !method.getReturnType().equals( Void.TYPE ) )
+                    {
+                        returnResult( mv, method.getReturnType() );
+                    }
+                    else
+                    {
+                        mv.visitInsn( RETURN );
+                    }
+
+                    mv.visitMaxs( 1, 1 );
+                    mv.visitEnd();
+                }
+            }
+        }
+
+        // Class initializer
+        {
+            MethodVisitor mv = cw.visitMethod( ACC_STATIC, "<clinit>", "()V", null, null );
+            mv.visitCode();
+            Label l0 = new Label();
+            Label l1 = new Label();
+            Label l2 = new Label();
+            mv.visitTryCatchBlock( l0, l1, l2, "java/lang/NoSuchMethodException" );
+            mv.visitLabel( l0 );
+
+            // Lookup methods and store in static variables
+            int midx = 0;
+            for( Method method : methods )
+            {
+                if( isOverloaded( method, baseClass ) )
+                {
+                    method.setAccessible( true );
+                    Class methodClass = method.getDeclaringClass();
+
+                    midx++;
+
+                    mv.visitLdcInsn( Type.getType( methodClass ) );
+                    mv.visitLdcInsn( method.getName() );
+                    insn( mv, method.getParameterTypes().length );
+                    mv.visitTypeInsn( ANEWARRAY, "java/lang/Class" );
+
+                    int pidx = 0;
+                    for( Class<?> aClass : method.getParameterTypes() )
+                    {
+                        mv.visitInsn( DUP );
+                        insn( mv, pidx++ );
+                        type( mv, aClass );
+                        mv.visitInsn( AASTORE );
+                    }
+
+                    mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Class", "getMethod",
+                                        "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;", false );
+                    mv.visitFieldInsn( PUTSTATIC, classSlash, "m" + midx, "Ljava/lang/reflect/Method;" );
+                }
+            }
+
+            mv.visitLabel( l1 );
+            Label l3 = new Label();
+            mv.visitJumpInsn( GOTO, l3 );
+            mv.visitLabel( l2 );
+            mv.visitFrame( Opcodes.F_SAME1, 0, null, 1, new Object[]{ "java/lang/NoSuchMethodException" } );
+            mv.visitVarInsn( ASTORE, 0 );
+            mv.visitVarInsn( ALOAD, 0 );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/NoSuchMethodException", "printStackTrace", "()V", false );
+            mv.visitLabel( l3 );
+            mv.visitFrame( Opcodes.F_SAME, 0, null, 0, null );
+            mv.visitInsn( RETURN );
+            mv.visitMaxs( 6, 1 );
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    private static boolean isOverloaded( Method method, Class baseClass )
+    {
+        return !Modifier.isFinal( method.getModifiers() );
+    }
+
+    private static boolean isInternalPolygeneMethod( Method method, Class baseClass )
+    {
+        return isDeclaredIn( method, Initializable.class, baseClass )
+               || isDeclaredIn( method, Lifecycle.class, baseClass );
+    }
+
+    private static boolean isDeclaredIn( Method method, Class<?> clazz, Class<?> baseClass )
+    {
+        if( !clazz.isAssignableFrom( baseClass ) )
+        {
+            return false;
+        }
+
+        try
+        {
+            clazz.getMethod( method.getName(), method.getParameterTypes() );
+            return true;
+        }
+        catch( NoSuchMethodException e )
+        {
+            return false;
+        }
+    }
+
+    private static Class<?> getInterfaceMethodDeclaration( Method method, Class clazz )
+        throws NoSuchMethodException
+    {
+        return interfacesOf( clazz ).map( RAW_CLASS ).filter( intFace -> {
+            try
+            {
+                intFace.getMethod( method.getName(), method.getParameterTypes() );
+                return true;
+            }
+            catch( NoSuchMethodException e )
+            {
+                // Try next
+                return false;
+            }
+        } ).findFirst().orElseThrow( () -> new NoSuchMethodException( method.getName() ) );
+    }
+
+    private static boolean isInterfaceMethod( Method method, Class<?> baseClass )
+    {
+        return interfacesOf( baseClass ).map( RAW_CLASS ).filter( Methods.HAS_METHODS ).anyMatch( clazz -> {
+            try
+            {
+                Method m = clazz.getMethod( method.getName(), method.getParameterTypes() );
+                m.setAccessible( true );
+                return true;
+            }
+            catch( NoSuchMethodException e )
+            {
+                // Ignore
+            }
+            return false;
+        } );
+    }
+
+    private static void type( MethodVisitor mv, Class<?> aClass )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Integer", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Long", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Short", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Byte", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Double", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Float", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Boolean", "TYPE", "Ljava/lang/Class;" );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitFieldInsn( GETSTATIC, "java/lang/Character", "TYPE", "Ljava/lang/Class;" );
+        }
+        else
+        {
+            mv.visitLdcInsn( Type.getType( aClass ) );
+        }
+    }
+
+    private static int wrapParameter( MethodVisitor mv, Class<?> aClass, int idx )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitVarInsn( LLOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitVarInsn( DLOAD, idx );
+            idx++; // Extra jump
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitVarInsn( FLOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;", false );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+            mv.visitMethodInsn( INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false );
+        }
+        else
+        {
+            mv.visitVarInsn( ALOAD, idx );
+        }
+
+        return idx;
+    }
+
+    private static void unwrapResult( MethodVisitor mv, Class<?> aClass, Label label )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Integer" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Long" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false );
+            mv.visitLabel( label );
+            mv.visitInsn( LRETURN );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Short" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Byte" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Double" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false );
+            mv.visitLabel( label );
+            mv.visitInsn( DRETURN );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Float" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false );
+            mv.visitLabel( label );
+            mv.visitInsn( FRETURN );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Boolean" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitTypeInsn( CHECKCAST, "java/lang/Character" );
+            mv.visitMethodInsn( INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false );
+            mv.visitLabel( label );
+            mv.visitInsn( IRETURN );
+        }
+        else
+        {
+            mv.visitTypeInsn( CHECKCAST, getInternalName( aClass ) );
+            mv.visitLabel( label );
+            mv.visitInsn( ARETURN );
+        }
+    }
+
+    private static int loadParameter( MethodVisitor mv, Class<?> aClass, int idx )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitVarInsn( LLOAD, idx );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitVarInsn( DLOAD, idx );
+            idx++; // Extra jump
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitVarInsn( FLOAD, idx );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitVarInsn( ILOAD, idx );
+        }
+        else
+        {
+            mv.visitVarInsn( ALOAD, idx );
+        }
+
+        return idx;
+    }
+
+    private static void returnResult( MethodVisitor mv, Class<?> aClass )
+    {
+        if( aClass.equals( Integer.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Long.TYPE ) )
+        {
+            mv.visitInsn( LRETURN );
+        }
+        else if( aClass.equals( Short.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Byte.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Double.TYPE ) )
+        {
+            mv.visitInsn( DRETURN );
+        }
+        else if( aClass.equals( Float.TYPE ) )
+        {
+            mv.visitInsn( FRETURN );
+        }
+        else if( aClass.equals( Boolean.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else if( aClass.equals( Character.TYPE ) )
+        {
+            mv.visitInsn( IRETURN );
+        }
+        else
+        {
+            mv.visitTypeInsn( CHECKCAST, getInternalName( aClass ) );
+            mv.visitInsn( ARETURN );
+        }
+    }
+
+    private static void insn( MethodVisitor mv, int length )
+    {
+        switch( length )
+        {
+        case 0:
+            mv.visitInsn( ICONST_0 );
+            return;
+        case 1:
+            mv.visitInsn( ICONST_1 );
+            return;
+        case 2:
+            mv.visitInsn( ICONST_2 );
+            return;
+        case 3:
+            mv.visitInsn( ICONST_3 );
+            return;
+        case 4:
+            mv.visitInsn( ICONST_4 );
+            return;
+        case 5:
+            mv.visitInsn( ICONST_5 );
+            return;
+        default:
+            mv.visitIntInsn( BIPUSH, length );
+        }
+    }
+
+    public static boolean isGenerated( Class clazz )
+    {
+        return clazz.getName().endsWith( GENERATED_POSTFIX );
+    }
+
+    public static boolean isGenerated( Object object )
+    {
+        return object.getClass().getName().endsWith( GENERATED_POSTFIX );
+    }
+
+    public Class loadFragmentClass( Class fragmentClass )
+        throws ClassNotFoundException
+    {
+        return loadClass( fragmentClass.getName().replace( '$', '_' ) + GENERATED_POSTFIX );
+    }
+
+    public static Class getSourceClass( Class fragmentClass )
+    {
+        return fragmentClass.getName().endsWith( GENERATED_POSTFIX ) ? fragmentClass.getSuperclass() : fragmentClass;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientInstance.java
new file mode 100644
index 0000000..a251349
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientInstance.java
@@ -0,0 +1,224 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Arrays;
+import java.util.stream.Stream;
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.structure.LayerDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+
+/**
+ * InvocationHandler for proxy objects.
+ */
+public class TransientInstance
+    implements CompositeInstance, MixinsInstance
+{
+    public static TransientInstance compositeInstanceOf( Composite composite )
+    {
+        InvocationHandler handler = Proxy.getInvocationHandler( composite );
+        return (TransientInstance) handler;
+    }
+
+    private final Composite proxy;
+    protected final Object[] mixins;
+    protected StateHolder state;
+    protected final CompositeModel compositeModel;
+
+    public TransientInstance( CompositeModel compositeModel,
+                              Object[] mixins,
+                              StateHolder state
+    )
+    {
+        this.compositeModel = compositeModel;
+        this.mixins = mixins;
+        this.state = state;
+
+        proxy = compositeModel.newProxy( this );
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return compositeModel.invoke( this, proxy, method, args );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> T proxy()
+    {
+        return (T) proxy;
+    }
+
+    @Override
+    public <T> T newProxy( Class<T> mixinType )
+        throws IllegalArgumentException
+    {
+        return compositeModel.newProxy( this, mixinType );
+    }
+
+    @Override
+    public Object invokeComposite( Method method, Object[] args )
+        throws Throwable
+    {
+        return compositeModel.invoke( this, proxy, method, args );
+    }
+
+    @Override
+    public CompositeModel descriptor()
+    {
+        return compositeModel;
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return compositeModel.metaInfo( infoType );
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return compositeModel.types();
+    }
+
+    @Override
+    public ModuleDescriptor module()
+    {
+        return compositeModel.module();
+    }
+
+    public LayerDescriptor layer()
+    {
+        return compositeModel.module().layer();
+    }
+
+    @Override
+    public StateHolder state()
+    {
+        return state;
+    }
+
+    @Override
+    public Object invoke( Object composite, Object[] params, CompositeMethodInstance methodInstance )
+        throws Throwable
+    {
+        Object mixin = methodInstance.getMixinFrom( mixins );
+        return methodInstance.invoke( proxy, params, mixin );
+    }
+
+    @Override
+    public Object invokeObject( Object proxy, Object[] args, Method method )
+        throws Throwable
+    {
+        return method.invoke( this, args );
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( o == null )
+        {
+            return false;
+        }
+        if( !Proxy.isProxyClass( o.getClass() ) )
+        {
+            return false;
+        }
+        TransientInstance other = (TransientInstance) PolygeneAPI.FUNCTION_COMPOSITE_INSTANCE_OF.apply( (Composite) o );
+        if( other.mixins.length != mixins.length )
+        {
+            return false;
+        }
+
+        for( int i = 0; i < mixins.length; i++ )
+        {
+            if( !mixins[ i ].equals( other.mixins[ i ] ) )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hashCode = 0;
+        for( Object mixin : mixins )
+        {
+            hashCode = hashCode * 31 + mixin.hashCode();
+        }
+        return hashCode;
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder buffer = new StringBuilder();
+        boolean first = true;
+        for( Object mixin : mixins )
+        {
+            try
+            {
+                if( mixin != null )  // Can happen during construction of incorrect composites, during exception creation.
+                {
+                    Class<?> type = mixin.getClass();
+                    Method toStringMethod = type.getMethod( "toString" );
+                    Class<?> declaringClass = toStringMethod.getDeclaringClass();
+                    if( !declaringClass.equals( Object.class ) )
+                    {
+                        if( !first )
+                        {
+                            buffer.append( ", " );
+                        }
+                        first = false;
+                        buffer.append( mixin.toString() );
+                    }
+                }
+            }
+            catch( NoSuchMethodException e )
+            {
+                // Can not happen??
+                e.printStackTrace();
+            }
+        }
+        if( first )
+        {
+            String modelTypeName = compositeModel.getClass().getSimpleName();
+            String metaTypeModel = modelTypeName.substring( 0, modelTypeName.length() - 5 );
+            return metaTypeModel + "Instance{" +
+                   "mixins=" + Arrays.asList( mixins ) +
+                   ", state=" + state +
+                   ", compositeModel=" + compositeModel +
+                   ", module=" + module() +
+                   '}';
+        }
+        return buffer.toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientModel.java
new file mode 100644
index 0000000..4aedb47
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientModel.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.List;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * Model for Transient Composites
+ */
+public class TransientModel extends CompositeModel
+    implements TransientDescriptor
+{
+    public TransientModel( ModuleDescriptor module,
+                           List<Class<?>> types, final Visibility visibility,
+                           final MetaInfo metaInfo,
+                           final MixinsModel mixinsModel,
+                           final StateModel stateModel,
+                           final CompositeMethodsModel compositeMethodsModel
+    )
+    {
+        super( module, types, visibility, metaInfo, mixinsModel, stateModel, compositeMethodsModel );
+    }
+
+    public TransientInstance newInstance( UsesInstance uses,
+                                          TransientStateInstance state
+    )
+    {
+        Object[] mixins = mixinsModel.newMixinHolder();
+        TransientInstance compositeInstance = new TransientInstance( this, mixins, state );
+
+        // Instantiate all mixins
+        int i = 0;
+        InjectionContext injectionContext = new InjectionContext( compositeInstance, uses, state );
+        for( MixinModel mixinModel : mixinsModel.mixinModels() )
+        {
+            mixins[ i++ ] = mixinModel.newInstance( injectionContext );
+        }
+
+        // Return
+        return compositeInstance;
+    }
+
+    public void checkConstraints( TransientStateInstance instanceState )
+        throws ConstraintViolationException
+    {
+        stateModel.properties().forEach( propertyModel ->
+            propertyModel.checkConstraints( instanceState.propertyFor( propertyModel.accessor() ).get() )
+        );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientStateInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientStateInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientStateInstance.java
new file mode 100644
index 0000000..c70c3b8
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientStateInstance.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.property.StateHolder;
+
+/**
+ * TODO
+ */
+public final class TransientStateInstance
+    implements StateHolder
+{
+    private final Map<AccessibleObject, Property<?>> properties;
+
+    public TransientStateInstance( Map<AccessibleObject, Property<?>> properties
+    )
+    {
+        this.properties = properties;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> Property<T> propertyFor( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        Property<T> property = (Property<T>) properties.get( accessor );
+
+        if( property == null )
+        {
+            throw new IllegalArgumentException( "No such property:" + accessor );
+        }
+
+        return property;
+    }
+
+    @Override
+    public Stream<Property<?>> properties()
+    {
+        return properties.values().stream();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientsModel.java
new file mode 100644
index 0000000..a18ef09
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientsModel.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public class TransientsModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<TransientModel> transientModels;
+
+    public TransientsModel( List<TransientModel> transientModels )
+    {
+        this.transientModels = transientModels;
+    }
+
+    public Stream<TransientModel> models()
+    {
+        return transientModels.stream();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( TransientModel transientModel : transientModels )
+            {
+                if( !transientModel.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    public Stream<? extends TransientDescriptor> stream()
+    {
+        return transientModels.stream();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
new file mode 100644
index 0000000..399e3f2
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+
+/**
+ * JAVADOC
+ */
+public final class TypedModifierInvocationHandler
+    extends FragmentInvocationHandler
+{
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        try
+        {
+            return this.method.invoke( fragment, args );
+        }
+        catch( InvocationTargetException e )
+        {
+            throw cleanStackTrace( e.getTargetException(), proxy, method );
+        }
+        catch( Throwable e )
+        {
+            if( fragment == null )
+            {
+                throw new InvalidCompositeException( "No fragment available for method " + method.getName() );
+            }
+            throw cleanStackTrace( e, proxy, method );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UnsynchronizedCompositeMethodInstancePool.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UnsynchronizedCompositeMethodInstancePool.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UnsynchronizedCompositeMethodInstancePool.java
new file mode 100644
index 0000000..56bfce5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UnsynchronizedCompositeMethodInstancePool.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+/**
+ * Method instance pool that keeps a linked list. Uses synchronization
+ * to ensure that instances are acquired and returned in a thread-safe
+ * manner.
+ */
+public final class UnsynchronizedCompositeMethodInstancePool
+    implements InstancePool<CompositeMethodInstance>
+{
+    private CompositeMethodInstance first = null;
+
+    @Override
+    public CompositeMethodInstance obtainInstance()
+    {
+        CompositeMethodInstance instance = first;
+        if( instance != null )
+        {
+            first = instance.getNext();
+        }
+        return instance;
+    }
+
+    @Override
+    public void releaseInstance( CompositeMethodInstance instance )
+    {
+        instance.setNext( first );
+        first = instance;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsageGraph.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsageGraph.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsageGraph.java
new file mode 100644
index 0000000..c0a0b35
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsageGraph.java
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import org.apache.polygene.bootstrap.BindingException;
+
+/**
+ * This class is NOT thread-safe.
+ * //TODO: Algorithm need to be optimized.
+ */
+public final class UsageGraph<K>
+{
+    private final Collection<K> data;
+    private final Use<K> use;
+    private final boolean allowCyclic;
+    private List<K> resolved;
+    private HashMap<K, List<K>> transitive;
+
+    public UsageGraph( Collection<K> data, Use<K> use, boolean allowCyclic )
+    {
+        this.data = data;
+        this.use = use;
+        this.allowCyclic = allowCyclic;
+    }
+
+    public boolean transitiveUse( K source, K other )
+        throws BindingException
+    {
+        if( transitive == null )
+        {
+            buildUsageGraph();
+        }
+        return transitive.containsKey( source ) && transitive.get( source ).contains( other );
+    }
+
+    private void checkCyclic( List<K> visited, K sourceItem, K used )
+        throws BindingException
+    {
+        Collection<K> nextLevel = use.uses( used );
+        for( K next : nextLevel )
+        {
+            if( next == sourceItem )
+            {
+                if( !allowCyclic )
+                {
+                    visited.add( next );
+                    throw new BindingException( "Cyclic usage detected: " + sourceItem + " -> " + visited );
+                }
+            }
+            if( !visited.contains( next ) )
+            {
+                visited.add( next );
+                checkCyclic( visited, sourceItem, next );
+            }
+        }
+    }
+
+    /**
+     * Must be called if the data set has been modified.
+     */
+    public void invalidate()
+    {
+        resolved = null;
+        transitive = null;
+    }
+
+    public List<K> resolveOrder()
+        throws BindingException
+    {
+        if( resolved == null )
+        {
+            buildUsageGraph();
+            resolved = new LinkedList<K>();
+            for( K item : data )
+            {
+                int pos = resolved.size();
+                for( K entry : resolved )
+                {
+                    if( transitiveUse( entry, item ) )
+                    {
+                        pos = resolved.indexOf( entry );
+                        break;
+                    }
+                }
+                resolved.add( pos, item );
+            }
+        }
+        return resolved;
+    }
+
+    private void buildUsageGraph()
+        throws BindingException
+    {
+        transitive = new HashMap<K, List<K>>();
+        for( K sourceItem : data )
+        {
+            LinkedList<K> visited = new LinkedList<K>();
+            checkCyclic( visited, sourceItem, sourceItem );
+            transitive.put( sourceItem, visited );
+        }
+    }
+
+    public interface Use<K>
+    {
+
+        /**
+         * @param source The item to be queried.
+         *
+         * @return A list of items it uses.
+         */
+        Collection<K> uses( K source );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsesInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsesInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsesInstance.java
new file mode 100644
index 0000000..0fc8eb3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/UsesInstance.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * JAVADOC
+ */
+public final class UsesInstance
+{
+    public static final UsesInstance EMPTY_USES;
+    private final Set<Object> uses;
+
+    static
+    {
+        EMPTY_USES = new UsesInstance( new HashSet<>() );
+    }
+
+    private UsesInstance( HashSet<Object> uses )
+    {
+        this.uses = Collections.unmodifiableSet( uses );
+    }
+
+    public UsesInstance use( Object... objects )
+    {
+        HashSet<Object> useObjects = new HashSet<>();
+        if( !uses.isEmpty() )
+        {
+            useObjects.addAll( uses );
+            for( Object object : objects )
+            {
+                Object oldUseForType = useForType( object.getClass() );
+                if( oldUseForType != null )
+                {
+                    useObjects.remove( oldUseForType );
+                }
+            }
+        }
+        useObjects.addAll( Arrays.asList( objects ) );
+        return new UsesInstance( useObjects );
+    }
+
+    public Object useForType( Class<?> type )
+    {
+        // Check instances first
+        for( Object use : uses )
+        {
+            if( type.isInstance( use ) )
+            {
+                return use;
+            }
+        }
+
+        return null;
+    }
+
+    public Object[] toArray()
+    {
+        return uses.toArray();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        UsesInstance that = (UsesInstance) o;
+        return uses.equals( that.uses );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return uses.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        return "UsesInstance{" +
+               "uses=" + uses +
+               '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsInstance.java
new file mode 100644
index 0000000..783a4ef
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsInstance.java
@@ -0,0 +1,145 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+
+/**
+ * JAVADOC
+ */
+public final class ValueConstraintsInstance
+{
+    private static final Optional OPTIONAL;
+
+    static
+    {
+        OPTIONAL = new OptionalDummy();
+    }
+
+    @SuppressWarnings( "raw" )
+    private final List<ConstraintInstance> constraints;
+    private String name;
+    private boolean optional;
+
+    public ValueConstraintsInstance( List<AbstractConstraintModel> constraintModels, String name, boolean optional )
+    {
+        this.name = name;
+        this.optional = optional;
+        constraints = new ArrayList<>();
+        for( AbstractConstraintModel constraintModel : constraintModels )
+        {
+            constraints.add( constraintModel.newInstance() );
+        }
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public List<ConstraintViolation> checkConstraints( Object value )
+    {
+        List<ConstraintViolation> violations = null;
+
+        // Check optional first - this avoids NPE's in constraints
+        if( optional )
+        {
+            if( value == null )
+            {
+                violations = Collections.emptyList();
+            }
+        }
+        else
+        {
+            if( value == null )
+            {
+                violations = new ArrayList<>();
+                violations.add( new ConstraintViolation( name, OPTIONAL, null ) );
+            }
+        }
+
+        if( violations == null && value != null )
+        {
+            for( ConstraintInstance constraint : constraints )
+            {
+                boolean valid;
+                try
+                {
+                    valid = constraint.isValid( value );
+                }
+                catch( NullPointerException e )
+                {
+                    // A NPE is the same as a failing constraint
+                    valid = false;
+                }
+
+                if( !valid )
+                {
+                    if( violations == null )
+                    {
+                        violations = new ArrayList<>();
+                    }
+                    ConstraintViolation violation = new ConstraintViolation( name, constraint.annotation(), value );
+                    violations.add( violation );
+                }
+            }
+        }
+
+        if( violations == null )
+        {
+            violations = Collections.emptyList();
+        }
+
+        return violations;
+    }
+
+    public void checkConstraints( Object value, AccessibleObject accessor )
+    {
+        List<ConstraintViolation> violations = checkConstraints( value );
+        if( !violations.isEmpty() )
+        {
+            Stream<Class<?>> empty = Stream.empty();
+            throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+        }
+    }
+
+    @SuppressWarnings( "AnnotationAsSuperInterface" )
+    private static class OptionalDummy
+        implements Optional
+    {
+        @Override
+        public Class<? extends Annotation> annotationType()
+        {
+            return Optional.class;
+        }
+
+        @Override
+        public String toString()
+        {
+            return "not optional";
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsModel.java
new file mode 100644
index 0000000..5568881
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ValueConstraintsModel.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.List;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public final class ValueConstraintsModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<AbstractConstraintModel> constraintModels;
+    private String name;
+    private boolean optional;
+
+    public ValueConstraintsModel( List<AbstractConstraintModel> constraintModels, String name, boolean optional )
+    {
+        this.constraintModels = constraintModels;
+        this.name = name;
+        this.optional = optional;
+    }
+
+    public ValueConstraintsInstance newInstance()
+    {
+        return new ValueConstraintsInstance( constraintModels, name, optional );
+    }
+
+    public boolean isConstrained()
+    {
+        if( !constraintModels.isEmpty() )
+        {
+            return true;
+        }
+
+        return !optional;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        for( AbstractConstraintModel constraintModel : constraintModels )
+        {
+            if( constraintModel.accept( modelVisitor ) )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntitiesModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntitiesModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntitiesModel.java
new file mode 100644
index 0000000..ebb3d78
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntitiesModel.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * Model of entities in a particular Module.
+ */
+public class EntitiesModel
+    implements VisitableHierarchy<Object, Object>
+{
+    private final List<EntityModel> entityModels;
+
+    public EntitiesModel( List<EntityModel> entityModels )
+    {
+        this.entityModels = entityModels;
+    }
+
+    public Stream<EntityModel> models()
+    {
+        return entityModels.stream();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( EntityModel entityModel : entityModels )
+            {
+                if( !entityModel.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    public Stream<? extends EntityDescriptor> stream()
+    {
+        return entityModels.stream();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityInstance.java
new file mode 100644
index 0000000..a58cee9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityInstance.java
@@ -0,0 +1,317 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkException;
+import org.apache.polygene.runtime.composite.CompositeMethodInstance;
+import org.apache.polygene.runtime.composite.MixinsInstance;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entity.EntityStatus;
+
+import static java.util.stream.Collectors.toList;
+
+/**
+ * Entity instance
+ */
+public final class EntityInstance
+    implements CompositeInstance, MixinsInstance
+{
+    public static EntityInstance entityInstanceOf( EntityComposite composite )
+    {
+        return (EntityInstance) Proxy.getInvocationHandler( composite );
+    }
+
+    private final EntityComposite proxy;
+    private final UnitOfWork uow;
+    private final EntityModel entityModel;
+    private final EntityReference reference;
+    private final EntityState entityState;
+
+    private Object[] mixins;
+    private EntityStateInstance state;
+
+    public EntityInstance( UnitOfWork uow,
+                           EntityModel entityModel,
+                           EntityState entityState
+    )
+    {
+        this.uow = uow;
+        this.entityModel = entityModel;
+        this.reference = entityState.entityReference();
+        this.entityState = entityState;
+
+        proxy = (EntityComposite) entityModel.newProxy( this );
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return entityModel.invoke( this, this.proxy, method, args );
+    }
+
+    public EntityReference reference()
+    {
+        return reference;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> T proxy()
+    {
+        return (T) proxy;
+    }
+
+    @Override
+    public CompositeDescriptor descriptor()
+    {
+        return entityModel;
+    }
+
+    @Override
+    public <T> T newProxy( Class<T> mixinType )
+        throws IllegalArgumentException
+    {
+        return entityModel.newProxy( this, mixinType );
+    }
+
+    @Override
+    public Object invokeComposite( Method method, Object[] args )
+        throws Throwable
+    {
+        return entityModel.invoke( this, proxy, method, args );
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return entityModel.metaInfo( infoType );
+    }
+
+    public EntityModel entityModel()
+    {
+        return entityModel;
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return entityModel.types();
+    }
+
+    @Override
+    public ModuleDescriptor module()
+    {
+        return entityModel.module();
+    }
+
+    public UnitOfWork unitOfWork()
+    {
+        return uow;
+    }
+
+    public EntityState entityState()
+    {
+        return entityState;
+    }
+
+    @Override
+    public EntityStateInstance state()
+    {
+        if( state == null )
+        {
+            initState();
+        }
+
+        return state;
+    }
+
+    public EntityStatus status()
+    {
+        return entityState.status();
+    }
+
+    @Override
+    public Object invoke( Object composite, Object[] params, CompositeMethodInstance methodInstance )
+        throws Throwable
+    {
+        if( mixins == null )
+        {
+            initState();
+        }
+
+        Object mixin = methodInstance.getMixinFrom( mixins );
+
+        if( mixin == null )
+        {
+            mixin = entityModel.newMixin( mixins, state, this, methodInstance.method() );
+        }
+
+        return methodInstance.invoke( proxy, params, mixin );
+    }
+
+    @Override
+    public Object invokeObject( Object proxy, Object[] args, Method method )
+        throws Throwable
+    {
+        return method.invoke( this, args );
+    }
+
+    private void initState()
+    {
+        if( !uow.isOpen() )
+        {
+            throw new UnitOfWorkException( "Unit of work has been closed" );
+        }
+
+        if( status() == EntityStatus.REMOVED )
+        {
+            throw new NoSuchEntityException(reference, entityModel.types(), unitOfWork().usecase() );
+        }
+
+        mixins = entityModel.newMixinHolder();
+        state = new EntityStateInstance( entityModel.state(), uow, entityState );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return reference.hashCode();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        try
+        {
+            HasIdentity other = ( (HasIdentity) o );
+            return other != null && other.identity().get().equals( reference.identity() );
+        }
+        catch( ClassCastException e )
+        {
+            return false;
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        if( Boolean.getBoolean( "polygene.entity.print.state" ) )
+        {
+            return state.toString();
+        }
+        else
+        {
+            return reference.toString();
+        }
+    }
+
+    public void remove( UnitOfWork unitOfWork )
+    {
+        invokeRemove();
+
+        removeAggregatedEntities( unitOfWork );
+
+        entityState.remove();
+        mixins = null;
+    }
+
+    public void invokeCreate()
+    {
+        lifecyleInvoke( true );
+    }
+
+    private void invokeRemove()
+    {
+        lifecyleInvoke( false );
+    }
+
+    private void lifecyleInvoke( boolean create )
+    {
+        if( mixins == null )
+        {
+            initState();
+        }
+
+        entityModel.invokeLifecycle( create, mixins, this, state );
+    }
+
+    private void removeAggregatedEntities( UnitOfWork unitOfWork )
+    {
+        // Calculate aggregated Entities
+        AssociationStateDescriptor stateDescriptor = entityModel.state();
+        Stream.concat(
+            stateDescriptor.associations()
+                .filter( AssociationDescriptor::isAggregated )
+                .map( association -> state.associationFor( association.accessor() ).get() )
+                .filter( Objects::nonNull ),
+
+            Stream.concat(
+                stateDescriptor.manyAssociations()
+                    .filter( AssociationDescriptor::isAggregated )
+                    .flatMap( association -> state.manyAssociationFor( association.accessor() ).toList().stream() )
+                    .filter( Objects::nonNull ),
+
+                stateDescriptor.namedAssociations()
+                    .filter( AssociationDescriptor::isAggregated )
+                    .flatMap( association -> state.namedAssociationFor( association.accessor() )
+                        .toMap()
+                        .values()
+                        .stream() )
+                    .filter( Objects::nonNull )
+            )
+        ).distinct().collect( Collectors.toList() ).forEach( unitOfWork::remove );
+    }
+
+    public void checkConstraints()
+    {
+        try
+        {
+            state.checkConstraints();
+        }
+        catch( ConstraintViolationException e )
+        {
+            List<? extends Type> entityModelList = entityModel.types().collect( toList() );
+            throw new ConstraintViolationException( reference.identity(),
+                                                    entityModelList,
+                                                    e.mixinTypeName(),
+                                                    e.methodName(),
+                                                    e.constraintViolations() );
+        }
+    }
+}


[16/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
new file mode 100644
index 0000000..6d5f6fe
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationInstance.java
@@ -0,0 +1,138 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.Type;
+import java.util.function.BiFunction;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationWrapper;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.property.Property;
+
+/**
+ * Implementation of Association to a single Entity.
+ */
+public final class AssociationInstance<T>
+    extends AbstractAssociationInstance<T>
+    implements Association<T>
+{
+    private Property<EntityReference> associationState;
+
+    public AssociationInstance( AssociationInfo associationInfo,
+                                BiFunction<EntityReference, Type, Object> entityFunction,
+                                Property<EntityReference> associationState
+    )
+    {
+        super( associationInfo, entityFunction );
+        this.associationState = associationState;
+    }
+
+    // Association implementation
+    @Override
+    public T get()
+    {
+        return getEntity( associationState.get() );
+    }
+
+    @Override
+    public void set( T newValue )
+        throws IllegalArgumentException
+    {
+        checkImmutable();
+        checkType( newValue );
+
+        associationInfo.checkConstraints( newValue );
+
+        // Change association
+        associationState.set( EntityReference.create( ((HasIdentity) newValue ).identity().get()));
+    }
+
+    @Override
+    public EntityReference reference()
+    {
+        return associationState.get();
+    }
+
+    public Property<EntityReference> getAssociationState()
+    {
+        return associationState;
+    }
+
+    @Override
+    public String toString()
+    {
+        if( associationState.get() == null )
+        {
+            return "";
+        }
+        else
+        {
+            return associationState.get().toString();
+        }
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hash = associationInfo.hashCode() * 39; // Descriptor
+        if( associationState.get() != null )
+        {
+            hash = hash * 997 + associationState.get().hashCode(); // State
+        }
+        return hash;
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        Association<?> that = (Association) o;
+        // Unwrap if needed
+        while( that instanceof AssociationWrapper )
+        {
+            that = ( (AssociationWrapper) that ).next();
+        }
+        // Descriptor equality
+        AssociationInstance<?> thatInstance = (AssociationInstance) that;
+        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
+        if( !associationInfo.equals( thatDescriptor ) )
+        {
+            return false;
+        }
+        // State equality
+        if( associationState.get() != null
+            ? !associationState.get().equals( thatInstance.associationState.get() )
+            : thatInstance.associationState.get() != null )
+        {
+            return false;
+        }
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationModel.java
new file mode 100644
index 0000000..b83021e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationModel.java
@@ -0,0 +1,229 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.Aggregated;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.Immutable;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.composite.ValueConstraintsInstance;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * Model for an Association.
+ *
+ * <p>Equality is based on the Association accessor object (associated type and name), not on the QualifiedName.</p>
+ */
+public final class AssociationModel
+    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<AssociationModel>
+{
+    private MetaInfo metaInfo;
+    private Type type;
+    private AccessibleObject accessor;
+    private QualifiedName qualifiedName;
+    private ValueConstraintsInstance constraints;
+    private ValueConstraintsInstance associationConstraints;
+    private boolean queryable;
+    private boolean immutable;
+    private boolean aggregated;
+    private AssociationInfo builderInfo;
+
+    public AssociationModel( AccessibleObject accessor,
+                             ValueConstraintsInstance valueConstraintsInstance,
+                             ValueConstraintsInstance associationConstraintsInstance,
+                             MetaInfo metaInfo
+    )
+    {
+        this.metaInfo = metaInfo;
+        this.constraints = valueConstraintsInstance;
+        this.associationConstraints = associationConstraintsInstance;
+        this.accessor = accessor;
+        initialize();
+    }
+
+    private void initialize()
+    {
+        this.type = GenericAssociationInfo.associationTypeOf( accessor );
+        this.qualifiedName = QualifiedName.fromAccessor( accessor );
+        this.immutable = metaInfo.get( Immutable.class ) != null;
+        this.aggregated = metaInfo.get( Aggregated.class ) != null;
+
+        final Queryable queryable = accessor.getAnnotation( Queryable.class );
+        this.queryable = queryable == null || queryable.value();
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public QualifiedName qualifiedName()
+    {
+        return qualifiedName;
+    }
+
+    @Override
+    public Type type()
+    {
+        return type;
+    }
+
+    @Override
+    public boolean isImmutable()
+    {
+        return immutable;
+    }
+
+    @Override
+    public boolean isAggregated()
+    {
+        return aggregated;
+    }
+
+    @Override
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public boolean queryable()
+    {
+        return queryable;
+    }
+
+    public AssociationInfo getBuilderInfo()
+    {
+        return builderInfo;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super AssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        return visitor.visit( this );
+    }
+
+    @Override
+    public void checkConstraints( Object value )
+        throws ConstraintViolationException
+    {
+        constraints.checkConstraints( value, accessor );
+    }
+
+    public void checkAssociationConstraints( Association<?> association )
+        throws ConstraintViolationException
+    {
+        associationConstraints.checkConstraints( association, accessor );
+    }
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        builderInfo = new AssociationInfo()
+        {
+            @Override
+            public boolean isImmutable()
+            {
+                return false;
+            }
+
+            @Override
+            public QualifiedName qualifiedName()
+            {
+                return qualifiedName;
+            }
+
+            @Override
+            public Type type()
+            {
+                return type;
+            }
+
+            @Override
+            public void checkConstraints( Object value )
+                throws ConstraintViolationException
+            {
+                AssociationModel.this.checkConstraints( value );
+            }
+        };
+
+        if( type instanceof TypeVariable )
+        {
+
+            Class mainType = resolution.model().types().findFirst().orElse( null );
+            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
+        }
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        AssociationModel that = (AssociationModel) o;
+        return accessor.equals( that.accessor );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return accessor.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        if( accessor instanceof Field )
+        {
+            return ( (Field) accessor ).toGenericString();
+        }
+        else
+        {
+            return ( (Method) accessor ).toGenericString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationsModel.java
new file mode 100644
index 0000000..aad7d83
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/AssociationsModel.java
@@ -0,0 +1,120 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * Model for Associations.
+ */
+public final class AssociationsModel
+    implements VisitableHierarchy<AssociationsModel, AssociationModel>
+{
+    private final Map<AccessibleObject, AssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
+
+    public AssociationsModel()
+    {
+    }
+
+    public Stream<AssociationModel> associations()
+    {
+        return mapAccessorAssociationModel.values().stream();
+    }
+
+    public void addAssociation( AssociationModel associationModel )
+    {
+        mapAccessorAssociationModel.put( associationModel.accessor(), associationModel );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super AssociationsModel, ? super AssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
+            {
+                if( !associationModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public AssociationModel getAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        AssociationModel associationModel = mapAccessorAssociationModel.get( accessor );
+        if( associationModel == null )
+        {
+            throw new IllegalArgumentException( "No association found with name:" + ( (Member) accessor ).getName() );
+        }
+        return associationModel;
+    }
+
+    public AssociationDescriptor getAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().name().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No association found with name:" + name );
+    }
+
+    public AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No association found with qualified name:" + name );
+    }
+
+    public void checkConstraints( AssociationStateHolder state )
+    {
+        for( AssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            Association<Object> association = state.<Object>associationFor( associationModel.accessor() );
+            associationModel.checkAssociationConstraints( association );
+            associationModel.checkConstraints( association.get() );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationInstance.java
new file mode 100644
index 0000000..b035745
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationInstance.java
@@ -0,0 +1,226 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.ManyAssociationWrapper;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.spi.entity.ManyAssociationState;
+
+/**
+ * JAVADOC
+ */
+public class ManyAssociationInstance<T>
+    extends AbstractAssociationInstance<T>
+    implements ManyAssociation<T>
+{
+    private ManyAssociationState manyAssociationState;
+
+    public ManyAssociationInstance( AssociationInfo associationInfo,
+                                    BiFunction<EntityReference, Type, Object> associationFunction,
+                                    ManyAssociationState manyAssociationState
+    )
+    {
+        super( associationInfo, associationFunction );
+        this.manyAssociationState = manyAssociationState;
+    }
+
+    @Override
+    public int count()
+    {
+        return manyAssociationState.count();
+    }
+
+    @Override
+    public boolean contains( T entity )
+    {
+        return manyAssociationState.contains( getEntityReference( entity ) );
+    }
+
+    @Override
+    public boolean add( int i, T entity )
+    {
+        NullArgumentException.validateNotNull( "entity", entity );
+        checkImmutable();
+        checkType( entity );
+        associationInfo.checkConstraints( entity );
+        return manyAssociationState.add( i, EntityReference.create( ((HasIdentity) entity ).identity().get()) );
+    }
+
+    @Override
+    public boolean add( T entity )
+    {
+        return add( manyAssociationState.count(), entity );
+    }
+
+    @Override
+    public boolean remove( T entity )
+    {
+        NullArgumentException.validateNotNull( "entity", entity );
+        checkImmutable();
+        checkType( entity );
+
+        return manyAssociationState.remove( EntityReference.create( ((HasIdentity) entity).identity().get() ) );
+    }
+
+    @Override
+    public T get( int i )
+    {
+        return getEntity( manyAssociationState.get( i ) );
+    }
+
+    @Override
+    public List<T> toList()
+    {
+        ArrayList<T> list = new ArrayList<>();
+        for( EntityReference entityReference : manyAssociationState )
+        {
+            list.add( getEntity( entityReference ) );
+        }
+
+        return list;
+    }
+
+    @Override
+    public Set<T> toSet()
+    {
+        Set<T> set = new HashSet<>();
+        for( EntityReference entityReference : manyAssociationState )
+        {
+            set.add( getEntity( entityReference ) );
+        }
+
+        return set;
+    }
+
+    @Override
+    public Stream<EntityReference> references()
+    {
+        return manyAssociationState.stream();
+    }
+
+    @Override
+    public String toString()
+    {
+        return manyAssociationState.toString();
+    }
+
+    @Override
+    public Iterator<T> iterator()
+    {
+        return new ManyAssociationIterator( manyAssociationState.iterator() );
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        ManyAssociation<?> that = (ManyAssociation) o;
+        // Unwrap if needed
+        while( that instanceof ManyAssociationWrapper )
+        {
+            that = ( (ManyAssociationWrapper) that ).next();
+        }
+        // Descriptor equality
+        ManyAssociationInstance<?> thatInstance = (ManyAssociationInstance) that;
+        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
+        if( !associationInfo.equals( thatDescriptor ) )
+        {
+            return false;
+        }
+        // State equality
+        if( manyAssociationState.count() != thatInstance.manyAssociationState.count() )
+        {
+            return false;
+        }
+        for( EntityReference ref : manyAssociationState )
+        {
+            if( !thatInstance.manyAssociationState.contains( ref ) )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hash = associationInfo.hashCode() * 31; // Descriptor
+        for( EntityReference ref : manyAssociationState )
+        {
+            hash += ref.hashCode() * 7; // State
+        }
+        return hash;
+    }
+
+    public ManyAssociationState getManyAssociationState()
+    {
+        return manyAssociationState;
+    }
+
+    protected class ManyAssociationIterator
+        implements Iterator<T>
+    {
+        private final Iterator<EntityReference> idIterator;
+
+        public ManyAssociationIterator( Iterator<EntityReference> idIterator )
+        {
+            this.idIterator = idIterator;
+        }
+
+        @Override
+        public boolean hasNext()
+        {
+            return idIterator.hasNext();
+        }
+
+        @Override
+        public T next()
+        {
+            return getEntity( idIterator.next() );
+        }
+
+        @Override
+        public void remove()
+        {
+            checkImmutable();
+            idIterator.remove();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationModel.java
new file mode 100644
index 0000000..e8fd0b6
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationModel.java
@@ -0,0 +1,265 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.Aggregated;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.Immutable;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.composite.ValueConstraintsInstance;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.unitofwork.BuilderEntityState;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * Model for a ManyAssociation.
+ *
+ * <p>Equality is based on the ManyAssociation accessor object (associated type and name), not on the QualifiedName.</p>
+ */
+public final class ManyAssociationModel
+    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<ManyAssociationModel>
+{
+    private final ValueConstraintsInstance associationConstraints;
+    private final MetaInfo metaInfo;
+    private Type type;
+    private final AccessibleObject accessor;
+    private QualifiedName qualifiedName;
+    private final ValueConstraintsInstance constraints;
+    private boolean queryable;
+    private boolean immutable;
+    private boolean aggregated;
+    private AssociationInfo builderInfo;
+
+    public ManyAssociationModel( AccessibleObject accessor,
+                                 ValueConstraintsInstance valueConstraintsInstance,
+                                 ValueConstraintsInstance associationConstraintsInstance,
+                                 MetaInfo metaInfo
+    )
+    {
+        this.metaInfo = metaInfo;
+        this.constraints = valueConstraintsInstance;
+        this.associationConstraints = associationConstraintsInstance;
+        this.accessor = accessor;
+        initialize();
+    }
+
+    private void initialize()
+    {
+        this.type = GenericAssociationInfo.associationTypeOf( accessor );
+        this.qualifiedName = QualifiedName.fromAccessor( accessor );
+        this.immutable = metaInfo.get( Immutable.class ) != null;
+        this.aggregated = metaInfo.get( Aggregated.class ) != null;
+
+        final Queryable queryable = accessor.getAnnotation( Queryable.class );
+        this.queryable = queryable == null || queryable.value();
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public QualifiedName qualifiedName()
+    {
+        return qualifiedName;
+    }
+
+    @Override
+    public Type type()
+    {
+        return type;
+    }
+
+    @Override
+    public boolean isImmutable()
+    {
+        return immutable;
+    }
+
+    @Override
+    public boolean isAggregated()
+    {
+        return aggregated;
+    }
+
+    @Override
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public boolean queryable()
+    {
+        return queryable;
+    }
+
+    public AssociationInfo getBuilderInfo()
+    {
+        return builderInfo;
+    }
+
+    public <T> ManyAssociation<T> newInstance( final ModuleUnitOfWork uow, EntityState state )
+    {
+        return new ManyAssociationInstance<>( state instanceof BuilderEntityState ? builderInfo : this, new BiFunction<EntityReference, Type, Object>()
+        {
+            @Override
+            public Object apply( EntityReference entityReference, Type type )
+            {
+                return uow.get( Classes.RAW_CLASS.apply( type ), entityReference.identity() );
+            }
+        }, state.manyAssociationValueOf( qualifiedName ) );
+    }
+
+    @Override
+    public void checkConstraints( Object composite )
+        throws ConstraintViolationException
+    {
+        if( constraints != null )
+        {
+            List<ConstraintViolation> violations = constraints.checkConstraints( composite );
+            if( !violations.isEmpty() )
+            {
+                Stream<Class<?>> empty = Stream.empty();
+                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+            }
+        }
+    }
+
+    public void checkAssociationConstraints( ManyAssociation manyAssociation )
+        throws ConstraintViolationException
+    {
+        if( associationConstraints != null )
+        {
+            List<ConstraintViolation> violations = associationConstraints.checkConstraints( manyAssociation );
+            if( !violations.isEmpty() )
+            {
+                Stream<Class<?>> empty = Stream.empty();
+                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+            }
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super ManyAssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        return visitor.visit( this );
+    }
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        builderInfo = new AssociationInfo()
+        {
+            @Override
+            public boolean isImmutable()
+            {
+                return false;
+            }
+
+            @Override
+            public QualifiedName qualifiedName()
+            {
+                return qualifiedName;
+            }
+
+            @Override
+            public Type type()
+            {
+                return type;
+            }
+
+            @Override
+            public void checkConstraints( Object value )
+                throws ConstraintViolationException
+            {
+                ManyAssociationModel.this.checkConstraints( value );
+            }
+        };
+
+        if( type instanceof TypeVariable )
+        {
+            Class mainType = resolution.model().types().findFirst().orElse( null );
+            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
+        }
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        ManyAssociationModel that = (ManyAssociationModel) o;
+
+        return accessor.equals( that.accessor );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return accessor.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        if( accessor instanceof Field )
+        {
+            return ( (Field) accessor ).toGenericString();
+        }
+        else
+        {
+            return ( (Method) accessor ).toGenericString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationsModel.java
new file mode 100644
index 0000000..090b180
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/ManyAssociationsModel.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.value.ValueStateInstance;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * Model for ManyAssociations.
+ */
+public final class ManyAssociationsModel
+    implements VisitableHierarchy<ManyAssociationsModel, ManyAssociationModel>
+{
+    private final Map<AccessibleObject, ManyAssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
+
+    public ManyAssociationsModel()
+    {
+    }
+
+    public Stream<ManyAssociationModel> manyAssociations()
+    {
+        return mapAccessorAssociationModel.values().stream();
+    }
+
+    public void addManyAssociation( ManyAssociationModel model )
+    {
+        mapAccessorAssociationModel.put( model.accessor(), model );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super ManyAssociationsModel, ? super ManyAssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
+            {
+                if( !associationModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public <T> ManyAssociation<T> newInstance( AccessibleObject accessor,
+                                               EntityState entityState,
+                                               ModuleUnitOfWork uow )
+    {
+        return mapAccessorAssociationModel.get( accessor ).newInstance( uow, entityState );
+    }
+
+    public ManyAssociationModel getManyAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        ManyAssociationModel manyAssociationModel = mapAccessorAssociationModel.get( accessor );
+        if( manyAssociationModel == null )
+        {
+            throw new IllegalArgumentException( "No many-association found with name:" + ( (Member) accessor ).getName() );
+        }
+        return manyAssociationModel;
+    }
+
+    public AssociationDescriptor getManyAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().name().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No many-association found with name:" + name );
+    }
+
+    public AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        for( ManyAssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No many-association found with qualified name:" + name );
+    }
+
+    public void checkConstraints( ValueStateInstance state )
+    {
+        for( ManyAssociationModel manyAssociationModel : mapAccessorAssociationModel.values() )
+        {
+            manyAssociationModel.checkAssociationConstraints( state.manyAssociationFor( manyAssociationModel.accessor() ) );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationInstance.java
new file mode 100644
index 0000000..05aa878
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationInstance.java
@@ -0,0 +1,192 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.association.NamedAssociationWrapper;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.spi.entity.NamedAssociationState;
+
+public class NamedAssociationInstance<T>
+    extends AbstractAssociationInstance<T>
+    implements NamedAssociation<T>
+{
+
+    private final NamedAssociationState namedAssociationState;
+
+    public NamedAssociationInstance( AssociationInfo associationInfo,
+                                     BiFunction<EntityReference, Type, Object> associationFunction,
+                                     NamedAssociationState namedAssociationState
+    )
+    {
+        super( associationInfo, associationFunction );
+        this.namedAssociationState = namedAssociationState;
+    }
+
+    @Override
+    public Iterator<String> iterator()
+    {
+        return namedAssociationState.iterator();
+    }
+
+    @Override
+    public int count()
+    {
+        return namedAssociationState.count();
+    }
+
+    @Override
+    public boolean containsName( String name )
+    {
+        return namedAssociationState.containsName( name );
+    }
+
+    @Override
+    public boolean put( String name, T entity )
+    {
+        NullArgumentException.validateNotNull( "entity", entity );
+        checkImmutable();
+        checkType( entity );
+        associationInfo.checkConstraints( entity );
+        return namedAssociationState.put( name, EntityReference.create( ((HasIdentity) entity).identity().get() ) );
+    }
+
+    @Override
+    public boolean remove( String name )
+    {
+        checkImmutable();
+        return namedAssociationState.remove( name );
+    }
+
+    @Override
+    public T get( String name )
+    {
+        return getEntity( namedAssociationState.get( name ) );
+    }
+
+    @Override
+    public String nameOf( T entity )
+    {
+        return namedAssociationState.nameOf( getEntityReference( entity ) );
+    }
+
+    @Override
+    public Map<String, T> toMap()
+    {
+        Map<String, T> map = new HashMap<>();
+        for( String name : namedAssociationState )
+        {
+            map.put( name, getEntity( namedAssociationState.get( name ) ) );
+        }
+        return map;
+    }
+
+    @Override
+    public Stream<Map.Entry<String, EntityReference>> references()
+    {
+        return namedAssociationState.stream();
+    }
+
+    @Override
+    public EntityReference referenceOf( String name )
+    {
+        return namedAssociationState.get( name );
+    }
+
+    public Iterable<Map.Entry<String, EntityReference>> getEntityReferences()
+    {
+        return Collections.unmodifiableMap(
+            StreamSupport.stream( namedAssociationState.spliterator(), false )
+                         .collect( Collectors.toMap( Function.identity(), namedAssociationState::get ) )
+        ).entrySet();
+    }
+
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        NamedAssociation<?> that = (NamedAssociation) o;
+        // Unwrap if needed
+        while( that instanceof NamedAssociationWrapper )
+        {
+            that = ( (NamedAssociationWrapper) that ).next();
+        }
+        // Descriptor equality
+        NamedAssociationInstance<?> thatInstance = (NamedAssociationInstance) that;
+        AssociationDescriptor thatDescriptor = (AssociationDescriptor) thatInstance.associationInfo();
+        if( !associationInfo.equals( thatDescriptor ) )
+        {
+            return false;
+        }
+        // State equality
+        if( namedAssociationState.count() != thatInstance.namedAssociationState.count() )
+        {
+            return false;
+        }
+        for( String name : namedAssociationState )
+        {
+            if( !thatInstance.namedAssociationState.containsName( name ) )
+            {
+                return false;
+            }
+            EntityReference thisReference = namedAssociationState.get( name );
+            EntityReference thatReference = thatInstance.namedAssociationState.get( name );
+            if( !thisReference.equals( thatReference ) )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        int hash = associationInfo.hashCode() * 31; // Descriptor
+        for( String name : namedAssociationState )
+        {
+            hash += name.hashCode();
+            hash += namedAssociationState.get( name ).hashCode() * 7; // State
+        }
+        return hash;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationModel.java
new file mode 100644
index 0000000..bfcec63
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationModel.java
@@ -0,0 +1,265 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.List;
+import java.util.function.BiFunction;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.GenericAssociationInfo;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.Aggregated;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.Immutable;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.composite.ValueConstraintsInstance;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.unitofwork.BuilderEntityState;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * Model for a NamedAssociation.
+ *
+ * <p>Equality is based on the NamedAssociation accessor object (associated type and name), not on the QualifiedName.</p>
+ */
+public final class NamedAssociationModel
+    implements AssociationDescriptor, AssociationInfo, Binder, Visitable<NamedAssociationModel>
+{
+    private final ValueConstraintsInstance associationConstraints;
+    private final MetaInfo metaInfo;
+    private Type type;
+    private final AccessibleObject accessor;
+    private QualifiedName qualifiedName;
+    private final ValueConstraintsInstance constraints;
+    private boolean queryable;
+    private boolean immutable;
+    private boolean aggregated;
+    private AssociationInfo builderInfo;
+
+    public NamedAssociationModel( AccessibleObject accessor,
+                                  ValueConstraintsInstance valueConstraintsInstance,
+                                  ValueConstraintsInstance associationConstraintsInstance,
+                                  MetaInfo metaInfo
+    )
+    {
+        this.metaInfo = metaInfo;
+        this.constraints = valueConstraintsInstance;
+        this.associationConstraints = associationConstraintsInstance;
+        this.accessor = accessor;
+        initialize();
+    }
+
+    private void initialize()
+    {
+        this.type = GenericAssociationInfo.associationTypeOf( accessor );
+        this.qualifiedName = QualifiedName.fromAccessor( accessor );
+        this.immutable = metaInfo.get( Immutable.class ) != null;
+        this.aggregated = metaInfo.get( Aggregated.class ) != null;
+
+        final Queryable queryable = accessor.getAnnotation( Queryable.class );
+        this.queryable = queryable == null || queryable.value();
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public QualifiedName qualifiedName()
+    {
+        return qualifiedName;
+    }
+
+    @Override
+    public Type type()
+    {
+        return type;
+    }
+
+    @Override
+    public boolean isImmutable()
+    {
+        return immutable;
+    }
+
+    @Override
+    public boolean isAggregated()
+    {
+        return aggregated;
+    }
+
+    @Override
+    public AccessibleObject accessor()
+    {
+        return accessor;
+    }
+
+    @Override
+    public boolean queryable()
+    {
+        return queryable;
+    }
+
+    public AssociationInfo getBuilderInfo()
+    {
+        return builderInfo;
+    }
+
+    public <T> NamedAssociation<T> newInstance( final ModuleUnitOfWork uow, EntityState state )
+    {
+        return new NamedAssociationInstance<>( state instanceof BuilderEntityState ? builderInfo : this, new BiFunction<EntityReference, Type, Object>()
+        {
+            @Override
+            public Object apply( EntityReference entityReference, Type type )
+            {
+                return uow.get( Classes.RAW_CLASS.apply( type ), entityReference.identity() );
+            }
+        }, state.namedAssociationValueOf( qualifiedName ) );
+    }
+
+    @Override
+    public void checkConstraints( Object composite )
+        throws ConstraintViolationException
+    {
+        if( constraints != null )
+        {
+            List<ConstraintViolation> violations = constraints.checkConstraints( composite );
+            if( !violations.isEmpty() )
+            {
+                Stream<Class<?>> empty = Stream.empty();
+                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+            }
+        }
+    }
+
+    public void checkAssociationConstraints( NamedAssociation association )
+        throws ConstraintViolationException
+    {
+        if( associationConstraints != null )
+        {
+            List<ConstraintViolation> violations = associationConstraints.checkConstraints( association );
+            if( !violations.isEmpty() )
+            {
+                Stream<Class<?>> empty = Stream.empty();
+                throw new ConstraintViolationException( "", empty, (Member) accessor, violations );
+            }
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super NamedAssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        return visitor.visit( this );
+    }
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        builderInfo = new AssociationInfo()
+        {
+            @Override
+            public boolean isImmutable()
+            {
+                return false;
+            }
+
+            @Override
+            public QualifiedName qualifiedName()
+            {
+                return qualifiedName;
+            }
+
+            @Override
+            public Type type()
+            {
+                return type;
+            }
+
+            @Override
+            public void checkConstraints( Object value )
+                throws ConstraintViolationException
+            {
+                NamedAssociationModel.this.checkConstraints( value );
+            }
+        };
+
+        if( type instanceof TypeVariable )
+        {
+            Class mainType = resolution.model().types().findFirst().orElse( null );
+            type = Classes.resolveTypeVariable( (TypeVariable) type, ( (Member) accessor ).getDeclaringClass(), mainType );
+        }
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        NamedAssociationModel that = (NamedAssociationModel) o;
+
+        return accessor.equals( that.accessor );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return accessor.hashCode();
+    }
+
+    @Override
+    public String toString()
+    {
+        if( accessor instanceof Field )
+        {
+            return ( (Field) accessor ).toGenericString();
+        }
+        else
+        {
+            return ( (Method) accessor ).toGenericString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationsModel.java
new file mode 100644
index 0000000..513b95a
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/association/NamedAssociationsModel.java
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.association;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Member;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.runtime.value.ValueStateInstance;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * Model for NamedAssociations.
+ */
+public final class NamedAssociationsModel
+    implements VisitableHierarchy<NamedAssociationsModel, NamedAssociationModel>
+{
+    private final Map<AccessibleObject, NamedAssociationModel> mapAccessorAssociationModel = new LinkedHashMap<>();
+
+    public NamedAssociationsModel()
+    {
+    }
+
+    public Stream<NamedAssociationModel> namedAssociations()
+    {
+        return mapAccessorAssociationModel.values().stream();
+    }
+
+    public void addNamedAssociation( NamedAssociationModel model )
+    {
+        mapAccessorAssociationModel.put( model.accessor(), model );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super NamedAssociationsModel, ? super NamedAssociationModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
+            {
+                if( !associationModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public <T> NamedAssociation<T> newInstance( AccessibleObject accessor,
+                                                EntityState entityState,
+                                                ModuleUnitOfWork uow )
+    {
+        return mapAccessorAssociationModel.get( accessor ).newInstance( uow, entityState );
+    }
+
+    public NamedAssociationModel getNamedAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        if( false )
+        {
+            return (NamedAssociationModel) getNamedAssociationByName( QualifiedName.fromAccessor( accessor ).name() );
+        }
+        NamedAssociationModel namedAssociationModel = mapAccessorAssociationModel.get( accessor );
+        if( namedAssociationModel == null )
+        {
+            throw new IllegalArgumentException( "No named-association found with name:" + ( (Member) accessor ).getName() );
+        }
+        return namedAssociationModel;
+    }
+
+    public AssociationDescriptor getNamedAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().name().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No named-association found with name:" + name );
+    }
+
+    public AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            if( associationModel.qualifiedName().equals( name ) )
+            {
+                return associationModel;
+            }
+        }
+        throw new IllegalArgumentException( "No named-association found with qualified name:" + name );
+    }
+
+    public void checkConstraints( ValueStateInstance state )
+    {
+        for( NamedAssociationModel associationModel : mapAccessorAssociationModel.values() )
+        {
+            associationModel.checkAssociationConstraints( state.namedAssociationFor( associationModel.accessor() ) );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AndAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AndAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AndAppliesToFilter.java
new file mode 100644
index 0000000..51e5695
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AndAppliesToFilter.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class AndAppliesToFilter
+    implements AppliesToFilter
+{
+    private final AppliesToFilter left;
+    private final AppliesToFilter right;
+
+    AndAppliesToFilter( AppliesToFilter left, AppliesToFilter right )
+    {
+        this.left = left;
+        this.right = right;
+    }
+
+    @Override
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        return left.appliesTo( method, mixin, compositeType, fragmentClass ) &&
+               right.appliesTo( method, mixin, compositeType, fragmentClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AnnotationAppliesToFilter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AnnotationAppliesToFilter.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AnnotationAppliesToFilter.java
new file mode 100644
index 0000000..006f24b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AnnotationAppliesToFilter.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesToFilter;
+
+/**
+ * JAVADOC
+ */
+final class AnnotationAppliesToFilter
+    implements AppliesToFilter
+{
+    @SuppressWarnings( "raw" )
+    private final Class annotationType;
+
+    @SuppressWarnings( "raw" )
+    AnnotationAppliesToFilter( Class type )
+    {
+        this.annotationType = type;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> fragmentClass )
+    {
+        return method.getAnnotation( annotationType ) != null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
new file mode 100644
index 0000000..46c8cee
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyFactoryImpl.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+/**
+ * Factory for ApplicationAssembly.
+ */
+public final class ApplicationAssemblyFactoryImpl
+    implements ApplicationAssemblyFactory
+{
+    @Override
+    public ApplicationAssembly newApplicationAssembly( Assembler assembler )
+        throws AssemblyException
+    {
+        return newApplicationAssembly( new Assembler[][][]{ { { assembler } } } );
+    }
+
+    @Override
+    public ApplicationAssembly newApplicationAssembly( Assembler[][][] assemblers )
+        throws AssemblyException
+    {
+        ApplicationAssembly applicationAssembly = newApplicationAssembly();
+
+        // Build all layers bottom-up
+        LayerAssembly below = null;
+        for( int layer = assemblers.length - 1; layer >= 0; layer-- )
+        {
+            // Create Layer
+            LayerAssembly layerAssembly = applicationAssembly.layer( "Layer " + ( layer + 1 ) );
+            for( int module = 0; module < assemblers[ layer ].length; module++ )
+            {
+                // Create Module
+                ModuleAssembly moduleAssembly = layerAssembly.module( "Module " + ( module + 1 ) );
+                for( Assembler assembler : assemblers[ layer ][ module ] )
+                {
+                    // Register Assembler
+                    assembler.assemble( moduleAssembly );
+                }
+            }
+            if( below != null )
+            {
+                layerAssembly.uses( below ); // Link layers
+            }
+            below = layerAssembly;
+        }
+        return applicationAssembly;
+    }
+
+    @Override
+    public ApplicationAssembly newApplicationAssembly()
+    {
+        return new ApplicationAssemblyImpl();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyImpl.java
new file mode 100644
index 0000000..ccc571b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationAssemblyImpl.java
@@ -0,0 +1,157 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyVisitor;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+
+/**
+ * The representation of an entire application. From
+ * this you can set information about the application
+ * and create LayerAssemblies.
+ */
+public final class ApplicationAssemblyImpl
+    implements ApplicationAssembly
+{
+    private final Map<String, LayerAssemblyImpl> layerAssemblies = new LinkedHashMap<>();
+    private String name = "Application";
+    private String version = "1.0"; // Default version
+    private Application.Mode mode;
+    private final MetaInfo metaInfo = new MetaInfo();
+    private final List<Class<? extends Activator<Application>>> activators = new ArrayList<>();
+
+    public ApplicationAssemblyImpl()
+    {
+        mode = Application.Mode.valueOf( System.getProperty( "mode", "production" ) );
+    }
+
+    @Override
+    public LayerAssembly layer( String name )
+    {
+        if( name != null )
+        {
+            LayerAssemblyImpl existing = layerAssemblies.get( name );
+            if( existing != null )
+            {
+                return existing;
+            }
+        }
+        LayerAssemblyImpl layerAssembly = new LayerAssemblyImpl( this, name );
+        layerAssemblies.put( name, layerAssembly );
+        return layerAssembly;
+    }
+
+    @Override
+    public ModuleAssembly module( String layerName, String moduleName )
+    {
+        return layer( layerName ).module( moduleName );
+    }
+
+    @Override
+    public ApplicationAssembly setName( String name )
+    {
+        this.name = name;
+        return this;
+    }
+
+    @Override
+    public ApplicationAssembly setVersion( String version )
+    {
+        this.version = version;
+        return this;
+    }
+
+    @Override
+    public ApplicationAssembly setMode( Application.Mode mode )
+    {
+        this.mode = mode;
+        return this;
+    }
+
+    @Override
+    public ApplicationAssembly setMetaInfo( Object info )
+    {
+        metaInfo.set( info );
+        return this;
+    }
+
+    @Override
+    @SafeVarargs
+    public final ApplicationAssembly withActivators( Class<? extends Activator<Application>>... activators )
+    {
+        this.activators.addAll( Arrays.asList( activators ) );
+        return this;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
+        throws ThrowableType
+    {
+        visitor.visitApplication( this );
+        for( LayerAssemblyImpl layerAssembly : layerAssemblies.values() )
+        {
+            layerAssembly.visit( visitor );
+        }
+    }
+
+    public Collection<LayerAssemblyImpl> layerAssemblies()
+    {
+        return layerAssemblies.values();
+    }
+
+    public List<Class<? extends Activator<Application>>> activators()
+    {
+        return activators;
+    }
+
+    public MetaInfo metaInfo()
+    {
+        return metaInfo;
+    }
+
+    @Override
+    public String name()
+    {
+        return name;
+    }
+
+    public String version()
+    {
+        return version;
+    }
+
+    @Override
+    public Application.Mode mode()
+    {
+        return mode;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationModelFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationModelFactoryImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationModelFactoryImpl.java
new file mode 100644
index 0000000..a39c521
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ApplicationModelFactoryImpl.java
@@ -0,0 +1,211 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.bootstrap;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.ApplicationModelFactory;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.runtime.activation.ActivatorsModel;
+import org.apache.polygene.runtime.composite.CompositeMethodModel;
+import org.apache.polygene.runtime.injection.InjectedFieldModel;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+import org.apache.polygene.runtime.structure.ApplicationModel;
+import org.apache.polygene.runtime.structure.LayerModel;
+import org.apache.polygene.runtime.structure.ModuleModel;
+import org.apache.polygene.runtime.structure.UsedLayersModel;
+
+/**
+ * Factory for Applications.
+ */
+public final class ApplicationModelFactoryImpl
+    implements ApplicationModelFactory
+{
+    @Override
+    public ApplicationDescriptor newApplicationModel( ApplicationAssembly assembly )
+        throws AssemblyException
+    {
+        AssemblyHelper helper = createAssemblyHelper( assembly );
+
+        ApplicationAssemblyImpl applicationAssembly = (ApplicationAssemblyImpl) assembly;
+        ActivatorsModel<Application> applicationActivators = new ActivatorsModel<>( applicationAssembly.activators() );
+        List<LayerModel> layerModels = new ArrayList<>();
+        final ApplicationModel applicationModel = new ApplicationModel( applicationAssembly.name(),
+                                                                        applicationAssembly.version(),
+                                                                        applicationAssembly.mode(),
+                                                                        applicationAssembly.metaInfo(),
+                                                                        applicationActivators,
+                                                                        layerModels );
+        Map<LayerAssembly, LayerModel> mapAssemblyModel = new HashMap<>();
+        Map<LayerAssembly, List<LayerModel>> mapUsedLayers = new HashMap<>();
+
+        // Build all layers
+        List<LayerAssemblyImpl> layerAssemblies = new ArrayList<>( applicationAssembly.layerAssemblies() );
+        for( LayerAssemblyImpl layerAssembly : layerAssemblies )
+        {
+            List<LayerModel> usedLayers = new ArrayList<>();
+            mapUsedLayers.put( layerAssembly, usedLayers );
+
+            UsedLayersModel usedLayersModel = new UsedLayersModel( usedLayers );
+            List<ModuleModel> moduleModels = new ArrayList<>();
+            String name = layerAssembly.name();
+            if( name == null )
+            {
+                throw new AssemblyException( "Layer must have name set" );
+            }
+            ActivatorsModel<Layer> layerActivators = new ActivatorsModel<>( layerAssembly.activators() );
+            LayerModel layerModel = new LayerModel( name, layerAssembly.metaInfo(), usedLayersModel, layerActivators, moduleModels );
+
+            for( ModuleAssemblyImpl moduleAssembly : layerAssembly.moduleAssemblies() )
+            {
+                moduleModels.add( moduleAssembly.assembleModule( layerModel, helper ) );
+            }
+            mapAssemblyModel.put( layerAssembly, layerModel );
+            layerModels.add( layerModel );
+        }
+
+        // Populate used layer lists
+        for( LayerAssemblyImpl layerAssembly : layerAssemblies )
+        {
+            Set<LayerAssembly> usesLayers = layerAssembly.uses();
+            List<LayerModel> usedLayers = mapUsedLayers.get( layerAssembly );
+            for( LayerAssembly usesLayer : usesLayers )
+            {
+                LayerModel layerModel = mapAssemblyModel.get( usesLayer );
+                usedLayers.add( layerModel );
+            }
+        }
+
+        // Bind model
+        // This will resolve all dependencies
+        try
+        {
+//            applicationModel.bind();
+            applicationModel.accept( new BindingVisitor( applicationModel ) );
+        }
+        catch( BindingException e )
+        {
+            throw new AssemblyException( "Unable to bind: " + applicationModel, e );
+        }
+
+        return applicationModel;
+    }
+
+    private AssemblyHelper createAssemblyHelper( ApplicationAssembly assembly )
+    {
+        if( assembly instanceof ApplicationAssemblyImpl )
+        {
+            ApplicationAssemblyImpl impl = (ApplicationAssemblyImpl) assembly;
+            AssemblyHelper helper = impl.metaInfo().get( AssemblyHelper.class );
+            if( helper != null )
+            {
+                return helper;
+            }
+        }
+        return new AssemblyHelper();
+    }
+
+    private static class BindingVisitor
+        implements HierarchicalVisitor<Object, Object, BindingException>
+    {
+        private LayerModel layer;
+        private ModuleModel module;
+        private ModelDescriptor objectDescriptor;
+        private CompositeMethodModel compositeMethodModel;
+
+        private Resolution resolution;
+        private final ApplicationModel applicationModel;
+
+        private BindingVisitor( ApplicationModel applicationModel )
+        {
+            this.applicationModel = applicationModel;
+        }
+
+        @Override
+        public boolean visitEnter( Object visited )
+            throws BindingException
+        {
+            if( visited instanceof Binder )
+            {
+                Binder binder = (Binder) visited;
+                binder.bind( resolution );
+
+                return false;
+            }
+            else if( visited instanceof CompositeMethodModel )
+            {
+                compositeMethodModel = (CompositeMethodModel) visited;
+                resolution = new Resolution( applicationModel, layer, module, objectDescriptor, compositeMethodModel, null );
+            }
+            else if( visited instanceof ModelDescriptor )
+            {
+                objectDescriptor = (ModelDescriptor) visited;
+                resolution = new Resolution( applicationModel, layer, module, objectDescriptor, null, null );
+            }
+            else if( visited instanceof InjectedFieldModel )
+            {
+                InjectedFieldModel fieldModel = (InjectedFieldModel) visited;
+                fieldModel.bind( new Resolution( applicationModel, layer, module,
+                                                 objectDescriptor, compositeMethodModel, fieldModel.field() ) );
+            }
+            else if( visited instanceof ModuleModel )
+            {
+                module = (ModuleModel) visited;
+            }
+            else if( visited instanceof LayerModel )
+            {
+                layer = (LayerModel) visited;
+            }
+
+            return true;
+        }
+
+        @Override
+        public boolean visitLeave( Object visited )
+            throws BindingException
+        {
+            return true;
+        }
+
+        @Override
+        public boolean visit( Object visited )
+            throws BindingException
+        {
+            if( visited instanceof Binder )
+            {
+                ( (Binder) visited ).bind( resolution );
+            }
+            return true;
+        }
+    }
+}
\ No newline at end of file


[39/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/UsedLayersDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/UsedLayersDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/structure/UsedLayersDescriptor.java
new file mode 100644
index 0000000..37ad6b2
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/UsedLayersDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.util.stream.Stream;
+
+/**
+ * Used Layers Descriptor.
+ */
+public interface UsedLayersDescriptor
+{
+    Stream<? extends LayerDescriptor> layers();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/package.html b/core/api/src/main/java/org/apache/polygene/api/structure/package.html
new file mode 100644
index 0000000..c44c4ad
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Application Structure API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/time/SystemTime.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/time/SystemTime.java b/core/api/src/main/java/org/apache/polygene/api/time/SystemTime.java
new file mode 100644
index 0000000..a469001
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/time/SystemTime.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.time;
+
+import java.time.Clock;
+import java.time.Instant;
+
+public class SystemTime
+{
+    private static Clock defaultClock = Clock.systemUTC();
+
+    public static Clock getDefaultClock()
+    {
+        return defaultClock;
+    }
+
+    public static void setDefaultClock(Clock defaultClock)
+    {
+        SystemTime.defaultClock = defaultClock;
+    }
+
+    public static Instant now()
+    {
+        return Instant.now(defaultClock);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/CollectionType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/CollectionType.java b/core/api/src/main/java/org/apache/polygene/api/type/CollectionType.java
new file mode 100644
index 0000000..faf19c5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/CollectionType.java
@@ -0,0 +1,78 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import org.apache.polygene.api.util.Classes;
+
+/**
+ * Collection ValueType.
+ * <p>This handles Collection, List and Set types.</p>
+ */
+public final class CollectionType
+    extends ValueType
+{
+
+    public static boolean isCollection( Type type )
+    {
+        Class<?> cl = Classes.RAW_CLASS.apply( type );
+        return cl.equals( Collection.class ) || cl.equals( List.class ) || cl.equals( Set.class );
+    }
+
+    public static CollectionType collectionOf( Class<?> collectedType )
+    {
+        return new CollectionType( Collection.class, ValueType.of( collectedType ) );
+    }
+
+    public static CollectionType listOf( Class<?> collectedType )
+    {
+        return new CollectionType( List.class, ValueType.of( collectedType ) );
+    }
+
+    public static CollectionType setOf( Class<?> collectedType )
+    {
+        return new CollectionType( Set.class, ValueType.of( collectedType ) );
+    }
+    private ValueType collectedType;
+
+    public CollectionType( Class<?> type, ValueType collectedType )
+    {
+        super( type );
+        this.collectedType = collectedType;
+        if( !isCollection( type ) )
+        {
+            throw new IllegalArgumentException( type + " is not a Collection, List or Set." );
+        }
+    }
+
+    public ValueType collectedType()
+    {
+        return collectedType;
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + "<" + collectedType + ">";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/EnumType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/EnumType.java b/core/api/src/main/java/org/apache/polygene/api/type/EnumType.java
new file mode 100644
index 0000000..ba7dc5a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/EnumType.java
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.reflect.Type;
+
+/**
+ * Enum ValueType.
+ */
+public final class EnumType
+    extends ValueType
+{
+
+    public static boolean isEnum( Type type )
+    {
+        if( type instanceof Class )
+        {
+            Class<?> typeClass = (Class) type;
+            return ( typeClass.isEnum() );
+        }
+        return false;
+    }
+
+    public static EnumType of( Class<?> type )
+    {
+        return new EnumType( type );
+    }
+
+    public EnumType( Class<?> type )
+    {
+        super( type );
+        if( !isEnum( type ) )
+        {
+            throw new IllegalArgumentException( type + " is not an Enum." );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/HasTypes.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/HasTypes.java b/core/api/src/main/java/org/apache/polygene/api/type/HasTypes.java
new file mode 100644
index 0000000..ae1f3c9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/HasTypes.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.reflect.Type;
+import java.util.stream.Stream;
+import org.apache.polygene.api.util.Classes;
+
+/**
+ * Has types.
+ */
+public interface HasTypes
+{
+    Stream<Class<?>> types();
+
+    default boolean hasType( Type type )
+    {
+        Class<?> rawType = Classes.RAW_CLASS.apply( type );
+        return types().map( Classes.RAW_CLASS ).anyMatch( rawType::isAssignableFrom );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/MapType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/MapType.java b/core/api/src/main/java/org/apache/polygene/api/type/MapType.java
new file mode 100644
index 0000000..4046628
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/MapType.java
@@ -0,0 +1,91 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+import org.apache.polygene.api.util.Classes;
+
+/**
+ * Map ValueType.
+ * <p>This handles instances of Map.</p>
+ */
+public final class MapType
+    extends ValueType
+{
+
+    private ValueType keyType;
+    private ValueType valueType;
+    private final Serialization.Variant variant;
+
+    public static boolean isMap( Type type )
+    {
+        Class<?> cl = Classes.RAW_CLASS.apply( type );
+        return Map.class.isAssignableFrom( cl );
+    }
+
+    public static MapType of( Class<?> keyType, Class<?> valueType )
+    {
+        return new MapType( Map.class, ValueType.of( keyType ), ValueType.of( valueType ) );
+    }
+
+    public static MapType of( Class<?> keyType, Class<?> valueType, Serialization.Variant variant )
+    {
+        return new MapType( Map.class, ValueType.of( keyType ), ValueType.of( valueType ), variant );
+    }
+
+    public MapType( Class<?> type, ValueType keyType, ValueType valueType )
+    {
+        this( type, keyType, valueType, Serialization.Variant.entry );
+    }
+
+    public MapType( Class<?> type, ValueType keyType, ValueType valueType, Serialization.Variant variant )
+    {
+        super( type );
+        this.keyType = keyType;
+        this.valueType = valueType;
+        this.variant = variant;
+        if( !isMap( type ) )
+        {
+            throw new IllegalArgumentException( type + " is not a Map." );
+        }
+    }
+
+    public ValueType keyType()
+    {
+        return keyType;
+    }
+
+    public ValueType valueType()
+    {
+        return valueType;
+    }
+
+    public Serialization.Variant variant()
+    {
+        return variant;
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + "<" + keyType + "," + valueType + ">";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/MatchTypeSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/MatchTypeSpecification.java b/core/api/src/main/java/org/apache/polygene/api/type/MatchTypeSpecification.java
new file mode 100644
index 0000000..8d8ff92
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/MatchTypeSpecification.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.util.function.Predicate;
+
+/**
+ * Match Type Specification for HasTypes.
+ */
+public class MatchTypeSpecification
+    implements Predicate<HasTypes>
+{
+    private final Class<?> matchType;
+
+    public MatchTypeSpecification( Class<?> matchType )
+    {
+        this.matchType = matchType;
+    }
+
+    @Override
+    public boolean test( HasTypes item )
+    {
+        return item.types().anyMatch( matchType::isAssignableFrom );
+//        for( Class<?> type : item.types() )
+//        {
+//            if( matchType.isAssignableFrom( type ) )
+//            {
+//                return true;
+//            }
+//        }
+//        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/Serialization.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/Serialization.java b/core/api/src/main/java/org/apache/polygene/api/type/Serialization.java
new file mode 100644
index 0000000..981ab00
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/Serialization.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Serialization options for Property intstances.
+ * <p>
+ * The {@code entry} type represents the explicit key=keyValue, value=valueValue. For JSON serialization;
+ * </p>
+ * <pre>
+ *     [
+ *         { "key1" : "value1" },
+ *         { "key2" : "value2" }
+ *     ]
+ * </pre>
+ * <p>
+ * For XML serialization;
+ * </p>
+ * <pre>
+ *     &lt;object&gt;
+ *         &lt;
+ *     &lt;/object&gt;
+ * </pre>
+ * <p>
+ * The {@code object} type represents the explicit keyValue=valueValue.
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface Serialization
+{
+    Variant value();
+
+    enum Variant
+    {
+        entry, object
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java b/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
new file mode 100644
index 0000000..4cf86a6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/ValueCompositeType.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.lang.reflect.Type;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.value.ValueComposite;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * ValueComposite ValueType.
+ */
+public final class ValueCompositeType
+    extends ValueType
+{
+    private final ValueDescriptor model;
+
+    public static boolean isValueComposite( Type type )
+    {
+        return ValueComposite.class.isAssignableFrom( Classes.RAW_CLASS.apply( type ) );
+    }
+
+    public ValueCompositeType( ValueDescriptor model )
+    {
+        super( model.types().collect( Collectors.toList() ) );
+        this.model = model;
+    }
+
+    public Stream<? extends PropertyDescriptor> properties()
+    {
+        return model.state().properties();
+    }
+
+    public Stream<? extends AssociationDescriptor> associations()
+    {
+        return model.state().associations();
+    }
+
+    public Stream<? extends AssociationDescriptor> manyAssociations()
+    {
+        return model.state().manyAssociations();
+    }
+
+    public Stream<? extends AssociationDescriptor> namedAssociations()
+    {
+        return model.state().namedAssociations();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java b/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java
new file mode 100644
index 0000000..13277d7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/ValueType.java
@@ -0,0 +1,154 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.type;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.util.NullArgumentException;
+
+import static java.util.stream.Collectors.joining;
+
+/**
+ * Base class for types of values in ValueComposites and Properties.
+ */
+public class ValueType
+    implements HasTypes
+{
+
+    public static ValueType of( Class<?> type )
+    {
+        return new ValueType( type );
+    }
+
+    /**
+     * Check if a non-null object is of any of the Primitive Value Types or an array of them.
+     * <p>
+     *     String, Boolean, Integer, Double, Float, Long, Byte, Short and Character and their Java primitive types
+     *     counterparts are considered as Primitive Value Types.
+     * </p>
+     * <p>
+     *     Date, BigInteger, BigDecimal and JodaTime types are not considered as Primitive Value Types.
+     * </p>
+     *
+     * @return true if object is a primitive value or an array of primitive values
+     * @throws IllegalArgumentException if object is null
+     */
+    public static boolean isPrimitiveValue( Object object )
+    {
+        NullArgumentException.validateNotNull( "object", object );
+        if( object instanceof String
+            || object instanceof Character
+            || object instanceof Boolean
+            || object instanceof Integer
+            || object instanceof Double
+            || object instanceof Float
+            || object instanceof Long
+            || object instanceof Byte
+            || object instanceof Short )
+        {
+            return true;
+        }
+        if( object.getClass().isArray() )
+        {
+            return isArrayOfPrimitiveValues( object );
+        }
+        return false;
+    }
+
+    public static boolean isIdentity( Object object )
+    {
+        return object instanceof Identity;
+    }
+
+    private static boolean isArrayOfPrimitiveValues( Object array )
+    {
+        if( array instanceof String[]
+            || array instanceof char[] || array instanceof Character[]
+            || array instanceof boolean[] || array instanceof Boolean[]
+            || array instanceof int[] || array instanceof Integer[]
+            || array instanceof double[] || array instanceof Double[]
+            || array instanceof float[] || array instanceof Float[]
+            || array instanceof long[] || array instanceof Long[]
+            || array instanceof byte[] || array instanceof Byte[]
+            || array instanceof short[] || array instanceof Short[] )
+        {
+            return true;
+        }
+        return false;
+    }
+
+    public static boolean isPrimitiveValueType( ValueType valueType )
+    {
+        return isPrimitiveValueType( valueType.mainType() );
+    }
+
+    /**
+     * @see ValueType#isPrimitiveValue(java.lang.Object) 
+     */
+    public static boolean isPrimitiveValueType( Class<?> type )
+    {
+        NullArgumentException.validateNotNull( "type", type );
+        if( String.class.isAssignableFrom( type ) )
+        {
+            return true;
+        }
+        if( type.isArray() )
+        {
+            return isPrimitiveValueType( type.getComponentType() );
+        }
+        return false;
+    }
+    protected final List<Class<?>> types;
+
+    public ValueType( Class<?> type )
+    {
+        this( Collections.singletonList( type ) );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public ValueType( List<Class<?>> types )
+    {
+        this.types = types;
+    }
+
+    public Class<?> mainType()
+    {
+        return types.stream().findFirst().orElse( null );
+    }
+
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return types.stream();
+    }
+
+    @Override
+    public String toString()
+    {
+        String name = types.stream().map( Class::getName ).collect( joining( "," ) );
+        if( name.contains( "," ) )
+        {
+            name = "{" + name + "}";
+        }
+        return name;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/type/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/type/package.html b/core/api/src/main/java/org/apache/polygene/api/type/package.html
new file mode 100644
index 0000000..c0c3eca
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/type/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Type API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/ConcurrentEntityModificationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/ConcurrentEntityModificationException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/ConcurrentEntityModificationException.java
new file mode 100644
index 0000000..7d439b0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/ConcurrentEntityModificationException.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.type.HasTypes;
+import org.apache.polygene.api.usecase.Usecase;
+
+/**
+ * This exception is thrown by UnitOfWork.complete() if any entities that are being committed
+ * had been changed while the UnitOfWork was being executed.
+ */
+public class ConcurrentEntityModificationException
+    extends UnitOfWorkCompletionException
+{
+    private static final long serialVersionUID = 3872723845064767689L;
+
+    private final Map<EntityComposite, HasTypes> concurrentlyModifiedEntities;
+
+    public ConcurrentEntityModificationException( Map<EntityComposite, HasTypes> concurrentlyModifiedEntities,
+                                                  Usecase usecase
+    )
+    {
+        super( "Entities changed concurrently, and detected in usecase '" + usecase + "'\nModified entities : " + format( concurrentlyModifiedEntities ) );
+        this.concurrentlyModifiedEntities = concurrentlyModifiedEntities;
+    }
+
+    private static String format( Map<EntityComposite, HasTypes> concurrentlyModifiedEntities )
+    {
+        return concurrentlyModifiedEntities.entrySet().stream()
+            .map( entry ->
+                      entry.getKey()
+                      + " : "
+                      + entry.getValue().types().map( Class::getSimpleName )
+                          .collect( Collectors.joining( "," ) )
+            )
+            .collect( Collectors.joining( "\n" ) );
+    }
+
+    public Map<EntityComposite, HasTypes> concurrentlyModifiedEntities()
+    {
+        return concurrentlyModifiedEntities;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/EntityCompositeAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/EntityCompositeAlreadyExistsException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/EntityCompositeAlreadyExistsException.java
new file mode 100644
index 0000000..dec6965
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/EntityCompositeAlreadyExistsException.java
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import org.apache.polygene.api.entity.EntityReference;
+
+/**
+ * If you try to create an EntityComposite whose reference already exists,
+ * then this exception will be thrown.
+ */
+public class EntityCompositeAlreadyExistsException
+    extends UnitOfWorkException
+{
+    private static final long serialVersionUID = -7297710939536508481L;
+
+    private final EntityReference reference;
+
+    public EntityCompositeAlreadyExistsException( EntityReference reference)
+    {
+        super( "EntityComposite (" + reference + ") already exists." );
+        this.reference = reference;
+    }
+
+    public EntityReference reference()
+    {
+        return reference;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityException.java
new file mode 100644
index 0000000..7b31427
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityException.java
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.usecase.Usecase;
+
+import static java.util.Arrays.stream;
+
+/**
+ * This exception indicates that the requested Entity with the given
+ * reference does not exist.
+ */
+public class NoSuchEntityException
+    extends UnitOfWorkException
+{
+    private final EntityReference reference;
+    private final Usecase usecase;
+    private final Class<?>[] mixinTypes;
+
+    public NoSuchEntityException(EntityReference reference, Class<?> mixinType, Usecase usecase )
+    {
+        super( "Could not find entity (" + reference + ") of type " + mixinType.getName() + " in usecase '" + usecase.name() + "'" );
+        this.reference = reference;
+        this.usecase = usecase;
+        this.mixinTypes = new Class<?>[]{ mixinType };
+    }
+
+    public NoSuchEntityException(EntityReference reference, Class<?>[] mixinTypes, Usecase usecase )
+    {
+        super( "Could not find entity (" + reference + ") of type " + toString( mixinTypes ) + " in usecase '" + usecase.name() + "'" );
+        this.reference = reference;
+        this.mixinTypes = mixinTypes;
+        this.usecase = usecase;
+    }
+
+    public NoSuchEntityException(EntityReference reference, Stream<Class<?>> types, Usecase usecase )
+    {
+        this(reference, types.toArray( Class[]::new ), usecase );
+    }
+
+    public EntityReference reference()
+    {
+        return reference;
+    }
+
+    public Class<?>[] mixinTypes()
+    {
+        return mixinTypes;
+    }
+
+    public Usecase usecase()
+    {
+        return usecase;
+    }
+
+    private static String toString( Class<?>[] mixinTypes )
+    {
+        String reduced = stream( mixinTypes ).map( Class::getName ).reduce( "", ( ret, name ) -> ret + "," + name );
+        return "[" + reduced.substring( 1 ) + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityTypeException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityTypeException.java
new file mode 100644
index 0000000..bd038f2
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/NoSuchEntityTypeException.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import java.util.stream.Collectors;
+import org.apache.polygene.api.composite.NoSuchCompositeException;
+import org.apache.polygene.api.structure.TypeLookup;
+
+/**
+ * Polygene 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/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWork.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWork.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWork.java
new file mode 100644
index 0000000..10e4216
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWork.java
@@ -0,0 +1,528 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+import org.apache.polygene.api.entity.EntityBuilder;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.entity.LifecycleException;
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.query.Query;
+import org.apache.polygene.api.query.QueryBuilder;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.usecase.Usecase;
+
+/**
+ * All operations on entities goes through an UnitOfWork.
+ * <p>
+ * A UnitOfWork allows you to access
+ * Entities and work with them. All modifications to Entities are recorded by the UnitOfWork,
+ * and at the end they may be sent to the underlying EntityStore by calling complete(). If the
+ * UoW was read-only you may instead simply discard() it.
+ * </p>
+ * <p>
+ * A UoW differs from a traditional Transaction in the sense that it is not tied at all to the underlying
+ * storage resource. Because of this there is no timeout on a UoW. It can be very short or very long.
+ * Another difference is that if a call to complete() fails, and the cause is validation errors in the
+ * Entities of the UoW, then these can be corrected and the UoW retried. By contrast, when a Transaction
+ * commit fails, then the whole transaction has to be done from the beginning again.
+ * </p>
+ * <p>
+ * A UoW can be associated with a Usecase. A Usecase describes the metainformation about the process
+ * to be performed by the UoW.
+ * </p>
+ * <p>
+ * If a code block that uses a UoW throws an exception you need to ensure that this is handled properly,
+ * and that the UoW is closed before returning. Because discard() is a no-op if the UoW is closed, we therefore
+ * recommend the following template to be used:
+ * </p>
+ * <pre>
+ *     UnitOfWork uow = module.newUnitOfWork();
+ *     try
+ *     {
+ *         ...
+ *         uow.complete();
+ *     }
+ *     finally
+ *     {
+ *         uow.discard();
+ *     }
+ * </pre>
+ * <p>
+ * This ensures that in the happy case the UoW is completed, and if any exception is thrown the UoW is discarded. After
+ * the UoW has completed the discard() method doesn't do anything, and so has no effect. You can choose to either add
+ * catch blocks for any exceptions, including exceptions from complete(), or skip them.
+ * </p>
+ * <p>
+ * Since 2.1 you can leverage Java 7 Automatic Resource Management (ie. Try With Resources) and use the following
+ * template instead:
+ * </p>
+ * <pre>
+ *     try( UnitOfWork uow = module.newUnitOfWork() )
+ *     {
+ *         ...
+ *         uow.complete();
+ *     }
+ * </pre>
+ * <p>
+ * It has the very same effect than the template above but is shorter.</p>
+ */
+public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
+{
+
+    /**
+     * Get the UnitOfWorkFactory that this UnitOfWork was created from.
+     *
+     * @return The UnitOfWorkFactory instance that was used to create this UnitOfWork.
+     */
+    UnitOfWorkFactory unitOfWorkFactory();
+
+    Instant currentTime();
+
+    /**
+     * Get the Usecase for this UnitOfWork
+     *
+     * @return the Usecase
+     */
+    Usecase usecase();
+
+    void setMetaInfo( Object metaInfo );
+
+    <T> Query<T> newQuery( QueryBuilder<T> queryBuilder );
+
+//    DataSet newDataSetBuilder(Specification<?>... constraints);
+
+    /**
+     * Create a new Entity which implements the given mixin type.
+     * <p>
+     * An EntityComposite
+     * will be chosen according to what has been registered and the visibility rules
+     * for Modules and Layers will be considered. If several
+     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
+     * </p>
+     * <p>
+     * The reference of the Entity will be generated by the IdentityGenerator of the Module of the EntityComposite.
+     * </p>
+     *
+     * @param type the mixin type that the EntityComposite must implement
+     *
+     * @return a new Entity
+     *
+     * @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 NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
+
+    /**
+     * Create a new Entity which implements the given mixin type. An EntityComposite
+     * will be chosen according to what has been registered and the visibility rules
+     * for Modules and Layers will be considered. If several
+     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
+     *
+     * @param type     the mixin type that the EntityComposite must implement
+     * @param identity the reference of the new Entity
+     *
+     * @return a new Entity
+     *
+     * @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 Identity identity )
+        throws NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
+
+    /**
+     * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
+     * will be chosen according to what has been registered and the visibility rules
+     * for Modules and Layers will be considered. If several
+     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
+     *
+     * @param type the mixin type that the EntityComposite must implement
+     *
+     * @return a new EntityBuilder
+     *
+     * @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 NoSuchEntityTypeException, AmbiguousTypeException;
+
+    /**
+     * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
+     * will be chosen according to what has been registered and the visibility rules
+     * for Modules and Layers will be considered. If several
+     * mixins implement the type then an AmbiguousTypeException will be thrown.
+     *
+     * @param type     the mixin type that the EntityComposite must implement
+     * @param identity the reference of the new Entity
+     *
+     * @return a new EntityBuilder
+     *
+     * @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 Identity identity )
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
+
+    /**
+     * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
+     * state.
+     * <p>
+     * An EntityComposite will be chosen according to what has been registered and the visibility rules for Modules and
+     * Layers will be considered.
+     *
+     * @param <T>                      Entity type
+     * @param type                     Entity type
+     * @param propertyFunction         a function providing the state of properties
+     * @param associationFunction      a function providing the state of associations
+     * @param manyAssociationFunction  a function providing the state of many associations
+     * @param namedAssociationFunction a function providing the state of named associations
+     *
+     * @return a new EntityBuilder starting with the given state
+     *
+     * @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,
+                                                    Function<PropertyDescriptor, Object> propertyFunction,
+                                                    Function<AssociationDescriptor, EntityReference> associationFunction,
+                                                    Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+                                                    Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
+    )
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
+
+    /**
+     * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
+     * state.
+     * <p>
+     * An EntityComposite will be chosen according to what has been registered and the visibility rules for Modules and
+     * Layers will be considered.
+     *
+     * @param <T>                      Entity type
+     * @param type                     Entity type
+     * @param identity                 the reference of the new Entity
+     * @param propertyFunction         a function providing the state of properties
+     * @param associationFunction      a function providing the state of associations
+     * @param manyAssociationFunction  a function providing the state of many associations
+     * @param namedAssociationFunction a function providing the state of named associations
+     *
+     * @return a new EntityBuilder starting with the given state
+     *
+     * @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 Identity identity,
+                                                    Function<PropertyDescriptor, Object> propertyFunction,
+                                                    Function<AssociationDescriptor, EntityReference> associationFunction,
+                                                    Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
+                                                    Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
+    )
+        throws NoSuchEntityTypeException, AmbiguousTypeException;
+
+    /**
+     * Find an Entity of the given mixin type with the give reference. This
+     * method verifies that it exists by asking the underlying EntityStore.
+     *
+     * @param type     of the entity
+     * @param identity of the entity
+     *
+     * @return the entity
+     *
+     * @throws NoSuchEntityTypeException if no entity type could be found
+     * @throws NoSuchEntityException     if the entity could not be found
+     */
+    <T> T get( Class<T> type, Identity identity )
+        throws NoSuchEntityTypeException, NoSuchEntityException;
+
+    /**
+     * If you have a reference to an Entity from another
+     * UnitOfWork and want to create a reference to it in this
+     * UnitOfWork, then call this method.
+     *
+     * @param entity the Entity to be dereferenced
+     *
+     * @return an Entity from this UnitOfWork
+     *
+     * @throws NoSuchEntityTypeException if no entity type could be found
+     */
+    <T> T get( T entity )
+        throws NoSuchEntityTypeException;
+
+    /**
+     * Remove the given Entity.
+     *
+     * @param entity the Entity to be removed.
+     *
+     * @throws LifecycleException if the entity could not be removed
+     */
+    void remove( Object entity )
+        throws LifecycleException;
+
+    /**
+     * Complete this UnitOfWork. This will send all the changes down to the underlying
+     * EntityStore's.
+     *
+     * @throws UnitOfWorkCompletionException         if the UnitOfWork could not be completed
+     * @throws ConcurrentEntityModificationException if entities have been modified by others
+     */
+    void complete()
+        throws UnitOfWorkCompletionException, ConcurrentEntityModificationException;
+
+    /**
+     * Discard this UnitOfWork. Use this if a failure occurs that you cannot handle,
+     * or if the usecase was of a read-only character. This is a no-op of the UnitOfWork
+     * is already closed.
+     */
+    void discard();
+
+    /**
+     * Discard this UnitOfWork. Use this if a failure occurs that you cannot handle,
+     * or if the usecase was of a read-only character. This is a no-op of the UnitOfWork
+     * is already closed. This simply call the {@link #discard()} method and is an
+     * implementation of the {@link AutoCloseable} interface providing Try With Resources
+     * support for UnitOfWork.
+     */
+    @Override
+    public void close();
+
+    /**
+     * Check if the UnitOfWork is open. It is closed after either complete() or discard()
+     * methods have been called successfully.
+     *
+     * @return true if the UnitOfWork is open.
+     */
+    boolean isOpen();
+
+    /**
+     * Check if the UnitOfWork is paused. It is not paused after it has been create through the
+     * UnitOfWorkFactory, and it can be paused by calling {@link #pause()} and then resumed by calling
+     * {@link #resume()}.
+     *
+     * @return true if this UnitOfWork has been paused.
+     */
+    boolean isPaused();
+
+    /**
+     * Pauses this UnitOfWork.
+     * <p>
+     * Calling this method will cause the underlying UnitOfWork to become the current UnitOfWork until the
+     * the resume() method is called. It is the client's responsibility not to drop the reference to this
+     * UnitOfWork while being paused.
+     * </p>
+     */
+    void pause();
+
+    /**
+     * Resumes this UnitOfWork to again become the current UnitOfWork.
+     */
+    void resume();
+
+    /**
+     * Register a callback. Callbacks are invoked when the UnitOfWork
+     * is completed or discarded.
+     *
+     * @param callback a callback to be registered with this UnitOfWork
+     */
+    void addUnitOfWorkCallback( UnitOfWorkCallback callback );
+
+    /**
+     * Unregister a callback. Callbacks are invoked when the UnitOfWork
+     * is completed or discarded.
+     *
+     * @param callback a callback to be unregistered with this UnitOfWork
+     */
+    void removeUnitOfWorkCallback( UnitOfWorkCallback callback );
+
+    /**
+     * Converts the provided Entity to a Value of the same type.
+     * This is a convenience method to convert an EntityComposite to a ValueComposite.
+     * <p>
+     * All Property values are transferred across as-is, and the Association, ManyAssociation
+     * and NamedAssociatino values are kept in the ValueComposite as EntityReferences
+     * until they are dereferenced (get() and other methods), and IF a UnitOfWork is
+     * present at dereferencing the corresponding EntityCompoiste is retrieved from the
+     * EntityStore. If there is not an UnitOfWork present, an exception is thrown.
+     * </p>
+     * <p>
+     * For this to work, the Composites (both Entity and Value) must not declare the
+     * EntityComposite and ValueComposite super types, but rely on the declaration in
+     * the assembly, and also extend the Identity supertype.
+     * </p>
+     * Example;
+     * <pre><code>
+     *     public interface Person extends Identity { ... };
+     *     public class MyAssembler
+     *     {
+     *         public void assemble( ModuleAssembly module )
+     *         {
+     *             module.values( Person.class );
+     *             module.entities( Person.class );
+     *         }
+     *     }
+     * </code></pre>
+     *
+     * @param <T>             The generic shared type
+     * @param primaryType     The shared type for which the properties and associations will
+     *                        be converted. Properties outside this type will be ignored.
+     * @param entityComposite The entity to be convered.
+     *
+     * @return The Value
+     */
+    <T extends HasIdentity> T toValue(Class<T> primaryType, T entityComposite );
+
+    /**
+     * Converts all the entities referenced in the ManyAssociation into a List of values of the same type.
+     *
+     * <p>
+     * All the referenced entities inside the association will be fetched from the underlying entity store,
+     * which is potentially very expensive operation. Each of the fetched entities will be passed to
+     * {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into values, but remain
+     * {@link EntityReference} values. Hence there is no problem with circular references.
+     * </p>
+     *
+     * <p>
+     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
+     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
+     * </p>
+     *
+     * @param association The association of entities to be converted into values.
+     * @param <T>         The primary type of the association.
+     *
+     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
+     *
+     * @see #toValue(Class, HasIdentity)
+     */
+    <T extends HasIdentity> List<T> toValueList(ManyAssociation<T> association );
+
+    /**
+     * Converts all the entities referenced in the ManyAssociation into a Set of values of the same type.
+     *
+     * <p>
+     * All the referenced entities inside the association will be fetched from the underlying entity store,
+     * which is potentially very expensive operation. However, any duplicate EntityReferences in the association
+     * will be dropped before the fetch occurs. Each of the fetched entities will be passed to
+     * {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into values, but remain
+     * {@link EntityReference} values. Hence there is no problem with circular references.
+     * </p>
+     *
+     * <p>
+     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
+     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
+     * </p>
+     *
+     * @param association The association of entities to be converted into values.
+     * @param <T>         The primary type of the association.
+     *
+     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
+     *
+     * @see #toValue(Class, HasIdentity)
+     */
+    <T extends HasIdentity> Set<T> toValueSet(ManyAssociation<T> association );
+
+    /**
+     * Converts the {@link NamedAssociation} into a Map with a String key and a ValueComposite as the value.
+     *
+     * <p>
+     * A {@link NamedAssociation} is effectively a Map with a String key and an EntityReference as the value. The
+     * EntityReference is fetched from the entity store and converted into a value of the same type.Each of the fetched
+     * entities will be passed to {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into
+     * values, but remain {@link EntityReference} values. Hence there is no problem with circular references.
+     * </p>
+     * <p>
+     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
+     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
+     * </p>
+     *
+     * @param association The association of entities to be converted into values.
+     * @param <T>         The primary type of the association.
+     *
+     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
+     *
+     * @see #toValue(Class, HasIdentity)
+     */
+    <T extends HasIdentity> Map<String, T> toValueMap(NamedAssociation<T> association );
+
+    /**
+     * Converts the provided Value to an Entity of the same type.
+     * This is a convenience method to convert a ValueComposite to an EntityComposite.
+     * <p>
+     * All Property values are transferred across as-is (no deep copy in case mutable
+     * types (DISCOURAGED!) are used), and the Association, ManyAssociation
+     * and NamedAssociatino that were in the ValueComposite as EntityReferences are
+     * transferred into the EntityComposite correctly, and can be dereferenced.
+     * </p>
+     * <p>
+     * This method MUST be called within a UnitOfWork.
+     * </p>
+     * <p>
+     * If an Entity with the Identity in the ValueComposite already exists, then that
+     * Entity is updated with the values from the ValueComposite. If an Entity of
+     * that Identity doesn't exist a new one is created.
+     * </p>
+     * <p>
+     * For this to work, the Composites (both Entity and Value) must not declare the
+     * EntityComposite and ValueComposite super types, but rely on the declaration in
+     * the assembly, and also extend the Identity supertype.
+     * </p>
+     * Example;
+     * <pre><code>
+     *     public interface Person extends Identity { ... };
+     *     public class MyAssembler
+     *     {
+     *         public void assemble( ModuleAssembly module )
+     *         {
+     *             module.values( Person.class );
+     *             module.entities( Person.class );
+     *         }
+     *     }
+     * </code></pre>
+     *
+     * @param <T>            The generic shared type
+     * @param primaryType    The shared type for which the properties and associations will
+     *                       be converted. Properties outside this type will be ignored.
+     * @param valueComposite The Value to be convered into an Entity.
+     *
+     * @return The new or updated Entity
+     */
+    <T extends HasIdentity> T toEntity(Class<T> primaryType, T valueComposite );
+
+    /**
+     * The Module of the UnitOfWork is defined as the Module the UnitOfWorkFactory belonged to from where the
+     * UnitOfWork was created.
+     *
+     * @return the Module where this UnitOfWork was initialized.
+     */
+    ModuleDescriptor module();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCallback.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCallback.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCallback.java
new file mode 100644
index 0000000..f8e467b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCallback.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+/**
+ * Callback interface for UnitOfWork completion or discard. Implementations
+ * of this interface can be registered through {@link UnitOfWork#addUnitOfWorkCallback(UnitOfWorkCallback)}.
+ *
+ * If Entities implement this interface they will also receive invocations of this callback interface.
+ */
+public interface UnitOfWorkCallback
+{
+    /**
+     * This is called before the completion of the UnitOfWork.
+     * The callback may do any validation checks and throw
+     * UnitOfWorkCompletionException if there is any reason
+     * why the UnitOfWork is not in a valid state to be completed.
+     *
+     * @throws UnitOfWorkCompletionException
+     */
+    void beforeCompletion()
+        throws UnitOfWorkCompletionException;
+
+    /**
+     * This is called after the completion or discarding
+     * of the UnitOfWork. The callback may do any cleanup
+     * necessary related to the UnitOfWork. Note that the
+     * UnitOfWork is no longer active when this method is
+     * called, so no methods on it may be invoked.
+     *
+     * @param status
+     */
+    void afterCompletion( UnitOfWorkStatus status );
+
+    enum UnitOfWorkStatus
+    {
+        COMPLETED, DISCARDED
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCompletionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCompletionException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCompletionException.java
new file mode 100644
index 0000000..0fd8335
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkCompletionException.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+/**
+ * When an attempt to {@link UnitOfWork#complete()} an UnitOfWork
+ * fails, this exception will be thrown.
+ */
+public class UnitOfWorkCompletionException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 6531642131384516904L;
+
+    public UnitOfWorkCompletionException()
+    {
+    }
+
+    public UnitOfWorkCompletionException( String string )
+    {
+        super( string );
+    }
+
+    public UnitOfWorkCompletionException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+
+    public UnitOfWorkCompletionException( Throwable throwable )
+    {
+        super( throwable );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkException.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkException.java
new file mode 100644
index 0000000..fdf6903
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkException.java
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+/**
+ * Base Exception for UnitOfWork related concerns.
+ */
+public class UnitOfWorkException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = -8544178439804058558L;
+
+    public UnitOfWorkException()
+    {
+    }
+
+    public UnitOfWorkException( String message )
+    {
+        super( message );
+    }
+
+    public UnitOfWorkException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public UnitOfWorkException( Throwable cause )
+    {
+        super( cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkFactory.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkFactory.java
new file mode 100644
index 0000000..98d23ba
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkFactory.java
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import java.time.Instant;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.time.SystemTime;
+import org.apache.polygene.api.usecase.Usecase;
+
+/**
+ * Factory for UnitOfWork.
+ */
+public interface UnitOfWorkFactory
+{
+    /**
+     * Create a new UnitOfWork and associate it with the current thread.
+     * <p>
+     * The UnitOfWork will use the default Usecase settings.
+     * </p>
+     * <p>
+     * Current time will be set to {@link SystemTime#now()}
+     * </p>
+     * @return a new UnitOfWork
+     */
+    UnitOfWork newUnitOfWork();
+
+    /**
+     * Create a new UnitOfWork and associate it with the current thread.
+     * <p>
+     * The UnitOfWork will use the default Usecase settings.
+     * </p>
+     * @return a new UnitOfWork
+     */
+    UnitOfWork newUnitOfWork( Instant currentTime );
+
+    /**
+     * Create a new UnitOfWork for the given Usecase and associate it with the current thread.
+     * <p>
+     * Current time will be set to {@link SystemTime#now()}
+     * </p>
+     * @param usecase the Usecase for this UnitOfWork
+     *
+     * @return a new UnitOfWork
+     */
+    UnitOfWork newUnitOfWork( Usecase usecase );
+
+    /**
+     * Create a new UnitOfWork for the given Usecase and associate it with the current thread.
+     *
+     * @param usecase the Usecase for this UnitOfWork
+     *
+     * @return a new UnitOfWork
+     */
+    UnitOfWork newUnitOfWork( Usecase usecase, Instant currentTime );
+
+    /**
+     * @return true if there is an active UnitOfWork associated with the executing thread
+     */
+    boolean isUnitOfWorkActive();
+
+    /**
+     * Returns the UnitOfWork that is currently associated with the executing thread.
+     *
+     * @return The current UnitOfWork associated with the executing thread
+     *
+     * @throws IllegalStateException if no current UnitOfWork is active
+     */
+    UnitOfWork currentUnitOfWork()
+        throws IllegalStateException;
+
+    /**
+     * Returns the UnitOfWork that the EntityComposite is bound to.
+     *
+     * @param entity the entity to be checked.
+     *
+     * @return The UnitOfWork instance that the Entity is bound to, or null if the entity is not associated with
+     *         any UnitOfWork.
+     */
+    UnitOfWork getUnitOfWork( EntityComposite entity );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkOptions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkOptions.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkOptions.java
new file mode 100644
index 0000000..02c6d5a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkOptions.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+/**
+ * Set instances of this in MetaInfo on UnitOfWork or the associated Usecase.
+ *  <p>
+ * Options:
+ *  </p>
+ * <p>
+ * "pruneOnPause": if true, then clear out all instances that have been loaded in the UoW but not modified
+ * </p>
+ */
+public class UnitOfWorkOptions
+{
+    private boolean pruneOnPause = false;
+
+    public UnitOfWorkOptions( boolean pruneOnPause )
+    {
+        this.pruneOnPause = pruneOnPause;
+    }
+
+    public boolean isPruneOnPause()
+    {
+        return pruneOnPause;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplate.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplate.java
new file mode 100644
index 0000000..1c821c3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/UnitOfWorkTemplate.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork;
+
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.usecase.Usecase;
+
+/**
+ * UnitOfWork Template.
+ */
+public abstract class UnitOfWorkTemplate<RESULT, ThrowableType extends Throwable>
+{
+    private Usecase usecase = Usecase.DEFAULT;
+    private int retries = 10;
+    private boolean complete = true;
+
+    protected UnitOfWorkTemplate()
+    {
+    }
+
+    protected UnitOfWorkTemplate( int retries, boolean complete )
+    {
+        this.retries = retries;
+        this.complete = complete;
+    }
+
+    protected UnitOfWorkTemplate( Usecase usecase, int retries, boolean complete )
+    {
+        this.usecase = usecase;
+        this.retries = retries;
+        this.complete = complete;
+    }
+
+    protected abstract RESULT withUnitOfWork( UnitOfWork uow )
+        throws ThrowableType;
+
+    @SuppressWarnings( "unchecked" )
+    public RESULT withModule( Module module )
+        throws ThrowableType, UnitOfWorkCompletionException
+    {
+        int loop = 0;
+        ThrowableType ex = null;
+        do
+        {
+            UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase );
+
+            try
+            {
+                RESULT result = withUnitOfWork( uow );
+                if( complete )
+                {
+                    try
+                    {
+                        uow.complete();
+                        return result;
+                    }
+                    catch( ConcurrentEntityModificationException e )
+                    {
+                        // Retry?
+                        ex = (ThrowableType) e;
+                    }
+                }
+            }
+            catch( Throwable e )
+            {
+                ex = (ThrowableType) e;
+            }
+            finally
+            {
+                uow.discard();
+            }
+        }
+        while( loop++ < retries );
+
+        throw ex;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkConcern.java b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkConcern.java
new file mode 100644
index 0000000..f982c45
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/unitofwork/concern/UnitOfWorkConcern.java
@@ -0,0 +1,212 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.unitofwork.concern;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.UndeclaredThrowableException;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.concern.GenericConcern;
+import org.apache.polygene.api.injection.scope.Invocation;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.unitofwork.ConcurrentEntityModificationException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.usecase.Usecase;
+import org.apache.polygene.api.usecase.UsecaseBuilder;
+
+/**
+ * {@code UnitOfWorkConcern} manages the unit of work complete, discard and retry policy.
+ *
+ * @see UnitOfWorkPropagation
+ * @see UnitOfWorkDiscardOn
+ */
+@AppliesTo( UnitOfWorkPropagation.class )
+public class UnitOfWorkConcern
+    extends GenericConcern
+{
+    private static final Class<?>[] DEFAULT_DISCARD_CLASSES = new Class[]{ Throwable.class };
+
+    @Structure
+    private UnitOfWorkFactory uowf;
+
+    @Invocation
+    private UnitOfWorkPropagation propagation;
+
+    /**
+     * Handles method with {@code UnitOfWorkPropagation} annotation.
+     *
+     * @param proxy  The object.
+     * @param method The invoked method.
+     * @param args   The method arguments.
+     *
+     * @return The returned value of method invocation.
+     *
+     * @throws Throwable Thrown if the method invocation throw exception.
+     */
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        UnitOfWorkPropagation.Propagation propagationPolicy = propagation.value();
+        if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRED )
+        {
+            if( uowf.isUnitOfWorkActive() )
+            {
+                //noinspection ConstantConditions
+                return next.invoke( proxy, method, args );
+            }
+            else
+            {
+                Usecase usecase = usecase();
+                return invokeWithCommit( proxy, method, args, uowf.newUnitOfWork( usecase ) );
+            }
+        }
+        else if( propagationPolicy == UnitOfWorkPropagation.Propagation.MANDATORY )
+        {
+            if( !uowf.isUnitOfWorkActive() )
+            {
+                throw new IllegalStateException( "UnitOfWork was required but there is no available unit of work." );
+            }
+        }
+        else if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRES_NEW )
+        {
+            Usecase usecase = usecase();
+            return invokeWithCommit( proxy, method, args, uowf.newUnitOfWork( usecase ) );
+        }
+        //noinspection ConstantConditions
+        return next.invoke( proxy, method, args );
+    }
+
+    private Usecase usecase()
+    {
+        String usecaseName = propagation.usecase();
+        Usecase usecase;
+        if( usecaseName == null )
+        {
+            usecase = Usecase.DEFAULT;
+        }
+        else
+        {
+            usecase = UsecaseBuilder.newUsecase( usecaseName );
+        }
+        return usecase;
+    }
+
+    protected Object invokeWithCommit( Object proxy, Method method, Object[] args, UnitOfWork currentUnitOfWork )
+        throws Throwable
+    {
+        try
+        {
+            UnitOfWorkRetry retryAnnot = method.getAnnotation( UnitOfWorkRetry.class );
+            int maxTries = 0;
+            long delayFactor = 0;
+            long initialDelay = 0;
+            if( retryAnnot != null )
+            {
+                maxTries = retryAnnot.retries();
+                initialDelay = retryAnnot.initialDelay();
+                delayFactor = retryAnnot.delayFactor();
+            }
+            int retry = 0;
+            while( true )
+            {
+                //noinspection ConstantConditions
+                Object result = next.invoke( proxy, method, args );
+                try
+                {
+                    currentUnitOfWork.complete();
+                    return result;
+                }
+                catch( UndeclaredThrowableException e )
+                {
+                    Throwable undeclared = e.getUndeclaredThrowable();
+                    if( undeclared instanceof ConcurrentEntityModificationException )
+                    {
+                        ConcurrentEntityModificationException ceme = (ConcurrentEntityModificationException) undeclared;
+                        currentUnitOfWork = checkRetry( maxTries, delayFactor, initialDelay, retry, ceme );
+                        retry++;
+                    }
+                    else
+                    {
+                        throw e;
+                    }
+                }
+                catch( ConcurrentEntityModificationException e )
+                {
+                    currentUnitOfWork = checkRetry( maxTries, delayFactor, initialDelay, retry, e );
+                    retry++;
+                }
+            }
+        }
+        catch( Throwable throwable )
+        {
+            // Discard only if this concern create a unit of work
+            discardIfRequired( method, currentUnitOfWork, throwable );
+            throw throwable;
+        }
+    }
+
+    private UnitOfWork checkRetry( int maxTries,
+                                   long delayFactor,
+                                   long initialDelay,
+                                   int retry,
+                                   ConcurrentEntityModificationException e
+    )
+        throws ConcurrentEntityModificationException, InterruptedException
+    {
+        if( retry >= maxTries )
+        {
+            throw e;
+        }
+        uowf.currentUnitOfWork().discard();
+        Thread.sleep( initialDelay + retry * delayFactor );
+        return uowf.newUnitOfWork( usecase() );
+    }
+
+    /**
+     * Discard unit of work if the discard policy match.
+     *
+     * @param aMethod     The invoked method. This argument must not be {@code null}.
+     * @param aUnitOfWork The current unit of work. This argument must not be {@code null}.
+     * @param aThrowable  The exception thrown. This argument must not be {@code null}.
+     */
+    protected void discardIfRequired( Method aMethod, UnitOfWork aUnitOfWork, Throwable aThrowable )
+    {
+        UnitOfWorkDiscardOn discardPolicy = aMethod.getAnnotation( UnitOfWorkDiscardOn.class );
+        Class<?>[] discardClasses;
+        if( discardPolicy != null )
+        {
+            discardClasses = discardPolicy.value();
+        }
+        else
+        {
+            discardClasses = DEFAULT_DISCARD_CLASSES;
+        }
+
+        Class<? extends Throwable> aThrowableClass = aThrowable.getClass();
+        for( Class<?> discardClass : discardClasses )
+        {
+            if( discardClass.isAssignableFrom( aThrowableClass ) )
+            {
+                aUnitOfWork.discard();
+            }
+        }
+    }
+}
\ No newline at end of file


[40/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/importer/InstanceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/importer/InstanceImporter.java b/core/api/src/main/java/org/apache/polygene/api/service/importer/InstanceImporter.java
new file mode 100644
index 0000000..52c38cb
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/importer/InstanceImporter.java
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.importer;
+
+import java.util.Objects;
+import java.util.stream.Stream;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.Layer;
+import org.apache.polygene.api.structure.Module;
+
+/**
+ * Return a predefined service instance that was provided as meta-info. Search for meta-info in the following order:
+ * the service itself, the module of the service, the layer of the service, the whole application.
+ */
+public final class InstanceImporter<T>
+    implements ServiceImporter<T>
+{
+    @Structure
+    private Application application;
+
+    @Structure
+    private Layer layer;
+
+    @Structure
+    private Module module;
+
+    @Override
+    public T importService( final ImportedServiceDescriptor serviceDescriptor )
+        throws ServiceImporterException
+    {
+        return Stream.of( serviceDescriptor, module, layer, application )
+            .flatMap( holder -> serviceDescriptor.types().map( type -> (T) holder.metaInfo( type ) ) )
+            .filter( Objects::nonNull )
+            .findFirst().orElse( null );
+    }
+
+    @Override
+    public boolean isAvailable( T instance )
+    {
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/importer/NewObjectImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/importer/NewObjectImporter.java b/core/api/src/main/java/org/apache/polygene/api/service/importer/NewObjectImporter.java
new file mode 100644
index 0000000..11df2fd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/importer/NewObjectImporter.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.importer;
+
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.ServiceImporterException;
+
+/**
+ * Import Services using a new registered Object instance.
+ */
+public final class NewObjectImporter<T>
+    implements ServiceImporter<T>
+{
+    @Structure
+    private ObjectFactory obf;
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public T importService( ImportedServiceDescriptor serviceDescriptor )
+        throws ServiceImporterException
+    {
+        return obf.newObject( (Class<T>) serviceDescriptor.types().findFirst().orElse( null ));
+    }
+
+    @Override
+    public boolean isAvailable( T instance )
+    {
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceInstanceImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceInstanceImporter.java b/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceInstanceImporter.java
new file mode 100644
index 0000000..b0abf1b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceInstanceImporter.java
@@ -0,0 +1,79 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.importer;
+
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Use a registered service that implements ServiceImporter to do the actual
+ * import. The service id of the service that this importer should delegate to must
+ * be set as meta-info on this service. Example:
+ * <pre><code>
+ * module.services(MyServiceImporterService.class).identifiedBy("someid");
+ * module.importedServices(OtherService.class).importedBy(ServiceInstanceImporter.class).setMetaInfo("someid");
+ * </code></pre>
+ */
+public class ServiceInstanceImporter<T>
+    implements ServiceImporter<T>
+{
+    @Structure
+    ServiceFinder finder;
+
+    ServiceImporter<T> service;
+
+    Identity serviceId;
+
+    @Override
+    public T importService( ImportedServiceDescriptor importedServiceDescriptor )
+        throws ServiceImporterException
+    {
+        serviceId = importedServiceDescriptor.metaInfo( Identity.class );
+
+        return serviceImporter().importService( importedServiceDescriptor );
+    }
+
+    @Override
+    public boolean isAvailable( T instance )
+    {
+        return serviceImporter().isAvailable( instance );
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    private ServiceImporter<T> serviceImporter()
+    {
+        if( service == null )
+        {
+            service = finder.findServices( ServiceImporter.class )
+                            .filter( ref -> ref.identity().equals( serviceId ) )
+                            .findFirst().map( ServiceReference::get )
+                            .orElseThrow( () -> new ServiceImporterException(
+                                "No service importer with id '" + serviceId + "' was found" )
+                            );
+        }
+        return service;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceSelectorImporter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceSelectorImporter.java b/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceSelectorImporter.java
new file mode 100644
index 0000000..929b814
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/importer/ServiceSelectorImporter.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.importer;
+
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.service.Availability;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.service.ServiceImporter;
+import org.apache.polygene.api.service.ServiceImporterException;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * If several services are available with a given type, and you want to constrain
+ * the current module to use a specific one, then use this importer. Specify a
+ * Specification&lt;ServiceReference&lt;T&gt;&gt; criteria as meta-info for the service, which will be applied
+ * to the list of available services, and the first match will be chosen.
+ *
+ * This importer will avoid selecting itself, as could be possible if the ServiceQualifier.first()
+ * filter is used.
+ */
+public final class ServiceSelectorImporter<T>
+    implements ServiceImporter<T>
+{
+    @Structure
+    private ServiceFinder locator;
+
+    @Override
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public T importService( ImportedServiceDescriptor serviceDescriptor )
+        throws ServiceImporterException
+    {
+        Predicate<ServiceReference<?>> selector = serviceDescriptor.metaInfo( Predicate.class );
+        Class serviceType = serviceDescriptor.types().findFirst().orElse( null );
+
+        Stream<ServiceReference<T>> services = locator.findServices( serviceType );
+        Predicate<ServiceReference<T>> filter = ref ->
+        {
+            Predicate selector1 = ref.metaInfo( Predicate.class );
+            return selector1 == null || selector == selector1;
+        };
+        return services.filter( filter.and( selector ) )
+                       .findFirst().map( ServiceReference::get )
+                       .orElseThrow(
+                           () -> new ServiceImporterException(
+                               "Could not find any service to import that matches the given specification for "
+                               + serviceDescriptor.identity() ) );
+    }
+
+    @Override
+    public boolean isAvailable( T instance )
+    {
+        return !( instance instanceof Availability ) || ( (Availability) instance ).isAvailable();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/importer/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/importer/package.html b/core/api/src/main/java/org/apache/polygene/api/service/importer/package.html
new file mode 100644
index 0000000..be1d382
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/importer/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Service Importers.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/package.html b/core/api/src/main/java/org/apache/polygene/api/service/package.html
new file mode 100644
index 0000000..c217c9c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Service API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Active.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Active.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Active.java
new file mode 100644
index 0000000..8428f36
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Active.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Filter services based on whether they are active or not.
+ * <p>
+ * At an injection point you can do this:
+ * </p>
+ * <pre><code>
+ * &#64;Service &#64;Active MyService service;
+ * </code></pre>
+ * <p>
+ * to get only a service that is currently active.
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Qualifier( Active.ActiveQualifier.class )
+public @interface Active
+{
+    /**
+     * Active Annotation Qualifier.
+     * See {@link Active}.
+     */
+    public final class ActiveQualifier
+        implements AnnotationQualifier<Active>
+    {
+        @Override
+        public <T> Predicate<ServiceReference<?>> qualifier( Active active )
+        {
+            return ServiceQualifier.whereActive();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/AnnotationQualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/AnnotationQualifier.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/AnnotationQualifier.java
new file mode 100644
index 0000000..8c35932
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/AnnotationQualifier.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Annotation;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Constructs a Specification for a given qualifier annotation
+ */
+public interface AnnotationQualifier<QUALIFIER extends Annotation>
+{
+    public <T> Predicate<ServiceReference<?>> qualifier( QUALIFIER qualifier );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Available.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Available.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Available.java
new file mode 100644
index 0000000..7af40d1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Available.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Filter services based on whether they are available or not.
+ *
+ * At an injection point you can do this:
+ *
+ * <pre><code>
+ * &#64;Service &#64;Available MyService service;
+ * </code></pre>
+ * to get only a service that is currently available.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Qualifier( Available.AvailableQualifier.class )
+public @interface Available
+{
+    /**
+     * Available Annotation Qualifier.
+     * See {@link Available}.
+     */
+    public final class AvailableQualifier
+        implements AnnotationQualifier<Available>
+    {
+        @Override
+        public <T> Predicate<ServiceReference<?>> qualifier( Available active )
+        {
+            return ServiceQualifier.whereAvailable();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/HasMetaInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/HasMetaInfo.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/HasMetaInfo.java
new file mode 100644
index 0000000..73d551f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/HasMetaInfo.java
@@ -0,0 +1,108 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Filter services based on Meta Info being declared on the Service.
+ * <p>
+ * Meta Info of any type can be set on the service during assembly, e.g.;
+ * </p>
+ * <pre><code>
+ * module.addService( MyService.class ).setMetaInfo( new MyCustomInfo(someData) );
+ * </code></pre>
+ * <p>
+ * and then at an injection point you can do this:
+ * </p>
+ * <pre><code>
+ * &#64;Service &#64;HasMetaInfo(MyCustomInfo.class) MyService service;
+ * </code></pre>
+ * <p>
+ * to get only a service that has a MyCustomInfo instance set as meta info.
+ * </p>
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Qualifier( HasMetaInfo.HasMetaInfoQualifier.class )
+@Documented
+public @interface HasMetaInfo
+{
+    /**
+     * The Class(es) needed to have been defined in the Service meta info for a qualifier to evaluate true.
+     *
+     * @return One or more classes that should be defined in the service's meta info for the service to be considered
+     *         qualified. If more than one class is defined, the {@code anded()} parameter will define if they must be
+     *         AND'ed or OR'ed together.
+     */
+    Class[] value();
+
+    /**
+     * True if the Classes defined in the value() field should be AND'ed instead of OR'ed.
+     *
+     * @return If true, all the Class types defined in {@code value()} must be defined for the service for it to be
+     *         qualified. If false, if any of the Class types defined in {@code value()} is defined for the service
+     *         the service is qualified.
+     */
+    boolean anded() default false;
+
+    /**
+     * HasMetaInfo Annotation Qualifier.
+     * See {@link HasMetaInfo}.
+     */
+    public static class HasMetaInfoQualifier
+        implements AnnotationQualifier<HasMetaInfo>
+    {
+        @Override
+        public <T> Predicate<ServiceReference<?>> qualifier( final HasMetaInfo hasMetaInfo )
+        {
+            return new Predicate<ServiceReference<?>>()
+            {
+                @Override
+                @SuppressWarnings( {"raw", "unchecked"} )
+                public boolean test( ServiceReference<?> service )
+                {
+                    for( Class metaInfoType : hasMetaInfo.value() )
+                    {
+                        Object metaInfo = service.metaInfo( metaInfoType );
+                        if( hasMetaInfo.anded() )
+                        {
+                            if( metaInfo == null )
+                            {
+                                return false;
+                            }
+                        }
+                        else
+                        {
+                            if( metaInfo != null )
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                    return false;
+                }
+            };
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/IdentifiedBy.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/IdentifiedBy.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/IdentifiedBy.java
new file mode 100644
index 0000000..40c52bb
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/IdentifiedBy.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Filter services based on identity. Identity can be set during assembly, like so:
+ * <pre><code>
+ * module.addService(MyService.class).identifiedBy("myservice1");
+ * </code></pre>
+ *
+ * and then at an injection point you can do this:
+ * <pre><code>
+ * &#64;Service @IdentifiedBy("myservice1") MyService service;
+ * </code></pre>
+ * to get only a service identified "myservice1".
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Qualifier( IdentifiedBy.IdentifiedByQualifier.class )
+public @interface IdentifiedBy
+{
+    public abstract String value();
+
+    /**
+     * IdentifiedBy Annotation Qualifier.
+     * See {@link IdentifiedBy}.
+     */
+    public final class IdentifiedByQualifier
+        implements AnnotationQualifier<IdentifiedBy>
+    {
+        @Override
+        public <T> Predicate<ServiceReference<?>> qualifier( IdentifiedBy identifiedBy )
+        {
+            return ServiceQualifier.withId( identifiedBy.value() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Qualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Qualifier.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Qualifier.java
new file mode 100644
index 0000000..c0b183b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Qualifier.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Annotation used to declare Qualifiers annotations.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+public @interface Qualifier
+{
+    public abstract Class<? extends AnnotationQualifier> value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceQualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceQualifier.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceQualifier.java
new file mode 100644
index 0000000..8e6a948
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceQualifier.java
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * This class helps you select a particular service
+ * from a list.
+ * <p>
+ * Provide a Selector which does the actual
+ * selection from the list. A common case is to select
+ * based on reference of the service, which you can do this way:
+ * </p>
+ *
+ * <pre><code>
+ * new ServiceQualifier&lt;MyService&gt;(services, ServiceQualifier.withId("someId"))
+ * </code></pre>
+ * <p>
+ * Many selectors can be combined by using firstOf. Example:
+ * </p>
+ * <pre><code>
+ * new ServiceQualifier&lt;MyService&gt;(services, firstOf(withTags("sometag"), firstActive(), first()))
+ * </code></pre>
+ * <p>
+ * This will pick a service that has the tag "sometag", or if none is found take the first active one. If no
+ * service is active, then the first service will be picked.
+ * </p>
+ */
+public abstract class ServiceQualifier
+{
+    public static Predicate<ServiceReference<?>> withId( final String anId )
+    {
+        return new Predicate<ServiceReference<?>>()
+        {
+            @Override
+            public boolean test( ServiceReference<?> service )
+            {
+                return service.identity().toString().equals( anId );
+            }
+        };
+    }
+
+    public static Predicate<ServiceReference<?>> whereMetaInfoIs( final Object metaInfo )
+    {
+        return new Predicate<ServiceReference<?>>()
+        {
+            @Override
+            public boolean test( ServiceReference<?> service )
+            {
+                Object metaObject = service.metaInfo( metaInfo.getClass() );
+                return metaObject != null && metaInfo.equals( metaObject );
+            }
+        };
+    }
+
+    public static Predicate<ServiceReference<?>> whereActive()
+    {
+        return new Predicate<ServiceReference<?>>()
+        {
+            @Override
+            public boolean test( ServiceReference<?> service )
+            {
+                return service.isActive();
+            }
+        };
+    }
+
+    public static Predicate<ServiceReference<?>> whereAvailable()
+    {
+        return new Predicate<ServiceReference<?>>()
+        {
+            @Override
+            public boolean test( ServiceReference<?> service )
+            {
+                return service.isAvailable();
+            }
+        };
+    }
+
+    public static Predicate<ServiceReference<?>> withTags( final String... tags )
+    {
+        return new Predicate<ServiceReference<?>>()
+        {
+            @Override
+            public boolean test( ServiceReference<?> service )
+            {
+                ServiceTags serviceTags = service.metaInfo( ServiceTags.class );
+
+                return serviceTags != null && serviceTags.hasTags( tags );
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceTags.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceTags.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceTags.java
new file mode 100644
index 0000000..c616a9f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/ServiceTags.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.io.Serializable;
+
+/**
+ * Use this as metainfo about a Service to specify tags. Easiest way to set them on a service
+ * is to use the <code>ServiceDeclaration.taggedWith(String...)</code> method.
+ *
+ * These can be used in conjunction with the withTags() Service
+ * Selector.
+ */
+public final class ServiceTags
+    implements Serializable
+{
+    private String[] tags;
+
+    public ServiceTags( String... tags )
+    {
+        this.tags = tags;
+    }
+
+    public String[] tags()
+    {
+        return tags;
+    }
+
+    public boolean hasTag( String tag )
+    {
+        for( String serviceTag : tags )
+        {
+            if( serviceTag.equals( tag ) )
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public boolean hasTags( String... aTags )
+    {
+        for( String tag : aTags )
+        {
+            if( !hasTag( tag ) )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Tagged.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Tagged.java b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Tagged.java
new file mode 100644
index 0000000..3df0780
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/Tagged.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.service.qualifier;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
+import org.apache.polygene.api.service.ServiceReference;
+
+/**
+ * Filter services based on tags. Tags can be set using the ServiceTags meta-info, like so:
+ * <pre><code>
+ * module.addService(MyService.class).taggedWith(new ServiceTags("onetag","twotag"));
+ * </code></pre>
+ *
+ * and then at an injection point you can do this:
+ *
+ * <pre><code>
+ * &#64;Service &#64;Tagged("onetag") MyService service;
+ * </code></pre>
+ * to get only a service tagged with MyService. If several match only the first match is used.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Qualifier( Tagged.TaggedQualifier.class )
+public @interface Tagged
+{
+    String[] value();
+
+    /**
+     * Tagged Annotation Qualifier.
+     * See {@link Tagged}.
+     */
+    final class TaggedQualifier
+        implements AnnotationQualifier<Tagged>
+    {
+        @Override
+        public Predicate<ServiceReference<?>> qualifier( Tagged tagged )
+        {
+            return ServiceQualifier.withTags( tagged.value() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
new file mode 100644
index 0000000..d37dc22
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
@@ -0,0 +1,62 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Service Qualifiers.</h2>
+        <p>
+            The @Service injection is only able to specify the type of the service to be injected. If any other type of
+            qualification has to be done it has to be done manually but for common cases it's more convenient to use
+            annotations to do this filtering. This package contains annotations to perform this qualification.
+        </p>
+        <p>Example:</p>
+        <blockquote>
+            <pre>@Service @Tagged( "sometag" ) MyService service;</pre>
+        </blockquote>
+        <p>
+            This will only inject instances of MyService that have been tagged with "sometag". If none exist an
+            exception will occur at injection time since it is not optional.
+        </p>
+        <p>It also works with iterables:</p>
+        <blockquote>
+            <pre>@Service @Tagged( "sometag" ) Iterable&lt;MyService&gt; services;</pre>
+        </blockquote>
+        <p>
+            The qualification will be evaluated upon each call to iterator(), and since the qualifier has access to a
+            ServiceReference, which contains the isActive() method, it can even provide some dynamicity.
+        </p>
+        <blockquote>
+            <pre>@Service @Active Iterable&lt;SomeImportedService&gt; importedServices;</pre>
+        </blockquote>
+        <p>
+            Let's say these SomeImportedService are only sometimes available. Then whenever iterator() is called the
+            {@link org.apache.polygene.api.service.qualifier.Active} tag can kick in and filter out those whose
+            ServiceReference.isActive() returns false.
+        </p>
+        <p>Standard ones defined in the API are:</p>
+        <ul>
+            <li>{@link org.apache.polygene.api.service.qualifier.Active}</li>
+            <li>{@link org.apache.polygene.api.service.qualifier.Available}</li>
+            <li>{@link org.apache.polygene.api.service.qualifier.HasMetaInfo}</li>
+            <li>{@link org.apache.polygene.api.service.qualifier.IdentifiedBy}</li>
+            <li>{@link org.apache.polygene.api.service.qualifier.Tagged}</li>
+        </ul>
+        <p>See tests and API for more examples, and how to implement your own qualifiers.</p>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/GenericSideEffect.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/GenericSideEffect.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/GenericSideEffect.java
new file mode 100644
index 0000000..7d9119e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/GenericSideEffect.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * Base class for generic SideEffects.
+ */
+public abstract class GenericSideEffect
+    extends SideEffectOf<InvocationHandler>
+    implements InvocationHandler
+{
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Object invoke( final Object proxy, final Method method, final Object[] args )
+        throws Throwable
+    {
+        invoke( method, args );
+        return null;
+    }
+
+    /**
+     * Convenience method to be overridden by subclasses in order to avoid returning null, as returned value from side
+     * effects is not taken in consideration.
+     *
+     * @param method the method that was invoked
+     * @param args   the arguments of the method invocation
+     *
+     * @throws Throwable - the exception to throw from the method invocation on the proxy instance. The exception's type
+     *                   must be assignable either to any of the exception types declared in the throws clause of the
+     *                   interface method or to the unchecked exception types {code}java.lang.RuntimeException{code}
+     *                   or {code}java.lang.Error{code}. If a checked exception is thrown by this method that is not
+     *                   assignable to any of the exception types declared in the throws clause of the interface method,
+     *                   then an UndeclaredThrowableException containing the exception that was thrown by this method
+     *                   will be thrown by the method invocation on the proxy instance.
+     */
+    protected void invoke( final Method method, final Object[] args )
+        throws Throwable
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectDescriptor.java
new file mode 100644
index 0000000..85a2842
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectDescriptor.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect;
+
+/**
+ * SideEffect Descriptor.
+ */
+public interface SideEffectDescriptor
+{
+    Class<?> modifierClass();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectOf.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectOf.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectOf.java
new file mode 100644
index 0000000..eca348f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectOf.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect;
+
+import org.apache.polygene.api.sideeffect.internal.SideEffectFor;
+
+/**
+ * Base class for SideEffects. It introduces a typed "next" pointer
+ * that SideEffects can use to get the result of the original invocation.
+ * <p>
+ * Generic SideEffects should subclass {@link GenericSideEffect} instead.
+ * </p>
+ * <p>
+ * SideEffects implementations must be thread-safe in their implementation,
+ * as multiple threads may share instances.
+ * </p>
+ */
+public abstract class SideEffectOf<T>
+{
+    final
+    @SideEffectFor
+    protected T result = null;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffects.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffects.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffects.java
new file mode 100644
index 0000000..af1ab3f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffects.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used by composites and mixins to declare what SideEffects
+ * should apply to the type or specific method.
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface SideEffects
+{
+    Class<?>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectsDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectsDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectsDescriptor.java
new file mode 100644
index 0000000..55bbcf4
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/SideEffectsDescriptor.java
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect;
+
+/**
+ * SideEffects Descriptor.
+ */
+public interface SideEffectsDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/SideEffectFor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/SideEffectFor.java b/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/SideEffectFor.java
new file mode 100644
index 0000000..59617c8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/SideEffectFor.java
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.sideeffect.internal;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.polygene.api.injection.InjectionScope;
+
+/**
+ * This annotation is required once in each SideEffect, to mark the
+ * field where the element providing the invocation result should be
+ * injected.
+ * <p>
+ * The type of the field must be of the same type as the SideEffect
+ * itself, or an InvocationHandler.
+ * </p>
+ * <p>
+ * Example;
+ * </p>
+ * <pre><code>
+ * public interface MyStuff
+ * {
+ *     SomeResult doSomething();
+ * }
+ *
+ * public class MyStuffSideEffect
+ *     implements MyStuff
+ * {
+ *     &#64;SideEffectFor MyStuff next;
+ *
+ *     public SomeResult doSomething()
+ *     {
+ *          SomeResult result = next.doSomething();
+ *
+ *         // HERE DO THE SIDEEFFECT STUFF.
+ *
+ *          return result; // Result value is ignored, null would work too.
+ *     }
+ * }
+ * </code></pre>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.FIELD, ElementType.PARAMETER })
+@Documented
+@InjectionScope
+public @interface SideEffectFor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/package.html b/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/package.html
new file mode 100644
index 0000000..9f70396
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/internal/package.html
@@ -0,0 +1,28 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h1>Internal/Private package for the API.</h1>
+        <p>
+            This is an internal package, and no classes in this package is part of the API and compatibility
+            with these classes will not be attempted.
+        </p>
+    </body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/sideeffect/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/sideeffect/package.html b/core/api/src/main/java/org/apache/polygene/api/sideeffect/package.html
new file mode 100644
index 0000000..4f14cc1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/sideeffect/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>SideEffect API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/Application.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/Application.java b/core/api/src/main/java/org/apache/polygene/api/structure/Application.java
new file mode 100644
index 0000000..609a9c8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/Application.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+
+/**
+ * The Application represents a whole Polygene application.
+ */
+public interface Application
+    extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
+{
+    /**
+     * Application modes.
+     */
+    public enum Mode
+    {
+        /**
+         * Should be used for unit test runs. Created files etc. should be cleaned up between runs.
+         */
+        test,
+        /**
+         * Should be used during development. Typically create in-memory databases etc.
+         */
+        development,
+        /**
+         * Should be used in QA environments, and other production-like settings where different set of external
+         * resources are utilized.
+         */
+        staging,
+        /**
+         * Should be used in production. All databases are persistent on disk etc.
+         */
+        production
+    }
+
+    /**
+     * @return Application name
+     */
+    String name();
+
+    /**
+     * The version of the application. This can be in any format, but
+     * most likely will follow the Dewey format, i.e. x.y.z.
+     *
+     * @return the version of the application
+     */
+    String version();
+
+    /**
+     * @return Application Mode
+     */
+    Mode mode();
+
+    /**
+     * Find a Layer.
+     *
+     * @param layerName Layer name
+     * @return Found Layer, never returns null
+     * @throws IllegalArgumentException if there's no such Layer
+     */
+    Layer findLayer( String layerName )
+        throws IllegalArgumentException;
+
+    /**
+     * Find a Module.
+     *
+     * @param layerName Layer name
+     * @param moduleName Module name
+     * @return Found Module, never returns null
+     * @throws IllegalArgumentException if there's no such Module
+     */
+    Module findModule( String layerName, String moduleName )
+        throws IllegalArgumentException;
+
+    /**
+     * @return Application Descriptor
+     */
+    ApplicationDescriptor descriptor();
+
+    Stream<? extends Layer> layers();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/ApplicationDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/ApplicationDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/structure/ApplicationDescriptor.java
new file mode 100644
index 0000000..82d01e0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/ApplicationDescriptor.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * Application Descriptor.
+ */
+public interface ApplicationDescriptor
+    extends VisitableHierarchy<Object, Object>
+{
+    /**
+     * Create a new instance of the Application.
+     * @param runtime Polygene Runtime
+     * @param importedServiceInstances Imported Services instances
+     * @return a new instance of the Application.
+     */
+    Application newInstance( PolygeneAPI runtime, Object... importedServiceInstances );
+
+    /**
+     * @return the Application's name
+     */
+    String name();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/Layer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/Layer.java b/core/api/src/main/java/org/apache/polygene/api/structure/Layer.java
new file mode 100644
index 0000000..2271047
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/Layer.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.activation.Activation;
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+
+/**
+ * The Layer represents a single layer in a Polygene application.
+ */
+public interface Layer
+    extends ActivationEventListenerRegistration, Activation, MetaInfoHolder
+{
+    /**
+     * @return the Layer's name
+     */
+    String name();
+
+    Application application();
+
+    Stream<? extends Module> modules();
+
+    LayerDescriptor descriptor();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/LayerDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/LayerDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/structure/LayerDescriptor.java
new file mode 100644
index 0000000..e8270ae
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/LayerDescriptor.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * Layer Descriptor.
+ */
+public interface LayerDescriptor
+{
+
+    /**
+     * @return the Layer's name
+     */
+    String name();
+
+    Layer instance();
+
+    /**
+     * @return Layers used by this Layer
+     */
+    UsedLayersDescriptor usedLayers();
+
+    Stream<? extends ObjectDescriptor> visibleObjects( Visibility visibility );
+
+    Stream<? extends TransientDescriptor> visibleTransients( Visibility visibility );
+
+    Stream<? extends EntityDescriptor> visibleEntities( Visibility visibility );
+
+    Stream<? extends ValueDescriptor> visibleValues( Visibility visibility );
+
+    Stream<? extends ModelDescriptor> visibleServices( Visibility visibility );
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/MetaInfoHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/MetaInfoHolder.java b/core/api/src/main/java/org/apache/polygene/api/structure/MetaInfoHolder.java
new file mode 100644
index 0000000..eea762e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/MetaInfoHolder.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+/**
+ * MetaInfo holder.
+ */
+public interface MetaInfoHolder
+{
+
+    /**
+     * Get metadata that implements the given type.
+     * The info is registered during assembly of the application.
+     *
+     * @param infoType the type of metadata to be returned
+     *
+     * @return the metadata for the given type, or <code>null</code> if
+     *         no such metadata has been registered
+     */
+    <T> T metaInfo( Class<T> infoType );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/Module.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/Module.java b/core/api/src/main/java/org/apache/polygene/api/structure/Module.java
new file mode 100644
index 0000000..635615f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/Module.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import org.apache.polygene.api.activation.ActivationEventListenerRegistration;
+import org.apache.polygene.api.composite.TransientBuilderFactory;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.api.query.QueryBuilderFactory;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+
+/**
+ * API for interacting with a Module. Instances
+ * of this can be accessed by using the {@link Structure}
+ * injection scope.
+ */
+public interface Module
+    extends ActivationEventListenerRegistration,
+            MetaInfoHolder,
+            ObjectFactory,
+            TransientBuilderFactory,
+            ValueBuilderFactory,
+            QueryBuilderFactory,
+            ServiceFinder
+{
+
+    /**
+     * @return the Module's name
+     */
+    String name();
+
+    ModuleDescriptor descriptor();
+
+    /**
+     * @return the Layer that the Module is declared in.
+     */
+    LayerDescriptor layer();
+
+    /** Returns the TypeLookup for the Module.
+     * TypeLookup handles all the types visible from within this Module.
+     *
+     * @return TypeLookup for this Module
+     */
+    TypeLookup typeLookup();
+
+    /** Returns the UnitOfWorkFactory for this Module.
+     *
+     * @return the UnitOfWorkFactory of this Module.
+     */
+    UnitOfWorkFactory unitOfWorkFactory();
+
+    /** Returns the ServiceFinder for this Module.
+     *
+     * @return the ServiceFinder for this Module.
+     */
+    ServiceFinder serviceFinder();
+
+    /** Returns the ValueBuilderFactory for this Module.
+     *
+     * @return the ValueBuilderFactory for this Module.
+     */
+    ValueBuilderFactory valueBuilderFactory();
+
+    /** Returns the TransientBuilderFactory for this Module.
+     *
+     * @return the TransientBuilderFactory for this Module.
+     */
+    TransientBuilderFactory transientBuilderFactory();
+
+    /** Returns the ObjectFactory for this Module.
+     *
+     * @return the ObjectFactory for this Module.
+     */
+    ObjectFactory objectFactory();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/ModuleDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/ModuleDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/structure/ModuleDescriptor.java
new file mode 100644
index 0000000..006ab06
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/ModuleDescriptor.java
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.service.ImportedServiceDescriptor;
+import org.apache.polygene.api.service.ServiceDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+/**
+ * Module Descriptor.
+ */
+public interface ModuleDescriptor
+{
+    String name();
+
+    LayerDescriptor layer();
+
+    /**
+     * @return the Module's ClassLoader
+     */
+    ClassLoader classLoader();
+
+    /**
+     * @param typeName name of a transient composite type
+     *
+     * @return the descriptor for a transient composite or null if the class could not be found or the transient composite is not visible
+     */
+    TransientDescriptor transientDescriptor( String typeName );
+
+    /**
+     * @param typeName name of an entity composite type
+     *
+     * @return the descriptor for an entity composite or null if the class could not be found or the entity composite is not visible
+     */
+    EntityDescriptor entityDescriptor( String typeName );
+
+    /**
+     * @param typeName name of an object type
+     *
+     * @return the descriptor for an object or null if the class could not be found or the object is not visible
+     */
+    ObjectDescriptor objectDescriptor( String typeName );
+
+    /**
+     * @param typeName name of a value composite type
+     *
+     * @return the descriptor for a value composite or null if the class could not be found or the value composite is not visible
+     */
+    ValueDescriptor valueDescriptor( String typeName );
+
+    Stream<? extends TransientDescriptor> findVisibleTransientTypes();
+
+    Stream<? extends ValueDescriptor> findVisibleValueTypes();
+
+    Stream<? extends EntityDescriptor> findVisibleEntityTypes();
+
+    Stream<? extends ObjectDescriptor> findVisibleObjectTypes();
+
+    Stream<? extends TransientDescriptor> transientComposites();
+
+    Stream<? extends ValueDescriptor> valueComposites();
+
+    Stream<? extends EntityDescriptor> entityComposites();
+
+    Stream<? extends ObjectDescriptor> objects();
+
+    Stream<? extends ImportedServiceDescriptor> importedServices();
+
+    Stream<? extends ServiceDescriptor> serviceComposites();
+
+    Module instance();
+
+    TypeLookup typeLookup();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/structure/TypeLookup.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/structure/TypeLookup.java b/core/api/src/main/java/org/apache/polygene/api/structure/TypeLookup.java
new file mode 100644
index 0000000..ceafc20
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/structure/TypeLookup.java
@@ -0,0 +1,195 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.structure;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.AmbiguousTypeException;
+import org.apache.polygene.api.composite.ModelDescriptor;
+import org.apache.polygene.api.composite.TransientDescriptor;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.object.ObjectDescriptor;
+import org.apache.polygene.api.value.ValueDescriptor;
+
+public interface TypeLookup
+{
+    /**
+     * Lookup first Object Model matching the given Type.
+     *
+     * <p>First, if Object Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Second, if Object Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return First matching Object Model
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    ObjectDescriptor lookupObjectModel( Class<?> type ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup first Transient Model matching the given Type.
+     *
+     * <p>First, if Transient Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Second, if Transient Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return First matching Transient Model
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    TransientDescriptor lookupTransientModel( Class<?> type ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup first Value Model matching the given Type.
+     *
+     * <p>First, if Value Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Second, if Value Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return First matching Value Model
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    ValueDescriptor lookupValueModel( Class<?> type ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup first Entity Model matching the given Type.
+     *
+     * <p>First, if Entity Models exactly match the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Second, if Entity Models match a type assignable to the given type, the closest one (Visibility then Assembly order) is returned.
+     * Multiple <b>assignable</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * <p><b>Should be used for creational use cases only.</b> For non-creational use cases see
+     * {@link #lookupEntityModels(Class)}.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return First matching Entity Model
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    EntityDescriptor lookupEntityModel( Class<?> type ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup all Entity Models matching the given Type.
+     *
+     * <p>Returned List contains, in order, Entity Models that: </p>
+     *
+     * <ul>
+     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
+     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
+     * </ul>
+     *
+     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>forbidden</b> and result in an AmbiguousTypeException.</p>
+     * <p>Multiple <b>assignable</b> matches are <b>allowed</b> to enable polymorphic fetches and queries.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * <p><b>Should be used for non-creational use cases only.</b> For creational use cases see
+     * {@link #lookupEntityModel(Class)}.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return All matching Entity Models
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    List<EntityDescriptor> lookupEntityModels( Class<?> type ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup first ServiceDescriptor/ImportedServiceDescriptor matching the given Type.
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * <p>See {@link #lookupServiceModels(Type)}.</p>
+     *
+     * @param serviceType Looked up Type
+     *
+     * @return First matching Service
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    ModelDescriptor lookupServiceModel( Type serviceType ) throws AmbiguousTypeException;
+
+    /**
+     * Lookup all ServiceDescriptors matching the given Type.
+     *
+     * <p>Returned List contains, in order, ServiceReferences that: </p>
+     *
+     * <ul>
+     * <li>exactly match the given type, in Visibility then Assembly order ;</li>
+     * <li>match a type assignable to the given type, in Visibility then Assembly order.</li>
+     * </ul>
+     *
+     * <p>Multiple <b>exact</b> matches with the same Visibility are <b>allowed</b> to enable polymorphic lookup/injection.</p>
+     * <p>Multiple <b>assignable</b> matches with the same Visibility are <b>allowed</b> for the very same reason.</p>
+     *
+     * <p>Type lookup is done lazily and cached.</p>
+     *
+     * @param type Looked up Type
+     *
+     * @return All matching ServiceReferences
+     * @throws AmbiguousTypeException when a type ambiguity is found
+     */
+    List<? extends ModelDescriptor> lookupServiceModels( Type type ) throws AmbiguousTypeException;
+
+    /**
+     * @return All visible Objects, in visibility order
+     */
+    Stream<ObjectDescriptor> allObjects();
+
+    /**
+     * @return All visible Transients, in visibility order
+     */
+    Stream<TransientDescriptor> allTransients();
+
+    /**
+     * @return All visible Values, in visibility order
+     */
+    Stream<ValueDescriptor> allValues();
+
+    /**
+     * @return All visible Entities, in visibility order
+     */
+    Stream<EntityDescriptor> allEntities();
+
+    /**
+     * @return All visible Services, in visibility order
+     */
+    Stream<? extends ModelDescriptor> allServices();
+}


[43/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/injection/scope/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/injection/scope/package.html b/core/api/src/main/java/org/apache/polygene/api/injection/scope/package.html
new file mode 100644
index 0000000..10f4f1c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/injection/scope/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Dependency Injection Scopes.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/Metric.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/Metric.java b/core/api/src/main/java/org/apache/polygene/api/metrics/Metric.java
new file mode 100644
index 0000000..46cd3f5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/Metric.java
@@ -0,0 +1,28 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Marker interface for all Metric types.
+ */
+public interface Metric
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricNames.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricNames.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricNames.java
new file mode 100644
index 0000000..d24bd8e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricNames.java
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+import org.apache.polygene.api.structure.Module;
+
+import java.lang.reflect.Method;
+import java.util.StringJoiner;
+
+/**
+ * Metric names utilities.
+ */
+public class MetricNames
+{
+    /**
+     * Build a Metric name for the given fragments.
+     *
+     * @param fragments Name fragments
+     * @return Metric name
+     */
+    public static String nameFor( String... fragments )
+    {
+        StringJoiner joiner = new StringJoiner( "." );
+        for( String fragment : fragments )
+        {
+            joiner.add( fragment );
+        }
+        return joiner.toString();
+    }
+
+    /**
+     * Build a Metric name for the given Module, Type and optional fragments.
+     *
+     * @param module Module
+     * @param type Type
+     * @param fragments Name fragments
+     * @return Metric name
+     */
+    public static String nameFor( Module module, Class<?> type, String... fragments )
+    {
+        StringJoiner joiner = new StringJoiner( "." )
+                .add( module.layer().name() )
+                .add( module.name() )
+                .add( className( type ) );
+        for( String fragment : fragments )
+        {
+            joiner.add( fragment );
+        }
+        return joiner.toString();
+    }
+
+    /**
+     * Build a Metric name for the given Module, Method and optional fragments.
+     *
+     * @param module Module
+     * @param method Method
+     * @param fragments Name fragments
+     * @return Metric name
+     */
+    public static String nameFor( Module module, Method method, String... fragments )
+    {
+        StringJoiner joiner = new StringJoiner( "." )
+                .add( module.layer().name() )
+                .add( module.name() )
+                .add( className( method.getDeclaringClass() ) )
+                .add( method.getName() );
+        for( String fragment : fragments )
+        {
+            joiner.add( fragment );
+        }
+        return joiner.toString();
+    }
+
+    private static String className( Class<?> clazz )
+    {
+        return clazz.getName().substring( clazz.getName().lastIndexOf( '.' ) + 1 ).replace( '$', '.' );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounter.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounter.java
new file mode 100644
index 0000000..9b9b9df
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounter.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Metrics Counter.
+ */
+public interface MetricsCounter extends Metric
+{
+    void increment();
+
+    void increment( int steps );
+
+    void decrement();
+
+    void decrement( int steps );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounterFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounterFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounterFactory.java
new file mode 100644
index 0000000..45959a3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsCounterFactory.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Create MetricsCounter instances.
+ */
+public interface MetricsCounterFactory extends MetricsFactory
+{
+    /**
+     * Create a MetricsCounter instance.
+     * If the same arguments are given twice, the same instance must be returned.
+     *
+     * @param name   A human readable, short name of the metric.
+     *
+     * @return A Metric instance to be used, OR org.apache.polygene.spi.metrics.DefaultMetric.NULL if not supported.
+     */
+    MetricsCounter createCounter( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsFactory.java
new file mode 100644
index 0000000..af85ea9
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsFactory.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+import java.util.stream.Stream;
+
+/**
+ * Metrics Factory.
+ */
+public interface MetricsFactory
+{
+    Stream<Metric> registered();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGauge.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGauge.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGauge.java
new file mode 100644
index 0000000..cf34fe6
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGauge.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * MetricsGauge is the most basic Metric type, and is completely flexible and therefor handled slightly differently in
+ * the MetricsFactory than all other Gauges. It needs to pass on custom code, so the implementation is typically
+ * an anonymous class, inlined at the implementation.
+ *
+ * @param <T> Any type holding the MetricsGauge's current value.
+ */
+public interface MetricsGauge<T> extends Metric
+{
+    /**
+     * Returns the metric's current value.
+     *
+     * @return the metric's current value
+     */
+    T value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGaugeFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGaugeFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGaugeFactory.java
new file mode 100644
index 0000000..9af3d19
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsGaugeFactory.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Register MetricsGauge with the underlying Metrics system.
+ */
+public interface MetricsGaugeFactory extends MetricsFactory
+{
+    /**
+     * Register a MetricsGauge with the underlying Metrics system.
+     *
+     * @param name   A human readable, short name of the metric.
+     * @param gauge  The implementation of the MetricsGauge.
+     * @param <T>    Any type holding the MetricsGauge's current value.
+     *
+     * @return The same MetricsGauge or the DefaultMetric.NULL MetricsGauge instance.
+     */
+    <T> MetricsGauge<T> registerGauge( String name, MetricsGauge<T> gauge );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheck.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheck.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheck.java
new file mode 100644
index 0000000..e65703c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheck.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Metrics Health Check.
+ */
+public interface MetricsHealthCheck extends Metric
+{
+    Result check()
+        throws Exception;
+
+    final class Result
+    {
+        private final boolean healthy;
+        private final String message;
+        private final Throwable exception;
+
+        public Result( boolean isHealthy, String message, Throwable exception )
+        {
+            healthy = isHealthy;
+            this.message = message;
+            this.exception = exception;
+        }
+
+        public boolean isHealthy()
+        {
+            return healthy;
+        }
+
+        public String getMessage()
+        {
+            return message;
+        }
+
+        public Throwable getException()
+        {
+            return exception;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheckFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheckFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheckFactory.java
new file mode 100644
index 0000000..ff31d02
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHealthCheckFactory.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Create MetricsHealthCheck instances.
+ */
+public interface MetricsHealthCheckFactory extends MetricsFactory
+{
+    /**
+     * Create a MetricsHealthCheck instance.
+     * If the same arguments are given twice, the same instance must be returned.
+     *
+     * @param name   A human readable, short name of the metric.
+     * @param check  The health check to be performed regularly.
+     *
+     * @return A MetricsHealthCheck instance to be used, OR org.apache.polygene.spi.metrics.DefaultMetric.NULL if not supported.
+     *
+     */
+    MetricsHealthCheck registerHealthCheck( String name, MetricsHealthCheck check );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogram.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogram.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogram.java
new file mode 100644
index 0000000..a61ee1f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogram.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * A metric which calculates the distribution of a value.
+ *
+ * @see <a href="http://www.johndcook.com/standard_deviation.html">Accurately computing running variance</a>
+ */
+public interface MetricsHistogram extends Metric
+{
+    void update( long newValue );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogramFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogramFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogramFactory.java
new file mode 100644
index 0000000..3ca7bbd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsHistogramFactory.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Create MetricsHistogram instances.
+ */
+public interface MetricsHistogramFactory extends MetricsFactory
+{
+    /**
+     * Create a MetricsHistogram instance.
+     * If the same arguments are given twice, the same instance must be returned.
+     *
+     * @param name   A human readable, short name of the metric.
+     *
+     * @return A Metric instance to be used, OR org.apache.polygene.spi.metrics.DefaultMetric.NULL if not supported.
+     *
+     */
+    MetricsHistogram createHistogram( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeter.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeter.java
new file mode 100644
index 0000000..e6f4df8
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeter.java
@@ -0,0 +1,39 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * A meter metric which measures mean throughput and one-, five-, and fifteen-minute
+ * exponentially-weighted moving average throughputs.
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average">EMA</a>
+ */
+public interface MetricsMeter extends Metric
+{
+    void mark();
+
+    /**
+     * Mark the occurrence of a given number of events.
+     *
+     * @param numberOfEvents the number of events
+     */
+    void mark( int numberOfEvents );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeterFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeterFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeterFactory.java
new file mode 100644
index 0000000..209ba3b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsMeterFactory.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Create MetricsMeter instances.
+ */
+public interface MetricsMeterFactory extends MetricsFactory
+{
+    /**
+     * Create a MetricsMeter instance.
+     * If the same arguments are given twice, the same instance must be returned.
+     *
+     * @param name      A human readable, short name of the metric.
+     *
+     * @return A Metric instance to be used, OR org.apache.polygene.spi.metrics.DefaultMetric.NULL if not supported.
+     */
+    MetricsMeter createMeter( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsNotSupportedException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsNotSupportedException.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsNotSupportedException.java
new file mode 100644
index 0000000..4a47f45
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsNotSupportedException.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Thrown when the underlying MetricsProvider do not support a Metric type.
+ */
+public class MetricsNotSupportedException extends RuntimeException
+{
+    public MetricsNotSupportedException( Class<? extends MetricsFactory> factoryType,
+                                         Class<? extends MetricsProvider> providerType
+    )
+    {
+        super( "Metrics [" + factoryType.getName() + "] is not supported by MetricsProvider [" + providerType.getName() + "]." );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsProvider.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsProvider.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsProvider.java
new file mode 100644
index 0000000..f3fd5c7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsProvider.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Metrics Provider SPI.
+ * <p>
+ * The Polygene Runtime will automatically look for a service that implements the MetricsProvider interface
+ * and use it for internal Runtime metrics, such as the UnitOfWork measuring the time from creation to close.
+ * </p>
+ * <p>
+ * The Metrics Library is available to add metric functionality to applications in the same way, and
+ * will use the same MetricsProvider.
+ * </p>
+ * <p>
+ * Note that the usual visibility rules applies, so you might have more than one MetricsProvider server,
+ * perhaps per layer.
+ * </p>
+ */
+public interface MetricsProvider
+{
+    /**
+     * Creates a new factory instance.
+     *
+     * The instantiation is done by providing a Metric type, which is one of
+     * <ul>
+     * <li>{@link MetricsCounter}</li>
+     * <li>{@link MetricsGauge}</li>
+     * <li>{@link MetricsHealthCheck}</li>
+     * <li>{@link MetricsHistogram}</li>
+     * <li>{@link MetricsMeter}</li>
+     * <li>{@link MetricsTimer}</li>
+     * </ul>
+     *
+     * @param factoryType The class of the metric type needed.
+     * @param <T>         The metric type requested.
+     *
+     * @return A factory instance
+     *
+     * @throws MetricsNotSupportedException when the MetricsProvider is not supporting the factory type requested.
+     */
+    <T extends MetricsFactory> T createFactory( Class<T> factoryType )
+        throws MetricsNotSupportedException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimer.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimer.java
new file mode 100644
index 0000000..c1eb9e1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimer.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Timer Metrics.
+ */
+public interface MetricsTimer extends Metric
+{
+    /**
+     * Start the Timer Metrics.
+     */
+    Context start();
+
+    /**
+     * Timer Metrics Context.
+     */
+    interface Context
+    {
+        /**
+         * Stop the Timer Metrics.
+         */
+        void stop();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimerFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimerFactory.java b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimerFactory.java
new file mode 100644
index 0000000..e672d5b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/MetricsTimerFactory.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.metrics;
+
+/**
+ * Create MetricsTimer instances.
+ */
+public interface MetricsTimerFactory extends MetricsFactory
+{
+    /**
+     * Create a MetricsTimer instance.
+     * If the same arguments are given twice, the same instance must be returned.
+     *
+     * @param name     A human readable, short name of the metric.
+     *
+     * @return A Metric instance to be used, OR org.apache.polygene.spi.metrics.DefaultMetric.NULL if not supported.
+     *
+     */
+    MetricsTimer createTimer( String name );
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/metrics/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/metrics/package.html b/core/api/src/main/java/org/apache/polygene/api/metrics/package.html
new file mode 100644
index 0000000..3657fe5
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/metrics/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Metrics API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/Initializable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/Initializable.java b/core/api/src/main/java/org/apache/polygene/api/mixin/Initializable.java
new file mode 100644
index 0000000..60136f7
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/Initializable.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+/**
+ * Fragments which want to be initialized can implement
+ * this callback interface. It will be invoked after
+ * the fragment has bee instantiated and all injections have been done.
+ */
+public interface Initializable
+{
+    /**
+     * Initialize the fragment
+     *
+     * @throws Exception if something went wrong
+     */
+    void initialize() throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/InitializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/InitializationException.java b/core/api/src/main/java/org/apache/polygene/api/mixin/InitializationException.java
new file mode 100644
index 0000000..11159b1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/InitializationException.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+/**
+ * Thrown when a Fragment or object could not be initialized.
+ */
+public class InitializationException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 1L;
+
+    public InitializationException()
+    {
+    }
+
+    public InitializationException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/InvalidMixinException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/InvalidMixinException.java b/core/api/src/main/java/org/apache/polygene/api/mixin/InvalidMixinException.java
new file mode 100644
index 0000000..0df6730
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/InvalidMixinException.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+import java.lang.reflect.Method;
+
+/**
+ * This exception is thrown if a Mixin is invalid (missing method implementation).
+ */
+public class InvalidMixinException
+    extends RuntimeException
+{
+    public InvalidMixinException( Class mixinClass, Method method )
+    {
+        super( mixinClass.getName() + "does not have a method implementation for " + method );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/MixinDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/MixinDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/mixin/MixinDescriptor.java
new file mode 100644
index 0000000..261e7bc
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/MixinDescriptor.java
@@ -0,0 +1,29 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+/**
+ * Mixin Descriptor.
+ */
+public interface MixinDescriptor
+{
+    Class<?> mixinClass();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/MixinMappingException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/MixinMappingException.java b/core/api/src/main/java/org/apache/polygene/api/mixin/MixinMappingException.java
new file mode 100644
index 0000000..84f3746
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/MixinMappingException.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+/**
+ * This Exception is thrown when it is not possible to map the MixinType to a valid
+ * CompositeType.
+ */
+public class MixinMappingException
+    extends RuntimeException
+{
+    private static final long serialVersionUID = 6843167709252705294L;
+
+    public MixinMappingException( String message )
+    {
+        super( message );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/Mixins.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/Mixins.java b/core/api/src/main/java/org/apache/polygene/api/mixin/Mixins.java
new file mode 100644
index 0000000..e81989c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/Mixins.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used in composites to declare mixin implementation classes.
+ * <p>
+ * Mixins tells the runtime which implementation class of a Mixin should be
+ * used. The &#64;Mixins annotation can occur at any level in the composite hierarchy
+ * and the runtime will match each found Mixin implementation against a Mixins annotation.
+ * All mixin interfaces must have a Mixin implementation in the composite hierarchy or
+ * a runtime exception will occur.
+ * </p>
+ * <p>
+ * Example;
+ * </p>
+ * <pre><code>
+ *
+ * &#64;Mixins( MyBeerOrder.class )
+ * public interface BeerOrderComposite extends BeerOrder, Composite
+ * {
+ * }
+ *
+ * public class MyBeerOrder
+ * implements BeerOrder
+ * {
+ * :
+ * }
+ * </code></pre>
+ * <p>
+ * Many implementations can be listed,
+ * </p>
+ * <pre><code>
+ * &#64;Mixins( { MyBeerOrder.class, DescriptionImpl.class } )
+ * public interface BeerOrderComposite extends BeerOrder, Description, Composite
+ * {
+ * }
+ * </code></pre>
+ * <p>
+ * If the Mixins is a class that implements InvocationHandler, it will be
+ * used for all mixins. To avoid that an invocation handler based implementation
+ * not service all mixin, use the AppliesTo annotation.
+ * </p>
+ *
+ * <p>
+ * It is valid to have multiple Mixins for a mixin. The first one found
+ * will be used. The search order is in the order they are written in the Mixins
+ * annotation left-to-right, and depth-first recursive search of the super-interfaces again
+ * left-to-right.
+ * </p>
+ *
+ * @see org.apache.polygene.api.common.AppliesTo
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( ElementType.TYPE )
+@Documented
+public @interface Mixins
+{
+    Class<?>[] value();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/NoopMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/NoopMixin.java b/core/api/src/main/java/org/apache/polygene/api/mixin/NoopMixin.java
new file mode 100644
index 0000000..7cfc81a
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/NoopMixin.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.mixin;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * Generic mixin that is a no-op. Can be useful if the functionality
+ * of a method is mainly provided by concerns and side-effects.
+ */
+public final class NoopMixin
+    implements InvocationHandler
+{
+    private static final Boolean BOOLEAN_DEFAULT = Boolean.FALSE;
+    private static final Short SHORT_DEFAULT = 0;
+    private static final Character CHARACTER_DEFAULT = 0;
+    private static final Integer INTEGER_DEFAULT = 0;
+    private static final Long LONG_DEFAULT = 0L;
+    private static final Float FLOAT_DEFAULT = 0f;
+    private static final Double DOUBLE_DEFAULT = 0.0;
+
+    @Override
+    public Object invoke( Object object, Method method, Object[] args )
+        throws Throwable
+    {
+        Class<?> retType = method.getReturnType();
+        if( !retType.isPrimitive() )
+        {
+            return null;
+        }
+        if( Void.TYPE == retType )
+        {
+            return null;
+        }
+        if( Boolean.TYPE == retType )
+        {
+            return BOOLEAN_DEFAULT;
+        }
+        if( Short.TYPE == retType )
+        {
+            return SHORT_DEFAULT;
+        }
+        if( Character.TYPE == retType )
+        {
+            return CHARACTER_DEFAULT;
+        }
+        if( Integer.TYPE == retType )
+        {
+            return INTEGER_DEFAULT;
+        }
+        if( Long.TYPE == retType )
+        {
+            return LONG_DEFAULT;
+        }
+        if( Float.TYPE == retType )
+        {
+            return FLOAT_DEFAULT;
+        }
+        if( Double.TYPE == retType )
+        {
+            return DOUBLE_DEFAULT;
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/mixin/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/mixin/package.html b/core/api/src/main/java/org/apache/polygene/api/mixin/package.html
new file mode 100644
index 0000000..7c916a3
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/mixin/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Mixin API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/object/NoSuchObjectException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/object/NoSuchObjectException.java b/core/api/src/main/java/org/apache/polygene/api/object/NoSuchObjectException.java
new file mode 100644
index 0000000..82b63bd
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/object/NoSuchObjectException.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.object;
+
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.InvalidApplicationException;
+
+/**
+ * This exception is thrown if no visible Object of the requested type can be found.
+ */
+public class NoSuchObjectException
+    extends InvalidApplicationException
+{
+    private static final long serialVersionUID = -1121690536365682511L;
+
+    private final String objectType;
+    private final String moduleName;
+
+    public NoSuchObjectException( String type, String moduleName, Stream<Class<?>> visible )
+    {
+        super( "Could not find any visible Object of type [" + type + "] in module ["
+               + moduleName
+               + "]. The visible types are: \n"
+               + visible.map( Class::getName ).collect( Collectors.joining("\n") )
+        );
+        this.objectType = type;
+        this.moduleName = moduleName;
+    }
+
+    public String objectType()
+    {
+        return objectType;
+    }
+
+    public String moduleName()
+    {
+        return moduleName;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/object/ObjectDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/object/ObjectDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/object/ObjectDescriptor.java
new file mode 100644
index 0000000..81ee90b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/object/ObjectDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.object;
+
+import org.apache.polygene.api.composite.ModelDescriptor;
+
+/**
+ * Object Descriptor.
+ */
+public interface ObjectDescriptor
+    extends ModelDescriptor
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/object/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/object/ObjectFactory.java b/core/api/src/main/java/org/apache/polygene/api/object/ObjectFactory.java
new file mode 100644
index 0000000..bd9a723
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/object/ObjectFactory.java
@@ -0,0 +1,52 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.object;
+
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * This factory creates and injects POJO's.
+ */
+public interface ObjectFactory
+{
+    /**
+     * Create new objects of the given type.
+     *
+     * @param type an object class which will be instantiated.
+     *
+     * @return new objects.
+     *
+     * @throws ConstructionException Thrown if instantiation fails.
+     * @throws NoSuchObjectException Thrown if {@code type} class is not an object.
+     */
+    <T> T newObject( Class<T> type, Object... uses )
+        throws NoSuchObjectException, ConstructionException;
+
+    /**
+     * Inject an existing instance. Only fields and methods will be called.
+     *
+     * @param instance instance
+     * @param uses dependencies
+     *
+     * @throws ConstructionException if it was not possible to construct the Object dependencies
+     */
+    void injectTo( Object instance, Object... uses )
+        throws ConstructionException;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/object/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/object/package.html b/core/api/src/main/java/org/apache/polygene/api/object/package.html
new file mode 100644
index 0000000..6956f39
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/object/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Object API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/package.html b/core/api/src/main/java/org/apache/polygene/api/package.html
new file mode 100644
index 0000000..1964935
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/package.html
@@ -0,0 +1,24 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you 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.
+  ~
+  ~
+  -->
+<html>
+    <body>
+        <h2>Apache Polygene\u2122 API.</h2>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/DefaultValues.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/DefaultValues.java b/core/api/src/main/java/org/apache/polygene/api/property/DefaultValues.java
new file mode 100644
index 0000000..00a128e
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/DefaultValues.java
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Default values for various property types
+ */
+public final class DefaultValues
+{
+    private static final Map<Type, Object> DEFAULT_VALUES = new HashMap<Type, Object>();
+
+    static
+    {
+        DEFAULT_VALUES.put( Byte.class, 0 );
+        DEFAULT_VALUES.put( Short.class, 0 );
+        DEFAULT_VALUES.put( Character.class, 0 );
+        DEFAULT_VALUES.put( Integer.class, 0 );
+        DEFAULT_VALUES.put( Long.class, 0L );
+        DEFAULT_VALUES.put( Double.class, 0D );
+        DEFAULT_VALUES.put( Float.class, 0F );
+        DEFAULT_VALUES.put( Boolean.class, false );
+        DEFAULT_VALUES.put( String.class, "" );
+    }
+
+    public static Object getDefaultValueOf( Type type )
+    {
+        Object value = DEFAULT_VALUES.get( type );
+        if( value != null )
+        {
+            return value;
+        }
+        if( type instanceof ParameterizedType )
+        {
+            // List<Foo> -> List
+            type = ( (ParameterizedType) type ).getRawType();
+        }
+
+        if( type instanceof Class )
+        {
+            Class typeAsClass = (Class) type;
+            if( Set.class.isAssignableFrom( typeAsClass ) )
+            {
+                return new HashSet();
+            }
+            else if( Map.class.isAssignableFrom( typeAsClass ) )
+            {
+                return new LinkedHashMap();
+            }
+            else if( Collection.class.isAssignableFrom( typeAsClass ) )
+            {
+                return new ArrayList();
+            }
+            else if( typeAsClass.isEnum() )
+            {
+                return ( (Class) type ).getEnumConstants()[ 0 ];
+            }
+        }
+        throw new IllegalArgumentException( "Cannot use @UseDefaults with type " + type.toString() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/GenericPropertyInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/GenericPropertyInfo.java b/core/api/src/main/java/org/apache/polygene/api/property/GenericPropertyInfo.java
new file mode 100644
index 0000000..0b3dd9b
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/GenericPropertyInfo.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import static org.apache.polygene.api.util.Classes.typeOf;
+
+/**
+ * Generic Property info utility class.
+ */
+public final class GenericPropertyInfo
+{
+    public static Type propertyTypeOf( AccessibleObject accessor )
+    {
+        return toPropertyType( typeOf( accessor ) );
+    }
+
+    public static Type toPropertyType( Type methodReturnType )
+    {
+        if( methodReturnType instanceof ParameterizedType )
+        {
+            ParameterizedType parameterizedType = (ParameterizedType) methodReturnType;
+            if( Property.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) )
+            {
+                return parameterizedType.getActualTypeArguments()[ 0 ];
+            }
+        }
+
+        if( methodReturnType instanceof Class<?> )
+        {
+            Type[] interfaces = ( (Class<?>) methodReturnType ).getGenericInterfaces();
+            for( Type anInterface : interfaces )
+            {
+                Type propertyType = toPropertyType( anInterface );
+                if( propertyType != null )
+                {
+                    return propertyType;
+                }
+            }
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/Immutable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/Immutable.java b/core/api/src/main/java/org/apache/polygene/api/property/Immutable.java
new file mode 100644
index 0000000..dee1d2f
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/Immutable.java
@@ -0,0 +1,37 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation adds Immutability to Types, Properties and Associations
+ */
+@Retention( RetentionPolicy.RUNTIME )
+@Target( { ElementType.TYPE, ElementType.METHOD } )
+@Documented
+public @interface Immutable
+{
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/InvalidPropertyTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/InvalidPropertyTypeException.java b/core/api/src/main/java/org/apache/polygene/api/property/InvalidPropertyTypeException.java
new file mode 100644
index 0000000..56e78d0
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/InvalidPropertyTypeException.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.AccessibleObject;
+import org.apache.polygene.api.common.ConstructionException;
+
+/**
+ * Thrown when attempting to subclass Property.
+ */
+public class InvalidPropertyTypeException extends ConstructionException
+{
+    public InvalidPropertyTypeException( AccessibleObject accessor )
+    {
+        super( createMessage(accessor) );
+    }
+
+    private static String createMessage( AccessibleObject accessor )
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append( "Not allowed to subclass " + Property.class.getName() + ". Property accessor " + accessor + " is returning a Property subclass." );
+        return builder.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/Numbers.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/Numbers.java b/core/api/src/main/java/org/apache/polygene/api/property/Numbers.java
new file mode 100644
index 0000000..779485c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/Numbers.java
@@ -0,0 +1,162 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.math.BigDecimal;
+
+/**
+ * Convenience class for mathematical operations on numerical properties.
+ * <pre>import static org.apache.polygene.api.property.Numbers.*;
+ * ...
+ * add( object.numberProperty(), 5 );</pre>
+ */
+public final class Numbers
+{
+    // Integer operations
+
+    public static Property<Integer> add( Property<Integer> property, int amount )
+    {
+        property.set( property.get() + amount );
+        return property;
+    }
+
+    public static Property<Integer> mult( Property<Integer> property, int amount )
+    {
+        property.set( property.get() * amount );
+        return property;
+    }
+
+    public static Property<Integer> sub( Property<Integer> property, int amount )
+    {
+        property.set( property.get() - amount );
+        return property;
+    }
+
+    public static Property<Integer> div( Property<Integer> property, int amount )
+    {
+        property.set( property.get() / amount );
+        return property;
+    }
+
+    // Long operations
+
+    public static Property<Long> add( Property<Long> property, long amount )
+    {
+        property.set( property.get() + amount );
+        return property;
+    }
+
+    public static Property<Long> mult( Property<Long> property, long amount )
+    {
+        property.set( property.get() * amount );
+        return property;
+    }
+
+    public static Property<Long> sub( Property<Long> property, long amount )
+    {
+        property.set( property.get() - amount );
+        return property;
+    }
+
+    public static Property<Long> div( Property<Long> property, long amount )
+    {
+        property.set( property.get() / amount );
+        return property;
+    }
+
+    // Double operations
+
+    public static Property<Double> add( Property<Double> property, double amount )
+    {
+        property.set( property.get() + amount );
+        return property;
+    }
+
+    public static Property<Double> mult( Property<Double> property, double amount )
+    {
+        property.set( property.get() * amount );
+        return property;
+    }
+
+    public static Property<Double> sub( Property<Double> property, double amount )
+    {
+        property.set( property.get() - amount );
+        return property;
+    }
+
+    public static Property<Double> div( Property<Double> property, double amount )
+    {
+        property.set( property.get() / amount );
+        return property;
+    }
+
+    // Float operations
+
+    public static Property<Float> add( Property<Float> property, float amount )
+    {
+        property.set( property.get() + amount );
+        return property;
+    }
+
+    public static Property<Float> mult( Property<Float> property, float amount )
+    {
+        property.set( property.get() * amount );
+        return property;
+    }
+
+    public static Property<Float> sub( Property<Float> property, float amount )
+    {
+        property.set( property.get() - amount );
+        return property;
+    }
+
+    public static Property<Float> div( Property<Float> property, float amount )
+    {
+        property.set( property.get() / amount );
+        return property;
+    }
+
+    // BigDecimal operations
+
+    public static Property<BigDecimal> add( Property<BigDecimal> property, BigDecimal amount )
+    {
+        property.set( property.get().add( amount ) );
+        return property;
+    }
+
+    public static Property<BigDecimal> mult( Property<BigDecimal> property, BigDecimal amount )
+    {
+        property.set( property.get().multiply( amount ) );
+        return property;
+    }
+
+    public static Property<BigDecimal> sub( Property<BigDecimal> property, BigDecimal amount )
+    {
+        property.set( property.get().subtract( amount ) );
+        return property;
+    }
+
+    public static Property<BigDecimal> div( Property<BigDecimal> property, BigDecimal amount )
+    {
+        property.set( property.get().divide( amount ) );
+        return property;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/Property.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/Property.java b/core/api/src/main/java/org/apache/polygene/api/property/Property.java
new file mode 100644
index 0000000..f3384b1
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/Property.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+/**
+ * Properties are declared in Composite interfaces by using this interface.
+ * <p>
+ * It creates a first-class object for the property from which you can get and set the value, and access any
+ * metadata about it.
+ * </p>
+ * <p>The type of the Property can be one of the following:</p>
+ * <ul>
+ * <li> A boxed primitive (Long,Integer,Boolean, etc.)</li>
+ * <li> String</li>
+ * <li> BigInteger</li>
+ * <li> BigDecimal</li>
+ * <li> Date</li>
+ * <li> DateTime (Joda Time)</li>
+ * <li> LocalDateTime (Joda Time)</li>
+ * <li> A serializable</li>
+ * <li> A ValueComposite</li>
+ * <li> A List, Set or Collection of any of the above</li>
+ * </ul>
+ *
+ * @param <T> Parameterized type of the Property
+ */
+public interface Property<T>
+{
+    /**
+     * Get the value of the property.
+     *
+     * @return the value
+     */
+    T get();
+
+    /**
+     * Set the value of the property
+     *
+     * @param newValue the new value
+     *
+     * @throws IllegalArgumentException if the value has an invalid value
+     * @throws IllegalStateException    if the property is immutable
+     */
+    void set( T newValue )
+        throws IllegalArgumentException, IllegalStateException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
new file mode 100644
index 0000000..52b217c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
@@ -0,0 +1,62 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Type;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.structure.MetaInfoHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.type.ValueType;
+
+/**
+ * Property Descriptor.
+ */
+public interface PropertyDescriptor extends MetaInfoHolder
+{
+    boolean isImmutable();
+
+    /**
+     * Get the qualified name of the property which is equal to:
+     * <pre><code>
+     * &lt;interface name&gt;:&lt;method name&gt;
+     * </code></pre>
+     *
+     * @return the qualified name of the property
+     */
+    QualifiedName qualifiedName();
+
+    /**
+     * Get the type of the property. If the property is declared
+     * as Property&lt;X&gt; then X is returned.
+     *
+     * @return the property type
+     */
+    Type type();
+
+    AccessibleObject accessor();
+
+    Object initialValue( ModuleDescriptor module );
+
+    ValueType valueType();
+
+    boolean queryable();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/PropertyMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/PropertyMixin.java b/core/api/src/main/java/org/apache/polygene/api/property/PropertyMixin.java
new file mode 100644
index 0000000..1be3155
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/PropertyMixin.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import org.apache.polygene.api.common.AppliesTo;
+import org.apache.polygene.api.common.AppliesToFilter;
+import org.apache.polygene.api.injection.scope.State;
+
+/**
+ * Generic mixin for properties.
+ */
+// START SNIPPET: actual
+@AppliesTo( { PropertyMixin.PropertyFilter.class } )
+public final class PropertyMixin
+    implements InvocationHandler
+{
+    @State
+    private StateHolder state;
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] args )
+        throws Throwable
+    {
+        return state.propertyFor( method );
+    }
+
+    /**
+     * Filter Property methods to apply generic Property Mixin.
+     */
+    public static class PropertyFilter
+        implements AppliesToFilter
+    {
+        @Override
+        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
+        {
+            return Property.class.isAssignableFrom( method.getReturnType() );
+        }
+    }
+}
+// END SNIPPET: actual

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/polygene/api/property/PropertyWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/PropertyWrapper.java b/core/api/src/main/java/org/apache/polygene/api/property/PropertyWrapper.java
new file mode 100644
index 0000000..85e703c
--- /dev/null
+++ b/core/api/src/main/java/org/apache/polygene/api/property/PropertyWrapper.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.api.property;
+
+/**
+ * If you want to catch getting and setting properties, then create a GenericConcern
+ * that wraps the Polygene-supplied Property instance with PropertyWrappers. Override
+ * get() and/or set() to perform your custom code.
+ */
+public class PropertyWrapper
+    implements Property<Object>
+{
+    protected Property<Object> next;
+
+    public PropertyWrapper( Property<Object> next )
+    {
+        this.next = next;
+    }
+
+    public Property<Object> next()
+    {
+        return next;
+    }
+
+    @Override
+    public Object get()
+    {
+        return next.get();
+    }
+
+    @Override
+    public void set( Object newValue )
+        throws IllegalArgumentException, IllegalStateException
+    {
+        next.set( newValue );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return next.hashCode();
+    }
+
+    @Override
+    public boolean equals( Object obj )
+    {
+        return next.equals( obj );
+    }
+
+    @Override
+    public String toString()
+    {
+        return next.toString();
+    }
+}


[29/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/MapType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/MapType.java b/core/api/src/main/java/org/apache/zest/api/type/MapType.java
deleted file mode 100644
index 2fc6893..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/MapType.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-import org.apache.zest.api.util.Classes;
-
-/**
- * Map ValueType.
- * <p>This handles instances of Map.</p>
- */
-public final class MapType
-    extends ValueType
-{
-
-    private ValueType keyType;
-    private ValueType valueType;
-    private final Serialization.Variant variant;
-
-    public static boolean isMap( Type type )
-    {
-        Class<?> cl = Classes.RAW_CLASS.apply( type );
-        return Map.class.isAssignableFrom( cl );
-    }
-
-    public static MapType of( Class<?> keyType, Class<?> valueType )
-    {
-        return new MapType( Map.class, ValueType.of( keyType ), ValueType.of( valueType ) );
-    }
-
-    public static MapType of( Class<?> keyType, Class<?> valueType, Serialization.Variant variant )
-    {
-        return new MapType( Map.class, ValueType.of( keyType ), ValueType.of( valueType ), variant );
-    }
-
-    public MapType( Class<?> type, ValueType keyType, ValueType valueType )
-    {
-        this( type, keyType, valueType, Serialization.Variant.entry );
-    }
-
-    public MapType( Class<?> type, ValueType keyType, ValueType valueType, Serialization.Variant variant )
-    {
-        super( type );
-        this.keyType = keyType;
-        this.valueType = valueType;
-        this.variant = variant;
-        if( !isMap( type ) )
-        {
-            throw new IllegalArgumentException( type + " is not a Map." );
-        }
-    }
-
-    public ValueType keyType()
-    {
-        return keyType;
-    }
-
-    public ValueType valueType()
-    {
-        return valueType;
-    }
-
-    public Serialization.Variant variant()
-    {
-        return variant;
-    }
-
-    @Override
-    public String toString()
-    {
-        return super.toString() + "<" + keyType + "," + valueType + ">";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/MatchTypeSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/MatchTypeSpecification.java b/core/api/src/main/java/org/apache/zest/api/type/MatchTypeSpecification.java
deleted file mode 100644
index 9ae13b5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/MatchTypeSpecification.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.util.function.Predicate;
-
-/**
- * Match Type Specification for HasTypes.
- */
-public class MatchTypeSpecification
-    implements Predicate<HasTypes>
-{
-    private final Class<?> matchType;
-
-    public MatchTypeSpecification( Class<?> matchType )
-    {
-        this.matchType = matchType;
-    }
-
-    @Override
-    public boolean test( HasTypes item )
-    {
-        return item.types().anyMatch( matchType::isAssignableFrom );
-//        for( Class<?> type : item.types() )
-//        {
-//            if( matchType.isAssignableFrom( type ) )
-//            {
-//                return true;
-//            }
-//        }
-//        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/Serialization.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/Serialization.java b/core/api/src/main/java/org/apache/zest/api/type/Serialization.java
deleted file mode 100644
index 81a0188..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/Serialization.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Serialization options for Property intstances.
- * <p>
- * The {@code entry} type represents the explicit key=keyValue, value=valueValue. For JSON serialization;
- * </p>
- * <pre>
- *     [
- *         { "key1" : "value1" },
- *         { "key2" : "value2" }
- *     ]
- * </pre>
- * <p>
- * For XML serialization;
- * </p>
- * <pre>
- *     &lt;object&gt;
- *         &lt;
- *     &lt;/object&gt;
- * </pre>
- * <p>
- * The {@code object} type represents the explicit keyValue=valueValue.
- * </p>
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface Serialization
-{
-    Variant value();
-
-    enum Variant
-    {
-        entry, object
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/ValueCompositeType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/ValueCompositeType.java b/core/api/src/main/java/org/apache/zest/api/type/ValueCompositeType.java
deleted file mode 100644
index 4195cef..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/ValueCompositeType.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.lang.reflect.Type;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.util.Classes;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.api.value.ValueDescriptor;
-
-/**
- * ValueComposite ValueType.
- */
-public final class ValueCompositeType
-    extends ValueType
-{
-    private final ValueDescriptor model;
-
-    public static boolean isValueComposite( Type type )
-    {
-        return ValueComposite.class.isAssignableFrom( Classes.RAW_CLASS.apply( type ) );
-    }
-
-    public ValueCompositeType( ValueDescriptor model )
-    {
-        super( model.types().collect( Collectors.toList() ) );
-        this.model = model;
-    }
-
-    public Stream<? extends PropertyDescriptor> properties()
-    {
-        return model.state().properties();
-    }
-
-    public Stream<? extends AssociationDescriptor> associations()
-    {
-        return model.state().associations();
-    }
-
-    public Stream<? extends AssociationDescriptor> manyAssociations()
-    {
-        return model.state().manyAssociations();
-    }
-
-    public Stream<? extends AssociationDescriptor> namedAssociations()
-    {
-        return model.state().namedAssociations();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/ValueType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/ValueType.java b/core/api/src/main/java/org/apache/zest/api/type/ValueType.java
deleted file mode 100644
index 3795d67..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/ValueType.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.type;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Stream;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.util.NullArgumentException;
-
-import static java.util.stream.Collectors.joining;
-
-/**
- * Base class for types of values in ValueComposites and Properties.
- */
-public class ValueType
-    implements HasTypes
-{
-
-    public static ValueType of( Class<?> type )
-    {
-        return new ValueType( type );
-    }
-
-    /**
-     * Check if a non-null object is of any of the Primitive Value Types or an array of them.
-     * <p>
-     *     String, Boolean, Integer, Double, Float, Long, Byte, Short and Character and their Java primitive types
-     *     counterparts are considered as Primitive Value Types.
-     * </p>
-     * <p>
-     *     Date, BigInteger, BigDecimal and JodaTime types are not considered as Primitive Value Types.
-     * </p>
-     *
-     * @return true if object is a primitive value or an array of primitive values
-     * @throws IllegalArgumentException if object is null
-     */
-    public static boolean isPrimitiveValue( Object object )
-    {
-        NullArgumentException.validateNotNull( "object", object );
-        if( object instanceof String
-            || object instanceof Character
-            || object instanceof Boolean
-            || object instanceof Integer
-            || object instanceof Double
-            || object instanceof Float
-            || object instanceof Long
-            || object instanceof Byte
-            || object instanceof Short )
-        {
-            return true;
-        }
-        if( object.getClass().isArray() )
-        {
-            return isArrayOfPrimitiveValues( object );
-        }
-        return false;
-    }
-
-    public static boolean isIdentity( Object object )
-    {
-        return object instanceof Identity;
-    }
-
-    private static boolean isArrayOfPrimitiveValues( Object array )
-    {
-        if( array instanceof String[]
-            || array instanceof char[] || array instanceof Character[]
-            || array instanceof boolean[] || array instanceof Boolean[]
-            || array instanceof int[] || array instanceof Integer[]
-            || array instanceof double[] || array instanceof Double[]
-            || array instanceof float[] || array instanceof Float[]
-            || array instanceof long[] || array instanceof Long[]
-            || array instanceof byte[] || array instanceof Byte[]
-            || array instanceof short[] || array instanceof Short[] )
-        {
-            return true;
-        }
-        return false;
-    }
-
-    public static boolean isPrimitiveValueType( ValueType valueType )
-    {
-        return isPrimitiveValueType( valueType.mainType() );
-    }
-
-    /**
-     * @see ValueType#isPrimitiveValue(java.lang.Object) 
-     */
-    public static boolean isPrimitiveValueType( Class<?> type )
-    {
-        NullArgumentException.validateNotNull( "type", type );
-        if( String.class.isAssignableFrom( type ) )
-        {
-            return true;
-        }
-        if( type.isArray() )
-        {
-            return isPrimitiveValueType( type.getComponentType() );
-        }
-        return false;
-    }
-    protected final List<Class<?>> types;
-
-    public ValueType( Class<?> type )
-    {
-        this( Collections.singletonList( type ) );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public ValueType( List<Class<?>> types )
-    {
-        this.types = types;
-    }
-
-    public Class<?> mainType()
-    {
-        return types.stream().findFirst().orElse( null );
-    }
-
-    @Override
-    public Stream<Class<?>> types()
-    {
-        return types.stream();
-    }
-
-    @Override
-    public String toString()
-    {
-        String name = types.stream().map( Class::getName ).collect( joining( "," ) );
-        if( name.contains( "," ) )
-        {
-            name = "{" + name + "}";
-        }
-        return name;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/type/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/type/package.html b/core/api/src/main/java/org/apache/zest/api/type/package.html
deleted file mode 100644
index c0c3eca..0000000
--- a/core/api/src/main/java/org/apache/zest/api/type/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Type API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/ConcurrentEntityModificationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/ConcurrentEntityModificationException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/ConcurrentEntityModificationException.java
deleted file mode 100644
index c709fed..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/ConcurrentEntityModificationException.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.Map;
-import java.util.stream.Collectors;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.type.HasTypes;
-import org.apache.zest.api.usecase.Usecase;
-
-/**
- * This exception is thrown by UnitOfWork.complete() if any entities that are being committed
- * had been changed while the UnitOfWork was being executed.
- */
-public class ConcurrentEntityModificationException
-    extends UnitOfWorkCompletionException
-{
-    private static final long serialVersionUID = 3872723845064767689L;
-
-    private final Map<EntityComposite, HasTypes> concurrentlyModifiedEntities;
-
-    public ConcurrentEntityModificationException( Map<EntityComposite, HasTypes> concurrentlyModifiedEntities,
-                                                  Usecase usecase
-    )
-    {
-        super( "Entities changed concurrently, and detected in usecase '" + usecase + "'\nModified entities : " + format( concurrentlyModifiedEntities ) );
-        this.concurrentlyModifiedEntities = concurrentlyModifiedEntities;
-    }
-
-    private static String format( Map<EntityComposite, HasTypes> concurrentlyModifiedEntities )
-    {
-        return concurrentlyModifiedEntities.entrySet().stream()
-            .map( entry ->
-                      entry.getKey()
-                      + " : "
-                      + entry.getValue().types().map( Class::getSimpleName )
-                          .collect( Collectors.joining( "," ) )
-            )
-            .collect( Collectors.joining( "\n" ) );
-    }
-
-    public Map<EntityComposite, HasTypes> concurrentlyModifiedEntities()
-    {
-        return concurrentlyModifiedEntities;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityCompositeAlreadyExistsException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityCompositeAlreadyExistsException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityCompositeAlreadyExistsException.java
deleted file mode 100644
index d0e754e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/EntityCompositeAlreadyExistsException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.apache.zest.api.entity.EntityReference;
-
-/**
- * If you try to create an EntityComposite whose reference already exists,
- * then this exception will be thrown.
- */
-public class EntityCompositeAlreadyExistsException
-    extends UnitOfWorkException
-{
-    private static final long serialVersionUID = -7297710939536508481L;
-
-    private final EntityReference reference;
-
-    public EntityCompositeAlreadyExistsException( EntityReference reference)
-    {
-        super( "EntityComposite (" + reference + ") already exists." );
-        this.reference = reference;
-    }
-
-    public EntityReference reference()
-    {
-        return reference;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityException.java
deleted file mode 100644
index 9827a2e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityException.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.Stream;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.usecase.Usecase;
-
-import static java.util.Arrays.stream;
-
-/**
- * This exception indicates that the requested Entity with the given
- * reference does not exist.
- */
-public class NoSuchEntityException
-    extends UnitOfWorkException
-{
-    private final EntityReference reference;
-    private final Usecase usecase;
-    private final Class<?>[] mixinTypes;
-
-    public NoSuchEntityException(EntityReference reference, Class<?> mixinType, Usecase usecase )
-    {
-        super( "Could not find entity (" + reference + ") of type " + mixinType.getName() + " in usecase '" + usecase.name() + "'" );
-        this.reference = reference;
-        this.usecase = usecase;
-        this.mixinTypes = new Class<?>[]{ mixinType };
-    }
-
-    public NoSuchEntityException(EntityReference reference, Class<?>[] mixinTypes, Usecase usecase )
-    {
-        super( "Could not find entity (" + reference + ") of type " + toString( mixinTypes ) + " in usecase '" + usecase.name() + "'" );
-        this.reference = reference;
-        this.mixinTypes = mixinTypes;
-        this.usecase = usecase;
-    }
-
-    public NoSuchEntityException(EntityReference reference, Stream<Class<?>> types, Usecase usecase )
-    {
-        this(reference, types.toArray( Class[]::new ), usecase );
-    }
-
-    public EntityReference reference()
-    {
-        return reference;
-    }
-
-    public Class<?>[] mixinTypes()
-    {
-        return mixinTypes;
-    }
-
-    public Usecase usecase()
-    {
-        return usecase;
-    }
-
-    private static String toString( Class<?>[] mixinTypes )
-    {
-        String reduced = stream( mixinTypes ).map( Class::getName ).reduce( "", ( ret, name ) -> ret + "," + name );
-        return "[" + reduced.substring( 1 ) + "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/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
deleted file mode 100644
index b389834..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/NoSuchEntityTypeException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-/**
- * Polygene 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/1c722f44/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
deleted file mode 100644
index 844562c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWork.java
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.time.Instant;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Stream;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.association.NamedAssociation;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.composite.AmbiguousTypeException;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.identity.HasIdentity;
-import org.apache.zest.api.entity.LifecycleException;
-import org.apache.zest.api.identity.Identity;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.query.Query;
-import org.apache.zest.api.query.QueryBuilder;
-import org.apache.zest.api.structure.MetaInfoHolder;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.usecase.Usecase;
-
-/**
- * All operations on entities goes through an UnitOfWork.
- * <p>
- * A UnitOfWork allows you to access
- * Entities and work with them. All modifications to Entities are recorded by the UnitOfWork,
- * and at the end they may be sent to the underlying EntityStore by calling complete(). If the
- * UoW was read-only you may instead simply discard() it.
- * </p>
- * <p>
- * A UoW differs from a traditional Transaction in the sense that it is not tied at all to the underlying
- * storage resource. Because of this there is no timeout on a UoW. It can be very short or very long.
- * Another difference is that if a call to complete() fails, and the cause is validation errors in the
- * Entities of the UoW, then these can be corrected and the UoW retried. By contrast, when a Transaction
- * commit fails, then the whole transaction has to be done from the beginning again.
- * </p>
- * <p>
- * A UoW can be associated with a Usecase. A Usecase describes the metainformation about the process
- * to be performed by the UoW.
- * </p>
- * <p>
- * If a code block that uses a UoW throws an exception you need to ensure that this is handled properly,
- * and that the UoW is closed before returning. Because discard() is a no-op if the UoW is closed, we therefore
- * recommend the following template to be used:
- * </p>
- * <pre>
- *     UnitOfWork uow = module.newUnitOfWork();
- *     try
- *     {
- *         ...
- *         uow.complete();
- *     }
- *     finally
- *     {
- *         uow.discard();
- *     }
- * </pre>
- * <p>
- * This ensures that in the happy case the UoW is completed, and if any exception is thrown the UoW is discarded. After
- * the UoW has completed the discard() method doesn't do anything, and so has no effect. You can choose to either add
- * catch blocks for any exceptions, including exceptions from complete(), or skip them.
- * </p>
- * <p>
- * Since 2.1 you can leverage Java 7 Automatic Resource Management (ie. Try With Resources) and use the following
- * template instead:
- * </p>
- * <pre>
- *     try( UnitOfWork uow = module.newUnitOfWork() )
- *     {
- *         ...
- *         uow.complete();
- *     }
- * </pre>
- * <p>
- * It has the very same effect than the template above but is shorter.</p>
- */
-public interface UnitOfWork extends MetaInfoHolder, AutoCloseable
-{
-
-    /**
-     * Get the UnitOfWorkFactory that this UnitOfWork was created from.
-     *
-     * @return The UnitOfWorkFactory instance that was used to create this UnitOfWork.
-     */
-    UnitOfWorkFactory unitOfWorkFactory();
-
-    Instant currentTime();
-
-    /**
-     * Get the Usecase for this UnitOfWork
-     *
-     * @return the Usecase
-     */
-    Usecase usecase();
-
-    void setMetaInfo( Object metaInfo );
-
-    <T> Query<T> newQuery( QueryBuilder<T> queryBuilder );
-
-//    DataSet newDataSetBuilder(Specification<?>... constraints);
-
-    /**
-     * Create a new Entity which implements the given mixin type.
-     * <p>
-     * An EntityComposite
-     * will be chosen according to what has been registered and the visibility rules
-     * for Modules and Layers will be considered. If several
-     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
-     * </p>
-     * <p>
-     * The reference of the Entity will be generated by the IdentityGenerator of the Module of the EntityComposite.
-     * </p>
-     *
-     * @param type the mixin type that the EntityComposite must implement
-     *
-     * @return a new Entity
-     *
-     * @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 NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
-
-    /**
-     * Create a new Entity which implements the given mixin type. An EntityComposite
-     * will be chosen according to what has been registered and the visibility rules
-     * for Modules and Layers will be considered. If several
-     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
-     *
-     * @param type     the mixin type that the EntityComposite must implement
-     * @param identity the reference of the new Entity
-     *
-     * @return a new Entity
-     *
-     * @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 Identity identity )
-        throws NoSuchEntityTypeException, AmbiguousTypeException, LifecycleException;
-
-    /**
-     * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
-     * will be chosen according to what has been registered and the visibility rules
-     * for Modules and Layers will be considered. If several
-     * EntityComposites implement the type then an AmbiguousTypeException will be thrown.
-     *
-     * @param type the mixin type that the EntityComposite must implement
-     *
-     * @return a new EntityBuilder
-     *
-     * @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 NoSuchEntityTypeException, AmbiguousTypeException;
-
-    /**
-     * Create a new EntityBuilder for an EntityComposite which implements the given mixin type. An EntityComposite
-     * will be chosen according to what has been registered and the visibility rules
-     * for Modules and Layers will be considered. If several
-     * mixins implement the type then an AmbiguousTypeException will be thrown.
-     *
-     * @param type     the mixin type that the EntityComposite must implement
-     * @param identity the reference of the new Entity
-     *
-     * @return a new EntityBuilder
-     *
-     * @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 Identity identity )
-        throws NoSuchEntityTypeException, AmbiguousTypeException;
-
-    /**
-     * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
-     * state.
-     * <p>
-     * An EntityComposite will be chosen according to what has been registered and the visibility rules for Modules and
-     * Layers will be considered.
-     *
-     * @param <T>                      Entity type
-     * @param type                     Entity type
-     * @param propertyFunction         a function providing the state of properties
-     * @param associationFunction      a function providing the state of associations
-     * @param manyAssociationFunction  a function providing the state of many associations
-     * @param namedAssociationFunction a function providing the state of named associations
-     *
-     * @return a new EntityBuilder starting with the given state
-     *
-     * @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,
-                                                    Function<PropertyDescriptor, Object> propertyFunction,
-                                                    Function<AssociationDescriptor, EntityReference> associationFunction,
-                                                    Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
-                                                    Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
-    )
-        throws NoSuchEntityTypeException, AmbiguousTypeException;
-
-    /**
-     * Create a new EntityBuilder for an EntityComposite wich implements the given mixin type starting with the given
-     * state.
-     * <p>
-     * An EntityComposite will be chosen according to what has been registered and the visibility rules for Modules and
-     * Layers will be considered.
-     *
-     * @param <T>                      Entity type
-     * @param type                     Entity type
-     * @param identity                 the reference of the new Entity
-     * @param propertyFunction         a function providing the state of properties
-     * @param associationFunction      a function providing the state of associations
-     * @param manyAssociationFunction  a function providing the state of many associations
-     * @param namedAssociationFunction a function providing the state of named associations
-     *
-     * @return a new EntityBuilder starting with the given state
-     *
-     * @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 Identity identity,
-                                                    Function<PropertyDescriptor, Object> propertyFunction,
-                                                    Function<AssociationDescriptor, EntityReference> associationFunction,
-                                                    Function<AssociationDescriptor, Stream<EntityReference>> manyAssociationFunction,
-                                                    Function<AssociationDescriptor, Stream<Map.Entry<String, EntityReference>>> namedAssociationFunction
-    )
-        throws NoSuchEntityTypeException, AmbiguousTypeException;
-
-    /**
-     * Find an Entity of the given mixin type with the give reference. This
-     * method verifies that it exists by asking the underlying EntityStore.
-     *
-     * @param type     of the entity
-     * @param identity of the entity
-     *
-     * @return the entity
-     *
-     * @throws NoSuchEntityTypeException if no entity type could be found
-     * @throws NoSuchEntityException     if the entity could not be found
-     */
-    <T> T get( Class<T> type, Identity identity )
-        throws NoSuchEntityTypeException, NoSuchEntityException;
-
-    /**
-     * If you have a reference to an Entity from another
-     * UnitOfWork and want to create a reference to it in this
-     * UnitOfWork, then call this method.
-     *
-     * @param entity the Entity to be dereferenced
-     *
-     * @return an Entity from this UnitOfWork
-     *
-     * @throws NoSuchEntityTypeException if no entity type could be found
-     */
-    <T> T get( T entity )
-        throws NoSuchEntityTypeException;
-
-    /**
-     * Remove the given Entity.
-     *
-     * @param entity the Entity to be removed.
-     *
-     * @throws LifecycleException if the entity could not be removed
-     */
-    void remove( Object entity )
-        throws LifecycleException;
-
-    /**
-     * Complete this UnitOfWork. This will send all the changes down to the underlying
-     * EntityStore's.
-     *
-     * @throws UnitOfWorkCompletionException         if the UnitOfWork could not be completed
-     * @throws ConcurrentEntityModificationException if entities have been modified by others
-     */
-    void complete()
-        throws UnitOfWorkCompletionException, ConcurrentEntityModificationException;
-
-    /**
-     * Discard this UnitOfWork. Use this if a failure occurs that you cannot handle,
-     * or if the usecase was of a read-only character. This is a no-op of the UnitOfWork
-     * is already closed.
-     */
-    void discard();
-
-    /**
-     * Discard this UnitOfWork. Use this if a failure occurs that you cannot handle,
-     * or if the usecase was of a read-only character. This is a no-op of the UnitOfWork
-     * is already closed. This simply call the {@link #discard()} method and is an
-     * implementation of the {@link AutoCloseable} interface providing Try With Resources
-     * support for UnitOfWork.
-     */
-    @Override
-    public void close();
-
-    /**
-     * Check if the UnitOfWork is open. It is closed after either complete() or discard()
-     * methods have been called successfully.
-     *
-     * @return true if the UnitOfWork is open.
-     */
-    boolean isOpen();
-
-    /**
-     * Check if the UnitOfWork is paused. It is not paused after it has been create through the
-     * UnitOfWorkFactory, and it can be paused by calling {@link #pause()} and then resumed by calling
-     * {@link #resume()}.
-     *
-     * @return true if this UnitOfWork has been paused.
-     */
-    boolean isPaused();
-
-    /**
-     * Pauses this UnitOfWork.
-     * <p>
-     * Calling this method will cause the underlying UnitOfWork to become the current UnitOfWork until the
-     * the resume() method is called. It is the client's responsibility not to drop the reference to this
-     * UnitOfWork while being paused.
-     * </p>
-     */
-    void pause();
-
-    /**
-     * Resumes this UnitOfWork to again become the current UnitOfWork.
-     */
-    void resume();
-
-    /**
-     * Register a callback. Callbacks are invoked when the UnitOfWork
-     * is completed or discarded.
-     *
-     * @param callback a callback to be registered with this UnitOfWork
-     */
-    void addUnitOfWorkCallback( UnitOfWorkCallback callback );
-
-    /**
-     * Unregister a callback. Callbacks are invoked when the UnitOfWork
-     * is completed or discarded.
-     *
-     * @param callback a callback to be unregistered with this UnitOfWork
-     */
-    void removeUnitOfWorkCallback( UnitOfWorkCallback callback );
-
-    /**
-     * Converts the provided Entity to a Value of the same type.
-     * This is a convenience method to convert an EntityComposite to a ValueComposite.
-     * <p>
-     * All Property values are transferred across as-is, and the Association, ManyAssociation
-     * and NamedAssociatino values are kept in the ValueComposite as EntityReferences
-     * until they are dereferenced (get() and other methods), and IF a UnitOfWork is
-     * present at dereferencing the corresponding EntityCompoiste is retrieved from the
-     * EntityStore. If there is not an UnitOfWork present, an exception is thrown.
-     * </p>
-     * <p>
-     * For this to work, the Composites (both Entity and Value) must not declare the
-     * EntityComposite and ValueComposite super types, but rely on the declaration in
-     * the assembly, and also extend the Identity supertype.
-     * </p>
-     * Example;
-     * <pre><code>
-     *     public interface Person extends Identity { ... };
-     *     public class MyAssembler
-     *     {
-     *         public void assemble( ModuleAssembly module )
-     *         {
-     *             module.values( Person.class );
-     *             module.entities( Person.class );
-     *         }
-     *     }
-     * </code></pre>
-     *
-     * @param <T>             The generic shared type
-     * @param primaryType     The shared type for which the properties and associations will
-     *                        be converted. Properties outside this type will be ignored.
-     * @param entityComposite The entity to be convered.
-     *
-     * @return The Value
-     */
-    <T extends HasIdentity> T toValue(Class<T> primaryType, T entityComposite );
-
-    /**
-     * Converts all the entities referenced in the ManyAssociation into a List of values of the same type.
-     *
-     * <p>
-     * All the referenced entities inside the association will be fetched from the underlying entity store,
-     * which is potentially very expensive operation. Each of the fetched entities will be passed to
-     * {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into values, but remain
-     * {@link EntityReference} values. Hence there is no problem with circular references.
-     * </p>
-     *
-     * <p>
-     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
-     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
-     * </p>
-     *
-     * @param association The association of entities to be converted into values.
-     * @param <T>         The primary type of the association.
-     *
-     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
-     *
-     * @see #toValue(Class, HasIdentity)
-     */
-    <T extends HasIdentity> List<T> toValueList(ManyAssociation<T> association );
-
-    /**
-     * Converts all the entities referenced in the ManyAssociation into a Set of values of the same type.
-     *
-     * <p>
-     * All the referenced entities inside the association will be fetched from the underlying entity store,
-     * which is potentially very expensive operation. However, any duplicate EntityReferences in the association
-     * will be dropped before the fetch occurs. Each of the fetched entities will be passed to
-     * {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into values, but remain
-     * {@link EntityReference} values. Hence there is no problem with circular references.
-     * </p>
-     *
-     * <p>
-     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
-     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
-     * </p>
-     *
-     * @param association The association of entities to be converted into values.
-     * @param <T>         The primary type of the association.
-     *
-     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
-     *
-     * @see #toValue(Class, HasIdentity)
-     */
-    <T extends HasIdentity> Set<T> toValueSet(ManyAssociation<T> association );
-
-    /**
-     * Converts the {@link NamedAssociation} into a Map with a String key and a ValueComposite as the value.
-     *
-     * <p>
-     * A {@link NamedAssociation} is effectively a Map with a String key and an EntityReference as the value. The
-     * EntityReference is fetched from the entity store and converted into a value of the same type.Each of the fetched
-     * entities will be passed to {@link #toValue(Class, HasIdentity)}, and its associations will NOT be converted into
-     * values, but remain {@link EntityReference} values. Hence there is no problem with circular references.
-     * </p>
-     * <p>
-     * For this to work, the type &lt;T&gt; must be registered at bootstrap as both an Entity and a Value, and
-     * as seen in the method signature, also be sub-type of {@link HasIdentity}.
-     * </p>
-     *
-     * @param association The association of entities to be converted into values.
-     * @param <T>         The primary type of the association.
-     *
-     * @return A List of ValueComposites that has been converted from EntityComposites referenced by the Associations.
-     *
-     * @see #toValue(Class, HasIdentity)
-     */
-    <T extends HasIdentity> Map<String, T> toValueMap(NamedAssociation<T> association );
-
-    /**
-     * Converts the provided Value to an Entity of the same type.
-     * This is a convenience method to convert a ValueComposite to an EntityComposite.
-     * <p>
-     * All Property values are transferred across as-is (no deep copy in case mutable
-     * types (DISCOURAGED!) are used), and the Association, ManyAssociation
-     * and NamedAssociatino that were in the ValueComposite as EntityReferences are
-     * transferred into the EntityComposite correctly, and can be dereferenced.
-     * </p>
-     * <p>
-     * This method MUST be called within a UnitOfWork.
-     * </p>
-     * <p>
-     * If an Entity with the Identity in the ValueComposite already exists, then that
-     * Entity is updated with the values from the ValueComposite. If an Entity of
-     * that Identity doesn't exist a new one is created.
-     * </p>
-     * <p>
-     * For this to work, the Composites (both Entity and Value) must not declare the
-     * EntityComposite and ValueComposite super types, but rely on the declaration in
-     * the assembly, and also extend the Identity supertype.
-     * </p>
-     * Example;
-     * <pre><code>
-     *     public interface Person extends Identity { ... };
-     *     public class MyAssembler
-     *     {
-     *         public void assemble( ModuleAssembly module )
-     *         {
-     *             module.values( Person.class );
-     *             module.entities( Person.class );
-     *         }
-     *     }
-     * </code></pre>
-     *
-     * @param <T>            The generic shared type
-     * @param primaryType    The shared type for which the properties and associations will
-     *                       be converted. Properties outside this type will be ignored.
-     * @param valueComposite The Value to be convered into an Entity.
-     *
-     * @return The new or updated Entity
-     */
-    <T extends HasIdentity> T toEntity(Class<T> primaryType, T valueComposite );
-
-    /**
-     * The Module of the UnitOfWork is defined as the Module the UnitOfWorkFactory belonged to from where the
-     * UnitOfWork was created.
-     *
-     * @return the Module where this UnitOfWork was initialized.
-     */
-    ModuleDescriptor module();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCallback.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCallback.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCallback.java
deleted file mode 100644
index fc8132f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCallback.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-/**
- * Callback interface for UnitOfWork completion or discard. Implementations
- * of this interface can be registered through {@link UnitOfWork#addUnitOfWorkCallback(UnitOfWorkCallback)}.
- *
- * If Entities implement this interface they will also receive invocations of this callback interface.
- */
-public interface UnitOfWorkCallback
-{
-    /**
-     * This is called before the completion of the UnitOfWork.
-     * The callback may do any validation checks and throw
-     * UnitOfWorkCompletionException if there is any reason
-     * why the UnitOfWork is not in a valid state to be completed.
-     *
-     * @throws UnitOfWorkCompletionException
-     */
-    void beforeCompletion()
-        throws UnitOfWorkCompletionException;
-
-    /**
-     * This is called after the completion or discarding
-     * of the UnitOfWork. The callback may do any cleanup
-     * necessary related to the UnitOfWork. Note that the
-     * UnitOfWork is no longer active when this method is
-     * called, so no methods on it may be invoked.
-     *
-     * @param status
-     */
-    void afterCompletion( UnitOfWorkStatus status );
-
-    enum UnitOfWorkStatus
-    {
-        COMPLETED, DISCARDED
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCompletionException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCompletionException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCompletionException.java
deleted file mode 100644
index cc4a31b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkCompletionException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-/**
- * When an attempt to {@link UnitOfWork#complete()} an UnitOfWork
- * fails, this exception will be thrown.
- */
-public class UnitOfWorkCompletionException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 6531642131384516904L;
-
-    public UnitOfWorkCompletionException()
-    {
-    }
-
-    public UnitOfWorkCompletionException( String string )
-    {
-        super( string );
-    }
-
-    public UnitOfWorkCompletionException( String string, Throwable throwable )
-    {
-        super( string, throwable );
-    }
-
-    public UnitOfWorkCompletionException( Throwable throwable )
-    {
-        super( throwable );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkException.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkException.java
deleted file mode 100644
index d7319ad..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-/**
- * Base Exception for UnitOfWork related concerns.
- */
-public class UnitOfWorkException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = -8544178439804058558L;
-
-    public UnitOfWorkException()
-    {
-    }
-
-    public UnitOfWorkException( String message )
-    {
-        super( message );
-    }
-
-    public UnitOfWorkException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-    public UnitOfWorkException( Throwable cause )
-    {
-        super( cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
deleted file mode 100644
index 3a1b00e..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkFactory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.time.Instant;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.time.SystemTime;
-import org.apache.zest.api.usecase.Usecase;
-
-/**
- * Factory for UnitOfWork.
- */
-public interface UnitOfWorkFactory
-{
-    /**
-     * Create a new UnitOfWork and associate it with the current thread.
-     * <p>
-     * The UnitOfWork will use the default Usecase settings.
-     * </p>
-     * <p>
-     * Current time will be set to {@link SystemTime#now()}
-     * </p>
-     * @return a new UnitOfWork
-     */
-    UnitOfWork newUnitOfWork();
-
-    /**
-     * Create a new UnitOfWork and associate it with the current thread.
-     * <p>
-     * The UnitOfWork will use the default Usecase settings.
-     * </p>
-     * @return a new UnitOfWork
-     */
-    UnitOfWork newUnitOfWork( Instant currentTime );
-
-    /**
-     * Create a new UnitOfWork for the given Usecase and associate it with the current thread.
-     * <p>
-     * Current time will be set to {@link SystemTime#now()}
-     * </p>
-     * @param usecase the Usecase for this UnitOfWork
-     *
-     * @return a new UnitOfWork
-     */
-    UnitOfWork newUnitOfWork( Usecase usecase );
-
-    /**
-     * Create a new UnitOfWork for the given Usecase and associate it with the current thread.
-     *
-     * @param usecase the Usecase for this UnitOfWork
-     *
-     * @return a new UnitOfWork
-     */
-    UnitOfWork newUnitOfWork( Usecase usecase, Instant currentTime );
-
-    /**
-     * @return true if there is an active UnitOfWork associated with the executing thread
-     */
-    boolean isUnitOfWorkActive();
-
-    /**
-     * Returns the UnitOfWork that is currently associated with the executing thread.
-     *
-     * @return The current UnitOfWork associated with the executing thread
-     *
-     * @throws IllegalStateException if no current UnitOfWork is active
-     */
-    UnitOfWork currentUnitOfWork()
-        throws IllegalStateException;
-
-    /**
-     * Returns the UnitOfWork that the EntityComposite is bound to.
-     *
-     * @param entity the entity to be checked.
-     *
-     * @return The UnitOfWork instance that the Entity is bound to, or null if the entity is not associated with
-     *         any UnitOfWork.
-     */
-    UnitOfWork getUnitOfWork( EntityComposite entity );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkOptions.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkOptions.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkOptions.java
deleted file mode 100644
index f641d80..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkOptions.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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;
-
-/**
- * Set instances of this in MetaInfo on UnitOfWork or the associated Usecase.
- *  <p>
- * Options:
- *  </p>
- * <p>
- * "pruneOnPause": if true, then clear out all instances that have been loaded in the UoW but not modified
- * </p>
- */
-public class UnitOfWorkOptions
-{
-    private boolean pruneOnPause = false;
-
-    public UnitOfWorkOptions( boolean pruneOnPause )
-    {
-        this.pruneOnPause = pruneOnPause;
-    }
-
-    public boolean isPruneOnPause()
-    {
-        return pruneOnPause;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplate.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplate.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplate.java
deleted file mode 100644
index a9fd501..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/UnitOfWorkTemplate.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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 org.apache.zest.api.structure.Module;
-import org.apache.zest.api.usecase.Usecase;
-
-/**
- * UnitOfWork Template.
- */
-public abstract class UnitOfWorkTemplate<RESULT, ThrowableType extends Throwable>
-{
-    private Usecase usecase = Usecase.DEFAULT;
-    private int retries = 10;
-    private boolean complete = true;
-
-    protected UnitOfWorkTemplate()
-    {
-    }
-
-    protected UnitOfWorkTemplate( int retries, boolean complete )
-    {
-        this.retries = retries;
-        this.complete = complete;
-    }
-
-    protected UnitOfWorkTemplate( Usecase usecase, int retries, boolean complete )
-    {
-        this.usecase = usecase;
-        this.retries = retries;
-        this.complete = complete;
-    }
-
-    protected abstract RESULT withUnitOfWork( UnitOfWork uow )
-        throws ThrowableType;
-
-    @SuppressWarnings( "unchecked" )
-    public RESULT withModule( Module module )
-        throws ThrowableType, UnitOfWorkCompletionException
-    {
-        int loop = 0;
-        ThrowableType ex = null;
-        do
-        {
-            UnitOfWork uow = module.unitOfWorkFactory().newUnitOfWork( usecase );
-
-            try
-            {
-                RESULT result = withUnitOfWork( uow );
-                if( complete )
-                {
-                    try
-                    {
-                        uow.complete();
-                        return result;
-                    }
-                    catch( ConcurrentEntityModificationException e )
-                    {
-                        // Retry?
-                        ex = (ThrowableType) e;
-                    }
-                }
-            }
-            catch( Throwable e )
-            {
-                ex = (ThrowableType) e;
-            }
-            finally
-            {
-                uow.discard();
-            }
-        }
-        while( loop++ < retries );
-
-        throw ex;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkConcern.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkConcern.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkConcern.java
deleted file mode 100644
index 07020a8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkConcern.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.UndeclaredThrowableException;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.concern.GenericConcern;
-import org.apache.zest.api.injection.scope.Invocation;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.Usecase;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-
-/**
- * {@code UnitOfWorkConcern} manages the unit of work complete, discard and retry policy.
- *
- * @see UnitOfWorkPropagation
- * @see UnitOfWorkDiscardOn
- */
-@AppliesTo( UnitOfWorkPropagation.class )
-public class UnitOfWorkConcern
-    extends GenericConcern
-{
-    private static final Class<?>[] DEFAULT_DISCARD_CLASSES = new Class[]{ Throwable.class };
-
-    @Structure
-    private UnitOfWorkFactory uowf;
-
-    @Invocation
-    private UnitOfWorkPropagation propagation;
-
-    /**
-     * Handles method with {@code UnitOfWorkPropagation} annotation.
-     *
-     * @param proxy  The object.
-     * @param method The invoked method.
-     * @param args   The method arguments.
-     *
-     * @return The returned value of method invocation.
-     *
-     * @throws Throwable Thrown if the method invocation throw exception.
-     */
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        UnitOfWorkPropagation.Propagation propagationPolicy = propagation.value();
-        if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRED )
-        {
-            if( uowf.isUnitOfWorkActive() )
-            {
-                //noinspection ConstantConditions
-                return next.invoke( proxy, method, args );
-            }
-            else
-            {
-                Usecase usecase = usecase();
-                return invokeWithCommit( proxy, method, args, uowf.newUnitOfWork( usecase ) );
-            }
-        }
-        else if( propagationPolicy == UnitOfWorkPropagation.Propagation.MANDATORY )
-        {
-            if( !uowf.isUnitOfWorkActive() )
-            {
-                throw new IllegalStateException( "UnitOfWork was required but there is no available unit of work." );
-            }
-        }
-        else if( propagationPolicy == UnitOfWorkPropagation.Propagation.REQUIRES_NEW )
-        {
-            Usecase usecase = usecase();
-            return invokeWithCommit( proxy, method, args, uowf.newUnitOfWork( usecase ) );
-        }
-        //noinspection ConstantConditions
-        return next.invoke( proxy, method, args );
-    }
-
-    private Usecase usecase()
-    {
-        String usecaseName = propagation.usecase();
-        Usecase usecase;
-        if( usecaseName == null )
-        {
-            usecase = Usecase.DEFAULT;
-        }
-        else
-        {
-            usecase = UsecaseBuilder.newUsecase( usecaseName );
-        }
-        return usecase;
-    }
-
-    protected Object invokeWithCommit( Object proxy, Method method, Object[] args, UnitOfWork currentUnitOfWork )
-        throws Throwable
-    {
-        try
-        {
-            UnitOfWorkRetry retryAnnot = method.getAnnotation( UnitOfWorkRetry.class );
-            int maxTries = 0;
-            long delayFactor = 0;
-            long initialDelay = 0;
-            if( retryAnnot != null )
-            {
-                maxTries = retryAnnot.retries();
-                initialDelay = retryAnnot.initialDelay();
-                delayFactor = retryAnnot.delayFactor();
-            }
-            int retry = 0;
-            while( true )
-            {
-                //noinspection ConstantConditions
-                Object result = next.invoke( proxy, method, args );
-                try
-                {
-                    currentUnitOfWork.complete();
-                    return result;
-                }
-                catch( UndeclaredThrowableException e )
-                {
-                    Throwable undeclared = e.getUndeclaredThrowable();
-                    if( undeclared instanceof ConcurrentEntityModificationException )
-                    {
-                        ConcurrentEntityModificationException ceme = (ConcurrentEntityModificationException) undeclared;
-                        currentUnitOfWork = checkRetry( maxTries, delayFactor, initialDelay, retry, ceme );
-                        retry++;
-                    }
-                    else
-                    {
-                        throw e;
-                    }
-                }
-                catch( ConcurrentEntityModificationException e )
-                {
-                    currentUnitOfWork = checkRetry( maxTries, delayFactor, initialDelay, retry, e );
-                    retry++;
-                }
-            }
-        }
-        catch( Throwable throwable )
-        {
-            // Discard only if this concern create a unit of work
-            discardIfRequired( method, currentUnitOfWork, throwable );
-            throw throwable;
-        }
-    }
-
-    private UnitOfWork checkRetry( int maxTries,
-                                   long delayFactor,
-                                   long initialDelay,
-                                   int retry,
-                                   ConcurrentEntityModificationException e
-    )
-        throws ConcurrentEntityModificationException, InterruptedException
-    {
-        if( retry >= maxTries )
-        {
-            throw e;
-        }
-        uowf.currentUnitOfWork().discard();
-        Thread.sleep( initialDelay + retry * delayFactor );
-        return uowf.newUnitOfWork( usecase() );
-    }
-
-    /**
-     * Discard unit of work if the discard policy match.
-     *
-     * @param aMethod     The invoked method. This argument must not be {@code null}.
-     * @param aUnitOfWork The current unit of work. This argument must not be {@code null}.
-     * @param aThrowable  The exception thrown. This argument must not be {@code null}.
-     */
-    protected void discardIfRequired( Method aMethod, UnitOfWork aUnitOfWork, Throwable aThrowable )
-    {
-        UnitOfWorkDiscardOn discardPolicy = aMethod.getAnnotation( UnitOfWorkDiscardOn.class );
-        Class<?>[] discardClasses;
-        if( discardPolicy != null )
-        {
-            discardClasses = discardPolicy.value();
-        }
-        else
-        {
-            discardClasses = DEFAULT_DISCARD_CLASSES;
-        }
-
-        Class<? extends Throwable> aThrowableClass = aThrowable.getClass();
-        for( Class<?> discardClass : discardClasses )
-        {
-            if( discardClass.isAssignableFrom( aThrowableClass ) )
-            {
-                aUnitOfWork.discard();
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkDiscardOn.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkDiscardOn.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkDiscardOn.java
deleted file mode 100644
index 8d2aa7b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkDiscardOn.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Annotation to denote the unit of work discard policy.
- * <p>
- * By default, discard is applied on any method that has {@link UnitOfWorkPropagation} and any exception is thrown.
- * </p>
- * <p>
- * Apply {@code UnitOfWorkDiscardOn} to override the default settings.
- * </p>
- * <p>
- * Usage example:
- * </p>
- * <pre>
- * <code>
- *
- * &#64;Concerns( UnitOfWorkConcern.class )
- * public class MyBusinessServiceMixin implements BusinessService
- * {
- *   &#64;Structure UnitOfWorkFactory uowf;
- *
- *   &#64;UnitOfWorkDiscardOn( MyBusinessException.class )
- *   public void myBusinessMethod()
- *   {
- *     // Must invoke current unit of work.
- *     UnitOfWork uow = uowf.currentUnitOfWork();
- *
- *     // Perform business logic
- *   }
- * }
- * </code>
- * </pre>
- *
- * <p>
- * The unit of work will be discarded iff {@code MyBusinessException} exceptions or its subclass is thrown from within
- * {@code myBusinessMethod} method.
- * </p>
- */
-@Retention( RUNTIME )
-@Target( METHOD )
-@Inherited
-@Documented
-public @interface UnitOfWorkDiscardOn
-{
-    Class<? extends Throwable>[] value() default { Throwable.class };
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkPropagation.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkPropagation.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkPropagation.java
deleted file mode 100644
index eff8fb6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkPropagation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * Annotation to denote the unit of work propagation.
- * <p>
- * Usage example:
- * </p>
- * <pre>
- * <code>
- *
- * &#64;Concerns( UnitOfWorkConcern.class )
- * public class MyBusinessServiceMixin implements BusinessService
- * {
- *   &#64;Structure UnitOfWorkFactory uowf;
- *
- *   &#64;UnitOfWorkPropagation
- *   public void myBusinessMethod()
- *   {
- *     // Must invoke current unit of work.
- *     UnitOfWork uow = uowf.currentUnitOfWork();
- *
- *     // Perform business logic
- *   }
- * }
- * </code>
- * </pre>
- */
-@Retention( RUNTIME )
-@Target( METHOD )
-@Inherited
-@Documented
-public @interface UnitOfWorkPropagation
-{
-    Propagation value() default Propagation.REQUIRED;
-
-    String usecase() default "";
-
-    /**
-     * Propagation behaviors.
-     */
-    enum Propagation
-    {
-        /**
-         * Default propagation behavior.
-         * Behavior: <br>
-         * If no current transaction: creates a new UnitOfWork <br>
-         * If there is a current UnitOfWork: use the current UnitOfWork.
-         */
-        REQUIRED,
-
-        /**
-         * Behavior: <br>
-         * If no current UnitOfWork: throw an exception <br>
-         * If there is a current UnitOfWork: use the current UnitOfWork.
-         */
-        MANDATORY,
-
-        /**
-         * Behavior: <br>
-         * If no current UnitOfWork: creates a new UnitOfWork <br>
-         * If there is a current UnitOfWork: suspend the current UnitOfWork and create a new UnitOfWork.
-         */
-        REQUIRES_NEW
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
deleted file mode 100644
index 98b5d77..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.concern;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-/**
- * This annotation describes the retries that should occur in case of
- * {@link org.apache.zest.api.unitofwork.ConcurrentEntityModificationException}
- * occurs.
- */
-@Retention( RUNTIME )
-@Target( METHOD )
-@Inherited
-@Documented
-public @interface UnitOfWorkRetry
-{
-    /**
-     * Number of times that the UnitOfWork should be tried in total.
-     * The default value is 1, which means that the UnitOfWork will execute only one time. It is also the minimum
-     * value allowed.
-     *
-     * @return Number of times that the UnitOfWork will be executed. Must be 1 or higher. If a value of 0 or lower is
-     * given, the UnitOfWork is still executed one time.
-     */
-    int retries() default 1;
-
-    /**
-     * Number of milliseconds to wait before executing the second UnitOfOfWork.
-     * The default value is 0, which means that there is no delay and it is tried immediately.
-     *
-     * @return Number of milliseconds to wait before executing the second UnitOfOfWork.
-     */
-    long initialDelay() default 0;
-
-    /**
-     * Number of milliseconds to be added for each additional retry, beyond the second one.
-     * The default value is 10.
-     *
-     * The delay is defined as;
-     *
-     * <pre><code>
-     *
-     * Thread.sleep( initialDelay + retry * delayFactor );
-     * </code></pre>
-     * where retry will be 0 after first UnitOfWork had a {@link ConcurrentEntityModificationException} and is 1 after
-     * the first retry and so forth.
-     * <p>
-     * So, with the {@code retries=4, initialDelay=5, delayFactor=20} the 3 delays between the UnitOfWorks will be
-     * {@code 5ms, 25ms, 45ms}
-     * </p>
-     *
-     * @return The number of milliseconds per retry, except the first one, that should be added to the delay between
-     * tries.
-     */
-    long delayFactor() default 10;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/package.html b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/package.html
deleted file mode 100644
index 20aa625..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/package.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>UnitOfWork Concerns.</h2>
-        <p>
-            UnitOfWork Concerns allow declarative UnitOfWork propagation, discard wrt. exceptions and automatic retry.
-        </p>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/unitofwork/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/package.html b/core/api/src/main/java/org/apache/zest/api/unitofwork/package.html
deleted file mode 100644
index 70ff9e9..0000000
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>UnitOfWork API.</h2>
-    </body>
-</html>


[58/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
ZEST-195 ; Replace all "zest" with "polygene"


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

Branch: refs/heads/develop
Commit: 54b69c48d47c641495235e14ce271c3947b83990
Parents: 1c722f4
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Tue Dec 13 20:34:27 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Tue Dec 13 20:34:36 2016 +0800

----------------------------------------------------------------------
 KEYS                                            |   2 +-
 README.txt                                      |   6 +-
 .../src/asciidoc/filters/devstatus/devstatus.py |   2 +-
 .../polygene/gradle/RootProjectPlugin.groovy    |   8 +-
 .../gradle/doc/DocumentationTask.groovy         |   4 +-
 .../polygene/gradle/doc/ManualPlugin.groovy     |  16 +-
 .../gradle/publish/PublishingPlugin.groovy      |   6 +-
 core/api/build.gradle                           |   8 +-
 core/api/dev-status.xml                         |   6 +-
 core/api/src/docs/application.txt               |   8 +-
 core/api/src/docs/composition.txt               |   4 +-
 core/api/src/docs/concern.txt                   |   6 +-
 core/api/src/docs/configuration.txt             |   6 +-
 core/api/src/docs/decoratormixin.txt            |  12 +-
 core/api/src/docs/metrics.txt                   |  14 +-
 core/api/src/docs/mixin.txt                     |  28 +-
 core/api/src/docs/servicecomposite.txt          |  12 +-
 core/api/src/docs/valuecomposite.txt            |   6 +-
 .../polygene/api/service/qualifier/package.html |   2 +-
 .../api/docsupport/ApplicationDocs.java         |  14 +-
 core/bootstrap/build.gradle                     |   4 +-
 core/bootstrap/dev-status.xml                   |   6 +-
 core/bootstrap/src/docs/bootstrap.txt           |  26 +-
 .../polygene/bootstrap/SingletonAssembler.java  |   8 +-
 .../bootstrap/builder/ApplicationBuilder.java   |   6 +-
 .../layered/LayeredApplicationAssembler.java    |  14 +-
 .../bootstrap/DocumentationSupport.java         |  14 +-
 core/runtime/build.gradle                       |   6 +-
 core/runtime/dev-status.xml                     |   6 +-
 core/runtime/src/docs/runtime.txt               |   6 +-
 .../runtime/composite/FragmentClassLoader.java  |   2 +-
 .../runtime/composite/TransientClassLoader.java |   4 +-
 .../polygene/regression/qi78/IssueTest.java     |   4 +-
 .../polygene/regression/qi94/IssueTest.java     |   2 +-
 .../association/AssociationEqualityTest.java    |  36 +-
 .../bootstrap/docs/DocumentationSupport.java    |   6 +-
 .../constraints/ConstraintsTest.properties      |   6 +-
 .../runtime/entity/EntityVisibilityTest.java    |   6 +-
 .../runtime/objects/ObjectVisibilityTest.java   |   6 +-
 .../runtime/property/PropertyEqualityTest.java  |  12 +-
 .../runtime/service/ServiceVisibilityTest.java  |   6 +-
 .../transients/TransientVisibilityTest.java     |   6 +-
 .../runtime/value/ValueEqualityTest.java        |  28 +-
 .../runtime/value/ValueVisibilityTest.java      |   6 +-
 .../visibility/VisibilityInUnitOfWorkTest.java  |   4 +-
 .../java/org/apache/polygene/test/ASMTest.java  |  58 +--
 core/spi/build.gradle                           |   6 +-
 core/spi/dev-status.xml                         |   6 +-
 core/testsupport/build.gradle                   |   4 +-
 core/testsupport/dev-status.xml                 |   6 +-
 core/testsupport/src/docs/testsupport.txt       |   8 +-
 .../polygene/test/AbstractZestBaseTest.java     |  10 +-
 .../polygene/test/AbstractZestScenarioTest.java |  10 +-
 .../AbstractPlainValueSerializationTest.java    |   2 +-
 doap.rdf                                        |  16 +-
 extensions/cache-ehcache/build.gradle           |  10 +-
 extensions/cache-ehcache/dev-status.xml         |   6 +-
 .../cache-ehcache/src/docs/cache-ehcache.txt    |   4 +-
 extensions/cache-memcache/build.gradle          |   8 +-
 extensions/cache-memcache/dev-status.xml        |   6 +-
 .../cache-memcache/src/docs/cache-memcache.txt  |   4 +-
 extensions/entitystore-file/build.gradle        |  14 +-
 extensions/entitystore-file/dev-status.xml      |   6 +-
 .../entitystore-file/src/docs/es-file.txt       |   6 +-
 extensions/entitystore-geode/build.gradle       |  10 +-
 extensions/entitystore-geode/dev-status.xml     |   6 +-
 .../entitystore-geode/src/docs/es-geode.txt     |   4 +-
 .../entitystore-hazelcast/README.persistent     |   2 +-
 extensions/entitystore-hazelcast/build.gradle   |  10 +-
 extensions/entitystore-hazelcast/dev-status.xml |   6 +-
 .../src/docs/es-hazelcast.txt                   |   4 +-
 .../HazelcastEntityStoreService.properties      |   2 +-
 .../entitystore/hazelcast/hazelcast.xml         |   2 +-
 extensions/entitystore-jclouds/build.gradle     |  12 +-
 extensions/entitystore-jclouds/dev-status.xml   |   6 +-
 .../entitystore-jclouds/src/docs/es-jclouds.txt |   4 +-
 extensions/entitystore-jdbm/build.gradle        |  12 +-
 extensions/entitystore-jdbm/dev-status.xml      |   6 +-
 .../entitystore-jdbm/src/docs/es-jdbm.txt       |   6 +-
 extensions/entitystore-leveldb/build.gradle     |  12 +-
 extensions/entitystore-leveldb/dev-status.xml   |   6 +-
 .../entitystore-leveldb/src/docs/es-leveldb.txt |   4 +-
 .../polygene/entitystore/leveldb/package.html   |   2 +-
 extensions/entitystore-memory/build.gradle      |   8 +-
 extensions/entitystore-memory/dev-status.xml    |   6 +-
 .../entitystore-memory/src/docs/es-memory.txt   |   2 +-
 extensions/entitystore-mongodb/build.gradle     |  10 +-
 extensions/entitystore-mongodb/dev-status.xml   |   6 +-
 .../entitystore-mongodb/src/docs/es-mongodb.txt |   4 +-
 extensions/entitystore-preferences/build.gradle |   8 +-
 .../entitystore-preferences/dev-status.xml      |   6 +-
 .../src/docs/es-preferences.txt                 |   2 +-
 extensions/entitystore-redis/build.gradle       |  10 +-
 extensions/entitystore-redis/dev-status.xml     |   6 +-
 .../entitystore-redis/src/docs/es-redis.txt     |   4 +-
 extensions/entitystore-riak/build.gradle        |  12 +-
 extensions/entitystore-riak/dev-status.xml      |   6 +-
 .../entitystore-riak/src/docs/es-riak.txt       |   4 +-
 extensions/entitystore-sql/build.gradle         |  12 +-
 extensions/entitystore-sql/dev-status.xml       |   6 +-
 extensions/entitystore-sql/src/docs/es-sql.txt  |  12 +-
 .../polygene/entitystore/sql/internal/SQLs.java |   4 +-
 extensions/indexing-elasticsearch/build.gradle  |   8 +-
 .../indexing-elasticsearch/dev-status.xml       |   6 +-
 .../src/docs/index-elasticsearch.txt            |  12 +-
 .../ElasticSearchConfiguration.java             |   4 +-
 .../internal/AbstractElasticSearchSupport.java  |   6 +-
 extensions/indexing-rdf/build.gradle            |  14 +-
 extensions/indexing-rdf/dev-status.xml          |   6 +-
 extensions/indexing-rdf/src/docs/index-rdf.txt  |  56 +--
 .../polygene/index/rdf/qi95/Qi95IssueTest.java  |   4 +-
 extensions/indexing-solr/build.gradle           |  10 +-
 extensions/indexing-solr/dev-status.xml         |   6 +-
 .../indexing-solr/src/docs/index-solr.txt       |   2 +-
 extensions/indexing-sql/build.gradle            |  12 +-
 extensions/indexing-sql/dev-status.xml          |   6 +-
 extensions/indexing-sql/instructions.txt        |   2 +-
 extensions/indexing-sql/src/docs/index-sql.txt  |   4 +-
 extensions/metrics-codahale/build.gradle        |  10 +-
 extensions/metrics-codahale/dev-status.xml      |   6 +-
 .../src/docs/metrics-codahale.txt               |   4 +-
 extensions/migration/build.gradle               |   6 +-
 extensions/migration/dev-status.xml             |   6 +-
 extensions/reindexer/build.gradle               |  10 +-
 extensions/reindexer/dev-status.xml             |   6 +-
 extensions/reindexer/src/docs/reindexer.txt     |   4 +-
 .../valueserialization-jackson/build.gradle     |   6 +-
 .../valueserialization-jackson/dev-status.xml   |   6 +-
 .../src/docs/vs-jackson.txt                     |   2 +-
 .../valueserialization-orgjson/build.gradle     |   6 +-
 .../valueserialization-orgjson/dev-status.xml   |   6 +-
 .../src/docs/vs-orgjson.txt                     |   2 +-
 extensions/valueserialization-stax/build.gradle |   6 +-
 .../valueserialization-stax/dev-status.xml      |   6 +-
 .../src/docs/vs-stax.txt                        |   2 +-
 libraries/alarm/build.gradle                    |   6 +-
 libraries/alarm/dev-status.xml                  |   6 +-
 libraries/alarm/src/docs/alarm.txt              |   2 +-
 libraries/circuitbreaker/build.gradle           |   8 +-
 libraries/circuitbreaker/dev-status.xml         |   6 +-
 .../circuitbreaker/src/docs/circuitbreaker.txt  |   6 +-
 libraries/constraints/build.gradle              |   6 +-
 libraries/constraints/dev-status.xml            |   6 +-
 libraries/constraints/src/docs/constraints.txt  |   2 +-
 libraries/fileconfig/build.gradle               |   6 +-
 libraries/fileconfig/dev-status.xml             |   6 +-
 libraries/fileconfig/src/docs/fileconfig.txt    |   6 +-
 libraries/http/build.gradle                     |  10 +-
 libraries/http/dev-status.xml                   |   6 +-
 libraries/http/src/docs/http.txt                |  14 +-
 libraries/invocation-cache/build.gradle         |   8 +-
 libraries/invocation-cache/dev-status.xml       |   6 +-
 .../src/docs/invocation-cache.txt               |   4 +-
 libraries/jmx/build.gradle                      |   6 +-
 libraries/jmx/dev-status.xml                    |   6 +-
 libraries/jmx/src/docs/jmx.txt                  |   4 +-
 libraries/lang-groovy/build.gradle              |   6 +-
 libraries/lang-groovy/dev-status.xml            |   6 +-
 libraries/lang-groovy/src/docs/lang-groovy.txt  |  14 +-
 libraries/lang-javascript/build.gradle          |   8 +-
 libraries/lang-javascript/dev-status.xml        |   6 +-
 .../src/docs/lang-javascript.txt                |   4 +-
 libraries/locking/build.gradle                  |   6 +-
 libraries/locking/dev-status.xml                |   6 +-
 libraries/locking/src/docs/locking.txt          |   2 +-
 libraries/logging/build.gradle                  |   8 +-
 libraries/logging/dev-status.xml                |   6 +-
 libraries/logging/src/docs/logging.txt          |   8 +-
 libraries/metrics/build.gradle                  |   8 +-
 libraries/metrics/dev-status.xml                |   6 +-
 libraries/metrics/src/docs/metrics.txt          |   4 +-
 libraries/osgi/build.gradle                     |   6 +-
 libraries/osgi/dev-status.xml                   |   6 +-
 libraries/osgi/src/docs/osgi.txt                |   4 +-
 libraries/rdf/build.gradle                      |  12 +-
 libraries/rdf/dev-status.xml                    |   6 +-
 .../polygene/library/rdf/entity/test2.xml       |  24 +-
 libraries/rest-client/build.gradle              |  10 +-
 libraries/rest-client/dev-status.xml            |   6 +-
 libraries/rest-client/src/docs/primer.txt       |   4 +-
 libraries/rest-client/src/docs/rest-client.txt  |  14 +-
 .../ContextResourceClientFactoryTest.java       |   2 +-
 .../rest/client/ContinuousIntegrationTest.java  |   2 +-
 libraries/rest-common/build.gradle              |   2 +-
 libraries/rest-common/dev-status.xml            |   6 +-
 libraries/rest-server/build.gradle              |   6 +-
 libraries/rest-server/dev-status.xml            |   6 +-
 libraries/rest/build.gradle                     |  10 +-
 libraries/rest/dev-status.xml                   |   6 +-
 .../polygene/library/rest/admin/sparqlform.html |  18 +-
 .../polygene/library/rest/admin/Main.java       |   4 +-
 .../polygene/library/rest/admin/RestTest.java   |   2 +-
 libraries/restlet/build.gradle                  |  14 +-
 libraries/restlet/dev-status.xml                |   6 +-
 .../library/restlet/ZrestApplication.java       |  14 +-
 libraries/scripting/build.gradle                |   6 +-
 libraries/scripting/dev-status.xml              |   6 +-
 libraries/servlet/build.gradle                  |   6 +-
 libraries/servlet/dev-status.xml                |   6 +-
 libraries/servlet/src/docs/servlet.txt          |   4 +-
 .../lifecycle/AbstractZestServletBootstrap.java |  10 +-
 .../polygene/library/servlet/package.html       |  14 +-
 libraries/shiro-core/build.gradle               |  12 +-
 libraries/shiro-core/dev-status.xml             |   6 +-
 libraries/shiro-core/src/docs/shiro.txt         |  24 +-
 libraries/shiro-web/build.gradle                |  16 +-
 libraries/shiro-web/dev-status.xml              |   6 +-
 libraries/shiro-web/src/docs/shiro-web.txt      |   2 +-
 libraries/spring/build.gradle                   |   6 +-
 libraries/spring/dev-status.xml                 |   6 +-
 libraries/spring/src/docs/spring.txt            |  14 +-
 .../library/spring/bootstrap/Constants.java     |   2 +-
 .../bootstrap/ZestApplicationBootstrap.java     |   4 +-
 .../src/main/resources/META-INF/spring.handlers |   2 +-
 .../src/main/resources/META-INF/spring.schemas  |   2 +-
 .../polygene/library/spring/spring-0.5.xsd      |   4 +-
 .../bootstrap/ZestExportServiceTest-context.xml |   8 +-
 libraries/sql-bonecp/build.gradle               |   2 +-
 libraries/sql-bonecp/dev-status.xml             |   6 +-
 libraries/sql-dbcp/build.gradle                 |   2 +-
 libraries/sql-dbcp/dev-status.xml               |   6 +-
 libraries/sql-liquibase/build.gradle            |   8 +-
 libraries/sql-liquibase/dev-status.xml          |   6 +-
 libraries/sql/build.gradle                      |  18 +-
 libraries/sql/dev-status.xml                    |   6 +-
 libraries/sql/src/docs/sql.txt                  |  20 +-
 libraries/uid/build.gradle                      |   6 +-
 libraries/uid/dev-status.xml                    |   6 +-
 libraries/uid/src/docs/uid.txt                  |  12 +-
 libraries/uowfile/build.gradle                  |   8 +-
 libraries/uowfile/dev-status.xml                |   6 +-
 libraries/uowfile/src/docs/uowfile.txt          |  24 +-
 manual/build.gradle                             |   8 +-
 manual/src/docs/reference/index.txt             |   6 +-
 .../tutorials/howto-assembly-application.txt    |  14 +-
 .../src/docs/tutorials/howto-build-system.txt   |   2 +-
 .../docs/tutorials/howto-configure-service.txt  |  26 +-
 .../tutorials/howto-contextual-fragments.txt    |   4 +-
 .../src/docs/tutorials/howto-create-concern.txt |  16 +-
 .../docs/tutorials/howto-create-constraint.txt  |  16 +-
 .../src/docs/tutorials/howto-create-entity.txt  |  36 +-
 .../docs/tutorials/howto-create-sideeffect.txt  |  16 +-
 .../src/docs/tutorials/howto-depend-on-zest.txt |   4 +-
 .../tutorials/howto-invocation-annotation.txt   |   6 +-
 .../tutorials/howto-leverage-properties.txt     |  14 +-
 .../docs/tutorials/howto-releasing-apache.txt   | 416 +++++++++----------
 .../src/docs/tutorials/howto-writing-docs.txt   |  20 +-
 manual/src/docs/userguide/core.txt              |   2 +-
 manual/src/docs/userguide/index.txt             |   6 +-
 manual/src/docs/userguide/preface.txt           |   2 +-
 manual/src/docs/website/intro.txt               |   2 +-
 manual/src/docs/website/javadocs.txt            |  24 +-
 manual/src/docs/website/samples.txt             |  14 +-
 manual/src/docs/website/tutorials.txt           |   6 +-
 manual/src/docs/website/xsl/head.xsl            |   6 +-
 .../polygene/manual/recipes/assemble/Main.java  |   6 +-
 .../manual/recipes/createEntity/Main.java       |   4 +-
 .../resources/css/progressive-enhancement.css   |   2 +-
 .../src/resources/js/progressive-enhancement.js |   4 +-
 .../schemas/2008/dev-status/1/dev-status.xsd    |   8 +-
 manual/src/xsl/disqus-footer.xsl                |   4 +-
 manual/src/xsl/fo.xsl                           |   2 +-
 manual/src/xsl/head-offline.xsl                 |   6 +-
 samples/dci/build.gradle                        |   8 +-
 samples/forum/build.gradle                      |  18 +-
 samples/rental/build.gradle                     |   8 +-
 .../sample/rental/web/QuikitServlet.java        |   4 +-
 .../polygene/sample/rental/web/BookingPage.html |   2 +-
 .../polygene/sample/rental/web/MainPage.html    |   2 +-
 samples/rental/src/main/webapp/WEB-INF/web.xml  |   2 +-
 samples/sql-support/build.gradle                |  12 +-
 samples/swing/build.gradle                      |   4 +-
 src/bin-dist/README.txt                         |   4 +-
 src/javadoc/overview.html                       |   2 +-
 tests/performance/build.gradle                  |  20 +-
 .../AbstractEntityStorePerformanceTest.java     |   4 +-
 .../PostgreSQLEntityStorePerformanceTest.java   |   4 +-
 .../indexing/rdf/QueryPerformanceTest.java      |   4 +-
 .../README-for-regression-reporting.txt         |   2 +-
 tests/regression/build.gradle                   |   8 +-
 tools/envisage/build.gradle                     |  10 +-
 tools/envisage/dev-status.xml                   |   6 +-
 tools/envisage/src/docs/envisage.txt            |   2 +-
 .../envisage/detail/DependencyPane.java         |  12 +-
 .../envisage/detail/ImportedByPane.java         |   4 +-
 .../detail/ServiceConfigurationPane.java        |   8 +-
 .../envisage/detail/DependencyPane.properties   |  12 +-
 .../envisage/detail/ImportedByPane.properties   |   4 +-
 .../detail/ServiceConfigurationPane.properties  |   8 +-
 tools/generator-zest/app/index.js               |  50 +--
 .../app/templates/Heroes/web.tmpl               |   2 +-
 .../InfrastructureLayer/bootstrap.tmpl          |   6 +-
 .../app/templates/StorageModule/bootstrap.tmpl  |  12 +-
 .../app/templates/buildtool/gradle-app.tmpl     |   8 +-
 .../templates/buildtool/gradle-bootstrap.tmpl   |  14 +-
 .../app/templates/buildtool/gradle-rest.tmpl    |   4 +-
 .../app/templates/buildtool/gradle-root.tmpl    |   8 +-
 .../app/templates/buildtool/settings.tmpl       |   2 +-
 tools/generator-zest/package.json               |   2 +-
 tools/model-detail/build.gradle                 |   8 +-
 tools/model-detail/dev-status.xml               |   6 +-
 tools/qidea/build.gradle                        |   6 +-
 .../plugin/idea/ZestApplicationComponent.java   |  10 +-
 .../common/actions/ZestCreateActionGroup.java   |   4 +-
 .../idea/common/inspections/AbstractFix.java    |   2 +-
 .../common/inspections/AbstractInspection.java  |   2 +-
 ...nsAnnotationDeclaredCorrectlyInspection.html |   2 +-
 .../resource/ZestResourceBundle.properties      |  10 +-
 tools/shell/dev-status.xml                      |   6 +-
 tools/shell/src/dist/bin/zest-boot              |  12 +-
 .../templates/default/files/app/build.gradle_   |   8 +-
 .../default/files/bootstrap/build.gradle_       |  14 +-
 .../etc/templates/default/files/build.gradle_   |   6 +-
 .../ng2-heroes/files/app/build.gradle_          |   8 +-
 .../ng2-heroes/files/bootstrap/build.gradle_    |  14 +-
 .../templates/ng2-heroes/files/build.gradle_    |   6 +-
 .../ng2-heroes/files/rest/build.gradle_         |   4 +-
 .../dist/etc/templates/null/files/build.gradle_ |   6 +-
 .../templates/restapp/files/app/build.gradle_   |   8 +-
 .../restapp/files/bootstrap/build.gradle_       |  14 +-
 .../etc/templates/restapp/files/build.gradle_   |   6 +-
 .../templates/restapp/files/rest/build.gradle_  |   4 +-
 .../etc/templates/singleton/files/build.gradle_ |   6 +-
 tools/shell/src/docs/quick-start.txt            |   2 +-
 tools/shell/src/docs/shell.txt                  |   8 +-
 tools/shell/src/docs/use-boot.txt               |  12 +-
 .../apache/polygene/tools/shell/FileUtils.java  |   4 +-
 .../create/project/AbstractProjectCreator.java  |   2 +-
 .../create/project/restapp/WebXmlWriter.java    |   4 +-
 .../apache/polygene/tools/shell/TestHelper.java |  12 +-
 tutorials/cargo/build.gradle                    |   6 +-
 tutorials/composites/build.gradle               |   8 +-
 tutorials/composites/src/docs/step1.txt         |  10 +-
 tutorials/composites/src/docs/step2.txt         |   4 +-
 tutorials/composites/src/docs/step3.txt         |  10 +-
 tutorials/composites/src/docs/step4.txt         |   4 +-
 tutorials/composites/src/docs/step5.txt         |   8 +-
 tutorials/composites/src/docs/step6.txt         |   8 +-
 tutorials/composites/src/docs/step7.txt         |   8 +-
 tutorials/composites/src/docs/step8.txt         |   6 +-
 tutorials/composites/src/docs/step9.txt         |   6 +-
 .../composites/src/docs/tut-composites.txt      |   4 +-
 .../tutorials/composites/tutorial2/package.html |   2 +-
 .../tutorials/composites/tutorial5/package.html |   4 +-
 .../composites/src/main/javadoc/overview.html   |   2 +-
 tutorials/hello/build.gradle                    |   8 +-
 tutorials/introduction/build.gradle             |   6 +-
 .../introduction/src/docs/state-modeling.txt    |  10 +-
 .../introduction/src/docs/whats-an-object.txt   |  10 +-
 tutorials/introduction/src/docs/zest-cop.txt    |   2 +-
 tutorials/introduction/tenminutes/build.gradle  |   6 +-
 .../tenminutes/src/docs/ten-minutes.txt         |  12 +-
 .../introduction/thirtyminutes/build.gradle     |   6 +-
 .../thirtyminutes/src/docs/thirty-minutes.txt   |  20 +-
 tutorials/introduction/twominutes/build.gradle  |   6 +-
 .../twominutes/src/docs/two-minutes.txt         |  10 +-
 tutorials/services/build.gradle                 |   6 +-
 tutorials/services/src/docs/step3.txt           |   2 +-
 tutorials/services/src/docs/tut-services.txt    |   4 +-
 .../tutorials/services/step3/package.html       |   2 +-
 360 files changed, 1603 insertions(+), 1603 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/KEYS
----------------------------------------------------------------------
diff --git a/KEYS b/KEYS
index 9b20046..a5d2f9d 100644
--- a/KEYS
+++ b/KEYS
@@ -26,7 +26,7 @@ Developers:
   Releases will be signed using one of the keys present in this file. This file
   will be available with the distributed Apache Polygene releases at:
 
-      https://dist.apache.org/repos/dist/zest/KEYS
+      https://dist.apache.org/repos/dist/polygene/KEYS
 
 ********************************************************************************
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/README.txt
----------------------------------------------------------------------
diff --git a/README.txt b/README.txt
index ee8cdd2..a27ea07 100644
--- a/README.txt
+++ b/README.txt
@@ -14,7 +14,7 @@ cool, new and challenging technology. We are especially interested in
 people willing to help improve the SDK, samples, tutorials, documentation
 and other supporting material.
 
-Please see https://zest.apache.org for more information.
+Please see https://polygene.apache.org for more information.
 
 
 Licensing
@@ -38,7 +38,7 @@ If you need to go offline type `./gradlew goOffline` to ensure all needed
 dependencies are cached by Gradle.
 
 If you prefer to use a dependency management system, go to:
-https://zest.apache.org/java/latest/howto-depend-on-zest.html
+https://polygene.apache.org/java/latest/howto-depend-on-polygene.html
 
 
 Building Apache Polygene
@@ -54,7 +54,7 @@ Here is how to run a full build with checks:
     ./gradlew check assemble
 
 Read the Polygene\u2122 Build System tutorial for more details:
-https://zest.apache.org/java/latest/build-system.html
+https://polygene.apache.org/java/latest/build-system.html
 
 
 Thank you for trying out Apache Polygene\u2122 and Composite Oriented Programming.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/buildSrc/src/asciidoc/filters/devstatus/devstatus.py
----------------------------------------------------------------------
diff --git a/buildSrc/src/asciidoc/filters/devstatus/devstatus.py b/buildSrc/src/asciidoc/filters/devstatus/devstatus.py
index 81bbc04..11abfa4 100755
--- a/buildSrc/src/asciidoc/filters/devstatus/devstatus.py
+++ b/buildSrc/src/asciidoc/filters/devstatus/devstatus.py
@@ -23,7 +23,7 @@ import sys
 import xml.dom.minidom
 
 PATH_PATTERN="%(source)s"
-NS="http://zest.apache.org/schemas/2008/dev-status/1"
+NS="http://polygene.apache.org/schemas/2008/dev-status/1"
 
 def configuration(indata):
     config = {}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
index c05a584..78857ea 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/RootProjectPlugin.groovy
@@ -132,7 +132,7 @@ class RootProjectPlugin implements Plugin<Project>
 
   private static void configureJavadocs( Project project )
   {
-    def zest = project.extensions.getByType( PolygeneExtension )
+    def polygene = project.extensions.getByType( PolygeneExtension )
     def releaseSpec = project.extensions.getByType( ReleaseSpecExtension )
     project.tasks.create( TaskNames.JAVADOCS, Javadoc ) { Javadoc task ->
       task.group = TaskGroups.DOCUMENTATION
@@ -184,7 +184,7 @@ class RootProjectPlugin implements Plugin<Project>
       task.description = 'Copy SDK public Javadoc to ../polygene-web'
       task.dependsOn TaskNames.JAVADOCS
       task.from 'build/docs/javadoc/'
-      if( zest.developmentVersion )
+      if( polygene.developmentVersion )
       {
         task.into( "$project.projectDir/../polygene-web/site/content/java/develop/javadocs/" )
       }
@@ -242,12 +242,12 @@ class RootProjectPlugin implements Plugin<Project>
 
   private static void configureReleaseTask( Project project )
   {
-    def zest = project.extensions.getByType( PolygeneExtension )
+    def polygene = project.extensions.getByType( PolygeneExtension )
     def release = project.tasks.create( 'release' )
     release.description = 'Builds, tests and uploads the release artifacts'
     release.group = TaskGroups.RELEASE
     release.doFirst {
-      if( zest.developmentVersion )
+      if( polygene.developmentVersion )
       {
         throw new GradleException( "Cannot release development version $project.version, use '-Dversion=X.Y.Z'" )
       }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
index a043aa0..574f081 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/DocumentationTask.groovy
@@ -134,13 +134,13 @@ class DocumentationTask extends DefaultTask
 
   def void generateAsciidocAccordingToReleaseSpecification()
   {
-    def zest = project.extensions.getByType( PolygeneExtension )
+    def polygene = project.extensions.getByType( PolygeneExtension )
     project.copy { CopySpec spec ->
       spec.from docsDir
       spec.into tempAsciidocDir
       spec.include '**'
     }
-    if( zest.releaseVersion )
+    if( polygene.releaseVersion )
     {
       def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
       def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
index f6e9707..16aff3c 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/doc/ManualPlugin.groovy
@@ -39,14 +39,14 @@ class ManualPlugin implements Plugin<Project>
   @Override
   void apply( final Project project )
   {
-    def zest = project.extensions.getByType( PolygeneExtension )
+    def polygene = project.extensions.getByType( PolygeneExtension )
     project.tasks.create( TaskNames.WEBSITE, DocumentationTask ) { DocumentationTask task ->
       task.group = TaskGroups.DOCUMENTATION
       task.description = 'Generates documentation website'
       task.dependsOn project.rootProject.allprojects.findResults { Project p ->
         p.tasks.findByName AsciidocBuildInfoPlugin.TASK_NAME
       }
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
+      task.onlyIf { isAsciidocInstalled( project, polygene ) }
       task.docName = 'website'
       task.docType = 'article'
     }
@@ -54,8 +54,8 @@ class ManualPlugin implements Plugin<Project>
       task.group = TaskGroups.DOCUMENTATION
       task.description = 'Copy website to ../polygene-web'
       task.dependsOn TaskNames.WEBSITE
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
-      if( zest.developmentVersion )
+      task.onlyIf { isAsciidocInstalled( project, polygene ) }
+      if( polygene.developmentVersion )
       {
         task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/develop"
       }
@@ -69,7 +69,7 @@ class ManualPlugin implements Plugin<Project>
       task.group = TaskGroups.RELEASE
       task.description = 'Copy website to ../polygene-web LATEST'
       task.dependsOn TaskNames.ARCHIVE_WEBSITE
-      task.onlyIf { zest.releaseVersion }
+      task.onlyIf { polygene.releaseVersion }
       task.from "$project.rootProject.projectDir/../polygene-web/site/content/java/$project.version/"
       task.into "$project.rootProject.projectDir/../polygene-web/site/content/java/latest/"
     }
@@ -77,7 +77,7 @@ class ManualPlugin implements Plugin<Project>
       task.group = TaskGroups.DOCUMENTATION
       task.description = 'Generates all documentation'
       task.dependsOn TaskNames.COPY_WEBSITE
-      task.onlyIf { isAsciidocInstalled( project, zest ) }
+      task.onlyIf { isAsciidocInstalled( project, polygene ) }
     }
   }
 
@@ -86,12 +86,12 @@ class ManualPlugin implements Plugin<Project>
   // Force when building a release version
   // Skip if skipAsciidocIfAbsent property is set
   // Skip if asciidoc is not found in PATH when building a development version
-  private static boolean isAsciidocInstalled( Project project, PolygeneExtension zest )
+  private static boolean isAsciidocInstalled( Project project, PolygeneExtension polygene )
   {
     if( asciidocInstalled == null )
     {
       def skipAsciidocIfAbsent = project.findProperty 'skipAsciidocIfAbsent'
-      if( !skipAsciidocIfAbsent && zest.releaseVersion )
+      if( !skipAsciidocIfAbsent && polygene.releaseVersion )
       {
         project.logger.info 'Asciidoc tasks forced for building a release version, hope you have Asciidoc installed'
         asciidocInstalled = true

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
index 6d55b9d..12d5666 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/publish/PublishingPlugin.groovy
@@ -91,10 +91,10 @@ class PublishingPlugin implements Plugin<Project>
 
   private static Config configFor( Project project )
   {
-    def zest = project.extensions.getByType( PolygeneExtension )
+    def polygene = project.extensions.getByType( PolygeneExtension )
     def config = new Config()
-    config.snapshots = zest.developmentVersion
-    config.releases = zest.releaseVersion
+    config.snapshots = polygene.developmentVersion
+    config.releases = polygene.releaseVersion
     config.signed = project.findProperty( 'uploadSigned' ) ?: config.releases
     config.releaseSpec = project.findProperty( 'uploadReleaseSpec' ) ?: config.releases
     config.wagon = project.findProperty( 'uploadWagon' ) ?: WAGON_HTTP

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/build.gradle
----------------------------------------------------------------------
diff --git a/core/api/build.gradle b/core/api/build.gradle
index 96f6c5a..db05b19 100644
--- a/core/api/build.gradle
+++ b/core/api/build.gradle
@@ -21,9 +21,9 @@
 jar { manifest { name = "Apache Polygene\u2122 Core API" } }
 
 dependencies {
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'constraints' )
-  testCompile zest.extension( 'valueserialization-orgjson' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'constraints' )
+  testCompile polygene.extension( 'valueserialization-orgjson' )
 
-  testRuntime zest.core.runtime
+  testRuntime polygene.core.runtime
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/dev-status.xml
----------------------------------------------------------------------
diff --git a/core/api/dev-status.xml b/core/api/dev-status.xml
index a2a7b18..3703137 100644
--- a/core/api/dev-status.xml
+++ b/core/api/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/application.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/application.txt b/core/api/src/docs/application.txt
index 5d9d715..19a4649 100644
--- a/core/api/src/docs/application.txt
+++ b/core/api/src/docs/application.txt
@@ -63,7 +63,7 @@ The full code looks like this;
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
+source=core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
 tag=application1
 -----------
 
@@ -74,7 +74,7 @@ shows what is the actual required sequence to start up Polygene.
 
 [snippet,java]
 -----------
-source=core/bootstrap/src/main/java/org/apache/zest/bootstrap/SingletonAssembler.java
+source=core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
 tag=actual
 -----------
 
@@ -92,7 +92,7 @@ Module in the second index and any number of Assembler instances in the last ind
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
+source=core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
 tag=application2
 -----------
 
@@ -107,7 +107,7 @@ free structure, as long as the rules for no cyclic reference of the Layers are k
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/docsupport/ApplicationDocs.java
+source=core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
 tag=application3
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/composition.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/composition.txt b/core/api/src/docs/composition.txt
index 6cb5492..1a60a3a 100644
--- a/core/api/src/docs/composition.txt
+++ b/core/api/src/docs/composition.txt
@@ -56,7 +56,7 @@ We can therefor get rid of a lot of additional types, and use Polygene-free inte
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java
+source=core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java
 tag=comp1
 -----------
 
@@ -64,7 +64,7 @@ and declare it with;
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/docsupport/CompositionDocs.java
+source=core/api/src/test/java/org/apache/polygene/api/docsupport/CompositionDocs.java
 tag=comp2
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/concern.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/concern.txt b/core/api/src/docs/concern.txt
index 10e19ef..02354e3 100644
--- a/core/api/src/docs/concern.txt
+++ b/core/api/src/docs/concern.txt
@@ -58,21 +58,21 @@ of the JDBC Connection class;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
 tag=class
 --------------
 
 We can also use an AppliesToFilter to define which methods should be wrapped with the concern, like this;
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
 tag=filter
 --------------
 
 And finally an example of how to use annotations to mark indvidual methods for being wrapped by the concern.
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/concern/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/concern/DocumentationSupport.java
 tag=annotation
 --------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/configuration.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/configuration.txt b/core/api/src/docs/configuration.txt
index f3fb2d9..6a6d1e5 100644
--- a/core/api/src/docs/configuration.txt
+++ b/core/api/src/docs/configuration.txt
@@ -32,7 +32,7 @@ Example;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/configuration/MailServiceConfiguration.java
+source=core/api/src/test/java/org/apache/polygene/api/configuration/MailServiceConfiguration.java
 tag=configuration
 --------------
 
@@ -47,7 +47,7 @@ changes take effect. Example;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/configuration/MailService.java
+source=core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java
 tag=read
 --------------
 
@@ -57,7 +57,7 @@ must be called. Example;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/configuration/MailService.java
+source=core/api/src/test/java/org/apache/polygene/api/configuration/MailService.java
 tag=write
 --------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/decoratormixin.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/decoratormixin.txt b/core/api/src/docs/decoratormixin.txt
index 4c34637..6bfae61 100644
--- a/core/api/src/docs/decoratormixin.txt
+++ b/core/api/src/docs/decoratormixin.txt
@@ -30,7 +30,7 @@ the same model instance, so any changes to the model will notify the views.
 We start with the FooModel interface;
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java
 tag=plain
 --------------
 
@@ -39,7 +39,7 @@ and its implementation is not really relevant for this discussion.
 Each of the views looks like this;
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/View1.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/View1.java
 tag=decorator
 --------------
 
@@ -51,7 +51,7 @@ FooModel with the DecoratorMixin.
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/FooModel.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/FooModel.java
 tag=decorator
 --------------
 
@@ -60,7 +60,7 @@ do;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
 tag=create
 --------------
 
@@ -68,7 +68,7 @@ And there is nothing special in the assembly of this simple example;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
 tag=assembly
 --------------
 
@@ -76,6 +76,6 @@ This can now be validated in a small test;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/mixin/decoratorMixin/DecoratorMixinTest.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/decoratorMixin/DecoratorMixinTest.java
 tag=test
 --------------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/metrics.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/metrics.txt b/core/api/src/docs/metrics.txt
index c49ca2a..af3529e 100644
--- a/core/api/src/docs/metrics.txt
+++ b/core/api/src/docs/metrics.txt
@@ -28,7 +28,7 @@ constructor argument.
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=common
 --------------
 
@@ -46,7 +46,7 @@ To create a Gauge, you do something like;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=gauge
 --------------
 
@@ -54,14 +54,14 @@ tag=gauge
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=counter
 --------------
 
 == Histogram ==
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=histogram
 --------------
 
@@ -69,7 +69,7 @@ tag=histogram
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=meter
 --------------
 
@@ -79,7 +79,7 @@ critical sections, or even HTTP requests duration and similar.
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=timer
 --------------
 
@@ -87,6 +87,6 @@ tag=timer
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/metrics/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/metrics/DocumentationSupport.java
 tag=healthcheck
 --------------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/mixin.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/mixin.txt b/core/api/src/docs/mixin.txt
index b95e710..cd7241c 100644
--- a/core/api/src/docs/mixin.txt
+++ b/core/api/src/docs/mixin.txt
@@ -23,7 +23,7 @@ the @Mixins annotation of a Composite declaration) implements one or more method
 Mixin Type can be very simple, like;
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/BankAccount.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/BankAccount.java
 tag=mixinType
 -----------
 
@@ -66,12 +66,12 @@ Mixins are declared as annotations on the composite interface.
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/Something.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/Something.java
 tag=something
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/SomethingMixin.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/SomethingMixin.java
 tag=something
 -----------
 In the above sample, the SomethingMixin will be made part of the Something composite.
@@ -81,17 +81,17 @@ the mixins required.
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/Car.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/Car.java
 tag=mixin
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/Startable.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/Startable.java
 tag=mixin
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/Vehicle.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/Vehicle.java
 tag=mixin
 -----------
 
@@ -101,22 +101,22 @@ which are ordinary mixins but are lacking some methods. This is simply done by d
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/partial/Car.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/partial/Car.java
 tag=partial
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/partial/Vehicle.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/partial/Vehicle.java
 tag=partial
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedLocation.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedLocation.java
 tag=partial
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/partial/SpeedMixin.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/partial/SpeedMixin.java
 tag=partial
 -----------
 
@@ -140,7 +140,7 @@ the Cargo interface like;
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/Cargo.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/Cargo.java
 tag=private
 -----------
 
@@ -150,12 +150,12 @@ probably do something like;
 
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoMixin.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoMixin.java
 tag=private
 -----------
 [snippet,java]
 -----------
-source=core/api/src/test/java/org/apache/zest/api/mixin/privateMixin/CargoState.java
+source=core/api/src/test/java/org/apache/polygene/api/mixin/privateMixin/CargoState.java
 tag=private
 -----------
 
@@ -177,7 +177,7 @@ interfaces and automatically included if needed. They also serve as excellent ex
 
 [snippet,java]
 -----------
-source=core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java
+source=core/api/src/main/java/org/apache/polygene/api/property/PropertyMixin.java
 tag=actual
 -----------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/servicecomposite.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/servicecomposite.txt b/core/api/src/docs/servicecomposite.txt
index b541c65..26c0d4f 100644
--- a/core/api/src/docs/servicecomposite.txt
+++ b/core/api/src/docs/servicecomposite.txt
@@ -52,7 +52,7 @@ by calling instantiateOnStartup(), this way;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=instantiateOnStartup
 --------------
 
@@ -67,7 +67,7 @@ The easiest way is to implement the ServiceActivation interface directly in the
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=activation1
 --------------
 
@@ -75,7 +75,7 @@ The activation code can also be moved outside the composite by using the Service
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=activation2
 --------------
 
@@ -83,7 +83,7 @@ Activators can be registered on Service assembly too, this way;
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=activation3
 --------------
 
@@ -100,7 +100,7 @@ instance. Services can also be arbitrarily tagged, via the ServiceDescriptor. Ex
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=tag
 --------------
 
@@ -108,6 +108,6 @@ Tags are useful inside the application code to locate a particular service insta
 
 [snippet,java]
 --------------
-source=core/api/src/test/java/org/apache/zest/api/service/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/service/DocumentationSupport.java
 tag=UseTag
 --------------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/docs/valuecomposite.txt
----------------------------------------------------------------------
diff --git a/core/api/src/docs/valuecomposite.txt b/core/api/src/docs/valuecomposite.txt
index 8c59187..c3de8b5 100644
--- a/core/api/src/docs/valuecomposite.txt
+++ b/core/api/src/docs/valuecomposite.txt
@@ -83,7 +83,7 @@ Let's see how it works in practice.
 
 [snippet,java]
 ----
-source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
 tag=default
 ----
 
@@ -107,7 +107,7 @@ Let's see how to use the ValueSerialization Services.
 
 [snippet,java]
 ----
-source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
 tag=service
 ----
 
@@ -125,7 +125,7 @@ Many applications need to stream data. The ValueSerialization API support such u
 
 [snippet,java]
 ----
-source=core/api/src/test/java/org/apache/zest/api/value/DocumentationSupport.java
+source=core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java
 tag=stream
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
index d37dc22..de38a6d 100644
--- a/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
+++ b/core/api/src/main/java/org/apache/polygene/api/service/qualifier/package.html
@@ -55,7 +55,7 @@
             <li>{@link org.apache.polygene.api.service.qualifier.Available}</li>
             <li>{@link org.apache.polygene.api.service.qualifier.HasMetaInfo}</li>
             <li>{@link org.apache.polygene.api.service.qualifier.IdentifiedBy}</li>
-            <li>{@link org.apache.polygene.api.service.qualifier.Tagged}</li>
+            <li>{@link org.apache.polygeneF.api.service.qualifier.Tagged}</li>
         </ul>
         <p>See tests and API for more examples, and how to implement your own qualifiers.</p>
     </body>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
index 58e4973..c6a6e78 100644
--- a/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
+++ b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
@@ -38,7 +38,7 @@ public class ApplicationDocs
     {
         {
 // START SNIPPET: application1
-            SingletonAssembler zest = new SingletonAssembler()
+            SingletonAssembler polygene = new SingletonAssembler()
             {
                 public void assemble( ModuleAssembly assembly )
                     throws AssemblyException
@@ -81,8 +81,8 @@ public class ApplicationDocs
                       }
                     }
                 };
-            Energy4Java zest = new Energy4Java();
-            Application app = zest.newApplication( new ApplicationAssembler()
+            Energy4Java polygene = new Energy4Java();
+            Application app = polygene.newApplication( new ApplicationAssembler()
             {
 
                 @Override
@@ -112,13 +112,13 @@ public class ApplicationDocs
     }
 
     // START SNIPPET: application3
-    private static Energy4Java zest;
+    private static Energy4Java polygene;
 
     public static void main( String[] args )
         throws Exception
     {
-        zest = new Energy4Java();
-        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
+        polygene = new Energy4Java();
+        ApplicationDescriptor model = polygene.newApplicationModel( new ApplicationAssembler()
         {
             @Override
             public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
@@ -127,7 +127,7 @@ public class ApplicationDocs
                 return createAssembly( applicationFactory );
             }
         } );
-        Application application = model.newInstance( zest.spi() );
+        Application application = model.newInstance( polygene.spi() );
     }
 
     private static ApplicationAssembly createAssembly( ApplicationAssemblyFactory factory )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/build.gradle
----------------------------------------------------------------------
diff --git a/core/bootstrap/build.gradle b/core/bootstrap/build.gradle
index e565e10..ae37429 100644
--- a/core/bootstrap/build.gradle
+++ b/core/bootstrap/build.gradle
@@ -21,7 +21,7 @@
 jar { manifest { name = "Apache Polygene\u2122 Core Bootstrap" } }
 
 dependencies {
-  compile zest.core.spi
+  compile polygene.core.spi
 
-  testRuntime zest.core.runtime
+  testRuntime polygene.core.runtime
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/dev-status.xml
----------------------------------------------------------------------
diff --git a/core/bootstrap/dev-status.xml b/core/bootstrap/dev-status.xml
index 994ff62..ba367e6 100644
--- a/core/bootstrap/dev-status.xml
+++ b/core/bootstrap/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/src/docs/bootstrap.txt
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/docs/bootstrap.txt b/core/bootstrap/src/docs/bootstrap.txt
index ee18228..e20b995 100644
--- a/core/bootstrap/src/docs/bootstrap.txt
+++ b/core/bootstrap/src/docs/bootstrap.txt
@@ -55,7 +55,7 @@ include::../../build/docs/buildinfo/artifact.txt[]
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=objects
 --------------
 
@@ -64,7 +64,7 @@ tag=objects
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=transients
 --------------
 
@@ -73,7 +73,7 @@ tag=transients
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=values
 --------------
 
@@ -82,7 +82,7 @@ tag=values
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=entities
 --------------
 
@@ -91,7 +91,7 @@ tag=entities
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=services
 --------------
 
@@ -99,7 +99,7 @@ tag=services
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=tagged-services
 --------------
 
@@ -107,7 +107,7 @@ tag=tagged-services
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=imported-services
 --------------
 
@@ -115,7 +115,7 @@ tag=imported-services
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=properties-defaults
 --------------
 
@@ -138,7 +138,7 @@ such as;
 
 [snippet,java]
 --------------
-source=libraries/rest-server/src/test/java/org/apache/zest/library/rest/server/DocumentationSupport.java
+source=libraries/rest-server/src/test/java/org/apache/polygene/library/rest/server/DocumentationSupport.java
 tag=UsingAssembler
 --------------
 
@@ -162,7 +162,7 @@ used like;
 
 [snippet,java]
 --------------
-source=extensions/entitystore-jdbm/src/test/java/org/apache/zest/entitystore/jdbm/DocumentationSupport.java
+source=extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/DocumentationSupport.java
 tag=UsingAssembler
 --------------
 
@@ -216,7 +216,7 @@ Let's take a closer look at how it is put together.
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=singleton
 --------------
 
@@ -270,7 +270,7 @@ Let's look at an example;
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=pancake
 --------------
 
@@ -285,7 +285,7 @@ ApplicationAssemblyFactory, which is used to create an ApplicationAssembly descr
 
 [snippet,java]
 --------------
-source=core/bootstrap/src/test/java/org/apache/zest/bootstrap/DocumentationSupport.java
+source=core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 tag=full
 --------------
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
index 18717dd..428d548 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/SingletonAssembler.java
@@ -41,7 +41,7 @@ import org.apache.polygene.api.value.ValueBuilderFactory;
 public abstract class SingletonAssembler
     implements Assembler
 {
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Application applicationInstance;
     private final Module moduleInstance;
 
@@ -59,8 +59,8 @@ public abstract class SingletonAssembler
         throws AssemblyException, ActivationException
     {
 // START SNIPPET: actual
-        zest = new Energy4Java();
-        applicationInstance = zest.newApplication(
+        polygene = new Energy4Java();
+        applicationInstance = polygene.newApplication(
             applicationFactory -> applicationFactory.newApplicationAssembly( SingletonAssembler.this )
         );
 
@@ -84,7 +84,7 @@ public abstract class SingletonAssembler
 
     public final PolygeneAPI runtime()
     {
-        return zest.spi();
+        return polygene.spi();
     }
 
     public final Application application()

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
index 313be1e..3a064e5 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
@@ -103,8 +103,8 @@ public class ApplicationBuilder
     public Application newApplication()
         throws AssemblyException, ActivationException
     {
-        Energy4Java zest = new Energy4Java();
-        ApplicationDescriptor model = zest.newApplicationModel( new ApplicationAssembler()
+        Energy4Java polygene = new Energy4Java();
+        ApplicationDescriptor model = polygene.newApplicationModel( new ApplicationAssembler()
         {
             @Override
             public ApplicationAssembly assemble( ApplicationAssemblyFactory factory )
@@ -137,7 +137,7 @@ public class ApplicationBuilder
                 return assembly;
             }
         } );
-        Application application = model.newInstance( zest.api() );
+        Application application = model.newInstance( polygene.api() );
         for( ActivationEventListener activationListener : activationListeners )
         {
             application.registerActivationEventListener( activationListener );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
index 58e5a9e..d5edba0 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
@@ -39,7 +39,7 @@ import org.apache.polygene.bootstrap.LayerAssembly;
 public abstract class LayeredApplicationAssembler
     implements ApplicationAssembler
 {
-    protected final Energy4Java zest;
+    protected final Energy4Java polygene;
     protected final String name;
     protected final String version;
 
@@ -56,15 +56,15 @@ public abstract class LayeredApplicationAssembler
         this.name = name;
         this.version = version;
         this.mode = mode;
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
     }
 
     public void initialize()
         throws AssemblyException
     {
-        model = zest.newApplicationModel( this );
+        model = polygene.newApplicationModel( this );
         onModelCreated( model );
-        instantiateApplication( zest, model );
+        instantiateApplication( polygene, model );
     }
 
     public ApplicationAssembly assembly()
@@ -83,12 +83,12 @@ public abstract class LayeredApplicationAssembler
      *   application = model.newInstance( polygene.spi() );
      * </code></pre>
      *
-     * @param zest  The Polygene runtime engine.
+     * @param polygene  The Polygene runtime engine.
      * @param model The application model descriptor.
      */
-    protected void instantiateApplication( Energy4Java zest, ApplicationDescriptor model )
+    protected void instantiateApplication( Energy4Java polygene, ApplicationDescriptor model )
     {
-        application = model.newInstance( zest.spi() );
+        application = model.newInstance( polygene.spi() );
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
index 08b61d1..a89629a 100644
--- a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
@@ -236,13 +236,13 @@ public class DocumentationSupport
         public static class PricingAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
         public static class ProductAssembler implements Assembler { public void assemble( ModuleAssembly module ) throws AssemblyException { } }
 
-        private static Energy4Java zest;
+        private static Energy4Java polygene;
 
         // START SNIPPET: pancake
         public static void main( String[] args )
                 throws Exception
         {
-            zest = new Energy4Java();
+            polygene = new Energy4Java();
             Assembler[][][] assemblers = new Assembler[][][]{
                 { // View Layer
                     { // Login Module
@@ -282,14 +282,14 @@ public class DocumentationSupport
                 }
             };
             ApplicationDescriptor model = newApplication( assemblers );
-            Application runtime = model.newInstance( zest.spi() );
+            Application runtime = model.newInstance( polygene.spi() );
             runtime.activate();
         }
 
         private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers )
                 throws AssemblyException
         {
-            return zest.newApplicationModel( new ApplicationAssembler()
+            return polygene.newApplicationModel( new ApplicationAssembler()
             {
 
                 @Override
@@ -321,7 +321,7 @@ public class DocumentationSupport
         public static class NeoAssembler implements Assembler{ NeoAssembler( String path ) {} public void assemble( ModuleAssembly module ) throws AssemblyException { } }
 
         // START SNIPPET: full
-        private static Energy4Java zest;
+        private static Energy4Java polygene;
 
         private static Application application;
 
@@ -329,8 +329,8 @@ public class DocumentationSupport
                 throws Exception
         {
             // Create a Polygene Runtime
-            zest = new Energy4Java();
-            application = zest.newApplication( new ApplicationAssembler()
+            polygene = new Energy4Java();
+            application = polygene.newApplication( new ApplicationAssembler()
             {
 
                 @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/build.gradle
----------------------------------------------------------------------
diff --git a/core/runtime/build.gradle b/core/runtime/build.gradle
index 39d4cca..5324662 100644
--- a/core/runtime/build.gradle
+++ b/core/runtime/build.gradle
@@ -23,11 +23,11 @@ jar { manifest { name = "Apache Polygene\u2122 Core Runtime" } }
 dependencies {
   compileOnly libraries.osgi_core
 
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.asm
   compile libraries.asm_util
   compile libraries.asm_commons
 
-  testCompile zest.core.testsupport
-  testCompile zest.library( 'constraints' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.library( 'constraints' )
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/dev-status.xml
----------------------------------------------------------------------
diff --git a/core/runtime/dev-status.xml b/core/runtime/dev-status.xml
index 994ff62..ba367e6 100644
--- a/core/runtime/dev-status.xml
+++ b/core/runtime/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <codebase>stable</codebase>
     <!--none,early,beta,stable,mature-->

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/docs/runtime.txt
----------------------------------------------------------------------
diff --git a/core/runtime/src/docs/runtime.txt b/core/runtime/src/docs/runtime.txt
index 6caaa4a..57429fe 100644
--- a/core/runtime/src/docs/runtime.txt
+++ b/core/runtime/src/docs/runtime.txt
@@ -25,7 +25,7 @@ source=core/runtime/dev-status.xml
 --------------
 
 First of all, your code should never, ever, have a dependency on Core Runtime. If you think you need this, you should
-probably contact users@zest.apache.org mailing list and see if your usecase can either be solved in a existing way or
+probably contact users@polygene.apache.org mailing list and see if your usecase can either be solved in a existing way or
 perhaps that a new Core SPI Extension is needed.
 
 include::../../build/docs/buildinfo/artifact.txt[]
@@ -42,12 +42,12 @@ To do this, add the +AssemblyHelper+ implementation instance as +metaInfo+ to th
 
 We think this is so rare, that the +AssemblyHelper+ class will remain in the +core/runtime+ module and has not
 been promoted to the +core/bootstrap+ module. If you plan to use this feature, please contact the Polygene development
-team at +dev@zest.apache.org+ to ensure we can make this a better supported, backed by real usecases.
+team at +dev@polygene.apache.org+ to ensure we can make this a better supported, backed by real usecases.
 
 Fictitious example of using a hypothetical Dalvik capable classloader;
 
 [source,java]
 --------------
-source=core/runtime/src/test/java/org/apache/zest/runtime/bootstrap/docs/DocumentationSupport.java
+source=core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
 tag=customAssemblyHelper
 --------------

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
index 774bea7..440e023 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/FragmentClassLoader.java
@@ -313,7 +313,7 @@ public class FragmentClassLoader
                             }
 
                             // Call method
-                            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/api/composite/CompositeInvoker",
+                            mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/api/composite/CompositeInvoker",
                                                 "invokeComposite",
                                                 "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
index c909e33..9f63677 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TransientClassLoader.java
@@ -161,7 +161,7 @@ import static org.objectweb.asm.Type.getInternalName;
         ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS );
 
         // Class definition start
-        cw.visit( JDK_VERSION, ACC_PUBLIC + ACC_SUPER, classSlash, null, baseClassSlash, new String[] { "org/apache/zest/api/composite/Composite" } );
+        cw.visit( JDK_VERSION, ACC_PUBLIC + ACC_SUPER, classSlash, null, baseClassSlash, new String[] { "org/apache/polygene/api/composite/Composite" } );
 
         // Composite reference
         {
@@ -283,7 +283,7 @@ import static org.objectweb.asm.Type.getInternalName;
                         }
 
                         // Call method
-                        mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/zest/api/composite/CompositeInvoker",
+                        mv.visitMethodInsn( INVOKEINTERFACE, "org/apache/polygene/api/composite/CompositeInvoker",
                                             "invokeComposite",
                                             "(Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;", true );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
index db2a409..7e96d69 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
@@ -38,9 +38,9 @@ public class IssueTest
     public void testLayersCanBeCreatedInOrderDifferentFromTheirDependency()
         throws AssemblyException
     {
-        Energy4Java zest = new Energy4Java();
+        Energy4Java polygene = new Energy4Java();
 
-        Application app = zest.newApplication( new ApplicationAssembler()
+        Application app = polygene.newApplication( new ApplicationAssembler()
         {
             public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
                 throws AssemblyException

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/regression/qi94/IssueTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/regression/qi94/IssueTest.java b/core/runtime/src/test/java/org/apache/polygene/regression/qi94/IssueTest.java
index 31df201..6a60093 100644
--- a/core/runtime/src/test/java/org/apache/polygene/regression/qi94/IssueTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/regression/qi94/IssueTest.java
@@ -50,7 +50,7 @@ public class IssueTest
         try
         {
             EntityBuilder<Item> builder = uow.newEntityBuilder( Item.class );
-            assertEquals( ItemType.class, zest.api()
+            assertEquals( ItemType.class, polygene.api()
                 .entityDescriptorFor( builder.instance() )
                 .state()
                 .getAssociationByName( "typeOfItem" )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
index 2c1594e..8f1e294 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/association/AssociationEqualityTest.java
@@ -93,14 +93,14 @@ public class AssociationEqualityTest
             AnEntity anEntity = uow.newEntity( AnEntity.class );
 
             SomeWithAssociations some = buildSomeWithAssociation( anEntity );
-            AssociationDescriptor someAssocDesc = zest.api().associationDescriptorFor( some.anEntity() );
-            AssociationDescriptor someManyAssocDesc = zest.api().associationDescriptorFor( some.manyEntities() );
-            AssociationDescriptor someNamedAssocDesc = zest.api().associationDescriptorFor( some.namedEntities() );
+            AssociationDescriptor someAssocDesc = polygene.api().associationDescriptorFor( some.anEntity() );
+            AssociationDescriptor someManyAssocDesc = polygene.api().associationDescriptorFor( some.manyEntities() );
+            AssociationDescriptor someNamedAssocDesc = polygene.api().associationDescriptorFor( some.namedEntities() );
 
             SomeWithAssociations some2 = buildSomeWithAssociation( anEntity );
-            AssociationDescriptor some2AssocDesc = zest.api().associationDescriptorFor( some2.anEntity() );
-            AssociationDescriptor some2ManyAssocDesc = zest.api().associationDescriptorFor( some2.manyEntities() );
-            AssociationDescriptor some2NamedAssocDesc = zest.api().associationDescriptorFor( some2.namedEntities() );
+            AssociationDescriptor some2AssocDesc = polygene.api().associationDescriptorFor( some2.anEntity() );
+            AssociationDescriptor some2ManyAssocDesc = polygene.api().associationDescriptorFor( some2.manyEntities() );
+            AssociationDescriptor some2NamedAssocDesc = polygene.api().associationDescriptorFor( some2.namedEntities() );
 
             assertThat( "AssociationDescriptor equal",
                         someAssocDesc,
@@ -134,14 +134,14 @@ public class AssociationEqualityTest
         try
         {
             SomeWithAssociations some = buildSomeWithAssociation( uow.newEntity( AnEntity.class ) );
-            AssociationDescriptor someAssocDesc = zest.api().associationDescriptorFor( some.anEntity() );
-            AssociationDescriptor someManyAssocDesc = zest.api().associationDescriptorFor( some.manyEntities() );
-            AssociationDescriptor someNamedAssocDesc = zest.api().associationDescriptorFor( some.namedEntities() );
+            AssociationDescriptor someAssocDesc = polygene.api().associationDescriptorFor( some.anEntity() );
+            AssociationDescriptor someManyAssocDesc = polygene.api().associationDescriptorFor( some.manyEntities() );
+            AssociationDescriptor someNamedAssocDesc = polygene.api().associationDescriptorFor( some.namedEntities() );
 
             SomeWithAssociations some2 = buildSomeWithAssociation( uow.newEntity( AnEntity.class ) );
-            AssociationDescriptor some2AssocDesc = zest.api().associationDescriptorFor( some2.anEntity() );
-            AssociationDescriptor some2ManyAssocDesc = zest.api().associationDescriptorFor( some2.manyEntities() );
-            AssociationDescriptor some2NamedAssocDesc = zest.api().associationDescriptorFor( some2.namedEntities() );
+            AssociationDescriptor some2AssocDesc = polygene.api().associationDescriptorFor( some2.anEntity() );
+            AssociationDescriptor some2ManyAssocDesc = polygene.api().associationDescriptorFor( some2.manyEntities() );
+            AssociationDescriptor some2NamedAssocDesc = polygene.api().associationDescriptorFor( some2.namedEntities() );
 
             assertThat( "AssociationDescriptor equal",
                         someAssocDesc,
@@ -177,14 +177,14 @@ public class AssociationEqualityTest
             AnEntity anEntity = uow.newEntity( AnEntity.class );
 
             SomeWithAssociations some = buildSomeWithAssociation( anEntity );
-            AssociationDescriptor someAssocDesc = zest.api().associationDescriptorFor( some.anEntity() );
-            AssociationDescriptor someManyAssocDesc = zest.api().associationDescriptorFor( some.manyEntities() );
-            AssociationDescriptor someNamedAssocDesc = zest.api().associationDescriptorFor( some.namedEntities() );
+            AssociationDescriptor someAssocDesc = polygene.api().associationDescriptorFor( some.anEntity() );
+            AssociationDescriptor someManyAssocDesc = polygene.api().associationDescriptorFor( some.manyEntities() );
+            AssociationDescriptor someNamedAssocDesc = polygene.api().associationDescriptorFor( some.namedEntities() );
 
             OtherWithAssociations other = buildOtherWithAssociation( anEntity );
-            AssociationDescriptor otherAssocDesc = zest.api().associationDescriptorFor( other.anEntity() );
-            AssociationDescriptor otherManyAssocDesc = zest.api().associationDescriptorFor( other.manyEntities() );
-            AssociationDescriptor otherNamedAssocDesc = zest.api().associationDescriptorFor( other.namedEntities() );
+            AssociationDescriptor otherAssocDesc = polygene.api().associationDescriptorFor( other.anEntity() );
+            AssociationDescriptor otherManyAssocDesc = polygene.api().associationDescriptorFor( other.manyEntities() );
+            AssociationDescriptor otherNamedAssocDesc = polygene.api().associationDescriptorFor( other.namedEntities() );
 
             assertThat( "AssociationDescriptor not equal",
                         someAssocDesc,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
index a5020b5..3c80414 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
@@ -32,7 +32,7 @@ import org.apache.polygene.runtime.composite.FragmentClassLoader;
 public class DocumentationSupport
 {
     // START SNIPPET: customAssemblyHelper
-    private static Energy4Java zest;
+    private static Energy4Java polygene;
 
     private static Application application;
 
@@ -40,8 +40,8 @@ public class DocumentationSupport
         throws Exception
     {
         // Create a Polygene Runtime
-        zest = new Energy4Java();
-        application = zest.newApplication( new ApplicationAssembler()
+        polygene = new Energy4Java();
+        application = polygene.newApplication( new ApplicationAssembler()
         {
 
             @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.properties
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.properties b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.properties
index d48d750..5f3fd7a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.properties
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/constraints/ConstraintsTest.properties
@@ -18,9 +18,9 @@
 #
 #
 
-zest.constraint.ConstraintsTest$MyOneComposite=Message1
+polygene.constraint.ConstraintsTest$MyOneComposite=Message1
 
-zest.constraint.NotNull=Message2
+polygene.constraint.NotNull=Message2
 
-zest.constraint.ConstraintsTest$MyOneComposite.doSomething=Message3
+polygene.constraint.ConstraintsTest$MyOneComposite.doSomething=Message3
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java
index fb00a0d..642bb14 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/entity/EntityVisibilityTest.java
@@ -50,7 +50,7 @@ public class EntityVisibilityTest
 
     public static final Identity TEST_IDENTITY = new StringIdentity( "123" );
 
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Module module;
     private Application app;
     private UnitOfWorkFactory uowf;
@@ -59,7 +59,7 @@ public class EntityVisibilityTest
     public void setup()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         Assembler[][][] assemblers = new Assembler[][][]
             {
@@ -82,7 +82,7 @@ public class EntityVisibilityTest
                   }
                 }
             };
-        app = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         app.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java
index d410b6d..45691e8 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectVisibilityTest.java
@@ -50,7 +50,7 @@ public class ObjectVisibilityTest
 
     public static final Identity TEST_IDENTITY = new StringIdentity( "123" );
 
-    private Energy4Java zest;
+    private Energy4Java polygene;
     private Module module;
     private UnitOfWorkFactory uowf;
     private Application app;
@@ -59,7 +59,7 @@ public class ObjectVisibilityTest
     public void setup()
         throws Exception
     {
-        zest = new Energy4Java();
+        polygene = new Energy4Java();
 
         Assembler[][][] assemblers = new Assembler[][][]
             {
@@ -82,7 +82,7 @@ public class ObjectVisibilityTest
                   }
                 }
             };
-        app = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        app = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         app.activate();


[13/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java
new file mode 100644
index 0000000..4a00359
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AbstractModifierModel.java
@@ -0,0 +1,184 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectedFieldsModel;
+import org.apache.polygene.runtime.injection.InjectedMethodsModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+import static org.apache.polygene.api.util.Classes.RAW_CLASS;
+import static org.apache.polygene.api.util.Classes.interfacesOf;
+
+/**
+ * JAVADOC
+ */
+public abstract class AbstractModifierModel
+    implements Dependencies, VisitableHierarchy<Object, Object>
+{
+    private final Class<?> modifierClass;
+
+    private final ConstructorsModel constructorsModel;
+    private final InjectedFieldsModel injectedFieldsModel;
+    private final InjectedMethodsModel injectedMethodsModel;
+
+    private final Class<Class<?>>[] nextInterfaces;
+
+    @SuppressWarnings( "unchecked" )
+    public AbstractModifierModel( Class<?> declaredModifierClass, Class<?> instantiationClass )
+    {
+        this.modifierClass = instantiationClass;
+        constructorsModel = new ConstructorsModel( modifierClass );
+        injectedFieldsModel = new InjectedFieldsModel( declaredModifierClass );
+        injectedMethodsModel = new InjectedMethodsModel( declaredModifierClass );
+        Class<Class<?>> componentType = (Class<Class<?>>) Class.class.cast( Class.class );
+        nextInterfaces = interfacesOf( declaredModifierClass )
+            .map( RAW_CLASS )
+            .distinct()
+            .toArray( size -> (Class<Class<?>>[]) Array.newInstance( componentType, size ) );
+    }
+
+    public Class<?> modifierClass()
+    {
+        return modifierClass;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public Stream<DependencyModel> dependencies()
+    {
+        Stream<? extends Dependencies> models = Stream.of( this.constructorsModel, injectedFieldsModel, injectedMethodsModel );
+        return models.flatMap( Dependencies::dependencies );
+    }
+
+    public boolean isGeneric()
+    {
+        return InvocationHandler.class.isAssignableFrom( modifierClass );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( constructorsModel.accept( visitor ) )
+            {
+                if( injectedFieldsModel.accept( visitor ) )
+                {
+                    injectedMethodsModel.accept( visitor );
+                }
+            }
+        }
+
+        return visitor.visitLeave( this );
+    }
+
+    // Context
+    public InvocationHandler newInstance( ModuleDescriptor module,
+                                          InvocationHandler next,
+                                          ProxyReferenceInvocationHandler proxyHandler,
+                                          Method method
+    )
+    {
+        InjectionContext injectionContext = new InjectionContext( module, wrapNext( next ), proxyHandler );
+
+        Object modifier = constructorsModel.newInstance( injectionContext );
+
+        try
+        {
+            if( FragmentClassLoader.isGenerated( modifier ) )
+            {
+                modifier.getClass().getField( "_instance" ).set( modifier, proxyHandler );
+            }
+        }
+        catch( IllegalAccessException | NoSuchFieldException e )
+        {
+            e.printStackTrace();
+        }
+
+        injectedFieldsModel.inject( injectionContext, modifier );
+        injectedMethodsModel.inject( injectionContext, modifier );
+
+        if( isGeneric() )
+        {
+            return (InvocationHandler) modifier;
+        }
+        else
+        {
+            try
+            {
+                Method invocationMethod = modifierClass.getMethod( "_" + method.getName(), method.getParameterTypes() );
+                TypedModifierInvocationHandler handler = new TypedModifierInvocationHandler();
+                handler.setFragment( modifier );
+                handler.setMethod( invocationMethod );
+                return handler;
+            }
+            catch( NoSuchMethodException e )
+            {
+                throw new ConstructionException( "Could not find modifier method", e );
+            }
+        }
+    }
+
+    private Object wrapNext( InvocationHandler next )
+    {
+        if( isGeneric() )
+        {
+            return next;
+        }
+        else
+        {
+            return Proxy.newProxyInstance( modifierClass.getClassLoader(), nextInterfaces, next );
+        }
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if( this == o )
+        {
+            return true;
+        }
+        if( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+        AbstractModifierModel that = (AbstractModifierModel) o;
+        return modifierClass.equals( that.modifierClass );
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return modifierClass.hashCode();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AtomicInstancePool.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AtomicInstancePool.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AtomicInstancePool.java
new file mode 100644
index 0000000..28ee8b2
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/AtomicInstancePool.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Method instance pool that keeps a linked list. Uses atomic reference
+ * to ensure that instances are acquired and returned in a thread-safe
+ * manner.
+ */
+public final class AtomicInstancePool
+    implements InstancePool<CompositeMethodInstance>
+{
+    private final AtomicReference<CompositeMethodInstance> first = new AtomicReference<CompositeMethodInstance>();
+
+    @Override
+    public CompositeMethodInstance obtainInstance()
+    {
+        CompositeMethodInstance firstInstance;
+        do
+        {
+            firstInstance = first.get();
+        }
+        while( firstInstance != null && !first.compareAndSet( firstInstance, firstInstance.getNext() ) );
+
+        return firstInstance;
+    }
+
+    @Override
+    public void releaseInstance( CompositeMethodInstance compositeMethodInstance )
+    {
+        CompositeMethodInstance firstInstance;
+        do
+        {
+            firstInstance = first.get();
+            compositeMethodInstance.setNext( firstInstance );
+        }
+        while( !first.compareAndSet( firstInstance, compositeMethodInstance ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompactLevel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompactLevel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompactLevel.java
new file mode 100644
index 0000000..5c44e98
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompactLevel.java
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+/**
+ * Compaction Level of the StackTrace clenaup operation.
+ *
+ * <pre>
+ * <b>off</b>       = Do not modify the stack trace.
+ * <b>proxy</b>     = Remove all Polygene internal classes and all JDK internal classes from
+ *             the originating method call.
+ * <b>semi</b>      = Remove all JDK internal classes on the entire stack.
+ * <b>extensive</b> = Remove all Polygene internal and JDK internal classes from the entire stack.
+ * </pre>
+ *
+ * <p>
+ * The Compaction is set through the System Property "<code><b>polygene.compacttrace</b></code>" to
+ * any of the above values.
+ * </p>
+ */
+enum CompactLevel
+{
+    off, proxy, semi, extensive
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeConstraintModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeConstraintModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeConstraintModel.java
new file mode 100644
index 0000000..5345594
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeConstraintModel.java
@@ -0,0 +1,74 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.constraint.Constraint;
+
+/**
+ * JAVADOC
+ */
+public final class CompositeConstraintModel
+    extends AbstractConstraintModel
+{
+    private final ValueConstraintsModel constraintsModel;
+
+    public CompositeConstraintModel( Annotation annotation, ValueConstraintsModel constraintsModel )
+    {
+        super( annotation );
+        this.constraintsModel = constraintsModel;
+    }
+
+    @Override
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public ConstraintInstance<?, ?> newInstance()
+    {
+        try
+        {
+            ValueConstraintsInstance compositeConstraintsInstance = constraintsModel.newInstance();
+            Constraint<?, ?> constraint = new CompositeConstraintInstance( compositeConstraintsInstance );
+            return new ConstraintInstance( constraint, annotation );
+        }
+        catch( Exception e )
+        {
+            throw new ConstructionException( "Could not instantiate constraint implementation", e );
+        }
+    }
+
+    private static class CompositeConstraintInstance
+        implements Constraint<Annotation, Object>
+    {
+        private final ValueConstraintsInstance valueConstraintsInstance;
+
+        private CompositeConstraintInstance( ValueConstraintsInstance valueConstraintsInstance )
+        {
+            this.valueConstraintsInstance = valueConstraintsInstance;
+        }
+
+        @Override
+        public boolean isValid( Annotation annotation, Object value )
+            throws NullPointerException
+        {
+            return valueConstraintsInstance.checkConstraints( value ).isEmpty();
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodInstance.java
new file mode 100644
index 0000000..1867bf1
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodInstance.java
@@ -0,0 +1,83 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+public final class CompositeMethodInstance
+{
+    private final InvocationHandler invoker;
+    private final FragmentInvocationHandler mixinInvoker;
+    private final Method method;
+    private final int methodIdx;
+
+    private CompositeMethodInstance next;
+
+    public CompositeMethodInstance( InvocationHandler invoker,
+                                    FragmentInvocationHandler mixinInvoker,
+                                    Method method, int methodIdx
+    )
+    {
+        this.invoker = invoker;
+        this.method = method;
+        this.mixinInvoker = mixinInvoker;
+        this.methodIdx = methodIdx;
+    }
+
+    public Method method()
+    {
+        return method;
+    }
+
+    public Object getMixinFrom( Object[] mixins )
+    {
+        return mixins[ methodIdx ];
+    }
+
+    public Object invoke( Object composite, Object[] params, Object mixin )
+        throws Throwable
+    {
+        mixinInvoker.setFragment( mixin );
+
+        try
+        {
+            return invoker.invoke( composite, method, params );
+        }
+        finally
+        {
+            mixinInvoker.setFragment( null );
+        }
+    }
+
+    public CompositeMethodInstance getNext()
+    {
+        return next;
+    }
+
+    public void setNext( CompositeMethodInstance next )
+    {
+        this.next = next;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodModel.java
new file mode 100644
index 0000000..267c065
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodModel.java
@@ -0,0 +1,324 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Array;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.MethodDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.NullArgumentException;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+
+/**
+ * JAVADOC
+ */
+public final class CompositeMethodModel
+    implements MethodDescriptor, Dependencies, VisitableHierarchy<Object, Object>
+{
+    // Model
+    private final Method method;
+    private Method invocationMethod; // This will be the _ prefixed method on typed mixins
+    private final ConstraintsModel constraints;
+    private final ConcernsModel concerns;
+    private final SideEffectsModel sideEffects;
+    private final MixinsModel mixins;
+    private AnnotatedElement annotations;
+
+    // Context
+//    private final SynchronizedCompositeMethodInstancePool instancePool = new SynchronizedCompositeMethodInstancePool();
+    private final AtomicInstancePool instancePool = new AtomicInstancePool();
+    private final ConstraintsInstance constraintsInstance;
+
+    public CompositeMethodModel( Method method,
+                                 ConstraintsModel constraintsModel,
+                                 ConcernsModel concernsModel,
+                                 SideEffectsModel sideEffectsModel,
+                                 MixinsModel mixinsModel
+    )
+    {
+        this.method = method;
+        mixins = mixinsModel;
+        concerns = concernsModel;
+        sideEffects = sideEffectsModel;
+        constraints = constraintsModel;
+        constraintsInstance = constraints.newInstance();
+        initialize();
+    }
+
+    private void initialize()
+    {
+        annotations = new CompositeMethodAnnotatedElement();
+        this.method.setAccessible( true );
+//        instancePool = new SynchronizedCompositeMethodInstancePool();
+    }
+
+    // Model
+
+    @Override
+    public Method method()
+    {
+        return method;
+    }
+
+    public MixinModel mixin()
+    {
+        return mixins.mixinFor( method );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public Stream<DependencyModel> dependencies()
+    {
+        return Stream.of( this.concerns, sideEffects ).filter( Objects::nonNull ).flatMap( Dependencies::dependencies );
+    }
+
+    // Context
+    public Object invoke( Object composite, Object[] params, MixinsInstance mixins, ModuleDescriptor module )
+        throws Throwable
+    {
+        constraintsInstance.checkValid( composite, method, params );
+
+        CompositeMethodInstance methodInstance = getInstance( module );
+        try
+        {
+            return mixins.invoke( composite, params, methodInstance );
+        }
+        finally
+        {
+            instancePool.releaseInstance( methodInstance );
+        }
+    }
+
+    private CompositeMethodInstance getInstance( ModuleDescriptor module )
+    {
+        CompositeMethodInstance methodInstance = instancePool.obtainInstance();
+        if( methodInstance == null )
+        {
+            methodInstance = newCompositeMethodInstance( module );
+        }
+
+        return methodInstance;
+    }
+
+    private CompositeMethodInstance newCompositeMethodInstance( ModuleDescriptor module )
+        throws ConstructionException
+    {
+        FragmentInvocationHandler mixinInvocationHandler = mixins.newInvocationHandler( method );
+        InvocationHandler invoker = mixinInvocationHandler;
+        if( concerns != ConcernsModel.EMPTY_CONCERNS )
+        {
+            ConcernsInstance concernsInstance = concerns.newInstance( method, module, mixinInvocationHandler );
+            invoker = concernsInstance;
+        }
+        if( sideEffects != SideEffectsModel.EMPTY_SIDEEFFECTS )
+        {
+            SideEffectsInstance sideEffectsInstance = sideEffects.newInstance( method, module, invoker );
+            invoker = sideEffectsInstance;
+        }
+
+        if( invocationMethod == null )
+        {
+            MixinModel model = mixins.mixinFor( method );
+            if( !InvocationHandler.class.isAssignableFrom( model.mixinClass() ) )
+            {
+                try
+                {
+                    invocationMethod = model.instantiationClass()
+                        .getMethod( "_" + method.getName(), method.getParameterTypes() );
+                }
+                catch( NoSuchMethodException e )
+                {
+                    invocationMethod = method;
+//                    throw new ConstructionException( "Could not find the subclass method", e );
+                }
+            }
+            else
+            {
+                invocationMethod = method;
+            }
+        }
+
+        mixinInvocationHandler.setMethod( invocationMethod );
+
+        return new CompositeMethodInstance( invoker, mixinInvocationHandler, method, mixins.methodIndex.get( method ) );
+    }
+
+    public AnnotatedElement annotatedElement()
+    {
+        return annotations;
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            constraints.accept( modelVisitor );
+            concerns.accept( modelVisitor );
+            sideEffects.accept( modelVisitor );
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    @Override
+    public String toString()
+    {
+        return method.toGenericString();
+    }
+
+    public Iterable<Method> invocationsFor( Class<?> mixinClass )
+    {
+        return mixins.invocationsFor( mixinClass ).collect( Collectors.toList() );
+    }
+
+    public class CompositeMethodAnnotatedElement
+        implements AnnotatedElement
+    {
+        @Override
+        public boolean isAnnotationPresent( Class<? extends Annotation> annotationClass )
+        {
+            // Check method
+            if( method.isAnnotationPresent( annotationClass ) )
+            {
+                return true;
+            }
+
+            // Check mixin
+            try
+            {
+                MixinModel model = mixins.mixinFor( method );
+                if( Genericpredicate.INSTANCE.test( model.mixinClass() ) )
+                {
+                    return false;
+                }
+                return ( model.mixinClass()
+                             .getMethod( method.getName(), method.getParameterTypes() )
+                             .isAnnotationPresent( annotationClass ) );
+            }
+            catch( NoSuchMethodException e )
+            {
+                return false;
+            }
+        }
+
+        @Override
+        public <T extends Annotation> T getAnnotation( Class<T> annotationClass )
+        {
+            // Check mixin
+            try
+            {
+                MixinModel model = mixins.mixinFor( method );
+                if( !Genericpredicate.INSTANCE.test( model.mixinClass() ) )
+                {
+                    T annotation = annotationClass.cast( model.mixinClass()
+                                                             .getMethod( method.getName(), method.getParameterTypes() )
+                                                             .getAnnotation( annotationClass ) );
+                    if( annotation != null )
+                    {
+                        return annotation;
+                    }
+                }
+            }
+            catch( NoSuchMethodException e )
+            {
+                // Ignore
+            }
+
+            // Check method
+            return method.getAnnotation( annotationClass );
+        }
+
+        @Override
+        public Annotation[] getAnnotations()
+        {
+            // Add mixin annotations
+            List<Annotation> annotations = new ArrayList<Annotation>();
+            MixinModel model = mixins.mixinFor( method );
+            Annotation[] mixinAnnotations = new Annotation[ 0 ];
+            if( !Genericpredicate.INSTANCE.test( model.mixinClass() ) )
+            {
+                mixinAnnotations = model.mixinClass().getAnnotations();
+                annotations.addAll( Arrays.asList( mixinAnnotations ) );
+            }
+
+            // Add method annotations, but don't include duplicates
+            Annotation[] methodAnnotations = method.getAnnotations();
+            next:
+            for( Annotation methodAnnotation : methodAnnotations )
+            {
+                for( int i = 0; i < mixinAnnotations.length; i++ )
+                {
+                    if( annotations.get( i ).annotationType().equals( methodAnnotation.annotationType() ) )
+                    {
+                        continue next;
+                    }
+                }
+
+                annotations.add( methodAnnotation );
+            }
+
+            return annotations.toArray( new Annotation[ annotations.size() ] );
+        }
+
+        @Override
+        public Annotation[] getDeclaredAnnotations()
+        {
+            return new Annotation[ 0 ];
+        }
+
+        // @Override (Since JDK 8)
+        @SuppressWarnings( "unchecked" )
+        public <T extends Annotation> T[] getAnnotationsByType( Class<T> annotationClass )
+        {
+            NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+            return (T[]) Array.newInstance( annotationClass, 0 );
+        }
+
+        // @Override (Since JDK 8)
+        public <T extends Annotation> T getDeclaredAnnotation( Class<T> annotationClass )
+        {
+            NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+            return null;
+        }
+
+        // @Override (Since JDK 8)
+        @SuppressWarnings( "unchecked" )
+        public <T extends Annotation> T[] getDeclaredAnnotationsByType( Class<T> annotationClass )
+        {
+            NullArgumentException.validateNotNull( "annotationClass", annotationClass );
+            return (T[]) Array.newInstance( annotationClass, 0 );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodsModel.java
new file mode 100644
index 0000000..8dc2495
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeMethodsModel.java
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.MissingMethodException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+
+/**
+ * Model for Composite methods. This includes both private and public methods.
+ */
+public final class CompositeMethodsModel
+    implements VisitableHierarchy<Object, Object>, Dependencies
+{
+    private final LinkedHashMap<Method, CompositeMethodModel> methods;
+    private final MixinsModel mixinsModel;
+
+    public CompositeMethodsModel( MixinsModel mixinsModel )
+    {
+        methods = new LinkedHashMap<>();
+        this.mixinsModel = mixinsModel;
+    }
+
+    public Stream<DependencyModel> dependencies()
+    {
+        Collection<CompositeMethodModel> compositeMethods = methods.values();
+        return compositeMethods.stream().flatMap( Dependencies.DEPENDENCIES_FUNCTION );
+    }
+
+    // Context
+    public Object invoke( MixinsInstance mixins,
+                          Object proxy,
+                          Method method,
+                          Object[] args,
+                          ModuleDescriptor moduleInstance
+    )
+        throws Throwable
+    {
+        CompositeMethodModel compositeMethod = methods.get( method );
+
+        if( compositeMethod == null )
+        {
+            if( method.getDeclaringClass().equals( Object.class ) )
+            {
+                return mixins.invokeObject( proxy, args, method );
+            }
+
+            // TODO: Figure out what was the intention of this code block, added by Rickard in 2009. It doesn't do anything useful.
+            if( !method.getDeclaringClass().isInterface() )
+            {
+                compositeMethod = mixinsModel.mixinTypes().map( aClass -> {
+                    try
+                    {
+                        Method realMethod = aClass.getMethod( method.getName(), method.getParameterTypes() );
+                        return methods.get( realMethod );
+                    }
+                    catch( NoSuchMethodException | SecurityException e )
+                    {
+
+                    }
+                    return null;
+                }).filter( model -> model != null ).findFirst().orElse( null );
+            }
+            throw new MissingMethodException( "Method '" + method + "' is not implemented" );
+        }
+        else
+        {
+            return compositeMethod.invoke( proxy, args, mixins, moduleInstance );
+        }
+    }
+
+    public void addMethod( CompositeMethodModel methodModel )
+    {
+        methods.put( methodModel.method(), methodModel );
+    }
+
+    public boolean isImplemented( Method method )
+    {
+        return methods.containsKey( method );
+    }
+
+    public Iterable<Method> methods()
+    {
+        return methods.keySet();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( CompositeMethodModel compositeMethodModel : methods.values() )
+            {
+                if( !compositeMethodModel.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    @Override
+    public String toString()
+    {
+        return methods().toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
new file mode 100644
index 0000000..2f1e81d
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
@@ -0,0 +1,278 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+
+import static java.lang.reflect.Proxy.newProxyInstance;
+
+/**
+ * JAVADOC
+ */
+public abstract class CompositeModel
+    implements VisitableHierarchy<Object, Object>, Dependencies, CompositeDescriptor
+{
+    protected final MixinsModel mixinsModel;
+    protected final CompositeMethodsModel compositeMethodsModel;
+    private final Set<Class<?>> types;
+    private final Visibility visibility;
+    private final MetaInfo metaInfo;
+    protected final StateModel stateModel;
+    private volatile Class<?> primaryType;
+    protected Class<? extends Composite> proxyClass;
+    protected Constructor<? extends Composite> proxyConstructor;
+    protected ModuleDescriptor module;
+
+    protected CompositeModel( final ModuleDescriptor module,
+                              final List<Class<?>> types,
+                              final Visibility visibility,
+                              final MetaInfo metaInfo,
+                              final MixinsModel mixinsModel,
+                              final StateModel stateModel,
+                              final CompositeMethodsModel compositeMethodsModel
+    )
+    {
+        this.module = module;
+        this.types = new LinkedHashSet<>( types );
+        this.visibility = visibility;
+        this.metaInfo = metaInfo;
+        this.stateModel = stateModel;
+        this.compositeMethodsModel = compositeMethodsModel;
+        this.mixinsModel = mixinsModel;
+
+        // Create proxy class
+        createProxyClass();
+        primaryType = mixinTypes()
+            .reduce( null, ( primary, type ) ->
+            {
+                if( primary == null )
+                {
+                    return type;
+                }
+                else if( primary.isAssignableFrom( type ) )
+                {
+                    return type;
+                }
+                return primary;
+            } );
+    }
+
+    // Model
+    @Override
+    public Stream<Class<?>> types()
+    {
+        return types.stream();
+    }
+
+    public StateModel state()
+    {
+        return stateModel;
+    }
+
+    @Override
+    public <T> T metaInfo( Class<T> infoType )
+    {
+        return metaInfo.get( infoType );
+    }
+
+    @Override
+    public Visibility visibility()
+    {
+        return visibility;
+    }
+
+    @Override
+    public boolean isAssignableTo( Class<?> type )
+    {
+        for( Class<?> aClass : types )
+        {
+            if( type.isAssignableFrom( aClass ) )
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public MixinsModel mixinsModel()
+    {
+        return mixinsModel;
+    }
+
+    @Override
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public Class<?> primaryType()
+    {
+        return primaryType;
+    }
+
+    @Override
+    public Stream<Class<?>> mixinTypes()
+    {
+        return mixinsModel.mixinTypes();
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        Stream<Dependencies> models = Stream.of( this.mixinsModel, compositeMethodsModel );
+        return models.flatMap( Dependencies::dependencies );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( compositeMethodsModel.accept( visitor ) )
+            {
+                if( stateModel.accept( visitor ) )
+                {
+                    mixinsModel.accept( visitor );
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    private void createProxyClass()
+    {
+        Class<?> mainType = types.stream().findFirst().get();
+        if( mainType.isInterface() )
+        {
+            ClassLoader proxyClassloader = mainType.getClassLoader();
+
+            Class<?>[] interfaces = types.stream().map( Class.class::cast ).toArray( Class[]::new );
+            proxyClass = (Class<? extends Composite>) ProxyGenerator.createProxyClass( proxyClassloader, interfaces );
+
+            try
+            {
+                proxyConstructor = proxyClass.getConstructor( InvocationHandler.class );
+            }
+            catch( NoSuchMethodException e )
+            {
+                throw (InvalidCompositeException) new InvalidCompositeException( "Could not get proxy constructor" ).initCause( e );
+            }
+            proxyConstructor.setAccessible( true );
+        }
+        else
+        {
+            try
+            {
+                proxyClass = new TransientClassLoader( getClass().getClassLoader() ).loadFragmentClass( mainType );
+                proxyConstructor = (Constructor<? extends Composite>) proxyClass.getConstructors()[ 0 ];
+            }
+            catch( ClassNotFoundException e )
+            {
+                throw (InvalidCompositeException) new InvalidCompositeException( "Could not get proxy constructor" ).initCause( e );
+            }
+        }
+    }
+
+    // Context
+    public final Object invoke( MixinsInstance mixins,
+                                Object proxy,
+                                Method method,
+                                Object[] args
+    )
+        throws Throwable
+    {
+        return compositeMethodsModel.invoke( mixins, proxy, method, args, module );
+    }
+
+    @Override
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    public Composite newProxy( InvocationHandler invocationHandler )
+        throws ConstructionException
+    {
+        Class<?> mainType = types.stream().findFirst().get();
+        if( mainType.isInterface() )
+        {
+            try
+            {
+                return Composite.class.cast( proxyConstructor.newInstance( invocationHandler ) );
+            }
+            catch( Exception e )
+            {
+                throw new ConstructionException( e );
+            }
+        }
+        else
+        {
+            try
+            {
+                Object[] args = new Object[ proxyConstructor.getParameterTypes().length ];
+                Composite composite = Composite.class.cast( proxyConstructor.newInstance( args ) );
+                proxyClass.getField( "_instance" ).set( composite, invocationHandler );
+                return composite;
+            }
+            catch( Exception e )
+            {
+                throw new ConstructionException( e );
+            }
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    public <T> T newProxy( InvocationHandler invocationHandler, Class<T> mixinType )
+        throws IllegalArgumentException
+    {
+
+//        if (!matchesAny( isAssignableFrom( mixinType ), types ))
+        if( !mixinsModel.isImplemented( mixinType ) )
+        {
+            String message = "Composite " + primaryType().getName() + " does not implement type " + mixinType.getName();
+            throw new IllegalArgumentException( message );
+        }
+
+        // Instantiate proxy for given mixin interface
+        return mixinType.cast( newProxyInstance( mixinType.getClassLoader(), new Class[]{ mixinType }, invocationHandler ) );
+    }
+
+    @Override
+    public String toString()
+    {
+        return types.toString();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernModel.java
new file mode 100644
index 0000000..b583aaf
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernModel.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import org.apache.polygene.api.concern.ConcernDescriptor;
+
+/**
+ * JAVADOC
+ */
+public final class ConcernModel extends AbstractModifierModel
+    implements ConcernDescriptor
+{
+    public ConcernModel( Class concernClass, Class instantiationClass )
+    {
+        super( concernClass, instantiationClass );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsInstance.java
new file mode 100644
index 0000000..da2fe20
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsInstance.java
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * JAVADOC
+ */
+public final class ConcernsInstance
+    implements InvocationHandler
+{
+    private final InvocationHandler firstConcern;
+    private final FragmentInvocationHandler mixinInvocationHandler;
+    private final ProxyReferenceInvocationHandler proxyHandler;
+
+    public ConcernsInstance( InvocationHandler firstConcern,
+                             FragmentInvocationHandler mixinInvocationHandler,
+                             ProxyReferenceInvocationHandler proxyHandler
+    )
+    {
+        this.firstConcern = firstConcern;
+        this.mixinInvocationHandler = mixinInvocationHandler;
+        this.proxyHandler = proxyHandler;
+    }
+
+    public boolean isEmpty()
+    {
+        return firstConcern == mixinInvocationHandler;
+    }
+
+    @Override
+    public Object invoke( Object proxy, Method method, Object[] params )
+        throws Throwable
+    {
+        proxyHandler.setProxy( proxy );
+        try
+        {
+            return firstConcern.invoke( proxy, method, params );
+        }
+        catch( InvocationTargetException e )
+        {
+            throw e.getTargetException();
+        }
+        finally
+        {
+            proxyHandler.clearProxy();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsModel.java
new file mode 100644
index 0000000..aa8d3ce
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConcernsModel.java
@@ -0,0 +1,89 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.concern.ConcernsDescriptor;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+
+/**
+ * JAVADOC
+ */
+public final class ConcernsModel
+    implements ConcernsDescriptor, Dependencies, VisitableHierarchy<Object, Object>
+{
+    public static final ConcernsModel EMPTY_CONCERNS = new ConcernsModel( Collections.<ConcernModel>emptyList() );
+
+    private List<ConcernModel> concernsFor;
+
+    public ConcernsModel( List<ConcernModel> concernsFor )
+    {
+        this.concernsFor = concernsFor;
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return concernsFor.stream().flatMap( ConcernModel::dependencies );
+    }
+
+    // Context
+    public ConcernsInstance newInstance( Method method, ModuleDescriptor module,
+                                         FragmentInvocationHandler mixinInvocationHandler
+    )
+    {
+        ProxyReferenceInvocationHandler proxyHandler = new ProxyReferenceInvocationHandler();
+        InvocationHandler nextConcern = mixinInvocationHandler;
+        for( int i = concernsFor.size() - 1; i >= 0; i-- )
+        {
+            ConcernModel concernModel = concernsFor.get( i );
+
+            nextConcern = concernModel.newInstance( module, nextConcern, proxyHandler, method );
+        }
+
+        return new ConcernsInstance( nextConcern, mixinInvocationHandler, proxyHandler );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( ConcernModel concernModel : concernsFor )
+            {
+                if( !concernModel.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintDeclaration.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintDeclaration.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintDeclaration.java
new file mode 100644
index 0000000..9826681
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintDeclaration.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import org.apache.polygene.api.constraint.Constraint;
+import org.apache.polygene.api.util.Classes;
+
+/**
+ * JAVADOC
+ */
+public final class ConstraintDeclaration
+{
+    private final Class<? extends Constraint<?, ?>> constraintClass;
+    @SuppressWarnings( "raw" )
+    private final Class constraintAnnotationType;
+    private final Type constraintValueType;
+
+    @SuppressWarnings( "unchecked" )
+    public ConstraintDeclaration( Class<? extends Constraint<?, ?>> constraintClass )
+    {
+        this.constraintClass = constraintClass;
+
+        constraintAnnotationType = (Class<? extends Annotation>) ( (ParameterizedType) constraintClass.getGenericInterfaces()[ 0 ] )
+            .getActualTypeArguments()[ 0 ];
+        constraintValueType = ( (ParameterizedType) constraintClass.getGenericInterfaces()[ 0 ] ).getActualTypeArguments()[ 1 ];
+    }
+
+    public Class<? extends Constraint<?, ?>> constraintClass()
+    {
+        return constraintClass;
+    }
+
+    @SuppressWarnings( {"raw", "unchecked"} )
+    public boolean appliesTo( Class annotationType, Type valueType )
+    {
+        if( constraintValueType instanceof Class )
+        {
+            Class constraintValueClass = (Class) constraintValueType;
+            Class valueClass = Classes.RAW_CLASS.apply( valueType );
+            return constraintAnnotationType.equals( annotationType ) && constraintValueClass.isAssignableFrom( valueClass );
+        }
+        else if( constraintValueType instanceof ParameterizedType )
+        {
+            // TODO Handle nested generics
+            Class constraintValueClass = Classes.RAW_CLASS.apply( constraintValueType );
+            Class valueClass = Classes.RAW_CLASS.apply( valueType );
+            return constraintAnnotationType.equals( annotationType ) && constraintValueClass.isAssignableFrom( valueClass );
+        }
+        else
+        {
+            return false; // TODO Handles more cases. What are they?
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintInstance.java
new file mode 100644
index 0000000..40645f9
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintInstance.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import org.apache.polygene.api.constraint.Constraint;
+
+/**
+ * JAVADOC
+ */
+public final class ConstraintInstance<A extends Annotation, T>
+{
+    private final Constraint<A, T> constraint;
+    private final A annotation;
+
+    public ConstraintInstance( Constraint<A, T> constraint, A annotation )
+    {
+        this.constraint = constraint;
+        this.annotation = annotation;
+    }
+
+    public A annotation()
+    {
+        return annotation;
+    }
+
+    public boolean isValid( T value )
+    {
+        return constraint.isValid( annotation, value );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintModel.java
new file mode 100644
index 0000000..1452eeb
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintModel.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.constraint.Constraint;
+
+/**
+ * JAVADOC
+ */
+public final class ConstraintModel
+    extends AbstractConstraintModel
+{
+    private final Class<? extends Constraint<?, ?>> constraintClass;
+
+    public ConstraintModel( Annotation annotation, Class<? extends Constraint<?, ?>> constraintClass )
+    {
+        super( annotation );
+        this.constraintClass = constraintClass;
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public ConstraintInstance<?, ?> newInstance()
+    {
+        try
+        {
+            Constraint<?, ?> constraint = constraintClass.newInstance();
+            return new ConstraintInstance( constraint, annotation );
+        }
+        catch( Exception e )
+        {
+            throw new ConstructionException( "Could not instantiate constraint implementation", e );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsCheck.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsCheck.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsCheck.java
new file mode 100644
index 0000000..1f72dc3
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsCheck.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+
+/**
+ * Call this to perform a value constraint check
+ */
+public interface ConstraintsCheck
+{
+    public void checkConstraints( Object value )
+        throws ConstraintViolationException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsInstance.java
new file mode 100644
index 0000000..23e8f98
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsInstance.java
@@ -0,0 +1,84 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.Composite;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.constraint.ConstraintViolation;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+
+/**
+ * JAVADOC
+ */
+public final class ConstraintsInstance
+{
+    private final List<ValueConstraintsInstance> valueConstraintsInstances;
+
+    public ConstraintsInstance( List<ValueConstraintsInstance> parameterConstraints )
+    {
+        valueConstraintsInstances = parameterConstraints;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    public void checkValid( Object instance, Method method, Object[] params )
+        throws ConstraintViolationException
+    {
+        if( valueConstraintsInstances.isEmpty() )
+        {
+            return; // No constraints to check
+        }
+
+        // Check constraints
+        List<ConstraintViolation> violations = null;
+        for( int i = 0; i < params.length; i++ )
+        {
+            Object param = params[ i ];
+            List<ConstraintViolation> paramViolations = valueConstraintsInstances.get( i ).checkConstraints( param );
+            if( !paramViolations.isEmpty() )
+            {
+                if( violations == null )
+                {
+                    violations = new ArrayList<>();
+                }
+                violations.addAll( paramViolations );
+            }
+        }
+
+        // Check if any constraint failed
+        if( violations != null )
+        {
+            if( instance instanceof Composite )
+            {
+                throw new ConstraintViolationException( (Composite) instance, method, violations );
+            }
+            if( instance instanceof CompositeInstance )
+            {
+                throw new ConstraintViolationException( ( (CompositeInstance) instance ).proxy(), method, violations );
+            }
+            Stream<Class<?>> types = Stream.of( instance.getClass() );
+            throw new ConstraintViolationException( instance.toString(), types, method, violations );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsModel.java
new file mode 100644
index 0000000..542217e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstraintsModel.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.polygene.api.constraint.ConstraintsDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public final class ConstraintsModel
+    implements ConstraintsDescriptor, VisitableHierarchy<Object, Object>
+{
+    private List<ValueConstraintsModel> parameterConstraintModels;
+
+    private static ConstraintsInstance EMPTY_CONSTRAINTS = new ConstraintsInstance( Collections.<ValueConstraintsInstance>emptyList() );
+
+    public ConstraintsModel( List<ValueConstraintsModel> parameterConstraintModels )
+    {
+        this.parameterConstraintModels = parameterConstraintModels;
+    }
+
+    public ConstraintsInstance newInstance()
+    {
+        if( parameterConstraintModels.isEmpty() )
+        {
+            return EMPTY_CONSTRAINTS;
+        }
+        else
+        {
+            List<ValueConstraintsInstance> parameterConstraintsInstances = new ArrayList<ValueConstraintsInstance>( parameterConstraintModels
+                                                                                                                        .size() );
+            for( ValueConstraintsModel parameterConstraintModel : parameterConstraintModels )
+            {
+                parameterConstraintsInstances.add( parameterConstraintModel.newInstance() );
+            }
+            return new ConstraintsInstance( parameterConstraintsInstances );
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            if( parameterConstraintModels != null )
+            {
+                for( ValueConstraintsModel parameterConstraintModel : parameterConstraintModels )
+                {
+                    if( !parameterConstraintModel.accept( modelVisitor ) )
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorModel.java
new file mode 100644
index 0000000..3df1ad5
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorModel.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.ConstructorDescriptor;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectedParametersModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+
+/**
+ * JAVADOC
+ */
+public final class ConstructorModel
+    implements ConstructorDescriptor, VisitableHierarchy<Object, Object>
+{
+    private Constructor<?> constructor;
+
+    private InjectedParametersModel parameters;
+
+    public ConstructorModel( Constructor<?> constructor, InjectedParametersModel parameters )
+    {
+        this.constructor = constructor;
+        this.parameters = parameters;
+        this.constructor.setAccessible( true );
+    }
+
+    @Override
+    public Constructor<?> constructor()
+    {
+        return constructor;
+    }
+
+    public Stream<DependencyModel> dependencies()
+    {
+        return parameters.dependencies();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            parameters.accept( modelVisitor );
+        }
+
+        return modelVisitor.visitLeave( this );
+    }
+
+    // Context
+
+    public Object newInstance( InjectionContext context )
+        throws ConstructionException
+    {
+        // Create parameters
+        Object[] parametersInstance = parameters.newParametersInstance( context );
+        // Invoke constructor
+        try
+        {
+            return constructor.newInstance( parametersInstance );
+        }
+        catch( InvocationTargetException e )
+        {
+            Throwable targetException = e.getTargetException();
+            if( targetException instanceof InvalidCompositeException )
+            {
+                throw (InvalidCompositeException) targetException;
+            }
+            String message = "Could not instantiate \n    " + constructor.getDeclaringClass() + "\nusing constructor:\n    " + constructor
+                .toGenericString();
+            throw new ConstructionException( message, targetException );
+        }
+        catch( Throwable e )
+        {
+            System.err.println( constructor.toGenericString() );
+            System.err.println( Arrays.asList( parametersInstance ) );
+            throw new ConstructionException( "Could not instantiate " + constructor.getDeclaringClass(), e );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return constructor.toGenericString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
new file mode 100644
index 0000000..bc4be4a
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
@@ -0,0 +1,298 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.composite;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.composite.CompositeDescriptor;
+import org.apache.polygene.api.composite.InvalidCompositeException;
+import org.apache.polygene.api.injection.InjectionScope;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.injection.Dependencies;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectedParametersModel;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.ParameterizedTypeInstance;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+
+import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
+
+/**
+ * JAVADOC
+ */
+public final class ConstructorsModel
+    implements Binder, Dependencies, VisitableHierarchy<Object, Object>
+{
+    @SuppressWarnings( "raw" )
+    private final Class<?> fragmentClass;
+    private final List<ConstructorModel> constructorModels;
+    private List<ConstructorModel> boundConstructors;
+
+    @SuppressWarnings( { "raw", "unchecked" } )
+    public ConstructorsModel( Class<?> fragmentClass )
+    {
+        this.fragmentClass = fragmentClass;
+        validate( fragmentClass );
+        constructorModels = new ArrayList<>();
+        Constructor<?>[] realConstructors = this.fragmentClass.getDeclaredConstructors();
+        Class<?> injectionClass = FragmentClassLoader.getSourceClass( fragmentClass );
+        for( Constructor<?> constructor : realConstructors )
+        {
+            constructor.setAccessible( true );
+            try
+            {
+                Constructor<?> injectionConstructor = injectionClass.getDeclaredConstructor( constructor.getParameterTypes() );
+                injectionConstructor.setAccessible( true );
+                ConstructorModel constructorModel = newConstructorModel( this.fragmentClass, constructor,
+                                                                         injectionConstructor );
+                if( constructorModel != null )
+                {
+                    constructorModels.add( constructorModel );
+                }
+            }
+            catch( NoSuchMethodException e )
+            {
+                // Ignore and continue
+                e.printStackTrace();
+            }
+        }
+    }
+
+    @SuppressWarnings( "raw" )
+    private void validate( Class<?> fragmentClass )
+    {
+        // Ensure that the fragment class is not an inner class, in which case we should give a reasonable exception
+        if( fragmentClass.getDeclaringClass() == null )
+        {
+            return;
+        }
+        if( Modifier.isStatic( fragmentClass.getModifiers() ) )
+        {
+            return;
+        }
+        throw new InvalidCompositeException( "Inner classes can not be used. Use static nested classes instead: " + fragmentClass );
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        if( boundConstructors == null )
+        {
+            return constructorModels.stream().flatMap( ConstructorModel::dependencies );
+        }
+        return boundConstructors.stream().flatMap( ConstructorModel::dependencies );
+    }
+
+    @SuppressWarnings( "raw" )
+    private ConstructorModel newConstructorModel( Class<?> fragmentClass,
+                                                  Constructor<?> realConstructor,
+                                                  Constructor<?> injectedConstructor
+    )
+    {
+        int idx = 0;
+        InjectedParametersModel parameters = new InjectedParametersModel();
+        Annotation[][] parameterAnnotations = injectedConstructor.getParameterAnnotations();
+        for( Type type : injectedConstructor.getGenericParameterTypes() )
+        {
+            Annotation injectionAnnotation = Stream.of( parameterAnnotations[ idx ] )
+                                                   .filter( typeHasAnnotation( InjectionScope.class ) )
+                                                   .findFirst().orElse( null );
+
+            if( injectionAnnotation == null )
+            {
+                if( fragmentClass.getSuperclass().isMemberClass() )
+                {
+                    injectionAnnotation = new Uses()
+                    {
+                        @Override
+                        public Class<? extends Annotation> annotationType()
+                        {
+                            return Uses.class;
+                        }
+                    };
+                }
+                else
+                {
+                    return null; // invalid constructor parameter
+                }
+            }
+
+            boolean optional = DependencyModel.isOptional( injectionAnnotation, parameterAnnotations[ idx ] );
+
+            Type genericType = type;
+            if( genericType instanceof ParameterizedType )
+            {
+                genericType = new ParameterizedTypeInstance( ( (ParameterizedType) genericType ).getActualTypeArguments(), ( (ParameterizedType) genericType )
+                    .getRawType(), ( (ParameterizedType) genericType ).getOwnerType() );
+
+                for( int i = 0; i < ( (ParameterizedType) genericType ).getActualTypeArguments().length; i++ )
+                {
+                    Type typeArg = ( (ParameterizedType) genericType ).getActualTypeArguments()[ i ];
+                    if( typeArg instanceof TypeVariable )
+                    {
+                        typeArg = Classes.resolveTypeVariable( (TypeVariable) typeArg, realConstructor.getDeclaringClass(), fragmentClass );
+                        ( (ParameterizedType) genericType ).getActualTypeArguments()[ i ] = typeArg;
+                    }
+                }
+            }
+
+            DependencyModel dependencyModel = new DependencyModel( injectionAnnotation, genericType, fragmentClass, optional,
+                                                                   parameterAnnotations[ idx ] );
+            parameters.addDependency( dependencyModel );
+            idx++;
+        }
+        return new ConstructorModel( realConstructor, parameters );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( boundConstructors != null )
+            {
+                for( ConstructorModel constructorModel : boundConstructors )
+                {
+                    if( !constructorModel.accept( visitor ) )
+                    {
+                        break;
+                    }
+                }
+            }
+            else
+            {
+                for( ConstructorModel constructorModel : constructorModels )
+                {
+                    if( !constructorModel.accept( visitor ) )
+                    {
+                        break;
+                    }
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    // Binding
+    @Override
+    public void bind( final Resolution resolution )
+        throws BindingException
+    {
+        boundConstructors = new ArrayList<>();
+        for( ConstructorModel constructorModel : constructorModels )
+        {
+            try
+            {
+                constructorModel.accept( new HierarchicalVisitorAdapter<Object, Object, BindingException>()
+                {
+                    @Override
+                    public boolean visit( Object visitor )
+                        throws BindingException
+                    {
+                        if( visitor instanceof Binder )
+                        {
+                            ( (Binder) visitor ).bind( resolution );
+                        }
+                        return true;
+                    }
+                } );
+                boundConstructors.add( constructorModel );
+            }
+            catch( Exception e )
+            {
+                // Ignore
+                e.printStackTrace();
+            }
+        }
+
+        if( boundConstructors.isEmpty() )
+        {
+            StringBuilder messageBuilder = new StringBuilder( "Found no constructor that could be bound: " );
+            if( resolution.model() instanceof CompositeDescriptor )
+            {
+                messageBuilder.append( fragmentClass.getName() )
+                    .append( " in " )
+                    .append( resolution.model().toString() );
+            }
+            else
+            {
+                messageBuilder.append( resolution.model().toString() );
+            }
+
+            if( messageBuilder.indexOf( "$" ) >= 0 )
+            {
+                // This could be ok if instance is created manually
+                return;
+//                messageBuilder.append( "\nInner classes can not be used." );
+            }
+            String message = messageBuilder.toString();
+            throw new BindingException( message );
+        }
+
+        // Sort based on parameter count
+        Collections.sort( boundConstructors, new Comparator<ConstructorModel>()
+        {
+            @Override
+            public int compare( ConstructorModel o1, ConstructorModel o2 )
+            {
+                Integer model2ParametersCount = o2.constructor().getParameterTypes().length;
+                int model1ParametersCount = o1.constructor().getParameterTypes().length;
+                return model2ParametersCount.compareTo( model1ParametersCount );
+            }
+        } );
+    }
+
+    public Object newInstance( InjectionContext injectionContext )
+    {
+        // Try all bound constructors, in order
+        ConstructionException exception = null;
+        for( ConstructorModel constructorModel : boundConstructors )
+        {
+            try
+            {
+                return constructorModel.newInstance( injectionContext );
+            }
+            catch( ConstructionException e )
+            {
+                exception = e;
+            }
+        }
+
+        throw exception;
+    }
+}


[10/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
new file mode 100644
index 0000000..6993b6f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
@@ -0,0 +1,117 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.entity.Lifecycle;
+import org.apache.polygene.api.entity.LifecycleException;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.runtime.composite.MixinModel;
+import org.apache.polygene.runtime.composite.MixinsModel;
+import org.apache.polygene.runtime.composite.UsesInstance;
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public final class EntityMixinsModel
+    extends MixinsModel
+{
+    List<Integer> lifecycleMixins;
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        super.bind( resolution );
+
+        // Find what mixins implement Lifecycle
+        for( int i = 0; i < mixinModels.size(); i++ )
+        {
+            MixinModel mixinModel = mixinModels.get( i );
+            if( Lifecycle.class.isAssignableFrom( mixinModel.mixinClass() ) )
+            {
+                if( lifecycleMixins == null )
+                {
+                    lifecycleMixins = new ArrayList<Integer>();
+                }
+
+                lifecycleMixins.add( i );
+            }
+        }
+    }
+
+    public Object newMixin( EntityInstance entityInstance, StateHolder state, Object[] mixins, Method method )
+    {
+        MixinModel model = methodImplementation.get( method );
+        InjectionContext injectionContext = new InjectionContext( entityInstance, UsesInstance.EMPTY_USES, state );
+        Object mixin = model.newInstance( injectionContext );
+        mixins[ methodIndex.get( method ) ] = mixin;
+        return mixin;
+    }
+
+    public void invokeLifecycle( boolean create, Object[] mixins, CompositeInstance instance, StateHolder state )
+    {
+        if( lifecycleMixins != null )
+        {
+            InjectionContext injectionContext = new InjectionContext( instance, UsesInstance.EMPTY_USES, state );
+            for( Integer lifecycleMixin : lifecycleMixins )
+            {
+                Lifecycle lifecycle = (Lifecycle) mixins[ lifecycleMixin ];
+
+                if( lifecycle == null )
+                {
+                    lifecycle = (Lifecycle) mixinModels.get( lifecycleMixin ).newInstance( injectionContext );
+                }
+
+                if( create )
+                {
+                    try
+                    {
+                        lifecycle.create();
+                    }
+                    catch( Exception ex )
+                    {
+                        String message = "Unable to invoke create lifecycle on " + lifecycle;
+                        throw new LifecycleException( message, ex );
+                    }
+                }
+                else
+                {
+                    try
+                    {
+                        lifecycle.remove();
+                    }
+                    catch( Exception ex )
+                    {
+                        String message = "Unable to invoke remove lifecycle on " + lifecycle;
+                        throw new LifecycleException( message, ex );
+                    }
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityModel.java
new file mode 100644
index 0000000..4fd073d
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityModel.java
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.common.MetaInfo;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.constraint.ConstraintViolationException;
+import org.apache.polygene.api.entity.EntityDescriptor;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.entity.Queryable;
+import org.apache.polygene.api.property.PropertyDescriptor;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.unitofwork.EntityCompositeAlreadyExistsException;
+import org.apache.polygene.api.util.Annotations;
+import org.apache.polygene.runtime.composite.CompositeMethodsModel;
+import org.apache.polygene.runtime.composite.CompositeModel;
+import org.apache.polygene.runtime.unitofwork.ModuleUnitOfWork;
+import org.apache.polygene.spi.entity.EntityState;
+import org.apache.polygene.spi.entitystore.EntityAlreadyExistsException;
+import org.apache.polygene.spi.entitystore.EntityStoreException;
+import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork;
+import org.apache.polygene.spi.module.ModuleSpi;
+
+import static org.apache.polygene.api.identity.HasIdentity.IDENTITY_METHOD;
+
+/**
+ * JAVADOC
+ */
+public final class EntityModel extends CompositeModel
+    implements EntityDescriptor
+{
+
+    private final boolean queryable;
+
+    public EntityModel( ModuleDescriptor module,
+                        List<Class<?>> types,
+                        Visibility visibility,
+                        MetaInfo info,
+                        EntityMixinsModel mixinsModel,
+                        EntityStateModel stateModel,
+                        CompositeMethodsModel compositeMethodsModel
+    )
+    {
+        super( module, types, visibility, info, mixinsModel, stateModel, compositeMethodsModel );
+
+        this.queryable = types.stream()
+            .flatMap( Annotations.ANNOTATIONS_OF )
+            .filter( Annotations.isType( Queryable.class ) )
+            .map( annot -> ( (Queryable) annot ).value() )
+            .findFirst()
+            .orElse( true );
+    }
+
+    @Override
+    public boolean queryable()
+    {
+        return queryable;
+    }
+
+    @Override
+    public EntityStateModel state()
+    {
+        return (EntityStateModel) super.state();
+    }
+
+    public EntityInstance newInstance( ModuleUnitOfWork uow, ModuleSpi moduleInstance, EntityState state )
+    {
+        return new EntityInstance( uow, this, state );
+    }
+
+    public Object[] newMixinHolder()
+    {
+        return mixinsModel.newMixinHolder();
+    }
+
+    public Object newMixin( Object[] mixins,
+                            EntityStateInstance entityState,
+                            EntityInstance entityInstance,
+                            Method method
+    )
+    {
+        return ( (EntityMixinsModel) mixinsModel ).newMixin( entityInstance, entityState, mixins, method );
+    }
+
+    public EntityState newEntityState( EntityStoreUnitOfWork store, EntityReference reference )
+        throws ConstraintViolationException, EntityStoreException
+    {
+        try
+        {
+            // New EntityState
+            EntityState entityState = store.newEntityState( reference, this );
+
+            // Set reference property
+            PropertyDescriptor persistentPropertyDescriptor = state().propertyModelFor( IDENTITY_METHOD );
+            entityState.setPropertyValue( persistentPropertyDescriptor.qualifiedName(), reference.identity() );
+
+            return entityState;
+        }
+        catch( EntityAlreadyExistsException e )
+        {
+            throw new EntityCompositeAlreadyExistsException( reference );
+        }
+        catch( EntityStoreException e )
+        {
+            throw new ConstructionException( "Could not create new entity in store", e );
+        }
+    }
+
+    public void initState( ModuleDescriptor module, EntityState entityState )
+    {
+        // Set new properties to default value
+        state().properties().forEach( propertyDescriptor -> {
+            entityState.setPropertyValue( propertyDescriptor.qualifiedName(), propertyDescriptor.initialValue( module ) );
+        } );
+
+        // Set new associations to null
+        state().associations().forEach( associationDescriptor -> {
+            entityState.setAssociationValue( associationDescriptor.qualifiedName(), null );
+        } );
+
+        // Set new many-associations to empty
+        state().manyAssociations().forEach( associationDescriptor -> {
+            entityState.manyAssociationValueOf( associationDescriptor.qualifiedName() );
+        } );
+
+        // Set new named-associations to empty
+        state().namedAssociations().forEach( associationDescriptor -> {
+            entityState.namedAssociationValueOf( associationDescriptor.qualifiedName() );
+        } );
+    }
+
+    public void invokeLifecycle( boolean create, Object[] mixins, CompositeInstance instance, StateHolder state )
+    {
+        ( (EntityMixinsModel) mixinsModel ).invokeLifecycle( create, mixins, instance, state );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityPropertyInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityPropertyInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityPropertyInstance.java
new file mode 100644
index 0000000..2f57d9e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityPropertyInstance.java
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import org.apache.polygene.runtime.property.PropertyInfo;
+import org.apache.polygene.runtime.property.PropertyInstance;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * {@code EntityPropertyInstance} represents a property whose value must be backed by an EntityState.
+ */
+public class EntityPropertyInstance<T>
+    extends PropertyInstance<T>
+{
+    private final EntityState entityState;
+
+    /**
+     * Construct an instance of {@code PropertyInstance} with the specified arguments.
+     *
+     * @param aPropertyInfo The property info. This argument must not be {@code null}.
+     * @param entityState EntityState
+     */
+    @SuppressWarnings( "unchecked" )
+    public EntityPropertyInstance( PropertyInfo aPropertyInfo, EntityState entityState )
+    {
+        super( aPropertyInfo, (T) entityState.propertyValueOf( aPropertyInfo.qualifiedName() ) );
+        this.entityState = entityState;
+    }
+
+    /**
+     * Sets this property value.
+     *
+     * @param aNewValue The new value.
+     */
+    @Override
+    public void set( T aNewValue )
+    {
+        super.set( aNewValue );
+        entityState.setPropertyValue( model.qualifiedName(), aNewValue );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateInstance.java
new file mode 100644
index 0000000..27660cc
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateInstance.java
@@ -0,0 +1,232 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.AssociationStateHolder;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.association.NamedAssociation;
+import org.apache.polygene.api.entity.EntityReference;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.runtime.association.AssociationInstance;
+import org.apache.polygene.runtime.association.AssociationModel;
+import org.apache.polygene.runtime.association.ManyAssociationInstance;
+import org.apache.polygene.runtime.association.ManyAssociationModel;
+import org.apache.polygene.runtime.association.NamedAssociationInstance;
+import org.apache.polygene.runtime.association.NamedAssociationModel;
+import org.apache.polygene.runtime.property.PropertyModel;
+import org.apache.polygene.runtime.unitofwork.BuilderEntityState;
+import org.apache.polygene.spi.entity.EntityState;
+
+/**
+ * TODO
+ */
+public final class EntityStateInstance
+    implements AssociationStateHolder
+{
+    private Map<AccessibleObject, Object> state;
+
+    private final EntityStateModel stateModel;
+    private EntityState entityState;
+    private final BiFunction<EntityReference, Type, Object> entityFunction;
+
+    public EntityStateInstance( EntityStateModel stateModel, final UnitOfWork uow, EntityState entityState )
+    {
+        this.stateModel = stateModel;
+        this.entityState = entityState;
+
+        entityFunction = ( entityReference, type ) -> uow.get( Classes.RAW_CLASS.apply( type ), entityReference.identity() );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> Property<T> propertyFor( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        Map<AccessibleObject, Object> state = state();
+
+        Property<T> property = (Property<T>) state.get( accessor );
+
+        if( property == null )
+        {
+            PropertyModel entityPropertyModel = stateModel.propertyModelFor( accessor );
+            property = new EntityPropertyInstance<>(
+                entityState instanceof BuilderEntityState
+                ? entityPropertyModel.getBuilderInfo()
+                : entityPropertyModel,
+                entityState );
+            state.put( accessor, property );
+        }
+
+        return property;
+    }
+
+    @Override
+    public Stream<Property<?>> properties()
+    {
+        return stateModel.properties().map( descriptor -> propertyFor( descriptor.accessor() ) );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> Association<T> associationFor( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        Map<AccessibleObject, Object> state = state();
+        Association<T> association = (Association<T>) state.get( accessor );
+
+        if( association == null )
+        {
+            final AssociationModel associationModel = stateModel.getAssociation( accessor );
+            association = new AssociationInstance<>(
+                entityState instanceof BuilderEntityState
+                ? associationModel.getBuilderInfo()
+                : associationModel,
+                entityFunction,
+                new Property<EntityReference>()
+                {
+                    @Override
+                    public EntityReference get()
+                    {
+                        return entityState.associationValueOf( associationModel.qualifiedName() );
+                    }
+
+                    @Override
+                    public void set( EntityReference newValue )
+                        throws IllegalArgumentException, IllegalStateException
+                    {
+                        entityState.setAssociationValue( associationModel.qualifiedName(), newValue );
+                    }
+                } );
+            state.put( accessor, association );
+        }
+
+        return association;
+    }
+
+    @Override
+    public Stream<? extends Association<?>> allAssociations()
+    {
+        return stateModel.associations().map( descriptor -> associationFor( descriptor.accessor() ) );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> ManyAssociation<T> manyAssociationFor( AccessibleObject accessor )
+    {
+        Map<AccessibleObject, Object> state = state();
+
+        ManyAssociation<T> manyAssociation = (ManyAssociation<T>) state.get( accessor );
+
+        if( manyAssociation == null )
+        {
+            ManyAssociationModel associationModel = stateModel.getManyAssociation( accessor );
+            manyAssociation = new ManyAssociationInstance<>(
+                entityState instanceof BuilderEntityState
+                ? associationModel.getBuilderInfo()
+                : associationModel,
+                entityFunction,
+                entityState.manyAssociationValueOf( associationModel.qualifiedName() ) );
+            state.put( accessor, manyAssociation );
+        }
+
+        return manyAssociation;
+    }
+
+    @Override
+    public Stream<ManyAssociation<?>> allManyAssociations()
+    {
+        return stateModel.manyAssociations().map( descriptor -> manyAssociationFor( descriptor.accessor() ) );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public <T> NamedAssociation<T> namedAssociationFor( AccessibleObject accessor )
+    {
+        Map<AccessibleObject, Object> state = state();
+
+        NamedAssociation<T> namedAssociation = (NamedAssociation<T>) state.get( accessor );
+
+        if( namedAssociation == null )
+        {
+            NamedAssociationModel associationModel = stateModel.getNamedAssociation( accessor );
+            namedAssociation = new NamedAssociationInstance<>(
+                entityState instanceof BuilderEntityState
+                ? associationModel.getBuilderInfo()
+                : associationModel,
+                entityFunction,
+                entityState.namedAssociationValueOf( associationModel.qualifiedName() ) );
+            state.put( accessor, namedAssociation );
+        }
+
+        return namedAssociation;
+    }
+
+    @Override
+    public Stream<? extends NamedAssociation<?>> allNamedAssociations()
+    {
+        return stateModel.namedAssociations().map( descriptor -> namedAssociationFor( descriptor.accessor() ) );
+    }
+
+    public void checkConstraints()
+    {
+        stateModel.properties().forEach( propertyDescriptor -> {
+            Property<Object> property = this.propertyFor( propertyDescriptor.accessor() );
+            propertyDescriptor.checkConstraints( property.get() );
+        } );
+
+        stateModel.associations().forEach( associationDescriptor -> {
+            Association<Object> association = this.associationFor( associationDescriptor.accessor() );
+            associationDescriptor.checkConstraints( association.get() );
+        } );
+
+        // TODO Should ManyAssociations and NamedAssociations be checked too?
+    }
+
+    private Map<AccessibleObject, Object> state()
+    {
+        if( state == null )
+        {
+            state = new HashMap<>();
+        }
+
+        return state;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "EntityState[" + state.entrySet().stream()
+            .map( entry -> ((Method) entry.getKey()).getName() + "=" + entry.getValue())
+            .collect( Collectors.joining("\n  ", "  ", "\n") )
+            + "]"
+            ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateModel.java
new file mode 100644
index 0000000..7601b4e
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityStateModel.java
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.entity;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.stream.Stream;
+import org.apache.polygene.api.association.AssociationDescriptor;
+import org.apache.polygene.api.association.AssociationStateDescriptor;
+import org.apache.polygene.api.common.QualifiedName;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.runtime.association.AssociationModel;
+import org.apache.polygene.runtime.association.AssociationsModel;
+import org.apache.polygene.runtime.association.ManyAssociationModel;
+import org.apache.polygene.runtime.association.ManyAssociationsModel;
+import org.apache.polygene.runtime.association.NamedAssociationModel;
+import org.apache.polygene.runtime.association.NamedAssociationsModel;
+import org.apache.polygene.runtime.composite.StateModel;
+import org.apache.polygene.runtime.property.PropertiesModel;
+
+/**
+ * Model for EntityComposite state.
+ */
+public final class EntityStateModel
+    extends StateModel
+    implements AssociationStateDescriptor
+{
+    private final AssociationsModel associationsModel;
+    private final ManyAssociationsModel manyAssociationsModel;
+    private final NamedAssociationsModel namedAssociationsModel;
+
+    public EntityStateModel( PropertiesModel propertiesModel,
+                             AssociationsModel associationsModel,
+                             ManyAssociationsModel manyAssociationsModel,
+                             NamedAssociationsModel namedAssociationsModel )
+    {
+        super( propertiesModel );
+        this.associationsModel = associationsModel;
+        this.manyAssociationsModel = manyAssociationsModel;
+        this.namedAssociationsModel = namedAssociationsModel;
+    }
+
+    public AssociationModel getAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        return associationsModel.getAssociation( accessor );
+    }
+
+    @Override
+    public AssociationDescriptor getAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        return associationsModel.getAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        return associationsModel.getAssociationByQualifiedName( name );
+    }
+
+    public ManyAssociationModel getManyAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        return manyAssociationsModel.getManyAssociation( accessor );
+    }
+
+    @Override
+    public AssociationDescriptor getManyAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        return manyAssociationsModel.getManyAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getManyAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        return manyAssociationsModel.getManyAssociationByQualifiedName( name );
+    }
+
+    public NamedAssociationModel getNamedAssociation( AccessibleObject accessor )
+        throws IllegalArgumentException
+    {
+        return namedAssociationsModel.getNamedAssociation( accessor );
+    }
+
+    @Override
+    public AssociationDescriptor getNamedAssociationByName( String name )
+        throws IllegalArgumentException
+    {
+        return namedAssociationsModel.getNamedAssociationByName( name );
+    }
+
+    @Override
+    public AssociationDescriptor getNamedAssociationByQualifiedName( QualifiedName name )
+        throws IllegalArgumentException
+    {
+        return namedAssociationsModel.getNamedAssociationByQualifiedName( name );
+    }
+
+    @Override
+    public Stream<AssociationModel> associations()
+    {
+        return associationsModel.associations();
+    }
+
+    @Override
+    public Stream<ManyAssociationModel> manyAssociations()
+    {
+        return manyAssociationsModel.manyAssociations();
+    }
+
+    @Override
+    public Stream<NamedAssociationModel> namedAssociations()
+    {
+        return namedAssociationsModel.namedAssociations();
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            if( ( (VisitableHierarchy<Object, Object>) propertiesModel ).accept( visitor ) )
+            {
+                if( ( (VisitableHierarchy<AssociationsModel, AssociationModel>) associationsModel ).accept( visitor ) )
+                {
+                    if( ( (VisitableHierarchy<ManyAssociationsModel, ManyAssociationModel>) manyAssociationsModel ).accept( visitor ) )
+                    {
+                        ( (VisitableHierarchy<NamedAssociationsModel, NamedAssociationModel>) namedAssociationsModel ).accept( visitor );
+                    }
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/Dependencies.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/Dependencies.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/Dependencies.java
new file mode 100644
index 0000000..31d8b75
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/Dependencies.java
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.util.function.Function;
+import java.util.stream.Stream;
+
+/**
+ * TODO
+ */
+public interface Dependencies
+{
+    Function<Dependencies, Stream<DependencyModel>> DEPENDENCIES_FUNCTION = Dependencies::dependencies;
+
+    Stream<DependencyModel> dependencies();
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/DependencyModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/DependencyModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/DependencyModel.java
new file mode 100644
index 0000000..0c72658
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/DependencyModel.java
@@ -0,0 +1,421 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.common.ConstructionException;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.composite.DependencyDescriptor;
+import org.apache.polygene.api.util.Visitable;
+import org.apache.polygene.api.util.Visitor;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.provider.CachingInjectionProviderDecorator;
+import org.apache.polygene.runtime.injection.provider.InjectionProviderException;
+import org.apache.polygene.runtime.injection.provider.ServiceInjectionProviderFactory;
+import org.apache.polygene.runtime.model.Binder;
+import org.apache.polygene.runtime.model.Resolution;
+
+import static org.apache.polygene.api.util.Annotations.isType;
+
+/**
+ * JAVADOC
+ * move all the extraction code to a TypeUtils class
+ */
+public final class DependencyModel
+    implements Binder, DependencyDescriptor, Visitable<DependencyModel>
+{
+    public static boolean isOptional( Annotation injectionAnnotation, Annotation[] annotations )
+    {
+        if( Stream.of( annotations ).anyMatch( isType( Optional.class ) ) )
+        {
+            return true;
+        }
+
+        Method[] methods = injectionAnnotation.annotationType().getMethods();
+        for( Method method : methods )
+        {
+            if( method.getName().equals( "optional" ) )
+            {
+                try
+                {
+                    return (Boolean) method.invoke( injectionAnnotation );
+                }
+                catch( Throwable e )
+                {
+                    return false;
+                }
+            }
+        }
+
+        return false;
+    }
+
+    // Model
+    private final Annotation injectionAnnotation;
+    private final Type injectionType;
+    private final Class<?> injectedClass;
+    private final Class<?> rawInjectionClass;
+    private final boolean optional;
+    private final Annotation[] annotations;
+
+    // Binding
+    private InjectionProvider injectionProvider;
+
+    public DependencyModel( Annotation injectionAnnotation,
+                            Type genericType,
+                            Class<?> injectedClass,
+                            boolean optional,
+                            Annotation[] annotations
+    )
+    {
+        this.injectionAnnotation = injectionAnnotation;
+        this.injectedClass = injectedClass;
+
+        this.injectionType = genericType;
+        this.optional = optional;
+        this.annotations = annotations;
+        this.rawInjectionClass = mapPrimitiveTypes( extractRawInjectionClass( injectedClass, injectionType ) );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( Visitor<? super DependencyModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        return visitor.visit( this );
+    }
+
+    private Class<?> extractRawInjectionClass( Class<?> injectedClass, final Type injectionType )
+    {
+        // Calculate raw injection type
+        if( injectionType instanceof Class )
+        {
+            return (Class<?>) injectionType;
+        }
+        else if( injectionType instanceof ParameterizedType )
+        {
+            return (Class<?>) ( (ParameterizedType) injectionType ).getRawType();
+        }
+        else if( injectionType instanceof TypeVariable )
+        {
+            return extractRawInjectionClass( injectedClass, (TypeVariable<?>) injectionType );
+        }
+        throw new IllegalArgumentException(
+            "Could not extract the rawInjectionClass of " + injectedClass + " and " + injectionType );
+    }
+
+    private Class<?> extractRawInjectionClass( Class<?> injectedClass, TypeVariable<?> injectionTypeVariable )
+    {
+        int index = 0;
+        for( TypeVariable<?> typeVariable : injectionTypeVariable.getGenericDeclaration().getTypeParameters() )
+        {
+            if( injectionTypeVariable.getName().equals( typeVariable.getName() ) )
+            {
+                return (Class<?>) getActualType( injectedClass, index );
+            }
+            index++;
+        }
+        throw new IllegalArgumentException(
+            "Could not extract the rawInjectionClass of " + injectedClass + " and " + injectionTypeVariable );
+    }
+
+    // todo continue refactoring
+
+    private Type getActualType( Class<?> injectedClass, int index )
+    {
+        // Type index found - map it to actual type
+        Type genericType = injectedClass;
+        Type type = null;
+
+        while( !Object.class.equals( genericType ) && type == null )
+        {
+            genericType = ( (Class<?>) genericType ).getGenericSuperclass();
+            if( genericType instanceof ParameterizedType )
+            {
+                type = ( (ParameterizedType) genericType ).getActualTypeArguments()[ index ];
+            }
+            else
+            {
+                Type[] genericInterfaces = ( (Class<?>) genericType ).getGenericInterfaces();
+                if( genericInterfaces.length > index )
+                {
+                    type = genericInterfaces[ index ];
+                    if( type instanceof ParameterizedType )
+                    {
+                        type = ( (ParameterizedType) type ).getActualTypeArguments()[ index ];
+                    }
+                    // TODO type may still be one of the generic interfaces???
+                }
+            }
+        }
+
+        if( type == null )
+        {
+            type = Object.class; // Generic type with no constraints so Object is fine
+        }
+
+        return type;
+    }
+
+    // FIXME This method is unused, remove it.
+    private Type extractDependencyType( Type injectionType )
+    {
+        if( injectionType instanceof ParameterizedType )
+        {
+            return ( (ParameterizedType) injectionType ).getActualTypeArguments()[ 0 ];
+        }
+        else if( injectionType instanceof TypeVariable )
+        {
+            return ( (TypeVariable) injectionType ).getBounds()[ 0 ];
+        }
+        return injectionType;
+    }
+
+    // Model
+    @Override
+    public Annotation injectionAnnotation()
+    {
+        return injectionAnnotation;
+    }
+
+    @Override
+    public Type injectionType()
+    {
+        return injectionType;
+    }
+
+    @Override
+    public Class<?> injectedClass()
+    {
+        return injectedClass;
+    }
+
+    /**
+     * Get the raw dependency type.
+     * <p>
+     * If the dependency uses generics this is the raw type,
+     * and otherwise it is the type of the field.
+     * <p>
+     * Examples:
+     * <p>
+     * {@code @Service MyService service} -&gt; MyService
+     * <p>
+     * {@code @Entity Iterable<Foo> fooList} -&gt; Iterable
+     * <p>
+     * {@code @Entity Query<Foo> fooQuery} -&gt; Query
+     *
+     * @return raw injection type.
+     */
+    @Override
+    public Class<?> rawInjectionType()
+    {
+        return rawInjectionClass;
+    }
+
+    @Override
+    public boolean optional()
+    {
+        return optional;
+    }
+
+    @Override
+    public Annotation[] annotations()
+    {
+        return annotations;
+    }
+
+    @Override
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        InjectionProviderFactory providerFactory = resolution.application().injectionProviderFactory();
+
+        try
+        {
+            injectionProvider = providerFactory.newInjectionProvider( resolution, this );
+
+            if( injectionProvider == null && !optional )
+            {
+                String message =
+                    "[Module " + resolution.module()
+                        .name() + "] Non-optional @" + rawInjectionClass.getName() + " was not bound in " + injectedClass
+                        .getName();
+                throw new ConstructionException( message );
+            }
+        }
+        catch( InvalidInjectionException e )
+        {
+            throw new BindingException( "Could not bind dependency injection", e );
+        }
+    }
+
+    // Context
+    public Object inject( InjectionContext context )
+    {
+        if( injectionProvider == null )
+        {
+            return null;
+        }
+        Object injectedValue;
+        try
+        {
+            injectedValue = injectionProvider.provideInjection( context );
+        }
+        catch( InjectionProviderException e )
+        {
+            Throwable ex = e;
+            if( ex.getCause() != null )
+            {
+                ex = ex.getCause();
+            }
+
+            String message = "[Module " + context.module().name() + "] InjectionProvider unable to resolve @" +
+                             injectionAnnotation.annotationType().getSimpleName() + " " + injectionType.toString();
+            throw new ConstructionException( message, ex );
+        }
+        if( injectedValue == null && !optional )
+        {
+            String simpleName = injectionAnnotation.annotationType().getSimpleName();
+            String message = "[Module " + context.module().name() + "] Non-optional @" +
+                             simpleName + " " + injectionType.toString() +
+                             " was null in " + injectedClass.getName();
+            if( simpleName.toLowerCase().contains( "service" )
+                && !isServiceInjectionProvider() )
+            {
+                message = message + ". Did you mean the @Service injection scope?";
+            }
+            throw new ConstructionException( message );
+        }
+        return getInjectedValue( injectedValue );
+    }
+
+    private boolean isServiceInjectionProvider()
+    {
+
+        InjectionProvider provider = this.injectionProvider;
+        if( provider instanceof CachingInjectionProviderDecorator ){
+            provider = ((CachingInjectionProviderDecorator) provider ).decoratedProvider();
+        }
+        return ServiceInjectionProviderFactory.ServiceInjectionProvider.class.isAssignableFrom( provider.getClass() );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private Object getInjectedValue( Object injectionResult )
+    {
+        if( injectionResult == null )
+        {
+            return null;
+        }
+
+        if( injectionResult instanceof Iterable )
+        {
+            if( Iterable.class.isAssignableFrom( rawInjectionClass )
+                || rawInjectionClass.isInstance( injectionResult ) )
+            {
+                return injectionResult;
+            }
+            else
+            {
+                Iterator iterator = ( (Iterable) injectionResult ).iterator();
+                return iterator.hasNext() ? iterator.next() : null;
+            }
+        }
+        else
+        {
+            if( Iterable.class.equals( injectionType ) )
+            {
+                return Collections.singleton( injectionResult );
+            }
+        }
+        return injectionResult;
+    }
+
+    private final static Class<?>[] primitiveTypeMapping = {
+        boolean.class, Boolean.class,
+        byte.class, Byte.class,
+        short.class, Short.class,
+        char.class, Character.class,
+        long.class, Long.class,
+        double.class, Double.class,
+        float.class, Float.class,
+        int.class, Integer.class,
+        };
+
+    private Class<?> mapPrimitiveTypes( Class<?> rawInjectionType )
+    {
+        if( rawInjectionType == null || !rawInjectionType.isPrimitive() )
+        {
+            return rawInjectionType;
+        }
+        for( int i = 0; i < primitiveTypeMapping.length; i += 2 )
+        {
+            if( primitiveTypeMapping[ i ].equals( rawInjectionType ) )
+            {
+                return primitiveTypeMapping[ i + 1 ];
+            }
+        }
+        return rawInjectionType;
+    }
+
+    public boolean hasScope( final Class<? extends Annotation> scope )
+    {
+        return scope == null || scope.equals( injectionAnnotation().annotationType() );
+    }
+
+    public Class<? extends Annotation> injectionAnnotationType()
+    {
+        if( injectionAnnotation == null )
+        {
+            return null;
+        }
+        return injectionAnnotation.annotationType();
+    }
+
+    @Override
+    public String toString()
+    {
+        return injectionAnnotation + " for " + injectionType + " in " + injectedClass.getName();
+    }
+
+    public static class ScopeSpecification
+        implements Predicate<DependencyModel>
+    {
+        private final Class<? extends Annotation> scope;
+
+        public ScopeSpecification( Class<? extends Annotation> scope )
+        {
+            this.scope = scope;
+        }
+
+        @Override
+        public boolean test( DependencyModel model )
+        {
+            return model.hasScope( scope );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldModel.java
new file mode 100644
index 0000000..e4fd289
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldModel.java
@@ -0,0 +1,165 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.util.Collection;
+import java.util.function.Predicate;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.DependencyDescriptor;
+import org.apache.polygene.api.composite.InjectedFieldDescriptor;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.bootstrap.BindingException;
+import org.apache.polygene.bootstrap.InjectionException;
+import org.apache.polygene.runtime.composite.TransientInstance;
+import org.apache.polygene.runtime.model.Resolution;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singleton;
+
+/**
+ * JAVADOC
+ */
+public final class InjectedFieldModel
+    implements InjectedFieldDescriptor, Dependencies, VisitableHierarchy<InjectedFieldModel, DependencyModel>
+{
+    private DependencyModel dependencyModel;
+    private Field injectedField;
+
+    public InjectedFieldModel( Field injectedField, DependencyModel dependencyModel )
+    {
+        injectedField.setAccessible( true );
+        this.injectedField = injectedField;
+        this.dependencyModel = dependencyModel;
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return Stream.of( dependencyModel );
+    }
+
+    @Override
+    public Field field()
+    {
+        return injectedField;
+    }
+
+    @Override
+    public DependencyDescriptor dependency()
+    {
+        return dependencyModel;
+    }
+
+    public void bind( Resolution resolution )
+        throws BindingException
+    {
+        dependencyModel.bind( resolution.forField( injectedField ) );
+    }
+
+    public void inject( InjectionContext context, Object instance )
+    {
+        Object value = dependencyModel.inject( context );
+        try
+        {
+            injectedField.set( instance, value );
+        }
+        catch( IllegalAccessException e )
+        {
+            throw new InjectionException( e );
+        }
+        catch( IllegalArgumentException e )
+        {
+            String valueClassName;
+            if( value == null )
+            {
+                valueClassName = "<null>";
+            }
+            else if( Proxy.isProxyClass( value.getClass() ) )
+            {
+                InvocationHandler invocationHandler = Proxy.getInvocationHandler( value );
+                if( invocationHandler instanceof TransientInstance )
+                {
+                    TransientInstance handler = (TransientInstance) invocationHandler;
+                    valueClassName = Classes.toString( handler.descriptor().types() )
+                                     + " in [" + handler.module().name() + "] of [" + handler.layer().name() + "]";
+                }
+                else
+                {
+                    valueClassName = invocationHandler.toString();
+                }
+            }
+            else
+            {
+                valueClassName = value.getClass().getName();
+            }
+            StringBuilder annotBuilder = new StringBuilder();
+            for( Annotation annot : injectedField.getAnnotations() )
+            {
+                String s = annot.toString();
+                annotBuilder.append( "@" ).append( s.substring( s.lastIndexOf( '.' ) + 1, s.length() - 2 ) );
+                annotBuilder.append( " " );
+            }
+            String annots = annotBuilder.toString();
+            String message = "Can not inject the field\n    "
+                             + injectedField.getDeclaringClass()
+                             + "\n    {\n        " + annots + "\n        "
+                             + injectedField.getType().getSimpleName() + " " + injectedField.getName()
+                             + "\n    }\nwith value \n    " + value + "\nof type\n    "
+                             + valueClassName;
+            throw new InjectionException( message, e );
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super InjectedFieldModel, ? super DependencyModel, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            visitor.visit( dependencyModel );
+        }
+        return visitor.visitLeave( this );
+    }
+
+    public Collection<DependencyModel> filter( Predicate<DependencyModel> specification )
+    {
+        if( specification.test( dependencyModel ) )
+        {
+            return singleton( dependencyModel );
+        }
+        else
+        {
+            return emptyList();
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "InjectedFieldModel{" + ", injectedField=" + injectedField + '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldsModel.java
new file mode 100644
index 0000000..54c8312
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedFieldsModel.java
@@ -0,0 +1,117 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Stream;
+import org.apache.polygene.api.injection.InjectionScope;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Fields;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
+
+/**
+ * JAVADOC
+ */
+public final class InjectedFieldsModel
+    implements Dependencies, VisitableHierarchy<Object, Object>
+{
+    private final List<InjectedFieldModel> fields = new ArrayList<>();
+
+    public InjectedFieldsModel( Class fragmentClass )
+    {
+        Fields.fieldsOf( fragmentClass ).forEach( field ->
+            Arrays.stream( field.getAnnotations() )
+                  .filter( typeHasAnnotation( InjectionScope.class ) )
+                  .filter( Objects::nonNull )
+                  .forEach( injectionAnnotation ->  addModel( fragmentClass, field, injectionAnnotation )
+            )
+        );
+    }
+
+    private void addModel( Class fragmentClass, Field field, Annotation injectionAnnotation )
+    {
+        Type genericType = field.getGenericType();
+        if( genericType instanceof ParameterizedType )
+        {
+            Type[] actualTypeArguments = ( (ParameterizedType) genericType ).getActualTypeArguments();
+            Type rawType = ( (ParameterizedType) genericType ).getRawType();
+            Type ownerType = ( (ParameterizedType) genericType ).getOwnerType();
+            genericType = new ParameterizedTypeInstance( actualTypeArguments, rawType, ownerType );
+
+            for( int i = 0; i < actualTypeArguments.length; i++ )
+            {
+                Type type = actualTypeArguments[ i ];
+                if( type instanceof TypeVariable )
+                {
+                    type = Classes.resolveTypeVariable( (TypeVariable) type, field.getDeclaringClass(), fragmentClass );
+                    actualTypeArguments[ i ] = type;
+                }
+            }
+        }
+
+        boolean optional = DependencyModel.isOptional( injectionAnnotation, field.getAnnotations() );
+        DependencyModel dependencyModel = new DependencyModel( injectionAnnotation, genericType, fragmentClass, optional, field.getAnnotations() );
+        InjectedFieldModel injectedFieldModel = new InjectedFieldModel( field, dependencyModel );
+        this.fields.add( injectedFieldModel );
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return fields.stream().flatMap( Dependencies::dependencies );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> modelVisitor )
+        throws ThrowableType
+    {
+        if( modelVisitor.visitEnter( this ) )
+        {
+            for( InjectedFieldModel field : fields )
+            {
+                if( !field.accept( modelVisitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return modelVisitor.visitLeave( this );
+    }
+
+    public void inject( InjectionContext context, Object instance )
+    {
+        for( InjectedFieldModel field : fields )
+        {
+            field.inject( context, instance );
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodModel.java
new file mode 100644
index 0000000..f1dc19b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodModel.java
@@ -0,0 +1,93 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.InjectedMethodDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+import org.apache.polygene.bootstrap.InjectionException;
+
+/**
+ * JAVADOC
+ */
+public final class InjectedMethodModel
+    implements InjectedMethodDescriptor, Dependencies, VisitableHierarchy<Object, Object>
+{
+    // Model
+    private Method method;
+    private InjectedParametersModel parameters;
+
+    public InjectedMethodModel( Method method, InjectedParametersModel parameters )
+    {
+        this.method = method;
+        this.method.setAccessible( true );
+        this.parameters = parameters;
+    }
+
+    @Override
+    public Method method()
+    {
+        return method;
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return parameters.dependencies();
+    }
+
+    // Context
+    public void inject( InjectionContext context, Object instance )
+        throws InjectionException
+    {
+        Object[] params = parameters.newParametersInstance( context );
+        try
+        {
+            if( !method.isAccessible() )
+            {
+                method.setAccessible( true );
+            }
+            method.invoke( instance, params );
+        }
+        catch( IllegalAccessException e )
+        {
+            throw new InjectionException( e );
+        }
+        catch( InvocationTargetException e )
+        {
+            throw new InjectionException( e.getTargetException() );
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            parameters.accept( visitor );
+        }
+        return visitor.visitLeave( this );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
new file mode 100644
index 0000000..388a17b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
@@ -0,0 +1,137 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Stream;
+import org.apache.polygene.api.injection.InjectionScope;
+import org.apache.polygene.api.util.Classes;
+import org.apache.polygene.api.util.Methods;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
+
+/**
+ * JAVADOC
+ */
+public final class InjectedMethodsModel
+    implements Dependencies, VisitableHierarchy<Object, Object>
+{
+    // Model
+    private final List<InjectedMethodModel> methodModels = new ArrayList<>();
+
+    public InjectedMethodsModel( Class fragmentClass )
+    {
+        Methods.methodsOf( fragmentClass ).forEach( method -> {
+            Annotation[][] parameterAnnotations = method.getParameterAnnotations();
+            if( parameterAnnotations.length > 0 )
+            {
+                InjectedParametersModel parametersModel = new InjectedParametersModel();
+                final Type[] genericParameterTypes = method.getGenericParameterTypes();
+                boolean found = true;
+                for( int i = 0; i < parameterAnnotations.length; i++ )
+                {
+                    Optional<Annotation> opt = Arrays.stream( parameterAnnotations[ i ] )
+                        .filter( typeHasAnnotation( InjectionScope.class ) )
+                        .findFirst();
+                    if( opt.isPresent() )
+                    {
+                        Annotation injectionAnnotation = opt.get();
+                        Type genericType = genericParameterTypes[ i ];
+                        if( genericType instanceof ParameterizedType )
+                        {
+                            genericType = createParameterizedTypeInstance( (ParameterizedType) genericType );
+
+                            for( int j = 0; j < ( (ParameterizedType) genericType ).getActualTypeArguments().length; j++ )
+                            {
+                                Type type = ( (ParameterizedType) genericType ).getActualTypeArguments()[ j ];
+                                if( type instanceof TypeVariable )
+                                {
+                                    type = Classes.resolveTypeVariable( (TypeVariable) type, method.getDeclaringClass(), fragmentClass );
+                                    ( (ParameterizedType) genericType ).getActualTypeArguments()[ j ] = type;
+                                }
+                            }
+                        }
+                        boolean optional = DependencyModel.isOptional( injectionAnnotation, parameterAnnotations[ i ] );
+                        DependencyModel dependencyModel = new DependencyModel( injectionAnnotation, genericType, fragmentClass, optional, parameterAnnotations[ i ] );
+                        parametersModel.addDependency( dependencyModel );
+                    }
+                    else
+                    {
+                        found = false;
+                        break;
+                    }
+                }
+                if( found )
+                {
+                    methodModels.add( new InjectedMethodModel( method, parametersModel ) );
+                }
+            }
+        } );
+    }
+
+    private Type createParameterizedTypeInstance( ParameterizedType genericType )
+    {
+        return new ParameterizedTypeInstance(
+            genericType.getActualTypeArguments(), genericType.getRawType(), genericType.getOwnerType()
+        );
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return methodModels.stream().flatMap( InjectedMethodModel::dependencies );
+    }
+
+    // Context
+    public void inject( InjectionContext context, Object instance )
+    {
+        for( InjectedMethodModel methodModel : methodModels )
+        {
+            methodModel.inject( context, instance );
+        }
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( InjectedMethodModel methodModel : methodModels )
+            {
+                if( !methodModel.accept( visitor ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedParametersModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedParametersModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedParametersModel.java
new file mode 100644
index 0000000..82ccd20
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedParametersModel.java
@@ -0,0 +1,95 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.apache.polygene.api.composite.InjectedParametersDescriptor;
+import org.apache.polygene.api.util.HierarchicalVisitor;
+import org.apache.polygene.api.util.VisitableHierarchy;
+
+/**
+ * JAVADOC
+ */
+public final class InjectedParametersModel
+    implements InjectedParametersDescriptor, Dependencies, VisitableHierarchy<Object, Object>
+{
+    private final List<DependencyModel> parameterDependencies;
+
+    public InjectedParametersModel()
+    {
+        parameterDependencies = new ArrayList<>();
+    }
+
+    @Override
+    public Stream<DependencyModel> dependencies()
+    {
+        return parameterDependencies.stream();
+    }
+
+    // Context
+    public Object[] newParametersInstance( InjectionContext context )
+    {
+        Object[] parametersInstance = new Object[ parameterDependencies.size() ];
+
+        // Inject parameterDependencies
+        for( int j = 0; j < parameterDependencies.size(); j++ )
+        {
+            DependencyModel dependencyModel = parameterDependencies.get( j );
+            Object parameter = dependencyModel.inject( context );
+            parametersInstance[ j ] = parameter;
+        }
+
+        return parametersInstance;
+    }
+
+    public void addDependency( DependencyModel dependency )
+    {
+        parameterDependencies.add( dependency );
+    }
+
+    @Override
+    public <ThrowableType extends Throwable> boolean accept( HierarchicalVisitor<? super Object, ? super Object, ThrowableType> visitor )
+        throws ThrowableType
+    {
+        if( visitor.visitEnter( this ) )
+        {
+            for( DependencyModel parameterDependency : parameterDependencies )
+            {
+                if( !visitor.visit( parameterDependency ) )
+                {
+                    break;
+                }
+            }
+        }
+        return visitor.visitLeave( this );
+    }
+
+    @Override
+    public String toString()
+    {
+        return "InjectedParametersModel{" +
+               "parameterDependencies=" + parameterDependencies +
+               '}';
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionContext.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionContext.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionContext.java
new file mode 100644
index 0000000..dd89d85
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionContext.java
@@ -0,0 +1,126 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import org.apache.polygene.api.composite.CompositeInstance;
+import org.apache.polygene.api.property.StateHolder;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.runtime.composite.ProxyReferenceInvocationHandler;
+import org.apache.polygene.runtime.composite.UsesInstance;
+
+/**
+ * JAVADOC
+ */
+public final class InjectionContext
+{
+    private final ModuleDescriptor module;
+    private CompositeInstance compositeInstance;
+    private UsesInstance uses;
+    private StateHolder state;
+    private Object next; // Only used for concerns and side-effects
+    private ProxyReferenceInvocationHandler proxyHandler;
+    private Object instance; // Only used for inner classes
+
+    // For mixins
+
+    public InjectionContext( CompositeInstance compositeInstance, UsesInstance uses, StateHolder state )
+    {
+        this.module = compositeInstance.module();
+        this.compositeInstance = compositeInstance;
+        this.uses = uses;
+        this.state = state;
+    }
+
+    // For concerns and side-effects
+    public InjectionContext( ModuleDescriptor module, Object next, ProxyReferenceInvocationHandler proxyHandler )
+    {
+        this.module = module;
+        this.next = next;
+        this.proxyHandler = proxyHandler;
+    }
+
+    public InjectionContext( ModuleDescriptor module, UsesInstance uses )
+    {
+        this.module = module;
+        this.uses = uses;
+    }
+
+    // For inner classes
+    public InjectionContext( ModuleDescriptor module, UsesInstance uses, Object instance )
+    {
+        this.module = module;
+        this.uses = uses;
+        this.instance = instance;
+    }
+
+    public ModuleDescriptor module()
+    {
+        return module;
+    }
+
+    public CompositeInstance compositeInstance()
+    {
+        return compositeInstance;
+    }
+
+    public UsesInstance uses()
+    {
+        return uses;
+    }
+
+    public StateHolder state()
+    {
+        return state;
+    }
+
+    public Object next()
+    {
+        return next;
+    }
+
+    public Object instance()
+    {
+        return instance;
+    }
+
+    public ProxyReferenceInvocationHandler proxyHandler()
+    {
+        return proxyHandler;
+    }
+
+    public void setUses( UsesInstance uses )
+    {
+        this.uses = uses;
+    }
+
+    @Override
+    public String toString()
+    {
+        return "InjectionContext{" +
+               "compositeInstance=" + compositeInstance +
+               ", module=" + module +
+               ", uses=" + uses +
+               ", state=" + state +
+               ", next=" + next +
+               ", proxyHandler=" + proxyHandler +
+               '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProvider.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProvider.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProvider.java
new file mode 100644
index 0000000..a21a352
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProvider.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import org.apache.polygene.runtime.injection.provider.InjectionProviderException;
+
+/**
+ * JAVADOC
+ */
+public interface InjectionProvider
+{
+    Object provideInjection( InjectionContext context )
+        throws InjectionProviderException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProviderFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProviderFactory.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProviderFactory.java
new file mode 100644
index 0000000..8671d4c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectionProviderFactory.java
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public interface InjectionProviderFactory
+{
+    /**
+     * Binding a dependency given an injection resolution. If no binding
+     * can be found, return null. If the dependency is optional the dependency will
+     * then be explicitly set to null.
+     *
+     * @param resolution Injection resolution
+     * @param dependencyModel Dependency model
+     * @return InjectionProvider
+     * @throws InvalidInjectionException if the injection is invalid
+     */
+    InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/ParameterizedTypeInstance.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/ParameterizedTypeInstance.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/ParameterizedTypeInstance.java
new file mode 100644
index 0000000..d1f2bc7
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/ParameterizedTypeInstance.java
@@ -0,0 +1,66 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
+/**
+ * TODO
+ */
+public class ParameterizedTypeInstance
+    implements ParameterizedType
+{
+    private Type[] actualTypeArguments;
+    private Type rawType;
+    private Type ownerType;
+
+    public ParameterizedTypeInstance( Type[] actualTypeArguments, Type rawType, Type ownerType )
+    {
+        this.actualTypeArguments = actualTypeArguments;
+        this.rawType = rawType;
+        this.ownerType = ownerType;
+    }
+
+    @Override
+    public Type[] getActualTypeArguments()
+    {
+        return actualTypeArguments;
+    }
+
+    @Override
+    public Type getRawType()
+    {
+        return rawType;
+    }
+
+    @Override
+    public Type getOwnerType()
+    {
+        return ownerType;
+    }
+
+    @Override
+    public String toString()
+    {
+        return rawType.toString() + Arrays.asList( actualTypeArguments );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderDecorator.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderDecorator.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderDecorator.java
new file mode 100644
index 0000000..3339a48
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderDecorator.java
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import org.apache.polygene.runtime.injection.InjectionContext;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+
+/**
+ * If a dependency resolution should be a singleton, wrap it with this
+ * to provide a single instance "cache".
+ */
+public final class CachingInjectionProviderDecorator
+    implements InjectionProvider
+{
+    private final InjectionProvider decoratedProvider;
+    private volatile Object singletonInstance;
+
+    public CachingInjectionProviderDecorator( InjectionProvider injectionProvider )
+    {
+        this.decoratedProvider = injectionProvider;
+    }
+
+    public InjectionProvider decoratedProvider()
+    {
+        return decoratedProvider;
+    }
+
+    @Override
+    public Object provideInjection( InjectionContext context )
+        throws InjectionProviderException
+    {
+        if( singletonInstance == null )
+        {
+            synchronized( this )
+            {
+                if( singletonInstance == null )
+                {
+                    singletonInstance = decoratedProvider.provideInjection( context );
+                }
+            }
+        }
+
+        return singletonInstance;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderFactoryDecorator.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderFactoryDecorator.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderFactoryDecorator.java
new file mode 100644
index 0000000..3e0ea74
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/CachingInjectionProviderFactoryDecorator.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+import org.apache.polygene.bootstrap.InvalidInjectionException;
+import org.apache.polygene.runtime.injection.DependencyModel;
+import org.apache.polygene.runtime.injection.InjectionProvider;
+import org.apache.polygene.runtime.injection.InjectionProviderFactory;
+import org.apache.polygene.runtime.model.Resolution;
+
+/**
+ * JAVADOC
+ */
+public class CachingInjectionProviderFactoryDecorator
+    implements InjectionProviderFactory
+{
+    private final InjectionProviderFactory decoratedFactory;
+
+    public CachingInjectionProviderFactoryDecorator( InjectionProviderFactory decoratedFactory )
+    {
+        this.decoratedFactory = decoratedFactory;
+    }
+
+    @Override
+    public InjectionProvider newInjectionProvider( Resolution resolution, DependencyModel dependencyModel )
+        throws InvalidInjectionException
+    {
+        InjectionProvider injectionProvider = decoratedFactory.newInjectionProvider( resolution, dependencyModel );
+        if( injectionProvider != null )
+        {
+            return new CachingInjectionProviderDecorator( injectionProvider );
+        }
+        else
+        {
+            return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderException.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderException.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderException.java
new file mode 100644
index 0000000..43a8872
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/provider/InjectionProviderException.java
@@ -0,0 +1,38 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.runtime.injection.provider;
+
+/**
+ * JAVADOC
+ */
+public class InjectionProviderException
+    extends RuntimeException
+{
+    public InjectionProviderException( String string )
+    {
+        super( string );
+    }
+
+    public InjectionProviderException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+}


[60/81] [abbrv] zest-java git commit: ZEST-195 ; Clean up the mistakes in the rename.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
new file mode 100644
index 0000000..b76bfd3
--- /dev/null
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneEntityRestlet.java
@@ -0,0 +1,311 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.restlet;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
+import org.apache.polygene.api.common.Optional;
+import org.apache.polygene.api.entity.EntityComposite;
+import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.injection.scope.Uses;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.NoSuchEntityException;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.api.usecase.UsecaseBuilder;
+import org.apache.polygene.api.value.ValueBuilder;
+import org.apache.polygene.api.value.ValueBuilderFactory;
+import org.apache.polygene.library.restlet.metainfo.UserIdentity;
+import org.apache.polygene.library.restlet.repository.RepositoryLocator;
+import org.apache.polygene.library.restlet.resource.DefaultResourceFactoryImpl;
+import org.apache.polygene.library.restlet.resource.NotPresentException;
+import org.apache.polygene.library.restlet.resource.ResourceFactory;
+import org.apache.polygene.library.restlet.resource.ServerResource;
+import org.apache.polygene.library.restlet.serialization.PolygeneConverter;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.restlet.Context;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.Restlet;
+import org.restlet.data.Form;
+import org.restlet.data.Method;
+import org.restlet.data.Parameter;
+import org.restlet.data.Status;
+import org.restlet.representation.Representation;
+import org.restlet.representation.Variant;
+import org.restlet.routing.Router;
+import org.restlet.security.User;
+
+public class PolygeneEntityRestlet<T extends HasIdentity> extends Restlet
+{
+    /**
+     * Creates a new PolygeneEntityRestlet instance for the given resource and entity classes.
+     * <p>
+     * This utility method should be used in your org.restlet.Application to create routes.
+     *
+     * @param <K>           Parameterized type of the resource
+     * @param <T>           Parameterized type of the entity
+     * @param module        Module to use for object instanciation
+     * @param router        Restlet Router
+     * @param resourceClass Resource class
+     * @param entityClass   Entity class
+     *
+     * @return The PolygeneEntityRestlet instance
+     */
+    public static <K extends HasIdentity, T extends ServerResource<K>> Restlet newInstance(
+        Module module, Router router, Class<T> resourceClass, Class<K> entityClass
+    )
+    {
+        @SuppressWarnings( "unchecked" )
+        ResourceFactory<K, T> factory = module.newObject( DefaultResourceFactoryImpl.class, resourceClass, router );
+        return module.newObject( PolygeneEntityRestlet.class, factory, router, entityClass, new PolygeneConverter( module ) );
+    }
+
+    @Structure
+    private ValueBuilderFactory vbf;
+
+    @Structure
+    private UnitOfWorkFactory uowf;
+
+    @Uses
+    private ResourceFactory resourceFactory;
+
+    @Uses
+    private Router router;
+
+    @Uses
+    @Optional
+    private Class<T> identityType;
+
+    @Structure
+    private PolygeneSPI spi;
+
+    @Uses
+    private PolygeneConverter converter;
+
+    @Service
+    private RepositoryLocator locator;
+
+    @Override
+    public void handle( Request request, Response response )
+    {
+        try
+        {
+            super.handle( request, response );
+            Method method = request.getMethod();
+            if( method.equals( Method.GET ) )
+            {
+                get( request, response );
+            }
+            if( method.equals( Method.DELETE ) )
+            {
+                delete( request, response );
+            }
+            if( method.equals( Method.POST ) )
+            {
+                post( request, response );
+            }
+            if( method.equals( Method.PUT ) )
+            {
+                put( request, response );
+            }
+        }
+        catch( RuntimeException e )
+        {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+    private void get( Request request, Response response )
+    {
+        execute( request, response, resource -> {
+                     try
+                     {
+                         T result = resource.get();
+                         if( result != null )
+                         {
+                             if( result instanceof EntityComposite )
+                             {
+                                 result = locator.find( identityType ).toValue( result );
+                             }
+                             Representation representation = converter.toRepresentation( result, new Variant(), null );
+                             response.setEntity( representation );
+                             response.setEntity( representation );
+                             response.setStatus( Status.SUCCESS_OK );
+                         }
+                         else
+                         {
+                             response.setStatus( Status.CLIENT_ERROR_NOT_FOUND );
+                         }
+                     }
+                     catch( NoSuchEntityException e )
+                     {
+                         response.setStatus( Status.CLIENT_ERROR_NOT_FOUND, e, "Entity not found." );
+                     }
+                 }
+        );
+    }
+
+    private void put( Request request, Response response )
+    {
+        execute( request, response, resource -> {
+
+            T value = convertToObject( identityType, request );
+            resource.put( value );
+            response.setStatus( Status.SUCCESS_OK );
+        } );
+    }
+
+    private void delete( Request request, Response response )
+    {
+        execute( request, response, resource -> {
+            resource.delete();
+            response.setStatus( Status.SUCCESS_NO_CONTENT );
+        } );
+    }
+
+    private void post( final Request request, final Response response )
+    {
+        execute( request, response, resource -> {
+            RestForm form = createRestForm( request );
+            RestLink link = resource.post( form );
+            response.setLocationRef( link.path().get() );
+            response.setStatus( Status.REDIRECTION_SEE_OTHER );
+        } );
+    }
+
+    private RestForm createRestForm( final Request request )
+    {
+        //noinspection MismatchedQueryAndUpdateOfCollection
+        Form form = new Form( request.getEntity() );
+        ValueBuilder<RestForm> builder = vbf.newValueBuilderWithState(
+            RestForm.class,
+            descriptor -> {
+                if( descriptor.qualifiedName().name().equals( "fields" ) )
+                {
+                    List<FormField> result = new ArrayList<>();
+                    for( Parameter param : form )
+                    {
+                        String name = param.getName();
+                        String value = param.getValue();
+                        ValueBuilder<FormField> fieldBuilder = vbf.newValueBuilder( FormField.class );
+                        FormField prototype = fieldBuilder.prototype();
+                        prototype.name().set( name );
+                        prototype.value().set( value );
+                        prototype.type().set( FormField.TEXT );
+                        result.add( fieldBuilder.newInstance() );
+                    }
+                    return result;
+                }
+                return null;
+            },
+            descriptor -> null,
+            descriptor -> null,
+            descriptor -> null
+        );
+        return builder.newInstance();
+    }
+
+    private void execute( Request request, Response response, Consumer<ServerResource<T>> closure )
+    {
+        UnitOfWork uow = null;
+        try
+        {
+            uow = createUnitOfWork( request );
+            ServerResource<T> resource = createResource( request, response, getContext() );
+            closure.accept( resource );
+            uow.complete();
+        }
+        catch( UnsupportedOperationException e )
+        {
+            e.printStackTrace();
+            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e, e.getMessage() );
+        }
+        catch( ConversionException e )
+        {
+            e.printStackTrace();
+            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage() );
+        }
+        catch( NotPresentException e )
+        {
+            e.printStackTrace();
+            response.setStatus( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage() );
+        }
+        catch( Throwable e )
+        {
+            e.printStackTrace();
+            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage() );
+        }
+        finally
+        {
+            if( uow != null && uow.isOpen() )
+            {
+                uow.discard();
+            }
+        }
+    }
+
+    private ServerResource<T> createResource( Request request, Response response, Context context )
+    {
+        @SuppressWarnings( "unchecked" )
+        ServerResource<T> serverResource = resourceFactory.create( identityType, request, response, context );
+        return serverResource;
+    }
+
+    private UnitOfWork createUnitOfWork( Request request )
+    {
+        UsecaseBuilder usecaseBuilder = UsecaseBuilder.buildUsecase( request.getResourceRef().getIdentifier( true ) );
+        User user = request.getClientInfo().getUser();
+        if( user != null )
+        {
+            UserIdentity userIdentity = new UserIdentity( user.getIdentifier(),
+                                                          user.getName(),
+                                                          user.getEmail(),
+                                                          user.getFirstName(),
+                                                          user.getLastName()
+            );
+            usecaseBuilder.withMetaInfo( userIdentity );
+        }
+        return uowf.newUnitOfWork( usecaseBuilder.newUsecase() );
+    }
+
+    private <K> K convertToObject( Class<K> type, Request request )
+    {
+        try
+        {
+            return converter.toObject( request.getEntity(), type, null );
+        }
+        catch( IOException e )
+        {
+            throw new ConversionException( request.getEntityAsText() );
+        }
+    }
+
+    @Override
+    public String toString()
+    {
+        return "PolygeneRestlet[" + ( identityType == null ? "<null>" : identityType.getSimpleName() ) + ", " + resourceFactory + "]";
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
new file mode 100644
index 0000000..f925cbe
--- /dev/null
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/PolygeneServerServlet.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.restlet;
+
+import javax.servlet.Servlet;
+
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.mixin.Mixins;
+import org.apache.polygene.api.structure.Module;
+import org.restlet.Context;
+import org.restlet.ext.servlet.ServerServlet;
+
+/**
+ * Restlet ServerServlet backed by a org.restlet.Application object.
+ */
+@Mixins( PolygeneServerServlet.Mixin.class )
+public interface PolygeneServerServlet
+    extends Servlet
+{
+    class Mixin
+        extends ServerServlet
+    {
+        private static final long serialVersionUID = 1L;
+
+        @Structure
+        private Module module;
+
+        @Override
+        protected org.restlet.Application createApplication( Context parentContext )
+        {
+            return module.newObject( org.restlet.Application.class, parentContext.createChildContext() );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestEntityRestlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestEntityRestlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestEntityRestlet.java
deleted file mode 100644
index b76bfd3..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestEntityRestlet.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.restlet;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Consumer;
-import org.apache.polygene.api.common.Optional;
-import org.apache.polygene.api.entity.EntityComposite;
-import org.apache.polygene.api.identity.HasIdentity;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.injection.scope.Uses;
-import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.api.unitofwork.NoSuchEntityException;
-import org.apache.polygene.api.unitofwork.UnitOfWork;
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.api.usecase.UsecaseBuilder;
-import org.apache.polygene.api.value.ValueBuilder;
-import org.apache.polygene.api.value.ValueBuilderFactory;
-import org.apache.polygene.library.restlet.metainfo.UserIdentity;
-import org.apache.polygene.library.restlet.repository.RepositoryLocator;
-import org.apache.polygene.library.restlet.resource.DefaultResourceFactoryImpl;
-import org.apache.polygene.library.restlet.resource.NotPresentException;
-import org.apache.polygene.library.restlet.resource.ResourceFactory;
-import org.apache.polygene.library.restlet.resource.ServerResource;
-import org.apache.polygene.library.restlet.serialization.PolygeneConverter;
-import org.apache.polygene.spi.PolygeneSPI;
-import org.restlet.Context;
-import org.restlet.Request;
-import org.restlet.Response;
-import org.restlet.Restlet;
-import org.restlet.data.Form;
-import org.restlet.data.Method;
-import org.restlet.data.Parameter;
-import org.restlet.data.Status;
-import org.restlet.representation.Representation;
-import org.restlet.representation.Variant;
-import org.restlet.routing.Router;
-import org.restlet.security.User;
-
-public class PolygeneEntityRestlet<T extends HasIdentity> extends Restlet
-{
-    /**
-     * Creates a new PolygeneEntityRestlet instance for the given resource and entity classes.
-     * <p>
-     * This utility method should be used in your org.restlet.Application to create routes.
-     *
-     * @param <K>           Parameterized type of the resource
-     * @param <T>           Parameterized type of the entity
-     * @param module        Module to use for object instanciation
-     * @param router        Restlet Router
-     * @param resourceClass Resource class
-     * @param entityClass   Entity class
-     *
-     * @return The PolygeneEntityRestlet instance
-     */
-    public static <K extends HasIdentity, T extends ServerResource<K>> Restlet newInstance(
-        Module module, Router router, Class<T> resourceClass, Class<K> entityClass
-    )
-    {
-        @SuppressWarnings( "unchecked" )
-        ResourceFactory<K, T> factory = module.newObject( DefaultResourceFactoryImpl.class, resourceClass, router );
-        return module.newObject( PolygeneEntityRestlet.class, factory, router, entityClass, new PolygeneConverter( module ) );
-    }
-
-    @Structure
-    private ValueBuilderFactory vbf;
-
-    @Structure
-    private UnitOfWorkFactory uowf;
-
-    @Uses
-    private ResourceFactory resourceFactory;
-
-    @Uses
-    private Router router;
-
-    @Uses
-    @Optional
-    private Class<T> identityType;
-
-    @Structure
-    private PolygeneSPI spi;
-
-    @Uses
-    private PolygeneConverter converter;
-
-    @Service
-    private RepositoryLocator locator;
-
-    @Override
-    public void handle( Request request, Response response )
-    {
-        try
-        {
-            super.handle( request, response );
-            Method method = request.getMethod();
-            if( method.equals( Method.GET ) )
-            {
-                get( request, response );
-            }
-            if( method.equals( Method.DELETE ) )
-            {
-                delete( request, response );
-            }
-            if( method.equals( Method.POST ) )
-            {
-                post( request, response );
-            }
-            if( method.equals( Method.PUT ) )
-            {
-                put( request, response );
-            }
-        }
-        catch( RuntimeException e )
-        {
-            e.printStackTrace();
-            throw e;
-        }
-    }
-
-    private void get( Request request, Response response )
-    {
-        execute( request, response, resource -> {
-                     try
-                     {
-                         T result = resource.get();
-                         if( result != null )
-                         {
-                             if( result instanceof EntityComposite )
-                             {
-                                 result = locator.find( identityType ).toValue( result );
-                             }
-                             Representation representation = converter.toRepresentation( result, new Variant(), null );
-                             response.setEntity( representation );
-                             response.setEntity( representation );
-                             response.setStatus( Status.SUCCESS_OK );
-                         }
-                         else
-                         {
-                             response.setStatus( Status.CLIENT_ERROR_NOT_FOUND );
-                         }
-                     }
-                     catch( NoSuchEntityException e )
-                     {
-                         response.setStatus( Status.CLIENT_ERROR_NOT_FOUND, e, "Entity not found." );
-                     }
-                 }
-        );
-    }
-
-    private void put( Request request, Response response )
-    {
-        execute( request, response, resource -> {
-
-            T value = convertToObject( identityType, request );
-            resource.put( value );
-            response.setStatus( Status.SUCCESS_OK );
-        } );
-    }
-
-    private void delete( Request request, Response response )
-    {
-        execute( request, response, resource -> {
-            resource.delete();
-            response.setStatus( Status.SUCCESS_NO_CONTENT );
-        } );
-    }
-
-    private void post( final Request request, final Response response )
-    {
-        execute( request, response, resource -> {
-            RestForm form = createRestForm( request );
-            RestLink link = resource.post( form );
-            response.setLocationRef( link.path().get() );
-            response.setStatus( Status.REDIRECTION_SEE_OTHER );
-        } );
-    }
-
-    private RestForm createRestForm( final Request request )
-    {
-        //noinspection MismatchedQueryAndUpdateOfCollection
-        Form form = new Form( request.getEntity() );
-        ValueBuilder<RestForm> builder = vbf.newValueBuilderWithState(
-            RestForm.class,
-            descriptor -> {
-                if( descriptor.qualifiedName().name().equals( "fields" ) )
-                {
-                    List<FormField> result = new ArrayList<>();
-                    for( Parameter param : form )
-                    {
-                        String name = param.getName();
-                        String value = param.getValue();
-                        ValueBuilder<FormField> fieldBuilder = vbf.newValueBuilder( FormField.class );
-                        FormField prototype = fieldBuilder.prototype();
-                        prototype.name().set( name );
-                        prototype.value().set( value );
-                        prototype.type().set( FormField.TEXT );
-                        result.add( fieldBuilder.newInstance() );
-                    }
-                    return result;
-                }
-                return null;
-            },
-            descriptor -> null,
-            descriptor -> null,
-            descriptor -> null
-        );
-        return builder.newInstance();
-    }
-
-    private void execute( Request request, Response response, Consumer<ServerResource<T>> closure )
-    {
-        UnitOfWork uow = null;
-        try
-        {
-            uow = createUnitOfWork( request );
-            ServerResource<T> resource = createResource( request, response, getContext() );
-            closure.accept( resource );
-            uow.complete();
-        }
-        catch( UnsupportedOperationException e )
-        {
-            e.printStackTrace();
-            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e, e.getMessage() );
-        }
-        catch( ConversionException e )
-        {
-            e.printStackTrace();
-            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage() );
-        }
-        catch( NotPresentException e )
-        {
-            e.printStackTrace();
-            response.setStatus( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage() );
-        }
-        catch( Throwable e )
-        {
-            e.printStackTrace();
-            response.setStatus( Status.CLIENT_ERROR_BAD_REQUEST, e.getMessage() );
-        }
-        finally
-        {
-            if( uow != null && uow.isOpen() )
-            {
-                uow.discard();
-            }
-        }
-    }
-
-    private ServerResource<T> createResource( Request request, Response response, Context context )
-    {
-        @SuppressWarnings( "unchecked" )
-        ServerResource<T> serverResource = resourceFactory.create( identityType, request, response, context );
-        return serverResource;
-    }
-
-    private UnitOfWork createUnitOfWork( Request request )
-    {
-        UsecaseBuilder usecaseBuilder = UsecaseBuilder.buildUsecase( request.getResourceRef().getIdentifier( true ) );
-        User user = request.getClientInfo().getUser();
-        if( user != null )
-        {
-            UserIdentity userIdentity = new UserIdentity( user.getIdentifier(),
-                                                          user.getName(),
-                                                          user.getEmail(),
-                                                          user.getFirstName(),
-                                                          user.getLastName()
-            );
-            usecaseBuilder.withMetaInfo( userIdentity );
-        }
-        return uowf.newUnitOfWork( usecaseBuilder.newUsecase() );
-    }
-
-    private <K> K convertToObject( Class<K> type, Request request )
-    {
-        try
-        {
-            return converter.toObject( request.getEntity(), type, null );
-        }
-        catch( IOException e )
-        {
-            throw new ConversionException( request.getEntityAsText() );
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return "PolygeneRestlet[" + ( identityType == null ? "<null>" : identityType.getSimpleName() ) + ", " + resourceFactory + "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestServerServlet.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestServerServlet.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestServerServlet.java
deleted file mode 100644
index f925cbe..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/ZestServerServlet.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.restlet;
-
-import javax.servlet.Servlet;
-
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.structure.Module;
-import org.restlet.Context;
-import org.restlet.ext.servlet.ServerServlet;
-
-/**
- * Restlet ServerServlet backed by a org.restlet.Application object.
- */
-@Mixins( PolygeneServerServlet.Mixin.class )
-public interface PolygeneServerServlet
-    extends Servlet
-{
-    class Mixin
-        extends ServerServlet
-    {
-        private static final long serialVersionUID = 1L;
-
-        @Structure
-        private Module module;
-
-        @Override
-        protected org.restlet.Application createApplication( Context parentContext )
-        {
-            return module.newObject( org.restlet.Application.class, parentContext.createChildContext() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java
new file mode 100644
index 0000000..17739b6
--- /dev/null
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/PolygeneConverter.java
@@ -0,0 +1,268 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.restlet.serialization;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.object.ObjectFactory;
+import org.apache.polygene.spi.PolygeneSPI;
+import org.restlet.data.MediaType;
+import org.restlet.data.Preference;
+import org.restlet.engine.converter.ConverterHelper;
+import org.restlet.engine.resource.VariantInfo;
+import org.restlet.representation.Representation;
+import org.restlet.representation.Variant;
+import org.restlet.resource.Resource;
+
+/**
+ * Converter between Apache Polygene and JSON.
+ */
+public class PolygeneConverter extends ConverterHelper
+{
+    @Structure
+    private PolygeneSPI spi;
+
+    /**
+     * Variant with media type application/json.
+     */
+    private static final VariantInfo VARIANT_JSON = new VariantInfo( MediaType.APPLICATION_JSON );
+    private static final VariantInfo VARIANT_WWW_FORM_URLENCODED = new VariantInfo( MediaType.APPLICATION_WWW_FORM );
+
+    private final ObjectFactory objectFactory;
+
+    public PolygeneConverter( ObjectFactory objectFactory )
+    {
+        this.objectFactory = objectFactory;
+    }
+
+    /**
+     * Creates the marshaling {@link JsonRepresentation}.
+     *
+     * @param mediaType The target media type.
+     * @param source    The source object to marshal.
+     *
+     * @return The marshaling {@link JsonRepresentation}.
+     */
+    protected <T> Representation create( MediaType mediaType, T source )
+    {
+        //noinspection unchecked
+        return objectFactory.newObject( JsonRepresentation.class, source );
+    }
+
+    /**
+     * Creates the unmarshaling {@link JsonRepresentation}.
+     *
+     * @param source      The source representation to unmarshal.
+     * @param objectClass The object class to instantiate.
+     *
+     * @return The unmarshaling {@link JsonRepresentation}.
+     */
+    protected <T> Representation create( Representation source, Class<T> objectClass )
+    {
+        if( VARIANT_WWW_FORM_URLENCODED.isCompatible( source ) )
+        {
+            return objectFactory.newObject( FormRepresentation.class, source, objectClass );
+        }
+        else if( VARIANT_WWW_FORM_URLENCODED.isCompatible( source ) )
+        {
+            //noinspection unchecked
+            return objectFactory.newObject( JsonRepresentation.class, source, objectClass );
+        }
+        return null;
+    }
+
+    public ObjectFactory getObjectFactory()
+    {
+        return objectFactory;
+    }
+
+    @Override
+    public List<Class<?>> getObjectClasses( Variant source )
+    {
+        List<Class<?>> result = new ArrayList<>();
+
+        if( isCompatible( source ) )
+        {
+            result = addObjectClass( result, Object.class );
+            result = addObjectClass( result, JsonRepresentation.class );
+        }
+
+        return result;
+    }
+
+    @Override
+    public List<VariantInfo> getVariants( Class<?> source )
+    {
+        List<VariantInfo> result = new ArrayList<>();
+
+        if( source != null )
+        {
+            result = addVariant( result, VARIANT_JSON );
+            result = addVariant( result, VARIANT_WWW_FORM_URLENCODED );
+        }
+
+        return result;
+    }
+
+    /**
+     * Indicates if the given variant is compatible with the media types
+     * supported by this converter.
+     *
+     * @param variant The variant.
+     *
+     * @return True if the given variant is compatible with the media types
+     * supported by this converter.
+     */
+    protected boolean isCompatible( Variant variant )
+    {
+        //noinspection SimplifiableIfStatement
+        if( variant == null )
+        {
+            return false;
+        }
+
+        return VARIANT_JSON.isCompatible( variant ) ||
+               VARIANT_WWW_FORM_URLENCODED.isCompatible( variant )
+            ;
+    }
+
+    @Override
+    public float score( Object source, Variant target, Resource resource )
+    {
+        float result;
+
+        if( source instanceof JsonRepresentation<?> )
+        {
+            result = 1.0F;
+        }
+        else
+        {
+            if( target == null )
+            {
+                result = 0.5F;
+            }
+            else if( isCompatible( target ) )
+            {
+                result = 0.8F;
+            }
+            else
+            {
+                result = 0.5F;
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T> float score( Representation source, Class<T> target,
+                            Resource resource
+    )
+    {
+        float result = -1.0F;
+
+        if( source instanceof JsonRepresentation<?> )
+        {
+            result = 1.0F;
+        }
+        else if( ( target != null )
+                 && JsonRepresentation.class.isAssignableFrom( target ) )
+        {
+            result = 1.0F;
+        }
+        else if( isCompatible( source ) )
+        {
+            result = 0.8F;
+        }
+
+        return result;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    @Override
+    public <T> T toObject( Representation source, Class<T> target, Resource resources )
+        throws IOException
+    {
+        Object result = null;
+
+        Representation representation = null;
+        if( isCompatible( source ) )
+        {
+            representation = create( source, target );
+        }
+
+        if( representation != null )
+        {
+            // Handle the conversion
+            if( ( target != null )
+                && JsonRepresentation.class.isAssignableFrom( target ) )
+            {
+                result = representation;
+            }
+            else
+            {
+                if( representation instanceof JsonRepresentation )
+                {
+                    result = ( (JsonRepresentation) representation ).getObject();
+                }
+                if( representation instanceof FormRepresentation )
+                {
+                    result = ( (FormRepresentation) representation ).getObject();
+                }
+            }
+        }
+
+        return (T) result;
+    }
+
+    @Override
+    public Representation toRepresentation( Object source, Variant target, Resource resource )
+    {
+        Representation result = null;
+
+        if( source instanceof JsonRepresentation )
+        {
+            result = (JsonRepresentation<?>) source;
+        }
+        else
+        {
+            if( target.getMediaType() == null )
+            {
+                target.setMediaType( MediaType.APPLICATION_JSON );
+            }
+            if( isCompatible( target ) )
+            {
+                result = create( target.getMediaType(), source );
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T> void updatePreferences( List<Preference<MediaType>> preferences,
+                                       Class<T> entity
+    )
+    {
+        updatePreferences( preferences, MediaType.APPLICATION_JSON, 1.0F );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/ZestConverter.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/ZestConverter.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/ZestConverter.java
deleted file mode 100644
index 17739b6..0000000
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/serialization/ZestConverter.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.restlet.serialization;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.spi.PolygeneSPI;
-import org.restlet.data.MediaType;
-import org.restlet.data.Preference;
-import org.restlet.engine.converter.ConverterHelper;
-import org.restlet.engine.resource.VariantInfo;
-import org.restlet.representation.Representation;
-import org.restlet.representation.Variant;
-import org.restlet.resource.Resource;
-
-/**
- * Converter between Apache Polygene and JSON.
- */
-public class PolygeneConverter extends ConverterHelper
-{
-    @Structure
-    private PolygeneSPI spi;
-
-    /**
-     * Variant with media type application/json.
-     */
-    private static final VariantInfo VARIANT_JSON = new VariantInfo( MediaType.APPLICATION_JSON );
-    private static final VariantInfo VARIANT_WWW_FORM_URLENCODED = new VariantInfo( MediaType.APPLICATION_WWW_FORM );
-
-    private final ObjectFactory objectFactory;
-
-    public PolygeneConverter( ObjectFactory objectFactory )
-    {
-        this.objectFactory = objectFactory;
-    }
-
-    /**
-     * Creates the marshaling {@link JsonRepresentation}.
-     *
-     * @param mediaType The target media type.
-     * @param source    The source object to marshal.
-     *
-     * @return The marshaling {@link JsonRepresentation}.
-     */
-    protected <T> Representation create( MediaType mediaType, T source )
-    {
-        //noinspection unchecked
-        return objectFactory.newObject( JsonRepresentation.class, source );
-    }
-
-    /**
-     * Creates the unmarshaling {@link JsonRepresentation}.
-     *
-     * @param source      The source representation to unmarshal.
-     * @param objectClass The object class to instantiate.
-     *
-     * @return The unmarshaling {@link JsonRepresentation}.
-     */
-    protected <T> Representation create( Representation source, Class<T> objectClass )
-    {
-        if( VARIANT_WWW_FORM_URLENCODED.isCompatible( source ) )
-        {
-            return objectFactory.newObject( FormRepresentation.class, source, objectClass );
-        }
-        else if( VARIANT_WWW_FORM_URLENCODED.isCompatible( source ) )
-        {
-            //noinspection unchecked
-            return objectFactory.newObject( JsonRepresentation.class, source, objectClass );
-        }
-        return null;
-    }
-
-    public ObjectFactory getObjectFactory()
-    {
-        return objectFactory;
-    }
-
-    @Override
-    public List<Class<?>> getObjectClasses( Variant source )
-    {
-        List<Class<?>> result = new ArrayList<>();
-
-        if( isCompatible( source ) )
-        {
-            result = addObjectClass( result, Object.class );
-            result = addObjectClass( result, JsonRepresentation.class );
-        }
-
-        return result;
-    }
-
-    @Override
-    public List<VariantInfo> getVariants( Class<?> source )
-    {
-        List<VariantInfo> result = new ArrayList<>();
-
-        if( source != null )
-        {
-            result = addVariant( result, VARIANT_JSON );
-            result = addVariant( result, VARIANT_WWW_FORM_URLENCODED );
-        }
-
-        return result;
-    }
-
-    /**
-     * Indicates if the given variant is compatible with the media types
-     * supported by this converter.
-     *
-     * @param variant The variant.
-     *
-     * @return True if the given variant is compatible with the media types
-     * supported by this converter.
-     */
-    protected boolean isCompatible( Variant variant )
-    {
-        //noinspection SimplifiableIfStatement
-        if( variant == null )
-        {
-            return false;
-        }
-
-        return VARIANT_JSON.isCompatible( variant ) ||
-               VARIANT_WWW_FORM_URLENCODED.isCompatible( variant )
-            ;
-    }
-
-    @Override
-    public float score( Object source, Variant target, Resource resource )
-    {
-        float result;
-
-        if( source instanceof JsonRepresentation<?> )
-        {
-            result = 1.0F;
-        }
-        else
-        {
-            if( target == null )
-            {
-                result = 0.5F;
-            }
-            else if( isCompatible( target ) )
-            {
-                result = 0.8F;
-            }
-            else
-            {
-                result = 0.5F;
-            }
-        }
-
-        return result;
-    }
-
-    @Override
-    public <T> float score( Representation source, Class<T> target,
-                            Resource resource
-    )
-    {
-        float result = -1.0F;
-
-        if( source instanceof JsonRepresentation<?> )
-        {
-            result = 1.0F;
-        }
-        else if( ( target != null )
-                 && JsonRepresentation.class.isAssignableFrom( target ) )
-        {
-            result = 1.0F;
-        }
-        else if( isCompatible( source ) )
-        {
-            result = 0.8F;
-        }
-
-        return result;
-    }
-
-    @SuppressWarnings( "unchecked" )
-    @Override
-    public <T> T toObject( Representation source, Class<T> target, Resource resources )
-        throws IOException
-    {
-        Object result = null;
-
-        Representation representation = null;
-        if( isCompatible( source ) )
-        {
-            representation = create( source, target );
-        }
-
-        if( representation != null )
-        {
-            // Handle the conversion
-            if( ( target != null )
-                && JsonRepresentation.class.isAssignableFrom( target ) )
-            {
-                result = representation;
-            }
-            else
-            {
-                if( representation instanceof JsonRepresentation )
-                {
-                    result = ( (JsonRepresentation) representation ).getObject();
-                }
-                if( representation instanceof FormRepresentation )
-                {
-                    result = ( (FormRepresentation) representation ).getObject();
-                }
-            }
-        }
-
-        return (T) result;
-    }
-
-    @Override
-    public Representation toRepresentation( Object source, Variant target, Resource resource )
-    {
-        Representation result = null;
-
-        if( source instanceof JsonRepresentation )
-        {
-            result = (JsonRepresentation<?>) source;
-        }
-        else
-        {
-            if( target.getMediaType() == null )
-            {
-                target.setMediaType( MediaType.APPLICATION_JSON );
-            }
-            if( isCompatible( target ) )
-            {
-                result = create( target.getMediaType(), source );
-            }
-        }
-
-        return result;
-    }
-
-    @Override
-    public <T> void updatePreferences( List<Preference<MediaType>> preferences,
-                                       Class<T> entity
-    )
-    {
-        updatePreferences( preferences, MediaType.APPLICATION_JSON, 1.0F );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneFilter.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneFilter.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneFilter.java
new file mode 100644
index 0000000..cd76212
--- /dev/null
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneFilter.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.servlet;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
+
+/**
+ * Base Filter providing easy access to the {@link Application} from the {@link ServletContext}.
+ * @see AbstractPolygeneServletBootstrap
+ */
+public abstract class PolygeneFilter
+        implements Filter
+{
+
+    private Application application;
+
+    @Override
+    public void init( FilterConfig filterConfig )
+            throws ServletException
+    {
+        application = PolygeneServletSupport.application( filterConfig.getServletContext() );
+    }
+
+    protected final Application application()
+    {
+        return application;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServlet.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServlet.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServlet.java
new file mode 100644
index 0000000..95835a5
--- /dev/null
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServlet.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.servlet;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
+
+/**
+ * Base HttpServlet providing easy access to the {@link org.apache.polygene.api.structure.Application} from the
+ * {@link javax.servlet.ServletContext}.
+ *
+ * @see AbstractPolygeneServletBootstrap
+ */
+public class PolygeneServlet extends HttpServlet
+{
+
+    private Application application;
+
+    public PolygeneServlet()
+    {
+        super();
+    }
+
+    @Override
+    public void init()
+            throws ServletException
+    {
+        super.init();
+        application = PolygeneServletSupport.application( getServletContext() );
+    }
+
+    protected final Application application()
+    {
+        return application;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServletSupport.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServletSupport.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServletSupport.java
new file mode 100644
index 0000000..0b42323
--- /dev/null
+++ b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/PolygeneServletSupport.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.servlet;
+
+import javax.servlet.ServletContext;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
+
+public final class PolygeneServletSupport
+{
+
+    public static final String APP_IN_CTX = "polygene-application-servlet-context-attribute";
+
+    /**
+     * @param servletContext    ServletContext
+     * @return                  The Application from the servlet context attribute previously set by {@link AbstractPolygeneServletBootstrap}
+     */
+    public static Application application( ServletContext servletContext )
+    {
+        return ( Application ) servletContext.getAttribute( APP_IN_CTX ); // TODO try/catch and find a suitable Polygene exception
+    }
+
+    private PolygeneServletSupport()
+    {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestFilter.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestFilter.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestFilter.java
deleted file mode 100644
index cd76212..0000000
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestFilter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.servlet;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
-
-/**
- * Base Filter providing easy access to the {@link Application} from the {@link ServletContext}.
- * @see AbstractPolygeneServletBootstrap
- */
-public abstract class PolygeneFilter
-        implements Filter
-{
-
-    private Application application;
-
-    @Override
-    public void init( FilterConfig filterConfig )
-            throws ServletException
-    {
-        application = PolygeneServletSupport.application( filterConfig.getServletContext() );
-    }
-
-    protected final Application application()
-    {
-        return application;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServlet.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServlet.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServlet.java
deleted file mode 100644
index 95835a5..0000000
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServlet.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.servlet;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
-
-/**
- * Base HttpServlet providing easy access to the {@link org.apache.polygene.api.structure.Application} from the
- * {@link javax.servlet.ServletContext}.
- *
- * @see AbstractPolygeneServletBootstrap
- */
-public class PolygeneServlet extends HttpServlet
-{
-
-    private Application application;
-
-    public PolygeneServlet()
-    {
-        super();
-    }
-
-    @Override
-    public void init()
-            throws ServletException
-    {
-        super.init();
-        application = PolygeneServletSupport.application( getServletContext() );
-    }
-
-    protected final Application application()
-    {
-        return application;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServletSupport.java
----------------------------------------------------------------------
diff --git a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServletSupport.java b/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServletSupport.java
deleted file mode 100644
index 0b42323..0000000
--- a/libraries/servlet/src/main/java/org/apache/polygene/library/servlet/ZestServletSupport.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.servlet;
-
-import javax.servlet.ServletContext;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.library.servlet.lifecycle.AbstractPolygeneServletBootstrap;
-
-public final class PolygeneServletSupport
-{
-
-    public static final String APP_IN_CTX = "polygene-application-servlet-context-attribute";
-
-    /**
-     * @param servletContext    ServletContext
-     * @return                  The Application from the servlet context attribute previously set by {@link AbstractPolygeneServletBootstrap}
-     */
-    public static Application application( ServletContext servletContext )
-    {
-        return ( Application ) servletContext.getAttribute( APP_IN_CTX ); // TODO try/catch and find a suitable Polygene exception
-    }
-
-    private PolygeneServletSupport()
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
index dbbddfc..c2b3fb8 100644
--- a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PasswordDomainTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.shiro;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authc.credential.PasswordService;
@@ -39,13 +40,12 @@ import org.apache.polygene.library.shiro.assembly.PasswordDomainAssembler;
 import org.apache.polygene.library.shiro.assembly.StandaloneShiroAssembler;
 import org.apache.polygene.library.shiro.domain.passwords.PasswordSecurable;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.*;
 
 public class PasswordDomainTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     // START SNIPPET: domain

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
index d1911dd..604b0bb 100644
--- a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/PermissionsDomainTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.shiro;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authc.credential.PasswordService;
@@ -44,7 +45,6 @@ import org.apache.polygene.library.shiro.domain.permissions.Role;
 import org.apache.polygene.library.shiro.domain.permissions.RoleAssignee;
 import org.apache.polygene.library.shiro.domain.permissions.RoleFactory;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.hamcrest.CoreMatchers.is;
@@ -52,7 +52,7 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 public class PermissionsDomainTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     // START SNIPPET: domain

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java
index a02aa9f..3a774a2 100644
--- a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/RealmServiceTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.shiro;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.UsernamePasswordToken;
 import org.apache.shiro.authc.credential.DefaultPasswordService;
@@ -36,13 +37,12 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.shiro.assembly.StandaloneShiroAssembler;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.assertNotNull;
 
 public class RealmServiceTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     // START SNIPPET: realm-service

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
index 2c5153e..062077a 100644
--- a/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
+++ b/libraries/shiro-core/src/test/java/org/apache/polygene/library/shiro/StandaloneShiroTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.shiro;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.IncorrectCredentialsException;
@@ -38,7 +39,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.shiro.assembly.StandaloneShiroAssembler;
 import org.apache.polygene.library.shiro.ini.IniSecurityManagerService;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,7 +48,7 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 public class StandaloneShiroTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     public void documentationSupport_before()

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java b/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java
index e2cc96c..e34edd0 100644
--- a/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java
+++ b/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebHttpShiroTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.shiro.web;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
@@ -27,7 +28,6 @@ import org.apache.polygene.library.http.JettyConfiguration;
 import org.apache.polygene.library.http.JettyServiceAssembler;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
 import org.apache.polygene.library.shiro.web.assembly.HttpShiroAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.util.FreePortFinder;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebRealmServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebRealmServiceTest.java b/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebRealmServiceTest.java
index 90b1be4..cebe368 100644
--- a/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebRealmServiceTest.java
+++ b/libraries/shiro-web/src/test/java/org/apache/polygene/library/shiro/web/WebRealmServiceTest.java
@@ -43,6 +43,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.EntityUtils;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.shiro.authc.credential.DefaultPasswordService;
 import org.apache.shiro.authc.credential.PasswordMatcher;
 import org.apache.shiro.authc.credential.PasswordService;
@@ -59,7 +60,6 @@ import org.apache.polygene.library.http.JettyConfiguration;
 import org.apache.polygene.library.http.JettyServiceAssembler;
 import org.apache.polygene.library.shiro.ini.ShiroIniConfiguration;
 import org.apache.polygene.library.shiro.web.assembly.HttpShiroAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.util.FreePortFinder;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
index 503fa98..5b99275 100644
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/Constants.java
@@ -21,7 +21,7 @@ package org.apache.polygene.library.spring.bootstrap;
 
 public final class Constants
 {
-    public static final String BEAN_ID_ZEST_APPLICATION = "polygeneApplication";
+    public static final String BEAN_ID_POLYGENE_APPLICATION = "polygeneApplication";
 
     private Constants()
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/PolygeneApplicationBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/PolygeneApplicationBootstrap.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/PolygeneApplicationBootstrap.java
new file mode 100644
index 0000000..2b33e22
--- /dev/null
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/PolygeneApplicationBootstrap.java
@@ -0,0 +1,88 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap;
+
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.springframework.context.ApplicationContextAware;
+
+/**
+ * Run a Polygene Application as a Spring Bean and export its Services to Spring.
+ * <p>
+ * Steps to export Polygene service:
+ * </p>
+ * <ul>
+ * <li>Create spring BeanFactory service of Apache Polygene services to export.</li>
+ * <li>Create a class that extends {@link PolygeneApplicationBootstrap}.</li>
+ * <li>Sets the layer and module that register BeanFactory service.</li>
+ * <li>Assemble Polygene application by implementing #assemble method.</li>
+ * <li>Sets the reference of bean factory service. This reference is the spring
+ * bean name.</li>
+ * <li>Declare Polygene bootstrap in spring xml application context.
+ * <pre><code>
+ * &lt;?xml version="1.0" encoding="UTF-8"?&gt;
+ *
+ * &lt;beans xmlns="http://www.springframework.org/schema/beans"
+ * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ * xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
+ * xsi:schemaLocation="
+ * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ * http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd"&gt;
+ *
+ * &lt;!-- class that implements PolygeneApplicationBootstrap --&gt;
+ *
+ * &lt;polygene:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap"/&gt;
+ *
+ * &lt;bean id="commentServiceHolder" class="org.apache.polygene.library.spring.bootstrap.CommentServiceHolder"&gt;
+ *
+ * &lt;constructor-arg ref="commentService"/&gt; &lt;!-- Reference Polygene comment service --&gt;
+ *
+ * &lt;/bean&gt;
+ * </code></pre>
+ * </li>
+ * </ul>
+ * <p>
+ * <b>Importing Spring beans as services</b><br>
+ * </p>
+ * <ol>
+ * <li>Application bootstrap class must implement interface
+ * {@link ApplicationContextAware}.</li>
+ * <li>In the application bootstrap import service to the module using method
+ * {@link ModuleAssembly#importedServices(Class...)}.</li>
+ * <li>Set concrete Spring bean as meta-data of the imported service.</li>
+ * </ol>
+ * <p>
+ * Look at org.apache.polygene.library.spring.bootstrap.PolygeneExportServiceTest for sample
+ * implementation.
+ * </p>
+ */
+public abstract class PolygeneApplicationBootstrap
+{
+    /**
+     * Assembles Polygene application.
+     * 
+     * @param applicationAssembly
+     *            Polygene application assembly. Must not be {@code null}.
+     * @throws AssemblyException
+     *             Thrown if assemblies fails.
+     */
+    public abstract void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException;
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
deleted file mode 100644
index 2b33e22..0000000
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/ZestApplicationBootstrap.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap;
-
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.springframework.context.ApplicationContextAware;
-
-/**
- * Run a Polygene Application as a Spring Bean and export its Services to Spring.
- * <p>
- * Steps to export Polygene service:
- * </p>
- * <ul>
- * <li>Create spring BeanFactory service of Apache Polygene services to export.</li>
- * <li>Create a class that extends {@link PolygeneApplicationBootstrap}.</li>
- * <li>Sets the layer and module that register BeanFactory service.</li>
- * <li>Assemble Polygene application by implementing #assemble method.</li>
- * <li>Sets the reference of bean factory service. This reference is the spring
- * bean name.</li>
- * <li>Declare Polygene bootstrap in spring xml application context.
- * <pre><code>
- * &lt;?xml version="1.0" encoding="UTF-8"?&gt;
- *
- * &lt;beans xmlns="http://www.springframework.org/schema/beans"
- * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- * xmlns:polygene="http://polygene.apache.org/schema/polygene/spring"
- * xsi:schemaLocation="
- * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- * http://polygene.apache.org/schema/polygene/spring http://polygene.apache.org/schema/polygene/spring/spring-0.5.xsd"&gt;
- *
- * &lt;!-- class that implements PolygeneApplicationBootstrap --&gt;
- *
- * &lt;polygene:bootstrap class="org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap"/&gt;
- *
- * &lt;bean id="commentServiceHolder" class="org.apache.polygene.library.spring.bootstrap.CommentServiceHolder"&gt;
- *
- * &lt;constructor-arg ref="commentService"/&gt; &lt;!-- Reference Polygene comment service --&gt;
- *
- * &lt;/bean&gt;
- * </code></pre>
- * </li>
- * </ul>
- * <p>
- * <b>Importing Spring beans as services</b><br>
- * </p>
- * <ol>
- * <li>Application bootstrap class must implement interface
- * {@link ApplicationContextAware}.</li>
- * <li>In the application bootstrap import service to the module using method
- * {@link ModuleAssembly#importedServices(Class...)}.</li>
- * <li>Set concrete Spring bean as meta-data of the imported service.</li>
- * </ol>
- * <p>
- * Look at org.apache.polygene.library.spring.bootstrap.PolygeneExportServiceTest for sample
- * implementation.
- * </p>
- */
-public abstract class PolygeneApplicationBootstrap
-{
-    /**
-     * Assembles Polygene application.
-     * 
-     * @param applicationAssembly
-     *            Polygene application assembly. Must not be {@code null}.
-     * @throws AssemblyException
-     *             Thrown if assemblies fails.
-     */
-    public abstract void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/PolygeneNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/PolygeneNamespaceHandler.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/PolygeneNamespaceHandler.java
new file mode 100644
index 0000000..6cbf7b4
--- /dev/null
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/PolygeneNamespaceHandler.java
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap.internal;
+
+import org.apache.polygene.library.spring.bootstrap.internal.application.PolygeneBootstrapBeanDefinitionParser;
+import org.apache.polygene.library.spring.bootstrap.internal.service.PolygeneServiceBeanDefinitionParser;
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+public final class PolygeneNamespaceHandler extends NamespaceHandlerSupport
+{
+    @Override
+    public final void init()
+    {
+        registerBeanDefinitionParser( "bootstrap", new PolygeneBootstrapBeanDefinitionParser() );
+        registerBeanDefinitionParser( "service", new PolygeneServiceBeanDefinitionParser() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/ZestNamespaceHandler.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/ZestNamespaceHandler.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/ZestNamespaceHandler.java
deleted file mode 100644
index 6cbf7b4..0000000
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/ZestNamespaceHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap.internal;
-
-import org.apache.polygene.library.spring.bootstrap.internal.application.PolygeneBootstrapBeanDefinitionParser;
-import org.apache.polygene.library.spring.bootstrap.internal.service.PolygeneServiceBeanDefinitionParser;
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
-
-public final class PolygeneNamespaceHandler extends NamespaceHandlerSupport
-{
-    @Override
-    public final void init()
-    {
-        registerBeanDefinitionParser( "bootstrap", new PolygeneBootstrapBeanDefinitionParser() );
-        registerBeanDefinitionParser( "service", new PolygeneServiceBeanDefinitionParser() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneApplicationFactoryBean.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneApplicationFactoryBean.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneApplicationFactoryBean.java
new file mode 100644
index 0000000..742052c
--- /dev/null
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneApplicationFactoryBean.java
@@ -0,0 +1,119 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap.internal.application;
+
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.bootstrap.*;
+import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanInitializationException;
+import org.springframework.beans.factory.DisposableBean;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.util.Assert;
+
+/**
+ * This class responsible to handle the lifecycle of Polygene application.
+ */
+public final class PolygeneApplicationFactoryBean
+        implements FactoryBean, DisposableBean, InitializingBean, ApplicationContextAware
+{
+
+    private final PolygeneApplicationBootstrap applicationBootstrap;
+
+    private Application application;
+
+    public PolygeneApplicationFactoryBean( final PolygeneApplicationBootstrap applicationBootstrap )
+    {
+        Assert.notNull( applicationBootstrap, "'applicationBootstrap' must not be null" );
+        this.applicationBootstrap = applicationBootstrap;
+    }
+
+    @Override
+    public final Application getObject() throws Exception
+    {
+        if ( this.application == null )
+        {
+            this.application = this.createApplication();
+        }
+        return this.application;
+    }
+
+    @Override
+    public final Class<Application> getObjectType()
+    {
+        return Application.class;
+    }
+
+    @Override
+    public final boolean isSingleton()
+    {
+        return true;
+    }
+
+    @Override
+    public final void destroy() throws Exception
+    {
+        this.getObject().passivate();
+    }
+
+    @Override
+    public final void afterPropertiesSet() throws Exception
+    {
+        this.getObject().activate();
+    }
+
+    private Application createApplication()
+    {
+        Energy4Java energy4Java = new Energy4Java();
+        try
+        {
+            return energy4Java.newApplication( new ApplicationAssembler()
+            {
+
+                @Override
+                public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
+                        throws AssemblyException
+                {
+                    final ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
+                    PolygeneApplicationFactoryBean.this.applicationBootstrap.assemble( applicationAssembly );
+                    return applicationAssembly;
+                }
+            } );
+        } catch ( AssemblyException e )
+        {
+            throw new BeanInitializationException( "Fail to bootstrap Polygene application.", e );
+        }
+
+    }
+
+    @Override
+    public void setApplicationContext( final ApplicationContext applicationContext ) throws BeansException
+    {
+        if ( this.applicationBootstrap instanceof ApplicationContextAware )
+        {
+            // propagate application context to the application bootstrap
+            ApplicationContextAware aware = (ApplicationContextAware) this.applicationBootstrap;
+            aware.setApplicationContext( applicationContext );
+        }
+    }
+}


[33/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java
deleted file mode 100644
index 5941c39..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsCounterFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Create MetricsCounter instances.
- */
-public interface MetricsCounterFactory extends MetricsFactory
-{
-    /**
-     * Create a MetricsCounter instance.
-     * If the same arguments are given twice, the same instance must be returned.
-     *
-     * @param name   A human readable, short name of the metric.
-     *
-     * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported.
-     */
-    MetricsCounter createCounter( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java
deleted file mode 100644
index 175f1b6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-import java.util.stream.Stream;
-
-/**
- * Metrics Factory.
- */
-public interface MetricsFactory
-{
-    Stream<Metric> registered();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java
deleted file mode 100644
index e19410f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGauge.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * MetricsGauge is the most basic Metric type, and is completely flexible and therefor handled slightly differently in
- * the MetricsFactory than all other Gauges. It needs to pass on custom code, so the implementation is typically
- * an anonymous class, inlined at the implementation.
- *
- * @param <T> Any type holding the MetricsGauge's current value.
- */
-public interface MetricsGauge<T> extends Metric
-{
-    /**
-     * Returns the metric's current value.
-     *
-     * @return the metric's current value
-     */
-    T value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java
deleted file mode 100644
index a5213f6..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsGaugeFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Register MetricsGauge with the underlying Metrics system.
- */
-public interface MetricsGaugeFactory extends MetricsFactory
-{
-    /**
-     * Register a MetricsGauge with the underlying Metrics system.
-     *
-     * @param name   A human readable, short name of the metric.
-     * @param gauge  The implementation of the MetricsGauge.
-     * @param <T>    Any type holding the MetricsGauge's current value.
-     *
-     * @return The same MetricsGauge or the DefaultMetric.NULL MetricsGauge instance.
-     */
-    <T> MetricsGauge<T> registerGauge( String name, MetricsGauge<T> gauge );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java
deleted file mode 100644
index 4c97e66..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheck.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Metrics Health Check.
- */
-public interface MetricsHealthCheck extends Metric
-{
-    Result check()
-        throws Exception;
-
-    final class Result
-    {
-        private final boolean healthy;
-        private final String message;
-        private final Throwable exception;
-
-        public Result( boolean isHealthy, String message, Throwable exception )
-        {
-            healthy = isHealthy;
-            this.message = message;
-            this.exception = exception;
-        }
-
-        public boolean isHealthy()
-        {
-            return healthy;
-        }
-
-        public String getMessage()
-        {
-            return message;
-        }
-
-        public Throwable getException()
-        {
-            return exception;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java
deleted file mode 100644
index ccc3bf8..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHealthCheckFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Create MetricsHealthCheck instances.
- */
-public interface MetricsHealthCheckFactory extends MetricsFactory
-{
-    /**
-     * Create a MetricsHealthCheck instance.
-     * If the same arguments are given twice, the same instance must be returned.
-     *
-     * @param name   A human readable, short name of the metric.
-     * @param check  The health check to be performed regularly.
-     *
-     * @return A MetricsHealthCheck instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported.
-     *
-     */
-    MetricsHealthCheck registerHealthCheck( String name, MetricsHealthCheck check );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java
deleted file mode 100644
index 6fa7a5d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogram.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * A metric which calculates the distribution of a value.
- *
- * @see <a href="http://www.johndcook.com/standard_deviation.html">Accurately computing running variance</a>
- */
-public interface MetricsHistogram extends Metric
-{
-    void update( long newValue );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java
deleted file mode 100644
index 44e2c8c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsHistogramFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Create MetricsHistogram instances.
- */
-public interface MetricsHistogramFactory extends MetricsFactory
-{
-    /**
-     * Create a MetricsHistogram instance.
-     * If the same arguments are given twice, the same instance must be returned.
-     *
-     * @param name   A human readable, short name of the metric.
-     *
-     * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported.
-     *
-     */
-    MetricsHistogram createHistogram( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java
deleted file mode 100644
index 207c1fd..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * A meter metric which measures mean throughput and one-, five-, and fifteen-minute
- * exponentially-weighted moving average throughputs.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average">EMA</a>
- */
-public interface MetricsMeter extends Metric
-{
-    void mark();
-
-    /**
-     * Mark the occurrence of a given number of events.
-     *
-     * @param numberOfEvents the number of events
-     */
-    void mark( int numberOfEvents );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java
deleted file mode 100644
index cad8f57..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsMeterFactory.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Create MetricsMeter instances.
- */
-public interface MetricsMeterFactory extends MetricsFactory
-{
-    /**
-     * Create a MetricsMeter instance.
-     * If the same arguments are given twice, the same instance must be returned.
-     *
-     * @param name      A human readable, short name of the metric.
-     *
-     * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported.
-     */
-    MetricsMeter createMeter( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java
deleted file mode 100644
index 9fa318d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsNotSupportedException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Thrown when the underlying MetricsProvider do not support a Metric type.
- */
-public class MetricsNotSupportedException extends RuntimeException
-{
-    public MetricsNotSupportedException( Class<? extends MetricsFactory> factoryType,
-                                         Class<? extends MetricsProvider> providerType
-    )
-    {
-        super( "Metrics [" + factoryType.getName() + "] is not supported by MetricsProvider [" + providerType.getName() + "]." );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java
deleted file mode 100644
index 6473b8d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Metrics Provider SPI.
- * <p>
- * The Polygene Runtime will automatically look for a service that implements the MetricsProvider interface
- * and use it for internal Runtime metrics, such as the UnitOfWork measuring the time from creation to close.
- * </p>
- * <p>
- * The Metrics Library is available to add metric functionality to applications in the same way, and
- * will use the same MetricsProvider.
- * </p>
- * <p>
- * Note that the usual visibility rules applies, so you might have more than one MetricsProvider server,
- * perhaps per layer.
- * </p>
- */
-public interface MetricsProvider
-{
-    /**
-     * Creates a new factory instance.
-     *
-     * The instantiation is done by providing a Metric type, which is one of
-     * <ul>
-     * <li>{@link MetricsCounter}</li>
-     * <li>{@link MetricsGauge}</li>
-     * <li>{@link MetricsHealthCheck}</li>
-     * <li>{@link MetricsHistogram}</li>
-     * <li>{@link MetricsMeter}</li>
-     * <li>{@link MetricsTimer}</li>
-     * </ul>
-     *
-     * @param factoryType The class of the metric type needed.
-     * @param <T>         The metric type requested.
-     *
-     * @return A factory instance
-     *
-     * @throws MetricsNotSupportedException when the MetricsProvider is not supporting the factory type requested.
-     */
-    <T extends MetricsFactory> T createFactory( Class<T> factoryType )
-        throws MetricsNotSupportedException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java
deleted file mode 100644
index a302dbe..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Timer Metrics.
- */
-public interface MetricsTimer extends Metric
-{
-    /**
-     * Start the Timer Metrics.
-     */
-    Context start();
-
-    /**
-     * Timer Metrics Context.
-     */
-    interface Context
-    {
-        /**
-         * Stop the Timer Metrics.
-         */
-        void stop();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java b/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java
deleted file mode 100644
index 3139a19..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/MetricsTimerFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.metrics;
-
-/**
- * Create MetricsTimer instances.
- */
-public interface MetricsTimerFactory extends MetricsFactory
-{
-    /**
-     * Create a MetricsTimer instance.
-     * If the same arguments are given twice, the same instance must be returned.
-     *
-     * @param name     A human readable, short name of the metric.
-     *
-     * @return A Metric instance to be used, OR org.apache.zest.spi.metrics.DefaultMetric.NULL if not supported.
-     *
-     */
-    MetricsTimer createTimer( String name );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/metrics/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/metrics/package.html b/core/api/src/main/java/org/apache/zest/api/metrics/package.html
deleted file mode 100644
index 3657fe5..0000000
--- a/core/api/src/main/java/org/apache/zest/api/metrics/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Metrics API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java b/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java
deleted file mode 100644
index 04c6b91..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/Initializable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-/**
- * Fragments which want to be initialized can implement
- * this callback interface. It will be invoked after
- * the fragment has bee instantiated and all injections have been done.
- */
-public interface Initializable
-{
-    /**
-     * Initialize the fragment
-     *
-     * @throws Exception if something went wrong
-     */
-    void initialize() throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java
deleted file mode 100644
index 3826779..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/InitializationException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-/**
- * Thrown when a Fragment or object could not be initialized.
- */
-public class InitializationException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 1L;
-
-    public InitializationException()
-    {
-    }
-
-    public InitializationException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java b/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java
deleted file mode 100644
index 1c5687a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/InvalidMixinException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-import java.lang.reflect.Method;
-
-/**
- * This exception is thrown if a Mixin is invalid (missing method implementation).
- */
-public class InvalidMixinException
-    extends RuntimeException
-{
-    public InvalidMixinException( Class mixinClass, Method method )
-    {
-        super( mixinClass.getName() + "does not have a method implementation for " + method );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java
deleted file mode 100644
index 1b60d6a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinDescriptor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-/**
- * Mixin Descriptor.
- */
-public interface MixinDescriptor
-{
-    Class<?> mixinClass();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java b/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java
deleted file mode 100644
index 3306c5a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/MixinMappingException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-/**
- * This Exception is thrown when it is not possible to map the MixinType to a valid
- * CompositeType.
- */
-public class MixinMappingException
-    extends RuntimeException
-{
-    private static final long serialVersionUID = 6843167709252705294L;
-
-    public MixinMappingException( String message )
-    {
-        super( message );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java b/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java
deleted file mode 100644
index 3bc325a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/Mixins.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation is used in composites to declare mixin implementation classes.
- * <p>
- * Mixins tells the runtime which implementation class of a Mixin should be
- * used. The &#64;Mixins annotation can occur at any level in the composite hierarchy
- * and the runtime will match each found Mixin implementation against a Mixins annotation.
- * All mixin interfaces must have a Mixin implementation in the composite hierarchy or
- * a runtime exception will occur.
- * </p>
- * <p>
- * Example;
- * </p>
- * <pre><code>
- *
- * &#64;Mixins( MyBeerOrder.class )
- * public interface BeerOrderComposite extends BeerOrder, Composite
- * {
- * }
- *
- * public class MyBeerOrder
- * implements BeerOrder
- * {
- * :
- * }
- * </code></pre>
- * <p>
- * Many implementations can be listed,
- * </p>
- * <pre><code>
- * &#64;Mixins( { MyBeerOrder.class, DescriptionImpl.class } )
- * public interface BeerOrderComposite extends BeerOrder, Description, Composite
- * {
- * }
- * </code></pre>
- * <p>
- * If the Mixins is a class that implements InvocationHandler, it will be
- * used for all mixins. To avoid that an invocation handler based implementation
- * not service all mixin, use the AppliesTo annotation.
- * </p>
- *
- * <p>
- * It is valid to have multiple Mixins for a mixin. The first one found
- * will be used. The search order is in the order they are written in the Mixins
- * annotation left-to-right, and depth-first recursive search of the super-interfaces again
- * left-to-right.
- * </p>
- *
- * @see org.apache.zest.api.common.AppliesTo
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( ElementType.TYPE )
-@Documented
-public @interface Mixins
-{
-    Class<?>[] value();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java b/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java
deleted file mode 100644
index 7f7490a..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/NoopMixin.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.mixin;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-/**
- * Generic mixin that is a no-op. Can be useful if the functionality
- * of a method is mainly provided by concerns and side-effects.
- */
-public final class NoopMixin
-    implements InvocationHandler
-{
-    private static final Boolean BOOLEAN_DEFAULT = Boolean.FALSE;
-    private static final Short SHORT_DEFAULT = 0;
-    private static final Character CHARACTER_DEFAULT = 0;
-    private static final Integer INTEGER_DEFAULT = 0;
-    private static final Long LONG_DEFAULT = 0L;
-    private static final Float FLOAT_DEFAULT = 0f;
-    private static final Double DOUBLE_DEFAULT = 0.0;
-
-    @Override
-    public Object invoke( Object object, Method method, Object[] args )
-        throws Throwable
-    {
-        Class<?> retType = method.getReturnType();
-        if( !retType.isPrimitive() )
-        {
-            return null;
-        }
-        if( Void.TYPE == retType )
-        {
-            return null;
-        }
-        if( Boolean.TYPE == retType )
-        {
-            return BOOLEAN_DEFAULT;
-        }
-        if( Short.TYPE == retType )
-        {
-            return SHORT_DEFAULT;
-        }
-        if( Character.TYPE == retType )
-        {
-            return CHARACTER_DEFAULT;
-        }
-        if( Integer.TYPE == retType )
-        {
-            return INTEGER_DEFAULT;
-        }
-        if( Long.TYPE == retType )
-        {
-            return LONG_DEFAULT;
-        }
-        if( Float.TYPE == retType )
-        {
-            return FLOAT_DEFAULT;
-        }
-        if( Double.TYPE == retType )
-        {
-            return DOUBLE_DEFAULT;
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/mixin/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/mixin/package.html b/core/api/src/main/java/org/apache/zest/api/mixin/package.html
deleted file mode 100644
index 7c916a3..0000000
--- a/core/api/src/main/java/org/apache/zest/api/mixin/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Mixin API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java b/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java
deleted file mode 100644
index 075d697..0000000
--- a/core/api/src/main/java/org/apache/zest/api/object/NoSuchObjectException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.object;
-
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.zest.api.common.InvalidApplicationException;
-
-/**
- * This exception is thrown if no visible Object of the requested type can be found.
- */
-public class NoSuchObjectException
-    extends InvalidApplicationException
-{
-    private static final long serialVersionUID = -1121690536365682511L;
-
-    private final String objectType;
-    private final String moduleName;
-
-    public NoSuchObjectException( String type, String moduleName, Stream<Class<?>> visible )
-    {
-        super( "Could not find any visible Object of type [" + type + "] in module ["
-               + moduleName
-               + "]. The visible types are: \n"
-               + visible.map( Class::getName ).collect( Collectors.joining("\n") )
-        );
-        this.objectType = type;
-        this.moduleName = moduleName;
-    }
-
-    public String objectType()
-    {
-        return objectType;
-    }
-
-    public String moduleName()
-    {
-        return moduleName;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java
deleted file mode 100644
index 733a790..0000000
--- a/core/api/src/main/java/org/apache/zest/api/object/ObjectDescriptor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.object;
-
-import org.apache.zest.api.composite.ModelDescriptor;
-
-/**
- * Object Descriptor.
- */
-public interface ObjectDescriptor
-    extends ModelDescriptor
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java b/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java
deleted file mode 100644
index d694c48..0000000
--- a/core/api/src/main/java/org/apache/zest/api/object/ObjectFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.object;
-
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * This factory creates and injects POJO's.
- */
-public interface ObjectFactory
-{
-    /**
-     * Create new objects of the given type.
-     *
-     * @param type an object class which will be instantiated.
-     *
-     * @return new objects.
-     *
-     * @throws ConstructionException Thrown if instantiation fails.
-     * @throws NoSuchObjectException Thrown if {@code type} class is not an object.
-     */
-    <T> T newObject( Class<T> type, Object... uses )
-        throws NoSuchObjectException, ConstructionException;
-
-    /**
-     * Inject an existing instance. Only fields and methods will be called.
-     *
-     * @param instance instance
-     * @param uses dependencies
-     *
-     * @throws ConstructionException if it was not possible to construct the Object dependencies
-     */
-    void injectTo( Object instance, Object... uses )
-        throws ConstructionException;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/object/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/object/package.html b/core/api/src/main/java/org/apache/zest/api/object/package.html
deleted file mode 100644
index 6956f39..0000000
--- a/core/api/src/main/java/org/apache/zest/api/object/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Object API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/package.html b/core/api/src/main/java/org/apache/zest/api/package.html
deleted file mode 100644
index 1964935..0000000
--- a/core/api/src/main/java/org/apache/zest/api/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Apache Polygene\u2122 API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java b/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java
deleted file mode 100644
index 8eb5c09..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/DefaultValues.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Default values for various property types
- */
-public final class DefaultValues
-{
-    private static final Map<Type, Object> DEFAULT_VALUES = new HashMap<Type, Object>();
-
-    static
-    {
-        DEFAULT_VALUES.put( Byte.class, 0 );
-        DEFAULT_VALUES.put( Short.class, 0 );
-        DEFAULT_VALUES.put( Character.class, 0 );
-        DEFAULT_VALUES.put( Integer.class, 0 );
-        DEFAULT_VALUES.put( Long.class, 0L );
-        DEFAULT_VALUES.put( Double.class, 0D );
-        DEFAULT_VALUES.put( Float.class, 0F );
-        DEFAULT_VALUES.put( Boolean.class, false );
-        DEFAULT_VALUES.put( String.class, "" );
-    }
-
-    public static Object getDefaultValueOf( Type type )
-    {
-        Object value = DEFAULT_VALUES.get( type );
-        if( value != null )
-        {
-            return value;
-        }
-        if( type instanceof ParameterizedType )
-        {
-            // List<Foo> -> List
-            type = ( (ParameterizedType) type ).getRawType();
-        }
-
-        if( type instanceof Class )
-        {
-            Class typeAsClass = (Class) type;
-            if( Set.class.isAssignableFrom( typeAsClass ) )
-            {
-                return new HashSet();
-            }
-            else if( Map.class.isAssignableFrom( typeAsClass ) )
-            {
-                return new LinkedHashMap();
-            }
-            else if( Collection.class.isAssignableFrom( typeAsClass ) )
-            {
-                return new ArrayList();
-            }
-            else if( typeAsClass.isEnum() )
-            {
-                return ( (Class) type ).getEnumConstants()[ 0 ];
-            }
-        }
-        throw new IllegalArgumentException( "Cannot use @UseDefaults with type " + type.toString() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java b/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java
deleted file mode 100644
index 0efb64d..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/GenericPropertyInfo.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import static org.apache.zest.api.util.Classes.typeOf;
-
-/**
- * Generic Property info utility class.
- */
-public final class GenericPropertyInfo
-{
-    public static Type propertyTypeOf( AccessibleObject accessor )
-    {
-        return toPropertyType( typeOf( accessor ) );
-    }
-
-    public static Type toPropertyType( Type methodReturnType )
-    {
-        if( methodReturnType instanceof ParameterizedType )
-        {
-            ParameterizedType parameterizedType = (ParameterizedType) methodReturnType;
-            if( Property.class.isAssignableFrom( (Class<?>) parameterizedType.getRawType() ) )
-            {
-                return parameterizedType.getActualTypeArguments()[ 0 ];
-            }
-        }
-
-        if( methodReturnType instanceof Class<?> )
-        {
-            Type[] interfaces = ( (Class<?>) methodReturnType ).getGenericInterfaces();
-            for( Type anInterface : interfaces )
-            {
-                Type propertyType = toPropertyType( anInterface );
-                if( propertyType != null )
-                {
-                    return propertyType;
-                }
-            }
-        }
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Immutable.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java b/core/api/src/main/java/org/apache/zest/api/property/Immutable.java
deleted file mode 100644
index 964140f..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/Immutable.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This annotation adds Immutability to Types, Properties and Associations
- */
-@Retention( RetentionPolicy.RUNTIME )
-@Target( { ElementType.TYPE, ElementType.METHOD } )
-@Documented
-public @interface Immutable
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java b/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java
deleted file mode 100644
index e14ec15..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/InvalidPropertyTypeException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.AccessibleObject;
-import org.apache.zest.api.common.ConstructionException;
-
-/**
- * Thrown when attempting to subclass Property.
- */
-public class InvalidPropertyTypeException extends ConstructionException
-{
-    public InvalidPropertyTypeException( AccessibleObject accessor )
-    {
-        super( createMessage(accessor) );
-    }
-
-    private static String createMessage( AccessibleObject accessor )
-    {
-        StringBuilder builder = new StringBuilder();
-        builder.append( "Not allowed to subclass " + Property.class.getName() + ". Property accessor " + accessor + " is returning a Property subclass." );
-        return builder.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Numbers.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java b/core/api/src/main/java/org/apache/zest/api/property/Numbers.java
deleted file mode 100644
index 515214b..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/Numbers.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.math.BigDecimal;
-
-/**
- * Convenience class for mathematical operations on numerical properties.
- * <pre>import static org.apache.zest.api.property.Numbers.*;
- * ...
- * add( object.numberProperty(), 5 );</pre>
- */
-public final class Numbers
-{
-    // Integer operations
-
-    public static Property<Integer> add( Property<Integer> property, int amount )
-    {
-        property.set( property.get() + amount );
-        return property;
-    }
-
-    public static Property<Integer> mult( Property<Integer> property, int amount )
-    {
-        property.set( property.get() * amount );
-        return property;
-    }
-
-    public static Property<Integer> sub( Property<Integer> property, int amount )
-    {
-        property.set( property.get() - amount );
-        return property;
-    }
-
-    public static Property<Integer> div( Property<Integer> property, int amount )
-    {
-        property.set( property.get() / amount );
-        return property;
-    }
-
-    // Long operations
-
-    public static Property<Long> add( Property<Long> property, long amount )
-    {
-        property.set( property.get() + amount );
-        return property;
-    }
-
-    public static Property<Long> mult( Property<Long> property, long amount )
-    {
-        property.set( property.get() * amount );
-        return property;
-    }
-
-    public static Property<Long> sub( Property<Long> property, long amount )
-    {
-        property.set( property.get() - amount );
-        return property;
-    }
-
-    public static Property<Long> div( Property<Long> property, long amount )
-    {
-        property.set( property.get() / amount );
-        return property;
-    }
-
-    // Double operations
-
-    public static Property<Double> add( Property<Double> property, double amount )
-    {
-        property.set( property.get() + amount );
-        return property;
-    }
-
-    public static Property<Double> mult( Property<Double> property, double amount )
-    {
-        property.set( property.get() * amount );
-        return property;
-    }
-
-    public static Property<Double> sub( Property<Double> property, double amount )
-    {
-        property.set( property.get() - amount );
-        return property;
-    }
-
-    public static Property<Double> div( Property<Double> property, double amount )
-    {
-        property.set( property.get() / amount );
-        return property;
-    }
-
-    // Float operations
-
-    public static Property<Float> add( Property<Float> property, float amount )
-    {
-        property.set( property.get() + amount );
-        return property;
-    }
-
-    public static Property<Float> mult( Property<Float> property, float amount )
-    {
-        property.set( property.get() * amount );
-        return property;
-    }
-
-    public static Property<Float> sub( Property<Float> property, float amount )
-    {
-        property.set( property.get() - amount );
-        return property;
-    }
-
-    public static Property<Float> div( Property<Float> property, float amount )
-    {
-        property.set( property.get() / amount );
-        return property;
-    }
-
-    // BigDecimal operations
-
-    public static Property<BigDecimal> add( Property<BigDecimal> property, BigDecimal amount )
-    {
-        property.set( property.get().add( amount ) );
-        return property;
-    }
-
-    public static Property<BigDecimal> mult( Property<BigDecimal> property, BigDecimal amount )
-    {
-        property.set( property.get().multiply( amount ) );
-        return property;
-    }
-
-    public static Property<BigDecimal> sub( Property<BigDecimal> property, BigDecimal amount )
-    {
-        property.set( property.get().subtract( amount ) );
-        return property;
-    }
-
-    public static Property<BigDecimal> div( Property<BigDecimal> property, BigDecimal amount )
-    {
-        property.set( property.get().divide( amount ) );
-        return property;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/Property.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/Property.java b/core/api/src/main/java/org/apache/zest/api/property/Property.java
deleted file mode 100644
index 1c351cd..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/Property.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-/**
- * Properties are declared in Composite interfaces by using this interface.
- * <p>
- * It creates a first-class object for the property from which you can get and set the value, and access any
- * metadata about it.
- * </p>
- * <p>The type of the Property can be one of the following:</p>
- * <ul>
- * <li> A boxed primitive (Long,Integer,Boolean, etc.)</li>
- * <li> String</li>
- * <li> BigInteger</li>
- * <li> BigDecimal</li>
- * <li> Date</li>
- * <li> DateTime (Joda Time)</li>
- * <li> LocalDateTime (Joda Time)</li>
- * <li> A serializable</li>
- * <li> A ValueComposite</li>
- * <li> A List, Set or Collection of any of the above</li>
- * </ul>
- *
- * @param <T> Parameterized type of the Property
- */
-public interface Property<T>
-{
-    /**
-     * Get the value of the property.
-     *
-     * @return the value
-     */
-    T get();
-
-    /**
-     * Set the value of the property
-     *
-     * @param newValue the new value
-     *
-     * @throws IllegalArgumentException if the value has an invalid value
-     * @throws IllegalStateException    if the property is immutable
-     */
-    void set( T newValue )
-        throws IllegalArgumentException, IllegalStateException;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java
deleted file mode 100644
index 97f9083..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/PropertyDescriptor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Type;
-import org.apache.zest.api.common.QualifiedName;
-import org.apache.zest.api.structure.MetaInfoHolder;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.ValueType;
-
-/**
- * Property Descriptor.
- */
-public interface PropertyDescriptor extends MetaInfoHolder
-{
-    boolean isImmutable();
-
-    /**
-     * Get the qualified name of the property which is equal to:
-     * <pre><code>
-     * &lt;interface name&gt;:&lt;method name&gt;
-     * </code></pre>
-     *
-     * @return the qualified name of the property
-     */
-    QualifiedName qualifiedName();
-
-    /**
-     * Get the type of the property. If the property is declared
-     * as Property&lt;X&gt; then X is returned.
-     *
-     * @return the property type
-     */
-    Type type();
-
-    AccessibleObject accessor();
-
-    Object initialValue( ModuleDescriptor module );
-
-    ValueType valueType();
-
-    boolean queryable();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java
deleted file mode 100644
index ea3fd3c..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/PropertyMixin.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import org.apache.zest.api.common.AppliesTo;
-import org.apache.zest.api.common.AppliesToFilter;
-import org.apache.zest.api.injection.scope.State;
-
-/**
- * Generic mixin for properties.
- */
-// START SNIPPET: actual
-@AppliesTo( { PropertyMixin.PropertyFilter.class } )
-public final class PropertyMixin
-    implements InvocationHandler
-{
-    @State
-    private StateHolder state;
-
-    @Override
-    public Object invoke( Object proxy, Method method, Object[] args )
-        throws Throwable
-    {
-        return state.propertyFor( method );
-    }
-
-    /**
-     * Filter Property methods to apply generic Property Mixin.
-     */
-    public static class PropertyFilter
-        implements AppliesToFilter
-    {
-        @Override
-        public boolean appliesTo( Method method, Class<?> mixin, Class<?> compositeType, Class<?> modifierClass )
-        {
-            return Property.class.isAssignableFrom( method.getReturnType() );
-        }
-    }
-}
-// END SNIPPET: actual

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java b/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java
deleted file mode 100644
index 1638529..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/PropertyWrapper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-/**
- * If you want to catch getting and setting properties, then create a GenericConcern
- * that wraps the Polygene-supplied Property instance with PropertyWrappers. Override
- * get() and/or set() to perform your custom code.
- */
-public class PropertyWrapper
-    implements Property<Object>
-{
-    protected Property<Object> next;
-
-    public PropertyWrapper( Property<Object> next )
-    {
-        this.next = next;
-    }
-
-    public Property<Object> next()
-    {
-        return next;
-    }
-
-    @Override
-    public Object get()
-    {
-        return next.get();
-    }
-
-    @Override
-    public void set( Object newValue )
-        throws IllegalArgumentException, IllegalStateException
-    {
-        next.set( newValue );
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return next.hashCode();
-    }
-
-    @Override
-    public boolean equals( Object obj )
-    {
-        return next.equals( obj );
-    }
-
-    @Override
-    public String toString()
-    {
-        return next.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java b/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java
deleted file mode 100644
index 8ae0089..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/StateHolder.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.property;
-
-import java.lang.reflect.AccessibleObject;
-import java.util.stream.Stream;
-
-/**
- * This represents the state of a composite (properties).
- */
-public interface StateHolder
-{
-    /**
-     * Get a property for a specific accessor
-     *
-     * @param accessor of the property
-     *
-     * @return the property
-     *
-     * @throws IllegalArgumentException if no property for given accessor exists
-     */
-    <T> Property<T> propertyFor( AccessibleObject accessor )
-        throws IllegalArgumentException;
-
-    Stream<? extends Property<?>> properties();
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/property/package.html
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/property/package.html b/core/api/src/main/java/org/apache/zest/api/property/package.html
deleted file mode 100644
index 95d7f77..0000000
--- a/core/api/src/main/java/org/apache/zest/api/property/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one
-  ~  or more contributor license agreements.  See the NOTICE file
-  ~  distributed with this work for additional information
-  ~  regarding copyright ownership.  The ASF licenses this file
-  ~  to you 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.
-  ~
-  ~
-  -->
-<html>
-    <body>
-        <h2>Property API.</h2>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java b/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java
deleted file mode 100644
index ff37a08..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/MissingIndexingSystemException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-/**
- * This Exception is thrown in <code>QueryBuilderFactory.newQueryBuilder()</code> method if
- * no indexing subsystem has been declared in the assembly.
- */
-public final class MissingIndexingSystemException
-    extends QueryException
-{
-    private static final long serialVersionUID = 5147421865890379209L;
-
-    public MissingIndexingSystemException()
-    {
-        super( "No EntityFinder has been declared in the assembly of the application." );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java b/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java
deleted file mode 100644
index a2805da..0000000
--- a/core/api/src/main/java/org/apache/zest/api/query/NotQueryableException.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.query;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Member;
-import org.apache.zest.api.entity.Queryable;
-import org.apache.zest.api.property.GenericPropertyInfo;
-import org.apache.zest.api.util.Classes;
-
-/**
- * Thrown in case that a non queryable type or accessor (marked with @Queriable(false)) is used during query building,
- * or when non-Property, non-Associations are trying to be queried (possibly can not happen).
- */
-public class NotQueryableException
-    extends QueryException
-{
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Constructor.
-     *
-     * @param message exception message
-     */
-    public NotQueryableException( final String message )
-    {
-        super( message );
-    }
-
-    /**
-     * Verify that the provided accessor method has not been marked with a Queryable(false).
-     *
-     * @param accessor accessor method
-     *
-     * @throws NotQueryableException - If accessor method has been marked as not queryable
-     */
-    public static void throwIfNotQueryable( final AccessibleObject accessor )
-    {
-        Queryable queryable = accessor.getAnnotation( Queryable.class );
-        if( queryable != null && !queryable.value() )
-        {
-            throw new NotQueryableException(
-                String.format(
-                    "%1$s \"%2$s\" (%3$s) is not queryable as has been marked with @Queryable(false)",
-                    Classes.RAW_CLASS.apply( GenericPropertyInfo.propertyTypeOf( accessor ) ).getSimpleName(),
-                    ( (Member) accessor ).getName(),
-                    ( (Member) accessor ).getDeclaringClass().getName()
-                )
-            );
-        }
-    }
-
-    /**
-     * Verify that the provided type has not been marked with a Queryable(false).
-     *
-     * @param type a type
-     *
-     * @throws NotQueryableException - If type has been marked as not queryable
-     */
-    public static void throwIfNotQueryable( final Class<?> type )
-    {
-        Queryable queryable = type.getAnnotation( Queryable.class );
-        if( queryable != null && !queryable.value() )
-        {
-            throw new NotQueryableException(
-                String.format(
-                    "Type \"%1$s\" is not queryable as has been marked with @Queryable(false)",
-                    type.getName()
-                )
-            );
-        }
-    }
-}
\ No newline at end of file


[20/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
deleted file mode 100644
index 69563a0..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Assemblers.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Assembler adapters for common use cases (visibility, reference, configuration).
- */
-public class Assemblers
-{
-    private Assemblers()
-    {
-    }
-
-    /**
-     * Assembler with Visibility interface.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public interface Visible<AssemblerType>
-        extends Assembler
-    {
-        /**
-         * Set Visibility.
-         * @param visibility Visibility
-         * @return This Assembler instance
-         */
-        AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility );
-
-        /**
-         * Get Visibility.
-         * <p>Default to {@link org.apache.zest.api.common.Visibility#module}.</p>
-         * @return Visibility
-         */
-        org.apache.zest.api.common.Visibility visibility();
-    }
-
-    /**
-     * Assembler with Identity interface.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public interface Identifiable<AssemblerType>
-        extends Assembler
-    {
-        /**
-         * Set Identity.
-         * @param identity Identity
-         * @return This Assembler instance
-         */
-        AssemblerType identifiedBy( String identity );
-
-        /**
-         * @return {@literal true} if {@link #identity()} do not return null, {@literal false} otherwise
-         */
-        boolean hasIdentity();
-
-        /**
-         * Get Identity.
-         * <p>Default to {@literal null}.</p>
-         * @return Identity
-         */
-        String identity();
-    }
-
-    /**
-     * Assembler with Configuration interface.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public interface Configurable<AssemblerType>
-        extends Assembler
-    {
-        /**
-         * Set Configuration Module and Visibility.
-         * @param configModule Configuration Module
-         * @param configVisibility Configuration Visiblity
-         * @return This Assembler instance
-         */
-        AssemblerType withConfig( ModuleAssembly configModule,
-                                  org.apache.zest.api.common.Visibility configVisibility );
-
-        /**
-         * @return {@literal true} if {@link #configModule() ()} do not return null, {@literal false} otherwise
-         */
-        boolean hasConfig();
-
-        /**
-         * Get Configuration Module.
-         * <p>Default to {@literal null}.</p>
-         * @return Configuration Module
-         */
-        ModuleAssembly configModule();
-
-        /**
-         * Get Configuration Visibility.
-         * <p>Default to {@link org.apache.zest.api.common.Visibility#module}.</p>
-         * @return Configuration Visibility
-         */
-        org.apache.zest.api.common.Visibility configVisibility();
-    }
-
-    /**
-     * Assembler with Visibility adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class Visibility<AssemblerType>
-        implements Visible<AssemblerType>
-    {
-        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
-        {
-            this.visibility = visibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility visibility()
-        {
-            return visibility;
-        }
-    }
-
-    /**
-     * Assembler with Identity adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class Identity<AssemblerType>
-        implements Identifiable<AssemblerType>
-    {
-        private String identity;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType identifiedBy( String identity )
-        {
-            this.identity = identity;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasIdentity()
-        {
-            return identity != null;
-        }
-
-        @Override
-        public final String identity()
-        {
-            return identity;
-        }
-    }
-
-    /**
-     * Assembler with Configuration adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class Config<AssemblerType>
-        implements Configurable<AssemblerType>
-    {
-        private ModuleAssembly configModule = null;
-        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType withConfig( ModuleAssembly configModule,
-                                               org.apache.zest.api.common.Visibility configVisibility )
-        {
-            this.configModule = configModule;
-            this.configVisibility = configVisibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasConfig()
-        {
-            return configModule != null;
-        }
-
-        @Override
-        public final ModuleAssembly configModule()
-        {
-            return configModule;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility configVisibility()
-        {
-            return configVisibility;
-        }
-    }
-
-    /**
-     * Assembler with Visibility and Identity adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class VisibilityIdentity<AssemblerType>
-        implements Visible<AssemblerType>,
-                   Identifiable<AssemblerType>
-    {
-        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
-        private String identity;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
-        {
-            this.visibility = visibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility visibility()
-        {
-            return visibility;
-        }
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType identifiedBy( String identityString )
-        {
-            this.identity = identityString;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasIdentity()
-        {
-            return identity != null;
-        }
-
-        @Override
-        public final String identity()
-        {
-            return identity;
-        }
-    }
-
-    /**
-     * Assembler with Visibility and Configuration adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class VisibilityConfig<AssemblerType>
-        implements Visible<AssemblerType>,
-                   Configurable<AssemblerType>
-    {
-        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
-        private ModuleAssembly configModule = null;
-        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
-        {
-            this.visibility = visibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility visibility()
-        {
-            return visibility;
-        }
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType withConfig( ModuleAssembly configModule,
-                                               org.apache.zest.api.common.Visibility configVisibility )
-        {
-            this.configModule = configModule;
-            this.configVisibility = configVisibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasConfig()
-        {
-            return configModule != null;
-        }
-
-        @Override
-        public final ModuleAssembly configModule()
-        {
-            return configModule;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility configVisibility()
-        {
-            return configVisibility;
-        }
-    }
-
-    /**
-     * Assembler with Identity and Configuration adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class IdentityConfig<AssemblerType>
-        implements Identifiable<AssemblerType>,
-                   Configurable<AssemblerType>
-    {
-        private String identity;
-        private ModuleAssembly configModule = null;
-        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType identifiedBy( String identity )
-        {
-            this.identity = identity;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasIdentity()
-        {
-            return identity != null;
-        }
-
-        @Override
-        public final String identity()
-        {
-            return identity;
-        }
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType withConfig( ModuleAssembly configModule,
-                                               org.apache.zest.api.common.Visibility configVisibility )
-        {
-            this.configModule = configModule;
-            this.configVisibility = configVisibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasConfig()
-        {
-            return configModule != null;
-        }
-
-        @Override
-        public final ModuleAssembly configModule()
-        {
-            return configModule;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility configVisibility()
-        {
-            return configVisibility;
-        }
-    }
-
-    /**
-     * Assembler with Visibility, Identity and Configuation adapter.
-     * @param <AssemblerType> Parameterized type of Assembler
-     */
-    public static abstract class VisibilityIdentityConfig<AssemblerType>
-        implements Visible<AssemblerType>,
-                   Identifiable<AssemblerType>,
-                   Configurable<AssemblerType>
-    {
-        private org.apache.zest.api.common.Visibility visibility = org.apache.zest.api.common.Visibility.module;
-        private String identity;
-        private ModuleAssembly configModule = null;
-        private org.apache.zest.api.common.Visibility configVisibility = org.apache.zest.api.common.Visibility.module;
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType visibleIn( org.apache.zest.api.common.Visibility visibility )
-        {
-            this.visibility = visibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility visibility()
-        {
-            return visibility;
-        }
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType identifiedBy( String identity )
-        {
-            this.identity = identity;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasIdentity()
-        {
-            return identity != null;
-        }
-
-        @Override
-        public final String identity()
-        {
-            return identity;
-        }
-
-        @Override
-        @SuppressWarnings( "unchecked" )
-        public final AssemblerType withConfig( ModuleAssembly configModule,
-                                               org.apache.zest.api.common.Visibility configVisibility )
-        {
-            this.configModule = configModule;
-            this.configVisibility = configVisibility;
-            return (AssemblerType) this;
-        }
-
-        @Override
-        public final boolean hasConfig()
-        {
-            return configModule != null;
-        }
-
-        @Override
-        public final ModuleAssembly configModule()
-        {
-            return configModule;
-        }
-
-        @Override
-        public final org.apache.zest.api.common.Visibility configVisibility()
-        {
-            return configVisibility;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
deleted file mode 100644
index 1fcb544..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Thrown by ModuleAssembly if the Assembler tries to make an invalid assembly.
- */
-public class AssemblyException extends RuntimeException
-{
-    public AssemblyException()
-    {
-    }
-
-    public AssemblyException( String string )
-    {
-        super( string );
-    }
-
-    public AssemblyException( String string, Throwable throwable )
-    {
-        super( string, throwable );
-    }
-
-    public AssemblyException( Throwable throwable )
-    {
-        super( throwable );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
deleted file mode 100644
index 39aa005..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblySpecifications.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.util.Arrays;
-import java.util.function.Predicate;
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * Utility specifications for Assemblies.
- */
-public class AssemblySpecifications
-{
-    public static Predicate<HasTypes> ofAnyType( final Class... types )
-    {
-        return item -> item.types().anyMatch( a -> Arrays.stream( types ).anyMatch( a::equals ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
deleted file mode 100644
index ce6b5fe..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Visitor interface to visit the whole or parts of an assembly.
- * <p>
- * Implement this interface and call visit() on ApplicationAssembly, LayerAssembly or ModuleAssembly.
- * </p>
- * <p>
- * This can be used to, for example, add metadata to all entities, add concerns on composites, or similar.
- * </p>
- */
-public interface AssemblyVisitor<ThrowableType extends Throwable>
-{
-    public void visitApplication( ApplicationAssembly assembly )
-        throws ThrowableType;
-
-    public void visitLayer( LayerAssembly assembly )
-        throws ThrowableType;
-
-    public void visitModule( ModuleAssembly assembly )
-        throws ThrowableType;
-
-    public void visitComposite( TransientDeclaration declaration )
-        throws ThrowableType;
-
-    public void visitEntity( EntityDeclaration declaration )
-        throws ThrowableType;
-
-    public void visitService( ServiceDeclaration declaration )
-        throws ThrowableType;
-
-    public void visitImportedService( ImportedServiceDeclaration declaration )
-        throws ThrowableType;
-
-    public void visitValue( ValueDeclaration declaration )
-        throws ThrowableType;
-
-    public void visitObject( ObjectDeclaration declaration )
-        throws ThrowableType;
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
deleted file mode 100644
index b2a9420..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssemblyVisitorAdapter.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Base class for assembly visitors. Subclass and override
- * the particular methods you are interested in.
- */
-public class AssemblyVisitorAdapter<ThrowableType extends Throwable>
-    implements AssemblyVisitor<ThrowableType>
-{
-    @Override
-    public void visitApplication( ApplicationAssembly assembly )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitLayer( LayerAssembly assembly )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitModule( ModuleAssembly assembly )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitComposite( TransientDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitEntity( EntityDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitService( ServiceDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitImportedService( ImportedServiceDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitValue( ValueDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-
-    @Override
-    public void visitObject( ObjectDeclaration declaration )
-        throws ThrowableType
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
deleted file mode 100644
index ee9c1a4..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/AssociationDeclarations.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.lang.reflect.AccessibleObject;
-import org.apache.zest.api.common.MetaInfo;
-
-/**
- * This provides declared {@link org.apache.zest.api.association.Association} information that the runtime can use.
- */
-public interface AssociationDeclarations
-{
-    MetaInfo metaInfoFor( AccessibleObject accessor );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
deleted file mode 100644
index 238d5cf..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BindingException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Thrown by the Polygene runtime if a dependency can not be bound.
- */
-public class BindingException
-    extends Exception
-{
-    public BindingException( String s )
-    {
-        super( s );
-    }
-
-    public BindingException( String s, InvalidInjectionException ex )
-    {
-        super( s, ex );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
deleted file mode 100644
index cda42bf..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/BootstrapException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * This exception is thrown if no ApplicationFactory provider can be found
- */
-public class BootstrapException
-    extends RuntimeException
-{
-    public BootstrapException( String message )
-    {
-        super( message );
-    }
-
-    public BootstrapException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
deleted file mode 100644
index c792048..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ClassScanner.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Modifier;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.CodeSource;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.regex.Pattern;
-import java.util.stream.Stream;
-
-/**
- * Scan classpath for classes that matches given criteria. Useful for automated assemblies with lots of similar classes.
- */
-public class ClassScanner
-{
-    private static final ValidClass VALID_CLASS_PREDICATE = new ValidClass();
-
-    /**
-     * Get all classes from the same package of the given class, and recursively in all subpackages.
-     * <p>
-     * This only works if the seed class is loaded from a file: URL. Jar files are possible as well. Abstract classes
-     * are not included in the results. For further filtering use e.g. Stream.filter.
-     * </p>
-     * @param seedClass starting point for classpath scanning
-     *
-     * @return Stream of all concrete classes in the same package as the seedclass, and also all classes in subpackages.
-     */
-    public static Stream<? extends Class<?>> findClasses( final Class<?> seedClass )
-    {
-        CodeSource codeSource = seedClass.getProtectionDomain().getCodeSource();
-        if( codeSource == null )
-        {
-            return Stream.of();
-        }
-
-        URL location = codeSource.getLocation();
-
-        if( !location.getProtocol().equals( "file" ) )
-        {
-            throw new IllegalArgumentException(
-                "Can only enumerate classes from file system locations. URL is:" + location );
-        }
-
-        final File file;
-        try
-        {
-            file = new File( location.toURI().getPath() );
-        }
-        catch( URISyntaxException e )
-        {
-            throw new IllegalArgumentException(
-                "The file location of codebase is invalid. Can not convert to URI. URL is:" + location );
-        }
-
-        if( file.getName().endsWith( ".jar" ) )
-        {
-            try
-            {
-                final String packageName = seedClass.getPackage().getName().replace( '.', '/' );
-
-                JarFile jarFile = new JarFile( file );
-                List<JarEntry> entries = Collections.list( jarFile.entries() );
-                try
-                {
-                    return entries.stream()
-                                  .filter( jarEntry -> jarEntry.getName().startsWith( packageName )
-                                                       && jarEntry.getName().endsWith( ".class" ) )
-                                  .map( jarEntry ->
-                                        {
-                                            String name = jarEntry.getName();
-                                            name = name.substring( 0, name.length() - 6 );
-                                            name = name.replace( '/', '.' );
-                                            try
-                                            {
-                                                return seedClass.getClassLoader().loadClass( name );
-                                            }
-                                            catch( ClassNotFoundException e )
-                                            {
-                                                return null;
-                                            }
-                                        } )
-                                  .filter( VALID_CLASS_PREDICATE );
-                }
-                finally
-                {
-                    jarFile.close();
-                }
-            }
-            catch( IOException e )
-            {
-                throw new IllegalArgumentException( "Could not open jar file " + file, e );
-            }
-        }
-        else
-        {
-            final File path = new File( file, seedClass.getPackage().getName().replace( '.', File.separatorChar ) );
-            Stream<File> classFiles = findFiles( path, candidate -> candidate.getName().endsWith( ".class" ) );
-            return classFiles
-                .map( classFile ->
-                      {
-                          String fileName = classFile.getAbsolutePath().substring( file.toString().length() + 1 );
-                          fileName = fileName.replace( File.separatorChar, '.' ).substring( 0, fileName.length() - 6 );
-                          try
-                          {
-                              return seedClass.getClassLoader().loadClass( fileName );
-                          }
-                          catch( ClassNotFoundException e )
-                          {
-                              return null;
-                          }
-                      } )
-                .filter( VALID_CLASS_PREDICATE );
-        }
-    }
-
-    /**
-     * Useful specification for filtering classes based on a regular expression matching the class names.
-     * <p>
-     * Example: matches(".*Model") -&gt; match only class names that end with Model
-     * </p>
-     *
-     * @param regex The regular expression to be matched.
-     *
-     * @return regex class name specification
-     */
-    public static Predicate<Class<?>> matches( String regex )
-    {
-        final Pattern pattern = Pattern.compile( regex );
-        return aClass -> pattern.matcher( aClass.getName() ).matches();
-    }
-
-    private static Stream<File> findFiles( File directory, final Predicate<File> filter )
-    {
-        File[] listedFiles = directory.listFiles();
-        if( listedFiles == null )
-        {
-            return Stream.of();
-        }
-        return Stream.concat( Stream.of( listedFiles ).filter( filter ),
-                              Stream.of( listedFiles )
-                                    .filter( File::isDirectory )
-                                    .map( dir -> findFiles( dir, filter ) )
-                                    .flatMap( Function.identity() ) );
-    }
-
-    private static class ValidClass
-        implements Predicate<Class<?>>
-    {
-        @Override
-        public boolean test( Class<?> item )
-        {
-            return ( item.isInterface() || !Modifier.isAbstract( item.getModifiers() ) )
-                   && ( !item.isEnum() && !item.isAnonymousClass() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
deleted file mode 100644
index 19b26ea..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single ConfigurationComposite in a Module.
- */
-public interface ConfigurationAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
deleted file mode 100644
index 270fd68..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ConfigurationDeclaration.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring configurations. Instances
- * of this API are acquired by calling {@link ModuleAssembly#configurations(Class[])}.
- */
-public interface ConfigurationDeclaration
-{
-    /**
-     * Set additional metainfo for this configuration declaration.
-     *
-     * @param info metainfo that can be retrieved from the CompositeDescriptor.
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration setMetaInfo( Object info );
-
-    /**
-     * Set visibility for declared entities.
-     *
-     * @param visibility The {@link Visibility} that this ConfigurationComposite will have.
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration visibleIn( Visibility visibility );
-
-    /**
-     * Declare additional concerns for these configurations.
-     *
-     * @param concerns The concerns that are to be added to the ConfigurationComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration withConcerns( Class<?>... concerns );
-
-    /**
-     * Declare additional side-effects for these configurations.
-     *
-     * @param sideEffects The sideeffects that are to be added to the ConfigurationComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration withSideEffects( Class<?>... sideEffects );
-
-    /**
-     * Declare additional mixins for these configurations.
-     * <p>
-     * This can be useful to override any default mixins from the configuration interface.
-     * </p>
-     * @param mixins The mixins that are to be added to the ConfigurationComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration withMixins( Class<?>... mixins );
-
-    /**
-     * Declare additional interfaces for these declared interfaces.
-     * <p>
-     * This can be useful to add types that the Configuration should implement, but
-     * which you do not want to include in the entity interface itself.
-     * </p>
-     * @param types list of interfaces to add
-     *
-     * @return This instance for a fluid DSL
-     */
-    ConfigurationDeclaration withTypes( Class<?>... types );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
deleted file mode 100644
index 7435d39..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/Energy4Java.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.PolygeneAPI;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.spi.PolygeneSPI;
-
-/**
- * Main bootstrap class for starting Polygene and creating new applications.
- * <p>
- * Instantiate this and call one of the factory methods to get started.
- * </p>
- * <p>
- * This class will use the Service Loader mechanism in Java to try to locate a runtime that implements
- * the PolygeneRuntime interface. This avoids a direct dependency from the bootstrap to the runtime.
- * </p>
- */
-public final class Energy4Java
-{
-    private PolygeneRuntime runtime;
-
-    public Energy4Java( RuntimeFactory runtimeFactory )
-    {
-        this( runtimeFactory.createRuntime() );
-    }
-
-    public Energy4Java()
-    {
-        this( new RuntimeFactory.StandaloneApplicationRuntimeFactory().createRuntime() );
-    }
-
-    public Energy4Java( PolygeneRuntime runtime )
-    {
-        if( runtime == null )
-        {
-            throw new BootstrapException( "Can not create Polygene without a Polygene Runtime." );
-        }
-        this.runtime = runtime;
-    }
-
-    public ApplicationDescriptor newApplicationModel( ApplicationAssembler assembler )
-        throws AssemblyException
-    {
-        ApplicationAssembly assembly = assembler.assemble( runtime.applicationAssemblyFactory() );
-
-        if( assembly == null )
-        {
-            throw new AssemblyException( "Application assembler did not return any ApplicationAssembly" );
-        }
-
-        try
-        {
-            ApplicationModelFactory modelFactory = runtime.applicationModelFactory();
-            return modelFactory.newApplicationModel( assembly );
-        }
-        catch( RuntimeException e )
-        {
-            throw new AssemblyException( "Unable to create Application Model.", e );
-        }
-    }
-
-    public Application newApplication( ApplicationAssembler assembler, Object... importedServiceInstances )
-        throws AssemblyException
-    {
-        ApplicationDescriptor model = newApplicationModel( assembler );
-        return model.newInstance( runtime.spi(), importedServiceInstances );
-    }
-
-    public PolygeneSPI spi()
-    {
-        return runtime.spi();
-    }
-
-    public PolygeneAPI api()
-    {
-        return runtime.spi();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
deleted file mode 100644
index 7703a61..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single EntityComposite in a Module.
- */
-public interface EntityAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
deleted file mode 100644
index 8c07dbf..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/EntityDeclaration.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.common.Visibility;
-
-/**
- * Fluent API for declaring entities. Instances
- * of this API are acquired by calling {@link ModuleAssembly#entities(Class[])}.
- */
-public interface EntityDeclaration
-{
-    /**
-     * Set additional metainfo for this entity declaration.
-     *
-     * @param info metainfo that can be retrieved from the EntityDescriptor.
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration setMetaInfo( Object info );
-
-    /**
-     * Set visibility for declared entities.
-     *
-     * @param visibility The {@link Visibility} that this EntityComposite will have.
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration visibleIn( Visibility visibility );
-
-    /**
-     * Declare additional concerns for these entities.
-     *
-     * @param concerns The concerns that are to be added to the EntityComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration withConcerns( Class<?>... concerns );
-
-    /**
-     * Declare additional side-effects for these entitites.
-     *
-     * @param sideEffects The sideeffects that are to be added to the EntityComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration withSideEffects( Class<?>... sideEffects );
-
-    /**
-     * Declare additional mixins for these entities.
-     * <p>
-     * This can be useful to override any default mixins from the entity interface.
-     * </p>
-     * @param mixins The mixins that are to be added to the EntityComposite beyond the statically declared ones.
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration withMixins( Class<?>... mixins );
-
-    /**
-     * Declare additional interfaces for these declared interfaces.
-     * <p>
-     * This can be useful to add types that the entities should implement, but
-     * which you do not want to include in the entity interface itself.
-     * </p>
-     * @param types list of interfaces to add
-     *
-     * @return This instance for a fluid DSL
-     */
-    EntityDeclaration withTypes( Class<?>... types );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
deleted file mode 100644
index 22768aa..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceAssembly.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single imported service in a Module.
- */
-public interface ImportedServiceAssembly
-    extends HasTypes
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
deleted file mode 100644
index 7cb41cd..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ImportedServiceDeclaration.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.common.Visibility;
-import org.apache.zest.api.service.ServiceImporter;
-import org.apache.zest.api.service.importer.InstanceImporter;
-import org.apache.zest.api.service.importer.NewObjectImporter;
-import org.apache.zest.api.service.importer.ServiceInstanceImporter;
-import org.apache.zest.api.service.importer.ServiceSelectorImporter;
-
-/**
- * Fluent API for declaring imported services. Instances
- * of this API are acquired by calling {@link ModuleAssembly#importedServices(Class[])}.
- */
-public interface ImportedServiceDeclaration
-{
-    // Convenience constants for common service importers
-    public static final Class<? extends ServiceImporter> INSTANCE = InstanceImporter.class;
-    public static final Class<? extends ServiceImporter> NEW_OBJECT = NewObjectImporter.class;
-    public static final Class<? extends ServiceImporter> SERVICE_SELECTOR = ServiceSelectorImporter.class;
-    public static final Class<? extends ServiceImporter> SERVICE_IMPORTER = ServiceInstanceImporter.class;
-
-    ImportedServiceDeclaration visibleIn( Visibility visibility );
-
-    ImportedServiceDeclaration importedBy( Class<? extends ServiceImporter> serviceImporterClass );
-
-    ImportedServiceDeclaration identifiedBy( String identity );
-
-    ImportedServiceDeclaration taggedWith( String... tags );
-
-    ImportedServiceDeclaration setMetaInfo( Object serviceAttribute );
-    
-    ImportedServiceDeclaration importOnStartup();
-
-    /**
-     * Set the imported service activators. Activators are executed in order around
-     * the ServiceReference activation and passivation.
-     *
-     * @param activators the imported service activators
-     * @return the assembly
-     */    
-    @SuppressWarnings( { "unchecked","varargs" } )
-    ImportedServiceDeclaration withActivators( Class<? extends Activator<?>>... activators );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
deleted file mode 100644
index d55fc47..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InjectionException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Thrown by the Polygene runtime if a dependency can not be injected.
- */
-public class InjectionException
-    extends RuntimeException
-{
-    public InjectionException( String s )
-    {
-        super( s );
-    }
-
-    public InjectionException( String s, Throwable throwable )
-    {
-        super( s, throwable );
-    }
-
-    public InjectionException( Throwable throwable )
-    {
-        super( throwable );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
deleted file mode 100644
index 6d5b6db..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/InvalidInjectionException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Thrown by the Polygene runtime if a dependency injection declaration is invalid.
- */
-public class InvalidInjectionException
-    extends Exception
-{
-    public InvalidInjectionException( String s )
-    {
-        super( s );
-    }
-
-    public InvalidInjectionException( String s, Throwable throwable )
-    {
-        super( s, throwable );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
deleted file mode 100644
index 57b3cad..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerAssembly.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.util.function.Predicate;
-import org.apache.zest.api.activation.Activator;
-import org.apache.zest.api.structure.Layer;
-
-/**
- * Fluid API for declaring a layer in an application. This is obtained by calling {@link ApplicationAssembly#layer(String)}.
- */
-public interface LayerAssembly
-{
-    /**
-     * Get an assembly for a particular Module. If this is called many times with the same name, then the same module
-     * is affected.
-     *
-     * @param name The name of the Module to retrieve or create.
-     *
-     * @return The ModuleAssembly for the Module.
-     */
-    ModuleAssembly module( String name );
-
-    ApplicationAssembly application();
-
-    String name();
-
-    LayerAssembly setName( String name );
-
-    LayerAssembly setMetaInfo( Object info );
-
-    LayerAssembly uses( LayerAssembly... layerAssembly );
-
-    /**
-     * Set the layer activators. Activators are executed in order around the
-     * Layer activation and passivation.
-     *
-     * @param activators the layer activators
-     * @return the assembly
-     */    
-    @SuppressWarnings( { "unchecked","varargs" } )
-    LayerAssembly withActivators( Class<? extends Activator<Layer>>... activators );
-
-    <ThrowableType extends Throwable> void visit( AssemblyVisitor<ThrowableType> visitor )
-        throws ThrowableType;
-
-    /**
-     * Given a Specification for EntityAssembly's, returns a EntityDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the EntityComposite types of interest.
-     *
-     * @return An EntityDeclaration for the specified EntityComposite types.
-     */
-    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
-
-    /**
-     * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the ServiceComposite types of interest.
-     *
-     * @return An ServiceDeclaration for the specified ServiceComposite types.
-     */
-    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
-
-    /**
-     * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the TransientComposite types of interest.
-     *
-     * @return An TransientDeclaration for the specified TransientComposite types.
-     */
-    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
-
-    /**
-     * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the ValueComposite types of interest.
-     *
-     * @return An ValueDeclaration for the specified ValueComposite types.
-     */
-    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
-
-    /**
-     * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the Object types of interest.
-     *
-     * @return An ObjectDeclaration for the specified Object types.
-     */
-    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
-
-    /**
-     * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
-     * be used to work with all of the assemblies in this Layer matched by the specification.
-     *
-     * @param specification The Specification that specifies the Imported Service types of interest.
-     *
-     * @return An ImportedServiceDeclaration for the specified Imported Service types.
-     */
-    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
deleted file mode 100644
index 938f990..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/LayerName.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Set the name of the layer
- */
-public final class LayerName
-    implements Assembler
-{
-    private final String name;
-
-    public LayerName( String name )
-    {
-        this.name = name;
-    }
-
-    @Override
-    public void assemble( ModuleAssembly module )
-        throws AssemblyException
-    {
-        module.layer().setName( name );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
deleted file mode 100644
index 0dcaf61..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/ManyAssociationDeclarations.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.lang.reflect.AccessibleObject;
-import org.apache.zest.api.common.MetaInfo;
-
-/**
- * This provides declared {@link org.apache.zest.api.association.ManyAssociation} information that the runtime can use.
- */
-public interface ManyAssociationDeclarations
-{
-    MetaInfo metaInfoFor( AccessibleObject accessor );
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MetaInfoDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MetaInfoDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MetaInfoDeclaration.java
deleted file mode 100644
index 2feafd3..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MetaInfoDeclaration.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.zest.api.common.MetaInfo;
-import org.apache.zest.api.property.Property;
-
-/**
- * Declaration of a Property or Association.
- */
-public final class MetaInfoDeclaration
-    implements StateDeclarations, AssociationDeclarations, ManyAssociationDeclarations, NamedAssociationDeclarations
-{
-    Map<Class<?>, InfoHolder<?>> mixinPropertyDeclarations = new HashMap<>();
-
-    public MetaInfoDeclaration()
-    {
-    }
-
-    public <T> MixinDeclaration<T> on( Class<T> mixinType )
-    {
-        @SuppressWarnings( "unchecked" )
-        InfoHolder<T> propertyDeclarationHolder = (InfoHolder<T>) mixinPropertyDeclarations.get( mixinType );
-        if( propertyDeclarationHolder == null )
-        {
-            propertyDeclarationHolder = new InfoHolder<>( mixinType );
-            mixinPropertyDeclarations.put( mixinType, propertyDeclarationHolder );
-        }
-        return propertyDeclarationHolder;
-    }
-
-    @Override
-    public MetaInfo metaInfoFor( AccessibleObject accessor )
-    {
-        for( Map.Entry<Class<?>, InfoHolder<?>> entry : mixinPropertyDeclarations.entrySet() )
-        {
-            InfoHolder<?> holder = entry.getValue();
-            MetaInfo metaInfo = holder.metaInfoFor( accessor );
-            if( metaInfo != null )
-            {
-                Class<?> mixinType = entry.getKey();
-                return metaInfo.withAnnotations( mixinType )
-                    .withAnnotations( accessor )
-                    .withAnnotations( accessor instanceof Method ? ( (Method) accessor ).getReturnType() : ( (Field) accessor )
-                        .getType() );
-            }
-        }
-        // TODO is this code reached at all??
-        Class<?> declaringType = ( (Member) accessor ).getDeclaringClass();
-        return new MetaInfo().withAnnotations( declaringType )
-            .withAnnotations( accessor )
-            .withAnnotations( accessor instanceof Method ? ( (Method) accessor ).getReturnType() : ( (Field) accessor ).getType() );
-    }
-
-    @Override
-    public Object initialValueOf( AccessibleObject accessor )
-    {
-        for( InfoHolder<?> propertyDeclarationHolder : mixinPropertyDeclarations.values() )
-        {
-            final Object initialValue = propertyDeclarationHolder.initialValueOf( accessor );
-            if( initialValue != null )
-            {
-                return initialValue;
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public boolean useDefaults( AccessibleObject accessor )
-    {
-        for( InfoHolder<?> propertyDeclarationHolder : mixinPropertyDeclarations.values() )
-        {
-            final boolean useDefaults = propertyDeclarationHolder.useDefaults( accessor );
-            if( useDefaults )
-            {
-                return useDefaults;
-            }
-        }
-        return false;
-    }
-
-    private static class InfoHolder<T>
-        implements InvocationHandler, StateDeclarations, MixinDeclaration<T>
-    {
-        private final static class MethodInfo
-        {
-            Object initialValue;
-            boolean useDefaults;
-            MetaInfo metaInfo;
-
-            private MethodInfo( MetaInfo metaInfo )
-            {
-                this.metaInfo = metaInfo;
-            }
-        }
-
-        private final Class<T> mixinType;
-        private final Map<AccessibleObject, MethodInfo> methodInfos = new HashMap<>();
-        // temporary holder
-        private MetaInfo metaInfo = null;
-
-        private InfoHolder( Class<T> mixinType )
-        {
-            this.mixinType = mixinType;
-        }
-
-        @Override
-        @SuppressWarnings( "raw" )
-        public Object invoke( Object o, Method method, Object[] objects )
-            throws Throwable
-        {
-            final MethodInfo methodInfo = new MethodInfo( metaInfo );
-            methodInfo.useDefaults = true;
-            methodInfos.put( method, methodInfo );
-            metaInfo = null; // reset
-            final Class<?> returnType = method.getReturnType();
-            try
-            {
-                return Proxy.newProxyInstance( returnType.getClassLoader(), new Class[]{ returnType },
-                                               ( o1, method1, objects1 ) -> {
-                                                   if( method1.getName().equals( "set" ) )
-                                                   {
-                                                       methodInfo.initialValue = objects1[ 0 ];
-                                                   }
-                                                   return null;
-                                               } );
-            }
-            catch( IllegalArgumentException e )
-            {
-                throw new IllegalArgumentException(
-                    "Only methods with " + Property.class.getName() + " as return type can have declareDefaults()" );
-            }
-        }
-
-        public MethodInfo matches( AccessibleObject accessor )
-        {
-            return methodInfos.get( accessor );
-        }
-
-        @Override
-        public MetaInfo metaInfoFor( AccessibleObject accessor )
-        {
-            final MethodInfo methodInfo = matches( accessor );
-            if( methodInfo == null )
-            {
-                return null;
-            }
-            return methodInfo.metaInfo;
-        }
-
-        @Override
-        public Object initialValueOf( AccessibleObject accessor )
-        {
-            final MethodInfo methodInfo = matches( accessor );
-            if( methodInfo == null )
-            {
-                return null;
-            }
-            return methodInfo.initialValue;
-        }
-
-        @Override
-        public boolean useDefaults( AccessibleObject accessor )
-        {
-            final MethodInfo methodInfo = matches( accessor );
-            if( methodInfo == null )
-            {
-                return false;
-            }
-            return methodInfo.useDefaults;
-        }
-
-        // DSL Interface
-
-        @Override
-        @SuppressWarnings( "raw" )
-        public T declareDefaults()
-        {
-            return mixinType.cast(
-                Proxy.newProxyInstance( mixinType.getClassLoader(), new Class[]{ mixinType }, this ) );
-        }
-
-        @Override
-        public MixinDeclaration<T> setMetaInfo( Object info )
-        {
-            if( metaInfo == null )
-            {
-                metaInfo = new MetaInfo();
-            }
-            metaInfo.set( info );
-            return this;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/1c722f44/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MixinDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MixinDeclaration.java b/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MixinDeclaration.java
deleted file mode 100644
index 57328f4..0000000
--- a/core/bootstrap/src/main/java/org/apache/zest/bootstrap/MixinDeclaration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.bootstrap;
-
-/**
- * Fluent API for declaring information about properties
- *
- * @param <T> Parameterized mixin type
- */
-public interface MixinDeclaration<T>
-{
-    T declareDefaults();
-
-    MixinDeclaration<T> setMetaInfo( Object info );
-}


[51/81] [abbrv] [partial] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
ZEST-195 ; Replace all "zest" with "polygene"


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

Branch: refs/heads/develop
Commit: 1c722f44bb04523c8e3ecf681cd69f83e2f1d018
Parents: 053a882
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Tue Dec 13 20:03:58 2016 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Tue Dec 13 20:13:05 2016 +0800

----------------------------------------------------------------------
 build.gradle                                    |    6 +-
 .../polygene/gradle/AllProjectsPlugin.groovy    |  208 ++
 .../polygene/gradle/CodeProjectsPlugin.groovy   |  146 ++
 .../polygene/gradle/RootProjectPlugin.groovy    |  262 +++
 .../apache/polygene/gradle/TaskGroups.groovy    |   40 +
 .../apache/polygene/gradle/ZestExtension.groovy |   79 +
 .../DependenciesDeclarationExtension.groovy     |   33 +
 .../DependenciesDeclarationPlugin.groovy        |   30 +
 .../dependencies/DependenciesPlugin.groovy      |   89 +
 .../gradle/dist/DistributionPlugin.groovy       |  387 ++++
 .../gradle/dist/GoOfflineHelpersTasks.groovy    |  345 ++++
 .../gradle/doc/AsciidocBuildInfoPlugin.groovy   |   60 +
 .../gradle/doc/DocumentationTask.groovy         |  292 +++
 .../polygene/gradle/doc/ManualPlugin.groovy     |  115 ++
 .../apache/polygene/gradle/doc/XsltTask.groovy  |  105 +
 .../performance/PerformanceTestsPlugin.groovy   |   62 +
 .../gradle/publish/MavenMetadata.groovy         |  281 +++
 .../gradle/publish/PublishingPlugin.groovy      |  183 ++
 .../gradle/release/CheckReleaseSpecTask.groovy  |   75 +
 .../gradle/release/ModuleReleaseSpec.groovy     |   44 +
 .../release/ReleaseApprovedProjectsTask.groovy  |   57 +
 .../gradle/release/ReleaseSpecExtension.groovy  |   40 +
 .../gradle/release/ReleaseSpecPlugin.groovy     |   56 +
 .../polygene/gradle/tasks/ExecLogged.groovy     |  117 ++
 .../test/AggregatedJacocoReportTask.groovy      |   91 +
 .../gradle/version/VersionClassPlugin.groovy    |   98 +
 .../apache/zest/gradle/AllProjectsPlugin.groovy |  208 --
 .../zest/gradle/CodeProjectsPlugin.groovy       |  146 --
 .../apache/zest/gradle/RootProjectPlugin.groovy |  262 ---
 .../org/apache/zest/gradle/TaskGroups.groovy    |   40 -
 .../org/apache/zest/gradle/ZestExtension.groovy |   79 -
 .../DependenciesDeclarationExtension.groovy     |   33 -
 .../DependenciesDeclarationPlugin.groovy        |   30 -
 .../dependencies/DependenciesPlugin.groovy      |   89 -
 .../zest/gradle/dist/DistributionPlugin.groovy  |  387 ----
 .../gradle/dist/GoOfflineHelpersTasks.groovy    |  345 ----
 .../gradle/doc/AsciidocBuildInfoPlugin.groovy   |   60 -
 .../zest/gradle/doc/DocumentationTask.groovy    |  292 ---
 .../apache/zest/gradle/doc/ManualPlugin.groovy  |  115 --
 .../org/apache/zest/gradle/doc/XsltTask.groovy  |  105 -
 .../performance/PerformanceTestsPlugin.groovy   |   62 -
 .../zest/gradle/publish/MavenMetadata.groovy    |  281 ---
 .../zest/gradle/publish/PublishingPlugin.groovy |  183 --
 .../gradle/release/CheckReleaseSpecTask.groovy  |   75 -
 .../gradle/release/ModuleReleaseSpec.groovy     |   44 -
 .../release/ReleaseApprovedProjectsTask.groovy  |   57 -
 .../gradle/release/ReleaseSpecExtension.groovy  |   40 -
 .../gradle/release/ReleaseSpecPlugin.groovy     |   56 -
 .../apache/zest/gradle/tasks/ExecLogged.groovy  |  117 --
 .../test/AggregatedJacocoReportTask.groovy      |   91 -
 .../gradle/version/VersionClassPlugin.groovy    |   98 -
 .../java/org/apache/polygene/api/ZestAPI.java   |  188 ++
 .../polygene/api/activation/Activation.java     |   60 +
 .../api/activation/ActivationEvent.java         |   99 +
 .../api/activation/ActivationEventListener.java |   29 +
 .../ActivationEventListenerRegistration.java    |   38 +
 .../api/activation/ActivationException.java     |   32 +
 .../polygene/api/activation/Activator.java      |   72 +
 .../api/activation/ActivatorAdapter.java        |   70 +
 .../api/activation/ActivatorDescriptor.java     |   27 +
 .../polygene/api/activation/Activators.java     |   41 +
 .../ApplicationPassivationThread.java           |  114 ++
 .../api/activation/PassivationException.java    |   57 +
 .../apache/polygene/api/activation/package.html |   29 +
 .../api/association/AbstractAssociation.java    |   28 +
 .../polygene/api/association/Association.java   |   52 +
 .../api/association/AssociationDescriptor.java  |   69 +
 .../api/association/AssociationMixin.java       |   58 +
 .../association/AssociationStateDescriptor.java |   54 +
 .../api/association/AssociationStateHolder.java |   79 +
 .../api/association/AssociationWrapper.java     |   81 +
 .../api/association/GenericAssociationInfo.java |   63 +
 .../api/association/ManyAssociation.java        |   58 +
 .../api/association/ManyAssociationMixin.java   |   58 +
 .../api/association/ManyAssociationWrapper.java |  126 ++
 .../api/association/NamedAssociation.java       |   93 +
 .../api/association/NamedAssociationMixin.java  |   58 +
 .../association/NamedAssociationWrapper.java    |  125 ++
 .../polygene/api/association/package.html       |   24 +
 .../apache/polygene/api/cache/CacheOptions.java |   88 +
 .../org/apache/polygene/api/cache/package.html  |   43 +
 .../apache/polygene/api/common/AppliesTo.java   |  111 ++
 .../polygene/api/common/AppliesToFilter.java    |   89 +
 .../api/common/ConstructionException.java       |   60 +
 .../api/common/InvalidApplicationException.java |   42 +
 .../apache/polygene/api/common/MetaInfo.java    |  154 ++
 .../apache/polygene/api/common/Optional.java    |   68 +
 .../polygene/api/common/QualifiedName.java      |  258 +++
 .../apache/polygene/api/common/TypeName.java    |  112 ++
 .../apache/polygene/api/common/UseDefaults.java |   92 +
 .../apache/polygene/api/common/Visibility.java  |   46 +
 .../org/apache/polygene/api/common/package.html |   84 +
 .../api/composite/AmbiguousTypeException.java   |   59 +
 .../polygene/api/composite/Composite.java       |   39 +
 .../api/composite/CompositeContext.java         |   84 +
 .../api/composite/CompositeDescriptor.java      |   34 +
 .../api/composite/CompositeInstance.java        |   45 +
 .../api/composite/CompositeInvoker.java         |   41 +
 .../api/composite/ConstructorDescriptor.java    |   31 +
 .../polygene/api/composite/DecoratorMixin.java  |  106 +
 .../api/composite/DependencyDescriptor.java     |   41 +
 .../api/composite/InjectedFieldDescriptor.java  |   32 +
 .../api/composite/InjectedMethodDescriptor.java |   31 +
 .../composite/InjectedParametersDescriptor.java |   28 +
 .../composite/InvalidCompositeException.java    |   32 +
 .../InvalidValueCompositeException.java         |   32 +
 .../api/composite/MethodDescriptor.java         |   31 +
 .../api/composite/MissingMethodException.java   |   38 +
 .../polygene/api/composite/ModelDescriptor.java |   41 +
 .../api/composite/NoSuchCompositeException.java |   59 +
 .../api/composite/NoSuchTransientException.java |   42 +
 .../polygene/api/composite/PropertyMapper.java  |  655 ++++++
 .../polygene/api/composite/StateDescriptor.java |   39 +
 .../composite/StatefulCompositeDescriptor.java  |   28 +
 .../api/composite/TransientBuilder.java         |   71 +
 .../api/composite/TransientBuilderFactory.java  |   59 +
 .../api/composite/TransientComposite.java       |   37 +
 .../api/composite/TransientDescriptor.java      |   29 +
 .../apache/polygene/api/composite/package.html  |   24 +
 .../polygene/api/concern/ConcernDescriptor.java |   29 +
 .../apache/polygene/api/concern/ConcernOf.java  |   46 +
 .../apache/polygene/api/concern/Concerns.java   |   39 +
 .../api/concern/ConcernsDescriptor.java         |   27 +
 .../polygene/api/concern/GenericConcern.java    |   34 +
 .../api/concern/internal/ConcernFor.java        |   67 +
 .../polygene/api/concern/internal/package.html  |   28 +
 .../apache/polygene/api/concern/package.html    |   24 +
 .../api/configuration/Configuration.java        |  401 ++++
 .../configuration/ConfigurationComposite.java   |   37 +
 .../polygene/api/configuration/Enabled.java     |   34 +
 .../NoSuchConfigurationException.java           |   50 +
 .../polygene/api/configuration/package.html     |   24 +
 .../polygene/api/constraint/Constraint.java     |   45 +
 .../api/constraint/ConstraintDeclaration.java   |   37 +
 .../api/constraint/ConstraintDescriptor.java    |   31 +
 ...nstraintImplementationNotFoundException.java |   34 +
 .../api/constraint/ConstraintViolation.java     |   58 +
 .../ConstraintViolationException.java           |  261 +++
 .../polygene/api/constraint/Constraints.java    |   42 +
 .../api/constraint/ConstraintsDescriptor.java   |   28 +
 .../apache/polygene/api/constraint/Name.java    |   37 +
 .../apache/polygene/api/constraint/package.html |   24 +
 .../apache/polygene/api/entity/Aggregated.java  |   37 +
 .../polygene/api/entity/EntityBuilder.java      |   63 +
 .../api/entity/EntityBuilderTemplate.java       |   44 +
 .../polygene/api/entity/EntityComposite.java    |   36 +
 .../polygene/api/entity/EntityDescriptor.java   |   37 +
 .../polygene/api/entity/EntityReference.java    |  123 ++
 .../apache/polygene/api/entity/Lifecycle.java   |   87 +
 .../polygene/api/entity/LifecycleException.java |   39 +
 .../apache/polygene/api/entity/Queryable.java   |   38 +
 .../org/apache/polygene/api/entity/package.html |   24 +
 .../org/apache/polygene/api/event/package.html  |   24 +
 .../polygene/api/identity/HasIdentity.java      |   76 +
 .../polygene/api/identity/Identifiable.java     |   25 +
 .../apache/polygene/api/identity/Identity.java  |   33 +
 .../api/identity/IdentityGenerator.java         |   39 +
 .../polygene/api/identity/StringIdentity.java   |   86 +
 .../api/identity/UuidGeneratorMixin.java        |   32 +
 .../polygene/api/injection/InjectionScope.java  |   37 +
 .../apache/polygene/api/injection/package.html  |   24 +
 .../api/injection/scope/Invocation.java         |   55 +
 .../polygene/api/injection/scope/Service.java   |   48 +
 .../polygene/api/injection/scope/State.java     |   54 +
 .../polygene/api/injection/scope/Structure.java |   54 +
 .../polygene/api/injection/scope/This.java      |   47 +
 .../polygene/api/injection/scope/Uses.java      |   45 +
 .../polygene/api/injection/scope/package.html   |   24 +
 .../org/apache/polygene/api/metrics/Metric.java |   28 +
 .../polygene/api/metrics/MetricNames.java       |   95 +
 .../polygene/api/metrics/MetricsCounter.java    |   35 +
 .../api/metrics/MetricsCounterFactory.java      |   37 +
 .../polygene/api/metrics/MetricsFactory.java    |   31 +
 .../polygene/api/metrics/MetricsGauge.java      |   38 +
 .../api/metrics/MetricsGaugeFactory.java        |   38 +
 .../api/metrics/MetricsHealthCheck.java         |   59 +
 .../api/metrics/MetricsHealthCheckFactory.java  |   39 +
 .../polygene/api/metrics/MetricsHistogram.java  |   31 +
 .../api/metrics/MetricsHistogramFactory.java    |   38 +
 .../polygene/api/metrics/MetricsMeter.java      |   39 +
 .../api/metrics/MetricsMeterFactory.java        |   37 +
 .../metrics/MetricsNotSupportedException.java   |   33 +
 .../polygene/api/metrics/MetricsProvider.java   |   62 +
 .../polygene/api/metrics/MetricsTimer.java      |   43 +
 .../api/metrics/MetricsTimerFactory.java        |   38 +
 .../apache/polygene/api/metrics/package.html    |   24 +
 .../polygene/api/mixin/Initializable.java       |   36 +
 .../api/mixin/InitializationException.java      |   38 +
 .../api/mixin/InvalidMixinException.java        |   35 +
 .../polygene/api/mixin/MixinDescriptor.java     |   29 +
 .../api/mixin/MixinMappingException.java        |   35 +
 .../org/apache/polygene/api/mixin/Mixins.java   |   84 +
 .../apache/polygene/api/mixin/NoopMixin.java    |   84 +
 .../org/apache/polygene/api/mixin/package.html  |   24 +
 .../api/object/NoSuchObjectException.java       |   57 +
 .../polygene/api/object/ObjectDescriptor.java   |   31 +
 .../polygene/api/object/ObjectFactory.java      |   52 +
 .../org/apache/polygene/api/object/package.html |   24 +
 .../java/org/apache/polygene/api/package.html   |   24 +
 .../polygene/api/property/DefaultValues.java    |   88 +
 .../api/property/GenericPropertyInfo.java       |   63 +
 .../apache/polygene/api/property/Immutable.java |   37 +
 .../property/InvalidPropertyTypeException.java  |   41 +
 .../apache/polygene/api/property/Numbers.java   |  162 ++
 .../apache/polygene/api/property/Property.java  |   63 +
 .../api/property/PropertyDescriptor.java        |   62 +
 .../polygene/api/property/PropertyMixin.java    |   60 +
 .../polygene/api/property/PropertyWrapper.java  |   72 +
 .../polygene/api/property/StateHolder.java      |   44 +
 .../apache/polygene/api/property/package.html   |   24 +
 .../query/MissingIndexingSystemException.java   |   35 +
 .../api/query/NotQueryableException.java        |   90 +
 .../org/apache/polygene/api/query/Query.java    |  143 ++
 .../apache/polygene/api/query/QueryBuilder.java |   56 +
 .../polygene/api/query/QueryBuilderFactory.java |   40 +
 .../polygene/api/query/QueryException.java      |   43 +
 .../api/query/QueryExecutionException.java      |   39 +
 .../api/query/QueryExpressionException.java     |   36 +
 .../polygene/api/query/QueryExpressions.java    |  940 +++++++++
 .../api/query/grammar/AndPredicate.java         |   61 +
 .../api/query/grammar/AssociationFunction.java  |  149 ++
 .../grammar/AssociationNotNullPredicate.java    |   68 +
 .../query/grammar/AssociationNullPredicate.java |   68 +
 .../api/query/grammar/BinaryPredicate.java      |   44 +
 .../api/query/grammar/ComparisonPredicate.java  |   77 +
 .../api/query/grammar/ContainsAllPredicate.java |   79 +
 .../api/query/grammar/ContainsPredicate.java    |   68 +
 .../polygene/api/query/grammar/EqPredicate.java |   44 +
 .../api/query/grammar/ExpressionPredicate.java  |   31 +
 .../polygene/api/query/grammar/GePredicate.java |   45 +
 .../polygene/api/query/grammar/GtPredicate.java |   45 +
 .../polygene/api/query/grammar/LePredicate.java |   45 +
 .../polygene/api/query/grammar/LtPredicate.java |   45 +
 .../ManyAssociationContainsPredicate.java       |   66 +
 .../query/grammar/ManyAssociationFunction.java  |  118 ++
 .../api/query/grammar/MatchesPredicate.java     |   86 +
 .../NamedAssociationContainsNamePredicate.java  |   66 +
 .../NamedAssociationContainsPredicate.java      |   66 +
 .../query/grammar/NamedAssociationFunction.java |  118 ++
 .../polygene/api/query/grammar/NePredicate.java |   44 +
 .../api/query/grammar/Notpredicate.java         |   53 +
 .../polygene/api/query/grammar/OrPredicate.java |   62 +
 .../polygene/api/query/grammar/OrderBy.java     |   93 +
 .../api/query/grammar/PropertyFunction.java     |  180 ++
 .../query/grammar/PropertyNotNullPredicate.java |   61 +
 .../query/grammar/PropertyNullPredicate.java    |   61 +
 .../api/query/grammar/PropertyReference.java    |   32 +
 .../api/query/grammar/QuerySpecification.java   |   72 +
 .../polygene/api/query/grammar/Variable.java    |   44 +
 .../polygene/api/query/grammar/package.html     |   24 +
 .../org/apache/polygene/api/query/package.html  |   24 +
 .../polygene/api/service/Availability.java      |   40 +
 .../DuplicateServiceIdentityException.java      |   35 +
 .../api/service/ImportedServiceDescriptor.java  |   35 +
 .../api/service/NoSuchServiceException.java     |   54 +
 .../polygene/api/service/ServiceActivation.java |   69 +
 .../api/service/ServiceActivatorAdapter.java    |   71 +
 .../polygene/api/service/ServiceComposite.java  |   33 +
 .../polygene/api/service/ServiceDescriptor.java |   37 +
 .../polygene/api/service/ServiceFinder.java     |   94 +
 .../polygene/api/service/ServiceImporter.java   |   48 +
 .../api/service/ServiceImporterException.java   |   48 +
 .../polygene/api/service/ServiceReference.java  |   55 +
 .../service/ServiceUnavailableException.java    |   37 +
 .../api/service/importer/InstanceImporter.java  |   64 +
 .../api/service/importer/NewObjectImporter.java |   51 +
 .../importer/ServiceInstanceImporter.java       |   79 +
 .../importer/ServiceSelectorImporter.java       |   75 +
 .../polygene/api/service/importer/package.html  |   24 +
 .../apache/polygene/api/service/package.html    |   24 +
 .../polygene/api/service/qualifier/Active.java  |   57 +
 .../service/qualifier/AnnotationQualifier.java  |   33 +
 .../api/service/qualifier/Available.java        |   55 +
 .../api/service/qualifier/HasMetaInfo.java      |  108 +
 .../api/service/qualifier/IdentifiedBy.java     |   59 +
 .../api/service/qualifier/Qualifier.java        |   33 +
 .../api/service/qualifier/ServiceQualifier.java |  113 ++
 .../api/service/qualifier/ServiceTags.java      |   72 +
 .../polygene/api/service/qualifier/Tagged.java  |   60 +
 .../polygene/api/service/qualifier/package.html |   62 +
 .../api/sideeffect/GenericSideEffect.java       |   63 +
 .../api/sideeffect/SideEffectDescriptor.java    |   29 +
 .../polygene/api/sideeffect/SideEffectOf.java   |   40 +
 .../polygene/api/sideeffect/SideEffects.java    |   39 +
 .../api/sideeffect/SideEffectsDescriptor.java   |   27 +
 .../api/sideeffect/internal/SideEffectFor.java  |   69 +
 .../api/sideeffect/internal/package.html        |   28 +
 .../apache/polygene/api/sideeffect/package.html |   24 +
 .../polygene/api/structure/Application.java     |  101 +
 .../api/structure/ApplicationDescriptor.java    |   43 +
 .../apache/polygene/api/structure/Layer.java    |   43 +
 .../polygene/api/structure/LayerDescriptor.java |   57 +
 .../polygene/api/structure/MetaInfoHolder.java  |   39 +
 .../apache/polygene/api/structure/Module.java   |   94 +
 .../api/structure/ModuleDescriptor.java         |   96 +
 .../polygene/api/structure/TypeLookup.java      |  195 ++
 .../api/structure/UsedLayersDescriptor.java     |   31 +
 .../apache/polygene/api/structure/package.html  |   24 +
 .../apache/polygene/api/time/SystemTime.java    |   43 +
 .../polygene/api/type/CollectionType.java       |   78 +
 .../org/apache/polygene/api/type/EnumType.java  |   54 +
 .../org/apache/polygene/api/type/HasTypes.java  |   38 +
 .../org/apache/polygene/api/type/MapType.java   |   91 +
 .../api/type/MatchTypeSpecification.java        |   51 +
 .../apache/polygene/api/type/Serialization.java |   62 +
 .../polygene/api/type/ValueCompositeType.java   |   69 +
 .../org/apache/polygene/api/type/ValueType.java |  154 ++
 .../org/apache/polygene/api/type/package.html   |   24 +
 .../ConcurrentEntityModificationException.java  |   64 +
 .../EntityCompositeAlreadyExistsException.java  |   45 +
 .../api/unitofwork/NoSuchEntityException.java   |   80 +
 .../unitofwork/NoSuchEntityTypeException.java   |   44 +
 .../polygene/api/unitofwork/UnitOfWork.java     |  528 +++++
 .../api/unitofwork/UnitOfWorkCallback.java      |   57 +
 .../UnitOfWorkCompletionException.java          |   50 +
 .../api/unitofwork/UnitOfWorkException.java     |   48 +
 .../api/unitofwork/UnitOfWorkFactory.java       |   97 +
 .../api/unitofwork/UnitOfWorkOptions.java       |   44 +
 .../api/unitofwork/UnitOfWorkTemplate.java      |   94 +
 .../unitofwork/concern/UnitOfWorkConcern.java   |  212 ++
 .../unitofwork/concern/UnitOfWorkDiscardOn.java |   73 +
 .../concern/UnitOfWorkPropagation.java          |   92 +
 .../api/unitofwork/concern/UnitOfWorkRetry.java |   81 +
 .../api/unitofwork/concern/package.html         |   27 +
 .../apache/polygene/api/unitofwork/package.html |   24 +
 .../apache/polygene/api/usecase/Usecase.java    |   75 +
 .../polygene/api/usecase/UsecaseBuilder.java    |   59 +
 .../apache/polygene/api/usecase/package.html    |   24 +
 .../apache/polygene/api/util/Annotations.java   |   79 +
 .../org/apache/polygene/api/util/Classes.java   |  541 +++++
 .../apache/polygene/api/util/Collectors.java    |  105 +
 .../apache/polygene/api/util/Constructors.java  |   35 +
 .../org/apache/polygene/api/util/Fields.java    |   44 +
 .../polygene/api/util/HierarchicalVisitor.java  |   57 +
 .../api/util/HierarchicalVisitorAdapter.java    |   48 +
 .../org/apache/polygene/api/util/ListMap.java   |   48 +
 .../org/apache/polygene/api/util/Methods.java   |   50 +
 .../api/util/NullArgumentException.java         |   59 +
 .../org/apache/polygene/api/util/Visitable.java |   29 +
 .../polygene/api/util/VisitableHierarchy.java   |   29 +
 .../org/apache/polygene/api/util/Visitor.java   |   39 +
 .../org/apache/polygene/api/util/package.html   |   24 +
 .../MissingValueSerializationException.java     |   43 +
 .../api/value/NoSuchValueException.java         |   43 +
 .../apache/polygene/api/value/ValueBuilder.java |   62 +
 .../polygene/api/value/ValueBuilderFactory.java |  107 +
 .../api/value/ValueBuilderTemplate.java         |   44 +
 .../polygene/api/value/ValueComposite.java      |   49 +
 .../polygene/api/value/ValueDescriptor.java     |   38 +
 .../polygene/api/value/ValueDeserializer.java   |  166 ++
 .../polygene/api/value/ValueSerialization.java  |   56 +
 .../api/value/ValueSerializationException.java  |   50 +
 .../polygene/api/value/ValueSerializer.java     |  327 +++
 .../org/apache/polygene/api/value/package.html  |   24 +
 .../main/java/org/apache/zest/api/ZestAPI.java  |  188 --
 .../apache/zest/api/activation/Activation.java  |   60 -
 .../zest/api/activation/ActivationEvent.java    |   99 -
 .../api/activation/ActivationEventListener.java |   29 -
 .../ActivationEventListenerRegistration.java    |   38 -
 .../api/activation/ActivationException.java     |   32 -
 .../apache/zest/api/activation/Activator.java   |   72 -
 .../zest/api/activation/ActivatorAdapter.java   |   70 -
 .../api/activation/ActivatorDescriptor.java     |   27 -
 .../apache/zest/api/activation/Activators.java  |   41 -
 .../ApplicationPassivationThread.java           |  114 --
 .../api/activation/PassivationException.java    |   57 -
 .../org/apache/zest/api/activation/package.html |   29 -
 .../api/association/AbstractAssociation.java    |   28 -
 .../zest/api/association/Association.java       |   52 -
 .../api/association/AssociationDescriptor.java  |   69 -
 .../zest/api/association/AssociationMixin.java  |   58 -
 .../association/AssociationStateDescriptor.java |   54 -
 .../api/association/AssociationStateHolder.java |   79 -
 .../api/association/AssociationWrapper.java     |   81 -
 .../api/association/GenericAssociationInfo.java |   63 -
 .../zest/api/association/ManyAssociation.java   |   58 -
 .../api/association/ManyAssociationMixin.java   |   58 -
 .../api/association/ManyAssociationWrapper.java |  126 --
 .../zest/api/association/NamedAssociation.java  |   93 -
 .../api/association/NamedAssociationMixin.java  |   58 -
 .../association/NamedAssociationWrapper.java    |  125 --
 .../apache/zest/api/association/package.html    |   24 -
 .../org/apache/zest/api/cache/CacheOptions.java |   88 -
 .../java/org/apache/zest/api/cache/package.html |   43 -
 .../org/apache/zest/api/common/AppliesTo.java   |  111 --
 .../apache/zest/api/common/AppliesToFilter.java |   89 -
 .../zest/api/common/ConstructionException.java  |   60 -
 .../api/common/InvalidApplicationException.java |   42 -
 .../org/apache/zest/api/common/MetaInfo.java    |  154 --
 .../org/apache/zest/api/common/Optional.java    |   68 -
 .../apache/zest/api/common/QualifiedName.java   |  258 ---
 .../org/apache/zest/api/common/TypeName.java    |  112 --
 .../org/apache/zest/api/common/UseDefaults.java |   92 -
 .../org/apache/zest/api/common/Visibility.java  |   46 -
 .../org/apache/zest/api/common/package.html     |   84 -
 .../api/composite/AmbiguousTypeException.java   |   59 -
 .../apache/zest/api/composite/Composite.java    |   39 -
 .../zest/api/composite/CompositeContext.java    |   84 -
 .../zest/api/composite/CompositeDescriptor.java |   34 -
 .../zest/api/composite/CompositeInstance.java   |   45 -
 .../zest/api/composite/CompositeInvoker.java    |   41 -
 .../api/composite/ConstructorDescriptor.java    |   31 -
 .../zest/api/composite/DecoratorMixin.java      |  106 -
 .../api/composite/DependencyDescriptor.java     |   41 -
 .../api/composite/InjectedFieldDescriptor.java  |   32 -
 .../api/composite/InjectedMethodDescriptor.java |   31 -
 .../composite/InjectedParametersDescriptor.java |   28 -
 .../composite/InvalidCompositeException.java    |   32 -
 .../InvalidValueCompositeException.java         |   32 -
 .../zest/api/composite/MethodDescriptor.java    |   31 -
 .../api/composite/MissingMethodException.java   |   38 -
 .../zest/api/composite/ModelDescriptor.java     |   41 -
 .../api/composite/NoSuchCompositeException.java |   59 -
 .../api/composite/NoSuchTransientException.java |   42 -
 .../zest/api/composite/PropertyMapper.java      |  655 ------
 .../zest/api/composite/StateDescriptor.java     |   39 -
 .../composite/StatefulCompositeDescriptor.java  |   28 -
 .../zest/api/composite/TransientBuilder.java    |   71 -
 .../api/composite/TransientBuilderFactory.java  |   59 -
 .../zest/api/composite/TransientComposite.java  |   37 -
 .../zest/api/composite/TransientDescriptor.java |   29 -
 .../org/apache/zest/api/composite/package.html  |   24 -
 .../zest/api/concern/ConcernDescriptor.java     |   29 -
 .../org/apache/zest/api/concern/ConcernOf.java  |   46 -
 .../org/apache/zest/api/concern/Concerns.java   |   39 -
 .../zest/api/concern/ConcernsDescriptor.java    |   27 -
 .../apache/zest/api/concern/GenericConcern.java |   34 -
 .../zest/api/concern/internal/ConcernFor.java   |   67 -
 .../zest/api/concern/internal/package.html      |   28 -
 .../org/apache/zest/api/concern/package.html    |   24 -
 .../zest/api/configuration/Configuration.java   |  401 ----
 .../configuration/ConfigurationComposite.java   |   37 -
 .../apache/zest/api/configuration/Enabled.java  |   34 -
 .../NoSuchConfigurationException.java           |   50 -
 .../apache/zest/api/configuration/package.html  |   24 -
 .../apache/zest/api/constraint/Constraint.java  |   45 -
 .../api/constraint/ConstraintDeclaration.java   |   37 -
 .../api/constraint/ConstraintDescriptor.java    |   31 -
 ...nstraintImplementationNotFoundException.java |   34 -
 .../api/constraint/ConstraintViolation.java     |   58 -
 .../ConstraintViolationException.java           |  261 ---
 .../apache/zest/api/constraint/Constraints.java |   42 -
 .../api/constraint/ConstraintsDescriptor.java   |   28 -
 .../org/apache/zest/api/constraint/Name.java    |   37 -
 .../org/apache/zest/api/constraint/package.html |   24 -
 .../org/apache/zest/api/entity/Aggregated.java  |   37 -
 .../apache/zest/api/entity/EntityBuilder.java   |   63 -
 .../zest/api/entity/EntityBuilderTemplate.java  |   44 -
 .../apache/zest/api/entity/EntityComposite.java |   36 -
 .../zest/api/entity/EntityDescriptor.java       |   37 -
 .../apache/zest/api/entity/EntityReference.java |  123 --
 .../org/apache/zest/api/entity/Lifecycle.java   |   87 -
 .../zest/api/entity/LifecycleException.java     |   39 -
 .../org/apache/zest/api/entity/Queryable.java   |   38 -
 .../org/apache/zest/api/entity/package.html     |   24 -
 .../java/org/apache/zest/api/event/package.html |   24 -
 .../apache/zest/api/identity/HasIdentity.java   |   76 -
 .../apache/zest/api/identity/Identifiable.java  |   25 -
 .../org/apache/zest/api/identity/Identity.java  |   33 -
 .../zest/api/identity/IdentityGenerator.java    |   39 -
 .../zest/api/identity/StringIdentity.java       |   86 -
 .../zest/api/identity/UuidGeneratorMixin.java   |   32 -
 .../zest/api/injection/InjectionScope.java      |   37 -
 .../org/apache/zest/api/injection/package.html  |   24 -
 .../zest/api/injection/scope/Invocation.java    |   55 -
 .../zest/api/injection/scope/Service.java       |   48 -
 .../apache/zest/api/injection/scope/State.java  |   54 -
 .../zest/api/injection/scope/Structure.java     |   54 -
 .../apache/zest/api/injection/scope/This.java   |   47 -
 .../apache/zest/api/injection/scope/Uses.java   |   45 -
 .../zest/api/injection/scope/package.html       |   24 -
 .../org/apache/zest/api/metrics/Metric.java     |   28 -
 .../apache/zest/api/metrics/MetricNames.java    |   95 -
 .../apache/zest/api/metrics/MetricsCounter.java |   35 -
 .../zest/api/metrics/MetricsCounterFactory.java |   37 -
 .../apache/zest/api/metrics/MetricsFactory.java |   31 -
 .../apache/zest/api/metrics/MetricsGauge.java   |   38 -
 .../zest/api/metrics/MetricsGaugeFactory.java   |   38 -
 .../zest/api/metrics/MetricsHealthCheck.java    |   59 -
 .../api/metrics/MetricsHealthCheckFactory.java  |   39 -
 .../zest/api/metrics/MetricsHistogram.java      |   31 -
 .../api/metrics/MetricsHistogramFactory.java    |   38 -
 .../apache/zest/api/metrics/MetricsMeter.java   |   39 -
 .../zest/api/metrics/MetricsMeterFactory.java   |   37 -
 .../metrics/MetricsNotSupportedException.java   |   33 -
 .../zest/api/metrics/MetricsProvider.java       |   62 -
 .../apache/zest/api/metrics/MetricsTimer.java   |   43 -
 .../zest/api/metrics/MetricsTimerFactory.java   |   38 -
 .../org/apache/zest/api/metrics/package.html    |   24 -
 .../apache/zest/api/mixin/Initializable.java    |   36 -
 .../zest/api/mixin/InitializationException.java |   38 -
 .../zest/api/mixin/InvalidMixinException.java   |   35 -
 .../apache/zest/api/mixin/MixinDescriptor.java  |   29 -
 .../zest/api/mixin/MixinMappingException.java   |   35 -
 .../java/org/apache/zest/api/mixin/Mixins.java  |   84 -
 .../org/apache/zest/api/mixin/NoopMixin.java    |   84 -
 .../java/org/apache/zest/api/mixin/package.html |   24 -
 .../zest/api/object/NoSuchObjectException.java  |   57 -
 .../zest/api/object/ObjectDescriptor.java       |   31 -
 .../apache/zest/api/object/ObjectFactory.java   |   52 -
 .../org/apache/zest/api/object/package.html     |   24 -
 .../main/java/org/apache/zest/api/package.html  |   24 -
 .../apache/zest/api/property/DefaultValues.java |   88 -
 .../zest/api/property/GenericPropertyInfo.java  |   63 -
 .../org/apache/zest/api/property/Immutable.java |   37 -
 .../property/InvalidPropertyTypeException.java  |   41 -
 .../org/apache/zest/api/property/Numbers.java   |  162 --
 .../org/apache/zest/api/property/Property.java  |   63 -
 .../zest/api/property/PropertyDescriptor.java   |   63 -
 .../apache/zest/api/property/PropertyMixin.java |   60 -
 .../zest/api/property/PropertyWrapper.java      |   72 -
 .../apache/zest/api/property/StateHolder.java   |   44 -
 .../org/apache/zest/api/property/package.html   |   24 -
 .../query/MissingIndexingSystemException.java   |   35 -
 .../zest/api/query/NotQueryableException.java   |   90 -
 .../java/org/apache/zest/api/query/Query.java   |  143 --
 .../org/apache/zest/api/query/QueryBuilder.java |   56 -
 .../zest/api/query/QueryBuilderFactory.java     |   40 -
 .../apache/zest/api/query/QueryException.java   |   43 -
 .../zest/api/query/QueryExecutionException.java |   39 -
 .../api/query/QueryExpressionException.java     |   36 -
 .../apache/zest/api/query/QueryExpressions.java |  940 ---------
 .../zest/api/query/grammar/AndPredicate.java    |   61 -
 .../api/query/grammar/AssociationFunction.java  |  149 --
 .../grammar/AssociationNotNullPredicate.java    |   68 -
 .../query/grammar/AssociationNullPredicate.java |   68 -
 .../zest/api/query/grammar/BinaryPredicate.java |   44 -
 .../api/query/grammar/ComparisonPredicate.java  |   77 -
 .../api/query/grammar/ContainsAllPredicate.java |   80 -
 .../api/query/grammar/ContainsPredicate.java    |   68 -
 .../zest/api/query/grammar/EqPredicate.java     |   44 -
 .../api/query/grammar/ExpressionPredicate.java  |   31 -
 .../zest/api/query/grammar/GePredicate.java     |   45 -
 .../zest/api/query/grammar/GtPredicate.java     |   45 -
 .../zest/api/query/grammar/LePredicate.java     |   45 -
 .../zest/api/query/grammar/LtPredicate.java     |   45 -
 .../ManyAssociationContainsPredicate.java       |   66 -
 .../query/grammar/ManyAssociationFunction.java  |  118 --
 .../api/query/grammar/MatchesPredicate.java     |   86 -
 .../NamedAssociationContainsNamePredicate.java  |   66 -
 .../NamedAssociationContainsPredicate.java      |   66 -
 .../query/grammar/NamedAssociationFunction.java |  118 --
 .../zest/api/query/grammar/NePredicate.java     |   44 -
 .../zest/api/query/grammar/Notpredicate.java    |   53 -
 .../zest/api/query/grammar/OrPredicate.java     |   62 -
 .../apache/zest/api/query/grammar/OrderBy.java  |   93 -
 .../api/query/grammar/PropertyFunction.java     |  180 --
 .../query/grammar/PropertyNotNullPredicate.java |   61 -
 .../query/grammar/PropertyNullPredicate.java    |   61 -
 .../api/query/grammar/PropertyReference.java    |   32 -
 .../api/query/grammar/QuerySpecification.java   |   72 -
 .../apache/zest/api/query/grammar/Variable.java |   44 -
 .../apache/zest/api/query/grammar/package.html  |   24 -
 .../java/org/apache/zest/api/query/package.html |   24 -
 .../apache/zest/api/service/Availability.java   |   40 -
 .../DuplicateServiceIdentityException.java      |   35 -
 .../api/service/ImportedServiceDescriptor.java  |   35 -
 .../api/service/NoSuchServiceException.java     |   54 -
 .../zest/api/service/ServiceActivation.java     |   69 -
 .../api/service/ServiceActivatorAdapter.java    |   71 -
 .../zest/api/service/ServiceComposite.java      |   33 -
 .../zest/api/service/ServiceDescriptor.java     |   37 -
 .../apache/zest/api/service/ServiceFinder.java  |   94 -
 .../zest/api/service/ServiceImporter.java       |   48 -
 .../api/service/ServiceImporterException.java   |   48 -
 .../zest/api/service/ServiceReference.java      |   55 -
 .../service/ServiceUnavailableException.java    |   37 -
 .../api/service/importer/InstanceImporter.java  |   64 -
 .../api/service/importer/NewObjectImporter.java |   51 -
 .../importer/ServiceInstanceImporter.java       |   79 -
 .../importer/ServiceSelectorImporter.java       |   75 -
 .../zest/api/service/importer/package.html      |   24 -
 .../org/apache/zest/api/service/package.html    |   24 -
 .../zest/api/service/qualifier/Active.java      |   57 -
 .../service/qualifier/AnnotationQualifier.java  |   33 -
 .../zest/api/service/qualifier/Available.java   |   55 -
 .../zest/api/service/qualifier/HasMetaInfo.java |  108 -
 .../api/service/qualifier/IdentifiedBy.java     |   59 -
 .../zest/api/service/qualifier/Qualifier.java   |   33 -
 .../api/service/qualifier/ServiceQualifier.java |  113 --
 .../zest/api/service/qualifier/ServiceTags.java |   72 -
 .../zest/api/service/qualifier/Tagged.java      |   60 -
 .../zest/api/service/qualifier/package.html     |   62 -
 .../zest/api/sideeffect/GenericSideEffect.java  |   63 -
 .../api/sideeffect/SideEffectDescriptor.java    |   29 -
 .../zest/api/sideeffect/SideEffectOf.java       |   40 -
 .../apache/zest/api/sideeffect/SideEffects.java |   39 -
 .../api/sideeffect/SideEffectsDescriptor.java   |   27 -
 .../api/sideeffect/internal/SideEffectFor.java  |   69 -
 .../zest/api/sideeffect/internal/package.html   |   28 -
 .../org/apache/zest/api/sideeffect/package.html |   24 -
 .../apache/zest/api/structure/Application.java  |  101 -
 .../api/structure/ApplicationDescriptor.java    |   43 -
 .../org/apache/zest/api/structure/Layer.java    |   43 -
 .../zest/api/structure/LayerDescriptor.java     |   57 -
 .../zest/api/structure/MetaInfoHolder.java      |   39 -
 .../org/apache/zest/api/structure/Module.java   |   94 -
 .../zest/api/structure/ModuleDescriptor.java    |   97 -
 .../apache/zest/api/structure/TypeLookup.java   |  195 --
 .../api/structure/UsedLayersDescriptor.java     |   31 -
 .../org/apache/zest/api/structure/package.html  |   24 -
 .../org/apache/zest/api/time/SystemTime.java    |   43 -
 .../apache/zest/api/type/CollectionType.java    |   78 -
 .../java/org/apache/zest/api/type/EnumType.java |   54 -
 .../java/org/apache/zest/api/type/HasTypes.java |   38 -
 .../java/org/apache/zest/api/type/MapType.java  |   91 -
 .../zest/api/type/MatchTypeSpecification.java   |   51 -
 .../org/apache/zest/api/type/Serialization.java |   62 -
 .../zest/api/type/ValueCompositeType.java       |   69 -
 .../org/apache/zest/api/type/ValueType.java     |  154 --
 .../java/org/apache/zest/api/type/package.html  |   24 -
 .../ConcurrentEntityModificationException.java  |   64 -
 .../EntityCompositeAlreadyExistsException.java  |   45 -
 .../api/unitofwork/NoSuchEntityException.java   |   80 -
 .../unitofwork/NoSuchEntityTypeException.java   |   44 -
 .../apache/zest/api/unitofwork/UnitOfWork.java  |  528 -----
 .../zest/api/unitofwork/UnitOfWorkCallback.java |   57 -
 .../UnitOfWorkCompletionException.java          |   50 -
 .../api/unitofwork/UnitOfWorkException.java     |   48 -
 .../zest/api/unitofwork/UnitOfWorkFactory.java  |   97 -
 .../zest/api/unitofwork/UnitOfWorkOptions.java  |   44 -
 .../zest/api/unitofwork/UnitOfWorkTemplate.java |   94 -
 .../unitofwork/concern/UnitOfWorkConcern.java   |  212 --
 .../unitofwork/concern/UnitOfWorkDiscardOn.java |   73 -
 .../concern/UnitOfWorkPropagation.java          |   92 -
 .../api/unitofwork/concern/UnitOfWorkRetry.java |   81 -
 .../zest/api/unitofwork/concern/package.html    |   27 -
 .../org/apache/zest/api/unitofwork/package.html |   24 -
 .../org/apache/zest/api/usecase/Usecase.java    |   75 -
 .../apache/zest/api/usecase/UsecaseBuilder.java |   59 -
 .../org/apache/zest/api/usecase/package.html    |   24 -
 .../org/apache/zest/api/util/Annotations.java   |   79 -
 .../java/org/apache/zest/api/util/Classes.java  |  541 -----
 .../org/apache/zest/api/util/Collectors.java    |  105 -
 .../org/apache/zest/api/util/Constructors.java  |   35 -
 .../java/org/apache/zest/api/util/Fields.java   |   44 -
 .../zest/api/util/HierarchicalVisitor.java      |   57 -
 .../api/util/HierarchicalVisitorAdapter.java    |   48 -
 .../java/org/apache/zest/api/util/ListMap.java  |   48 -
 .../java/org/apache/zest/api/util/Methods.java  |   50 -
 .../zest/api/util/NullArgumentException.java    |   59 -
 .../org/apache/zest/api/util/Visitable.java     |   29 -
 .../zest/api/util/VisitableHierarchy.java       |   29 -
 .../java/org/apache/zest/api/util/Visitor.java  |   39 -
 .../java/org/apache/zest/api/util/package.html  |   24 -
 .../MissingValueSerializationException.java     |   43 -
 .../zest/api/value/NoSuchValueException.java    |   43 -
 .../org/apache/zest/api/value/ValueBuilder.java |   62 -
 .../zest/api/value/ValueBuilderFactory.java     |  107 -
 .../zest/api/value/ValueBuilderTemplate.java    |   45 -
 .../apache/zest/api/value/ValueComposite.java   |   49 -
 .../apache/zest/api/value/ValueDescriptor.java  |   38 -
 .../zest/api/value/ValueDeserializer.java       |  166 --
 .../zest/api/value/ValueSerialization.java      |   56 -
 .../api/value/ValueSerializationException.java  |   50 -
 .../apache/zest/api/value/ValueSerializer.java  |  327 ---
 .../java/org/apache/zest/api/value/package.html |   24 -
 .../org/apache/polygene/api/OperatorsTest.java  |  121 ++
 .../api/activation/ActivationEventsTest.java    |  294 +++
 .../activation/PassivationExceptionTest.java    |  214 ++
 .../polygene/api/annotation/MixinsTest.java     |   50 +
 .../polygene/api/annotation/ModifiedByTest.java |   50 +
 .../api/annotation/scope/ModifiesTest.java      |   51 +
 .../polygene/api/common/AppliesToTest.java      |   49 +
 .../polygene/api/common/QualifiedNameTest.java  |   84 +
 .../api/composite/PropertyMapperTest.java       |  240 +++
 .../api/concern/DocumentationSupport.java       |  101 +
 .../api/configuration/ConfigurationTest.java    |  110 +
 .../DeclareConfigurationDefaultsTest.java       |   85 +
 .../polygene/api/configuration/MailService.java |   69 +
 .../configuration/MailServiceConfiguration.java |   33 +
 .../api/docsupport/ApplicationDocs.java         |  275 +++
 .../api/docsupport/CompositionDocs.java         |   57 +
 .../apache/polygene/api/docsupport/package.html |   24 +
 .../api/injection/scope/StateFieldTest.java     |  149 ++
 .../polygene/api/injection/scope/ThisTest.java  |   54 +
 .../api/metrics/DocumentationSupport.java       |  114 ++
 .../apache/polygene/api/mixin/BankAccount.java  |   31 +
 .../java/org/apache/polygene/api/mixin/Car.java |   26 +
 .../apache/polygene/api/mixin/Something.java    |   28 +
 .../polygene/api/mixin/SomethingMixin.java      |   33 +
 .../apache/polygene/api/mixin/StartMixin.java   |   23 +
 .../apache/polygene/api/mixin/Startable.java    |   29 +
 .../org/apache/polygene/api/mixin/Vehicle.java  |   32 +
 .../apache/polygene/api/mixin/VehicleMixin.java |   23 +
 .../decoratorMixin/DecoratorMixinTest.java      |   92 +
 .../api/mixin/decoratorMixin/FooModel.java      |   37 +
 .../api/mixin/decoratorMixin/FooModelImpl.java  |   42 +
 .../FooModelInvocationHandler.java              |   48 +
 .../api/mixin/decoratorMixin/View1.java         |   44 +
 .../api/mixin/decoratorMixin/View2.java         |   41 +
 .../apache/polygene/api/mixin/partial/Car.java  |   31 +
 .../api/mixin/partial/CrashResultMixin.java     |   24 +
 .../polygene/api/mixin/partial/Crashable.java   |   24 +
 .../api/mixin/partial/SpeedLocation.java        |   29 +
 .../polygene/api/mixin/partial/SpeedMixin.java  |   34 +
 .../polygene/api/mixin/partial/Vehicle.java     |   27 +
 .../polygene/api/mixin/privateMixin/Cargo.java  |   37 +
 .../api/mixin/privateMixin/CargoMixin.java      |   47 +
 .../api/mixin/privateMixin/CargoState.java      |   31 +
 .../polygene/api/object/ObjectBuilderTest.java  |   75 +
 .../api/property/PropertyErrorTest.java         |   67 +
 .../api/service/DocumentationSupport.java       |  139 ++
 .../polygene/api/unitofwork/RemovalTest.java    |  133 ++
 .../api/unitofwork/UnitOfWorkTemplateTest.java  |   74 +
 .../apache/polygene/api/util/ClassesTest.java   |  211 ++
 .../polygene/api/util/CollectorsTest.java       |   75 +
 .../api/value/DocumentationSupport.java         |  277 +++
 .../api/value/ValueBuilderTemplateTest.java     |   85 +
 .../polygene/api/value/ValueCompositeTest.java  |  314 +++
 .../java/org/apache/zest/api/OperatorsTest.java |  121 --
 .../api/activation/ActivationEventsTest.java    |  294 ---
 .../activation/PassivationExceptionTest.java    |  214 --
 .../apache/zest/api/annotation/MixinsTest.java  |   50 -
 .../zest/api/annotation/ModifiedByTest.java     |   50 -
 .../zest/api/annotation/scope/ModifiesTest.java |   51 -
 .../apache/zest/api/common/AppliesToTest.java   |   49 -
 .../zest/api/common/QualifiedNameTest.java      |   84 -
 .../zest/api/composite/PropertyMapperTest.java  |  240 ---
 .../zest/api/concern/DocumentationSupport.java  |  101 -
 .../api/configuration/ConfigurationTest.java    |  110 -
 .../DeclareConfigurationDefaultsTest.java       |   85 -
 .../zest/api/configuration/MailService.java     |   69 -
 .../configuration/MailServiceConfiguration.java |   33 -
 .../zest/api/docsupport/ApplicationDocs.java    |  275 ---
 .../zest/api/docsupport/CompositionDocs.java    |   57 -
 .../org/apache/zest/api/docsupport/package.html |   24 -
 .../api/injection/scope/StateFieldTest.java     |  149 --
 .../zest/api/injection/scope/ThisTest.java      |   54 -
 .../zest/api/metrics/DocumentationSupport.java  |  115 --
 .../org/apache/zest/api/mixin/BankAccount.java  |   31 -
 .../java/org/apache/zest/api/mixin/Car.java     |   26 -
 .../org/apache/zest/api/mixin/Something.java    |   28 -
 .../apache/zest/api/mixin/SomethingMixin.java   |   33 -
 .../org/apache/zest/api/mixin/StartMixin.java   |   23 -
 .../org/apache/zest/api/mixin/Startable.java    |   29 -
 .../java/org/apache/zest/api/mixin/Vehicle.java |   32 -
 .../org/apache/zest/api/mixin/VehicleMixin.java |   23 -
 .../decoratorMixin/DecoratorMixinTest.java      |   92 -
 .../zest/api/mixin/decoratorMixin/FooModel.java |   37 -
 .../api/mixin/decoratorMixin/FooModelImpl.java  |   42 -
 .../FooModelInvocationHandler.java              |   48 -
 .../zest/api/mixin/decoratorMixin/View1.java    |   44 -
 .../zest/api/mixin/decoratorMixin/View2.java    |   41 -
 .../org/apache/zest/api/mixin/partial/Car.java  |   31 -
 .../api/mixin/partial/CrashResultMixin.java     |   24 -
 .../zest/api/mixin/partial/Crashable.java       |   24 -
 .../zest/api/mixin/partial/SpeedLocation.java   |   29 -
 .../zest/api/mixin/partial/SpeedMixin.java      |   34 -
 .../apache/zest/api/mixin/partial/Vehicle.java  |   27 -
 .../zest/api/mixin/privateMixin/Cargo.java      |   37 -
 .../zest/api/mixin/privateMixin/CargoMixin.java |   47 -
 .../zest/api/mixin/privateMixin/CargoState.java |   31 -
 .../zest/api/object/ObjectBuilderTest.java      |   75 -
 .../zest/api/property/PropertyErrorTest.java    |   67 -
 .../zest/api/service/DocumentationSupport.java  |  139 --
 .../apache/zest/api/unitofwork/RemovalTest.java |  134 --
 .../api/unitofwork/UnitOfWorkTemplateTest.java  |   74 -
 .../org/apache/zest/api/util/ClassesTest.java   |  211 --
 .../apache/zest/api/util/CollectorsTest.java    |   75 -
 .../zest/api/value/DocumentationSupport.java    |  277 ---
 .../api/value/ValueBuilderTemplateTest.java     |   85 -
 .../zest/api/value/ValueCompositeTest.java      |  314 ---
 .../api/configuration/MyService.properties      |   21 +
 .../zest/api/configuration/MyService.properties |   21 -
 .../bootstrap/ApplicationAssembler.java         |   39 +
 .../bootstrap/ApplicationAssemblerAdapter.java  |   49 +
 .../polygene/bootstrap/ApplicationAssembly.java |  111 ++
 .../bootstrap/ApplicationAssemblyFactory.java   |   63 +
 .../bootstrap/ApplicationModelFactory.java      |   33 +
 .../polygene/bootstrap/ApplicationName.java     |   42 +
 .../apache/polygene/bootstrap/Assembler.java    |   50 +
 .../polygene/bootstrap/AssemblerCollection.java |   76 +
 .../apache/polygene/bootstrap/Assemblers.java   |  448 +++++
 .../polygene/bootstrap/AssemblyException.java   |   46 +
 .../bootstrap/AssemblySpecifications.java       |   35 +
 .../polygene/bootstrap/AssemblyVisitor.java     |   60 +
 .../bootstrap/AssemblyVisitorAdapter.java       |   83 +
 .../bootstrap/AssociationDeclarations.java      |   32 +
 .../polygene/bootstrap/BindingException.java    |   38 +
 .../polygene/bootstrap/BootstrapException.java  |   38 +
 .../apache/polygene/bootstrap/ClassScanner.java |  182 ++
 .../bootstrap/ConfigurationAssembly.java        |   30 +
 .../bootstrap/ConfigurationDeclaration.java     |   89 +
 .../apache/polygene/bootstrap/Energy4Java.java  |   98 +
 .../polygene/bootstrap/EntityAssembly.java      |   30 +
 .../polygene/bootstrap/EntityDeclaration.java   |   89 +
 .../bootstrap/ImportedServiceAssembly.java      |   30 +
 .../bootstrap/ImportedServiceDeclaration.java   |   64 +
 .../polygene/bootstrap/InjectionException.java  |   43 +
 .../bootstrap/InvalidInjectionException.java    |   37 +
 .../polygene/bootstrap/LayerAssembly.java       |  124 ++
 .../apache/polygene/bootstrap/LayerName.java    |   42 +
 .../bootstrap/ManyAssociationDeclarations.java  |   32 +
 .../polygene/bootstrap/MetaInfoDeclaration.java |  221 ++
 .../polygene/bootstrap/MixinDeclaration.java    |   33 +
 .../polygene/bootstrap/ModuleAssembly.java      |  242 +++
 .../apache/polygene/bootstrap/ModuleName.java   |   42 +
 .../bootstrap/NamedAssociationDeclarations.java |   31 +
 .../polygene/bootstrap/ObjectAssembly.java      |   30 +
 .../polygene/bootstrap/ObjectDeclaration.java   |   35 +
 .../polygene/bootstrap/RuntimeFactory.java      |   63 +
 .../polygene/bootstrap/ServiceAssembly.java     |   30 +
 .../polygene/bootstrap/ServiceDeclaration.java  |   59 +
 .../polygene/bootstrap/SingletonAssembler.java  |  129 ++
 .../polygene/bootstrap/StateDeclarations.java   |   36 +
 .../polygene/bootstrap/TransientAssembly.java   |   30 +
 .../bootstrap/TransientDeclaration.java         |   42 +
 .../polygene/bootstrap/ValueAssembly.java       |   30 +
 .../polygene/bootstrap/ValueDeclaration.java    |   41 +
 .../apache/polygene/bootstrap/ZestRuntime.java  |   38 +
 .../bootstrap/builder/ApplicationBuilder.java   |  303 +++
 .../bootstrap/builder/LayerDeclaration.java     |  111 ++
 .../bootstrap/builder/ModuleDeclaration.java    |  168 ++
 .../polygene/bootstrap/builder/package.html     |   28 +
 .../DefaultIdentityGeneratorAssembler.java      |   38 +
 .../layered/IllegalLayerAssemblerException.java |   31 +
 .../bootstrap/layered/LayerAssembler.java       |   29 +
 .../layered/LayeredApplicationAssembler.java    |  297 +++
 .../layered/LayeredLayerAssembler.java          |   90 +
 .../bootstrap/layered/ModuleAssembler.java      |   30 +
 .../polygene/bootstrap/layered/package.html     |   24 +
 .../org/apache/polygene/bootstrap/package.html  |   24 +
 .../unitofwork/DefaultUnitOfWorkAssembler.java  |   55 +
 .../zest/bootstrap/ApplicationAssembler.java    |   39 -
 .../bootstrap/ApplicationAssemblerAdapter.java  |   49 -
 .../zest/bootstrap/ApplicationAssembly.java     |  111 --
 .../bootstrap/ApplicationAssemblyFactory.java   |   63 -
 .../zest/bootstrap/ApplicationModelFactory.java |   33 -
 .../apache/zest/bootstrap/ApplicationName.java  |   42 -
 .../org/apache/zest/bootstrap/Assembler.java    |   50 -
 .../zest/bootstrap/AssemblerCollection.java     |   76 -
 .../org/apache/zest/bootstrap/Assemblers.java   |  448 -----
 .../zest/bootstrap/AssemblyException.java       |   46 -
 .../zest/bootstrap/AssemblySpecifications.java  |   35 -
 .../apache/zest/bootstrap/AssemblyVisitor.java  |   60 -
 .../zest/bootstrap/AssemblyVisitorAdapter.java  |   83 -
 .../zest/bootstrap/AssociationDeclarations.java |   32 -
 .../apache/zest/bootstrap/BindingException.java |   38 -
 .../zest/bootstrap/BootstrapException.java      |   38 -
 .../org/apache/zest/bootstrap/ClassScanner.java |  182 --
 .../zest/bootstrap/ConfigurationAssembly.java   |   30 -
 .../bootstrap/ConfigurationDeclaration.java     |   89 -
 .../org/apache/zest/bootstrap/Energy4Java.java  |   98 -
 .../apache/zest/bootstrap/EntityAssembly.java   |   30 -
 .../zest/bootstrap/EntityDeclaration.java       |   89 -
 .../zest/bootstrap/ImportedServiceAssembly.java |   30 -
 .../bootstrap/ImportedServiceDeclaration.java   |   64 -
 .../zest/bootstrap/InjectionException.java      |   43 -
 .../bootstrap/InvalidInjectionException.java    |   37 -
 .../apache/zest/bootstrap/LayerAssembly.java    |  124 --
 .../org/apache/zest/bootstrap/LayerName.java    |   42 -
 .../bootstrap/ManyAssociationDeclarations.java  |   32 -
 .../zest/bootstrap/MetaInfoDeclaration.java     |  221 --
 .../apache/zest/bootstrap/MixinDeclaration.java |   33 -
 .../apache/zest/bootstrap/ModuleAssembly.java   |  243 ---
 .../org/apache/zest/bootstrap/ModuleName.java   |   42 -
 .../bootstrap/NamedAssociationDeclarations.java |   31 -
 .../apache/zest/bootstrap/ObjectAssembly.java   |   30 -
 .../zest/bootstrap/ObjectDeclaration.java       |   35 -
 .../apache/zest/bootstrap/RuntimeFactory.java   |   63 -
 .../apache/zest/bootstrap/ServiceAssembly.java  |   30 -
 .../zest/bootstrap/ServiceDeclaration.java      |   59 -
 .../zest/bootstrap/SingletonAssembler.java      |  129 --
 .../zest/bootstrap/StateDeclarations.java       |   36 -
 .../zest/bootstrap/TransientAssembly.java       |   30 -
 .../zest/bootstrap/TransientDeclaration.java    |   42 -
 .../apache/zest/bootstrap/ValueAssembly.java    |   30 -
 .../apache/zest/bootstrap/ValueDeclaration.java |   41 -
 .../org/apache/zest/bootstrap/ZestRuntime.java  |   38 -
 .../bootstrap/builder/ApplicationBuilder.java   |  303 ---
 .../bootstrap/builder/LayerDeclaration.java     |  111 --
 .../bootstrap/builder/ModuleDeclaration.java    |  168 --
 .../apache/zest/bootstrap/builder/package.html  |   28 -
 .../DefaultIdentityGeneratorAssembler.java      |   38 -
 .../layered/IllegalLayerAssemblerException.java |   31 -
 .../zest/bootstrap/layered/LayerAssembler.java  |   29 -
 .../layered/LayeredApplicationAssembler.java    |  297 ---
 .../layered/LayeredLayerAssembler.java          |   90 -
 .../zest/bootstrap/layered/ModuleAssembler.java |   30 -
 .../apache/zest/bootstrap/layered/package.html  |   24 -
 .../java/org/apache/zest/bootstrap/package.html |   24 -
 .../unitofwork/DefaultUnitOfWorkAssembler.java  |   55 -
 .../bootstrap/AssemblySpecificationTest.java    |   99 +
 .../polygene/bootstrap/ClassScannerTest.java    |   63 +
 .../bootstrap/DocumentationSupport.java         |  442 ++++
 .../apache/polygene/bootstrap/TestValue.java    |   29 +
 .../LayeredApplicationAssemblerTest.java        |   43 +
 .../bootstrap/assembly/TestApplication.java     |   62 +
 .../assembly/config/ConfigurationLayer.java     |   34 +
 .../connectivity/ConnectivityLayer.java         |   36 +
 .../bootstrap/assembly/domain/DomainLayer.java  |   36 +
 .../assembly/domain/InvoicingModule.java        |   36 +
 .../bootstrap/assembly/domain/OrderModule.java  |   57 +
 .../assembly/infrastructure/IndexingModule.java |   44 +
 .../infrastructure/InfrastructureLayer.java     |   48 +
 .../infrastructure/SerializationModule.java     |   37 +
 .../assembly/infrastructure/StorageModule.java  |   44 +
 .../assembly/service/ServiceLayer.java          |   36 +
 .../builder/ApplicationBuilderTest.java         |  136 ++
 .../bootstrap/somepackage/Test2Value.java       |   29 +
 .../bootstrap/AssemblySpecificationTest.java    |   99 -
 .../apache/zest/bootstrap/ClassScannerTest.java |   63 -
 .../zest/bootstrap/DocumentationSupport.java    |  442 ----
 .../org/apache/zest/bootstrap/TestValue.java    |   29 -
 .../LayeredApplicationAssemblerTest.java        |   43 -
 .../bootstrap/assembly/TestApplication.java     |   62 -
 .../assembly/config/ConfigurationLayer.java     |   34 -
 .../connectivity/ConnectivityLayer.java         |   36 -
 .../bootstrap/assembly/domain/DomainLayer.java  |   36 -
 .../assembly/domain/InvoicingModule.java        |   36 -
 .../bootstrap/assembly/domain/OrderModule.java  |   57 -
 .../assembly/infrastructure/IndexingModule.java |   44 -
 .../infrastructure/InfrastructureLayer.java     |   48 -
 .../infrastructure/SerializationModule.java     |   37 -
 .../assembly/infrastructure/StorageModule.java  |   44 -
 .../assembly/service/ServiceLayer.java          |   36 -
 .../builder/ApplicationBuilderTest.java         |  136 --
 .../zest/bootstrap/somepackage/Test2Value.java  |   29 -
 core/runtime/src/docs/runtime.txt               |    2 +-
 .../polygene/runtime/ZestRuntimeImpl.java       |  360 ++++
 .../runtime/activation/ActivationDelegate.java  |  401 ++++
 .../ActivationEventListenerSupport.java         |   69 +
 .../runtime/activation/ActivatorModel.java      |  110 +
 .../runtime/activation/ActivatorsInstance.java  |  126 ++
 .../runtime/activation/ActivatorsModel.java     |   98 +
 .../AbstractAssociationInstance.java            |   94 +
 .../runtime/association/AssociationInfo.java    |   37 +
 .../association/AssociationInstance.java        |  138 ++
 .../runtime/association/AssociationModel.java   |  229 +++
 .../runtime/association/AssociationsModel.java  |  120 ++
 .../association/ManyAssociationInstance.java    |  226 +++
 .../association/ManyAssociationModel.java       |  265 +++
 .../association/ManyAssociationsModel.java      |  126 ++
 .../association/NamedAssociationInstance.java   |  192 ++
 .../association/NamedAssociationModel.java      |  265 +++
 .../association/NamedAssociationsModel.java     |  130 ++
 .../runtime/bootstrap/AndAppliesToFilter.java   |   47 +
 .../bootstrap/AnnotationAppliesToFilter.java    |   47 +
 .../ApplicationAssemblyFactoryImpl.java         |   79 +
 .../bootstrap/ApplicationAssemblyImpl.java      |  157 ++
 .../bootstrap/ApplicationModelFactoryImpl.java  |  211 ++
 .../runtime/bootstrap/AssemblyHelper.java       |  214 ++
 .../bootstrap/CompositeAssemblyImpl.java        |  909 +++++++++
 .../bootstrap/ConfigurationAssemblyImpl.java    |   45 +
 .../bootstrap/ConfigurationDeclarationImpl.java |  126 ++
 .../runtime/bootstrap/EntityAssemblyImpl.java   |  121 ++
 .../bootstrap/EntityDeclarationImpl.java        |  100 +
 .../ImplementsMethodAppliesToFilter.java        |   46 +
 .../bootstrap/ImportedServiceAssemblyImpl.java  |  125 ++
 .../ImportedServiceDeclarationImpl.java         |  128 ++
 .../runtime/bootstrap/LayerAssemblyImpl.java    |  630 ++++++
 .../runtime/bootstrap/ModuleAssemblyImpl.java   |  645 ++++++
 .../runtime/bootstrap/ObjectAssemblyImpl.java   |   73 +
 .../bootstrap/ObjectDeclarationImpl.java        |   59 +
 .../runtime/bootstrap/OrAppliesToFilter.java    |   47 +
 .../runtime/bootstrap/ServiceAssemblyImpl.java  |  106 +
 .../bootstrap/ServiceDeclarationImpl.java       |  158 ++
 .../bootstrap/TransientAssemblyImpl.java        |   69 +
 .../bootstrap/TransientDeclarationImpl.java     |  100 +
 .../bootstrap/TypeCheckAppliesToFilter.java     |   47 +
 .../bootstrap/TypedFragmentAppliesToFilter.java |   37 +
 .../runtime/bootstrap/ValueAssemblyImpl.java    |   95 +
 .../runtime/bootstrap/ValueDeclarationImpl.java |  100 +
 .../composite/AbstractConstraintModel.java      |   55 +
 .../composite/AbstractModifierModel.java        |  184 ++
 .../runtime/composite/AtomicInstancePool.java   |   59 +
 .../runtime/composite/CompactLevel.java         |   41 +
 .../composite/CompositeConstraintModel.java     |   74 +
 .../composite/CompositeMethodInstance.java      |   83 +
 .../runtime/composite/CompositeMethodModel.java |  324 +++
 .../composite/CompositeMethodsModel.java        |  134 ++
 .../runtime/composite/CompositeModel.java       |  278 +++
 .../runtime/composite/ConcernModel.java         |   35 +
 .../runtime/composite/ConcernsInstance.java     |   70 +
 .../runtime/composite/ConcernsModel.java        |   89 +
 .../composite/ConstraintDeclaration.java        |   75 +
 .../runtime/composite/ConstraintInstance.java   |   49 +
 .../runtime/composite/ConstraintModel.java      |   55 +
 .../runtime/composite/ConstraintsCheck.java     |   32 +
 .../runtime/composite/ConstraintsInstance.java  |   84 +
 .../runtime/composite/ConstraintsModel.java     |   82 +
 .../runtime/composite/ConstructorModel.java     |  112 ++
 .../runtime/composite/ConstructorsModel.java    |  298 +++
 .../runtime/composite/FragmentClassLoader.java  |  847 ++++++++
 .../composite/FragmentInvocationHandler.java    |  137 ++
 .../composite/FunctionStateResolver.java        |  115 ++
 .../GenericFragmentInvocationHandler.java       |   51 +
 .../runtime/composite/Genericpredicate.java     |   38 +
 .../runtime/composite/InstancePool.java         |   30 +
 .../polygene/runtime/composite/MixinModel.java  |  184 ++
 .../runtime/composite/MixinsInstance.java       |   35 +
 .../polygene/runtime/composite/MixinsModel.java |  234 +++
 .../runtime/composite/ProxyGenerator.java       |   35 +
 .../ProxyReferenceInvocationHandler.java        |   86 +
 .../SideEffectInvocationHandlerResult.java      |   59 +
 .../runtime/composite/SideEffectModel.java      |   36 +
 .../runtime/composite/SideEffectsInstance.java  |  101 +
 .../runtime/composite/SideEffectsModel.java     |   87 +
 .../polygene/runtime/composite/StateModel.java  |   79 +
 .../runtime/composite/StateResolver.java        |   40 +
 ...SynchronizedCompositeMethodInstancePool.java |   50 +
 .../composite/TransientBuilderInstance.java     |  102 +
 .../runtime/composite/TransientClassLoader.java |  789 ++++++++
 .../runtime/composite/TransientInstance.java    |  224 +++
 .../runtime/composite/TransientModel.java       |   74 +
 .../composite/TransientStateInstance.java       |   62 +
 .../runtime/composite/TransientsModel.java      |   68 +
 .../TypedModifierInvocationHandler.java         |   53 +
 ...synchronizedCompositeMethodInstancePool.java |   50 +
 .../polygene/runtime/composite/UsageGraph.java  |  134 ++
 .../runtime/composite/UsesInstance.java         |  112 ++
 .../composite/ValueConstraintsInstance.java     |  145 ++
 .../composite/ValueConstraintsModel.java        |   72 +
 .../polygene/runtime/entity/EntitiesModel.java  |   68 +
 .../polygene/runtime/entity/EntityInstance.java |  317 +++
 .../runtime/entity/EntityMixinsModel.java       |  117 ++
 .../polygene/runtime/entity/EntityModel.java    |  158 ++
 .../runtime/entity/EntityPropertyInstance.java  |   58 +
 .../runtime/entity/EntityStateInstance.java     |  232 +++
 .../runtime/entity/EntityStateModel.java        |  158 ++
 .../runtime/injection/Dependencies.java         |   33 +
 .../runtime/injection/DependencyModel.java      |  421 ++++
 .../runtime/injection/InjectedFieldModel.java   |  165 ++
 .../runtime/injection/InjectedFieldsModel.java  |  117 ++
 .../runtime/injection/InjectedMethodModel.java  |   93 +
 .../runtime/injection/InjectedMethodsModel.java |  137 ++
 .../injection/InjectedParametersModel.java      |   95 +
 .../runtime/injection/InjectionContext.java     |  126 ++
 .../runtime/injection/InjectionProvider.java    |   32 +
 .../injection/InjectionProviderFactory.java     |   43 +
 .../injection/ParameterizedTypeInstance.java    |   66 +
 .../CachingInjectionProviderDecorator.java      |   63 +
 ...achingInjectionProviderFactoryDecorator.java |   56 +
 .../provider/InjectionProviderException.java    |   38 +
 .../InjectionProviderFactoryStrategy.java       |  106 +
 .../InvocationInjectionProviderFactory.java     |  118 ++
 .../ModifiesInjectionProviderFactory.java       |   71 +
 .../ServiceInjectionProviderFactory.java        |  224 +++
 .../provider/StateInjectionProviderFactory.java |  273 +++
 .../StructureInjectionProviderFactory.java      |  129 ++
 .../provider/ThisInjectionProviderFactory.java  |  130 ++
 .../provider/UsesInjectionProviderFactory.java  |  132 ++
 .../polygene/runtime/internal/Activator.java    |   58 +
 .../apache/polygene/runtime/model/Binder.java   |   32 +
 .../polygene/runtime/model/Resolution.java      |   92 +
 .../polygene/runtime/object/ObjectModel.java    |  158 ++
 .../polygene/runtime/object/ObjectsModel.java   |   62 +
 .../org/apache/polygene/runtime/package.html    |   24 +
 .../runtime/property/PropertiesModel.java       |  107 +
 .../polygene/runtime/property/PropertyInfo.java |   37 +
 .../runtime/property/PropertyInstance.java      |  326 +++
 .../runtime/property/PropertyModel.java         |  338 ++++
 .../runtime/query/IterableQuerySource.java      |  245 +++
 .../runtime/query/QueryBuilderFactoryImpl.java  |   69 +
 .../runtime/query/QueryBuilderImpl.java         |   96 +
 .../polygene/runtime/query/QueryImpl.java       |  220 ++
 .../service/ImportedServiceInstance.java        |   71 +
 .../runtime/service/ImportedServiceModel.java   |  197 ++
 .../ImportedServiceReferenceInstance.java       |  221 ++
 .../service/ImportedServicesInstance.java       |  128 ++
 .../runtime/service/ImportedServicesModel.java  |   77 +
 .../runtime/service/ServiceInstance.java        |   89 +
 .../polygene/runtime/service/ServiceModel.java  |  192 ++
 .../service/ServiceReferenceInstance.java       |  323 +++
 .../runtime/service/ServicesInstance.java       |  122 ++
 .../polygene/runtime/service/ServicesModel.java |   90 +
 .../runtime/structure/ApplicationInstance.java  |  174 ++
 .../runtime/structure/ApplicationModel.java     |  178 ++
 .../runtime/structure/LayerInstance.java        |  150 ++
 .../polygene/runtime/structure/LayerModel.java  |  170 ++
 .../runtime/structure/ModuleClassLoader.java    |  182 ++
 .../runtime/structure/ModuleInstance.java       |  606 ++++++
 .../polygene/runtime/structure/ModuleModel.java |  394 ++++
 .../runtime/structure/TypeLookupImpl.java       |  543 +++++
 .../runtime/structure/UsedLayersInstance.java   |   74 +
 .../runtime/structure/UsedLayersModel.java      |   71 +
 .../runtime/structure/Visibilitypredicate.java  |   48 +
 .../runtime/types/ValueTypeFactory.java         |  233 +++
 .../runtime/unitofwork/BuilderEntityState.java  |  173 ++
 .../unitofwork/BuilderManyAssociationState.java |   84 +
 .../BuilderNamedAssociationState.java           |   90 +
 .../unitofwork/EntityBuilderInstance.java       |  139 ++
 .../runtime/unitofwork/EntityFunction.java      |   46 +
 .../runtime/unitofwork/EntityStateStore.java    |   39 +
 .../runtime/unitofwork/ModuleUnitOfWork.java    |  769 +++++++
 .../unitofwork/UnitOfWorkFactoryMixin.java      |  100 +
 .../runtime/unitofwork/UnitOfWorkInstance.java  |  510 +++++
 .../value/ManyAssociationValueState.java        |  106 +
 .../value/NamedAssociationValueState.java       |   85 +
 .../runtime/value/ReferenceProperty.java        |   54 +
 .../runtime/value/ValueBuilderInstance.java     |   86 +
 .../value/ValueBuilderWithPrototype.java        |  202 ++
 .../runtime/value/ValueBuilderWithState.java    |   97 +
 .../polygene/runtime/value/ValueInstance.java   |  172 ++
 .../polygene/runtime/value/ValueModel.java      |  145 ++
 .../runtime/value/ValueStateInstance.java       |  234 +++
 .../polygene/runtime/value/ValueStateModel.java |  133 ++
 .../polygene/runtime/value/ValuesModel.java     |   68 +
 .../apache/zest/runtime/ZestRuntimeImpl.java    |  360 ----
 .../runtime/activation/ActivationDelegate.java  |  401 ----
 .../ActivationEventListenerSupport.java         |   69 -
 .../zest/runtime/activation/ActivatorModel.java |  110 -
 .../runtime/activation/ActivatorsInstance.java  |  126 --
 .../runtime/activation/ActivatorsModel.java     |   98 -
 .../AbstractAssociationInstance.java            |   94 -
 .../runtime/association/AssociationInfo.java    |   37 -
 .../association/AssociationInstance.java        |  138 --
 .../runtime/association/AssociationModel.java   |  229 ---
 .../runtime/association/AssociationsModel.java  |  120 --
 .../association/ManyAssociationInstance.java    |  226 ---
 .../association/ManyAssociationModel.java       |  265 ---
 .../association/ManyAssociationsModel.java      |  126 --
 .../association/NamedAssociationInstance.java   |  192 --
 .../association/NamedAssociationModel.java      |  265 ---
 .../association/NamedAssociationsModel.java     |  130 --
 .../runtime/bootstrap/AndAppliesToFilter.java   |   47 -
 .../bootstrap/AnnotationAppliesToFilter.java    |   47 -
 .../ApplicationAssemblyFactoryImpl.java         |   79 -
 .../bootstrap/ApplicationAssemblyImpl.java      |  157 --
 .../bootstrap/ApplicationModelFactoryImpl.java  |  211 --
 .../zest/runtime/bootstrap/AssemblyHelper.java  |  214 --
 .../bootstrap/CompositeAssemblyImpl.java        |  909 ---------
 .../bootstrap/ConfigurationAssemblyImpl.java    |   45 -
 .../bootstrap/ConfigurationDeclarationImpl.java |  126 --
 .../runtime/bootstrap/EntityAssemblyImpl.java   |  121 --
 .../bootstrap/EntityDeclarationImpl.java        |  100 -
 .../ImplementsMethodAppliesToFilter.java        |   46 -
 .../bootstrap/ImportedServiceAssemblyImpl.java  |  125 --
 .../ImportedServiceDeclarationImpl.java         |  128 --
 .../runtime/bootstrap/LayerAssemblyImpl.java    |  630 ------
 .../runtime/bootstrap/ModuleAssemblyImpl.java   |  645 ------
 .../runtime/bootstrap/ObjectAssemblyImpl.java   |   73 -
 .../bootstrap/ObjectDeclarationImpl.java        |   59 -
 .../runtime/bootstrap/OrAppliesToFilter.java    |   47 -
 .../runtime/bootstrap/ServiceAssemblyImpl.java  |  106 -
 .../bootstrap/ServiceDeclarationImpl.java       |  158 --
 .../bootstrap/TransientAssemblyImpl.java        |   72 -
 .../bootstrap/TransientDeclarationImpl.java     |  100 -
 .../bootstrap/TypeCheckAppliesToFilter.java     |   47 -
 .../bootstrap/TypedFragmentAppliesToFilter.java |   37 -
 .../runtime/bootstrap/ValueAssemblyImpl.java    |  121 --
 .../runtime/bootstrap/ValueDeclarationImpl.java |  100 -
 .../composite/AbstractConstraintModel.java      |   55 -
 .../composite/AbstractModifierModel.java        |  184 --
 .../runtime/composite/AtomicInstancePool.java   |   59 -
 .../zest/runtime/composite/CompactLevel.java    |   41 -
 .../composite/CompositeConstraintModel.java     |   74 -
 .../composite/CompositeMethodInstance.java      |   83 -
 .../runtime/composite/CompositeMethodModel.java |  324 ---
 .../composite/CompositeMethodsModel.java        |  134 --
 .../zest/runtime/composite/CompositeModel.java  |  278 ---
 .../zest/runtime/composite/ConcernModel.java    |   35 -
 .../runtime/composite/ConcernsInstance.java     |   70 -
 .../zest/runtime/composite/ConcernsModel.java   |   89 -
 .../composite/ConstraintDeclaration.java        |   75 -
 .../runtime/composite/ConstraintInstance.java   |   49 -
 .../zest/runtime/composite/ConstraintModel.java |   55 -
 .../runtime/composite/ConstraintsCheck.java     |   32 -
 .../runtime/composite/ConstraintsInstance.java  |   84 -
 .../runtime/composite/ConstraintsModel.java     |   82 -
 .../runtime/composite/ConstructorModel.java     |  112 --
 .../runtime/composite/ConstructorsModel.java    |  298 ---
 .../runtime/composite/FragmentClassLoader.java  |  847 --------
 .../composite/FragmentInvocationHandler.java    |  137 --
 .../composite/FunctionStateResolver.java        |  115 --
 .../GenericFragmentInvocationHandler.java       |   51 -
 .../runtime/composite/Genericpredicate.java     |   38 -
 .../zest/runtime/composite/InstancePool.java    |   30 -
 .../zest/runtime/composite/MixinModel.java      |  184 --
 .../zest/runtime/composite/MixinsInstance.java  |   35 -
 .../zest/runtime/composite/MixinsModel.java     |  234 ---
 .../zest/runtime/composite/ProxyGenerator.java  |   35 -
 .../ProxyReferenceInvocationHandler.java        |   86 -
 .../SideEffectInvocationHandlerResult.java      |   59 -
 .../zest/runtime/composite/SideEffectModel.java |   36 -
 .../runtime/composite/SideEffectsInstance.java  |  101 -
 .../runtime/composite/SideEffectsModel.java     |   87 -
 .../zest/runtime/composite/StateModel.java      |   79 -
 .../zest/runtime/composite/StateResolver.java   |   40 -
 ...SynchronizedCompositeMethodInstancePool.java |   50 -
 .../composite/TransientBuilderInstance.java     |  102 -
 .../runtime/composite/TransientClassLoader.java |  791 --------
 .../runtime/composite/TransientInstance.java    |  224 ---
 .../zest/runtime/composite/TransientModel.java  |   75 -
 .../composite/TransientStateInstance.java       |   62 -
 .../zest/runtime/composite/TransientsModel.java |   68 -
 .../TypedModifierInvocationHandler.java         |   53 -
 ...synchronizedCompositeMethodInstancePool.java |   50 -
 .../zest/runtime/composite/UsageGraph.java      |  134 --
 .../zest/runtime/composite/UsesInstance.java    |  112 --
 .../composite/ValueConstraintsInstance.java     |  145 --
 .../composite/ValueConstraintsModel.java        |   72 -
 .../zest/runtime/entity/EntitiesModel.java      |   68 -
 .../zest/runtime/entity/EntityInstance.java     |  317 ---
 .../zest/runtime/entity/EntityMixinsModel.java  |  117 --
 .../apache/zest/runtime/entity/EntityModel.java |  158 --
 .../runtime/entity/EntityPropertyInstance.java  |   58 -
 .../runtime/entity/EntityStateInstance.java     |  232 ---
 .../zest/runtime/entity/EntityStateModel.java   |  158 --
 .../zest/runtime/injection/Dependencies.java    |   33 -
 .../zest/runtime/injection/DependencyModel.java |  421 ----
 .../runtime/injection/InjectedFieldModel.java   |  165 --
 .../runtime/injection/InjectedFieldsModel.java  |  117 --
 .../runtime/injection/InjectedMethodModel.java  |   93 -
 .../runtime/injection/InjectedMethodsModel.java |  137 --
 .../injection/InjectedParametersModel.java      |   95 -
 .../runtime/injection/InjectionContext.java     |  126 --
 .../runtime/injection/InjectionProvider.java    |   32 -
 .../injection/InjectionProviderFactory.java     |   43 -
 .../injection/ParameterizedTypeInstance.java    |   66 -
 .../CachingInjectionProviderDecorator.java      |   63 -
 ...achingInjectionProviderFactoryDecorator.java |   56 -
 .../provider/InjectionProviderException.java    |   38 -
 .../InjectionProviderFactoryStrategy.java       |  106 -
 .../InvocationInjectionProviderFactory.java     |  118 --
 .../ModifiesInjectionProviderFactory.java       |   71 -
 .../ServiceInjectionProviderFactory.java        |  224 ---
 .../provider/StateInjectionProviderFactory.java |  273 ---
 .../StructureInjectionProviderFactory.java      |  129 --
 .../provider/ThisInjectionProviderFactory.java  |  130 --
 .../provider/UsesInjectionProviderFactory.java  |  132 --
 .../apache/zest/runtime/internal/Activator.java |   58 -
 .../org/apache/zest/runtime/model/Binder.java   |   32 -
 .../apache/zest/runtime/model/Resolution.java   |   92 -
 .../apache/zest/runtime/object/ObjectModel.java |  158 --
 .../zest/runtime/object/ObjectsModel.java       |   62 -
 .../java/org/apache/zest/runtime/package.html   |   24 -
 .../zest/runtime/property/PropertiesModel.java  |  107 -
 .../zest/runtime/property/PropertyInfo.java     |   37 -
 .../zest/runtime/property/PropertyInstance.java |  326 ---
 .../zest/runtime/property/PropertyModel.java    |  338 ----
 .../zest/runtime/query/IterableQuerySource.java |  245 ---
 .../runtime/query/QueryBuilderFactoryImpl.java  |   69 -
 .../zest/runtime/query/QueryBuilderImpl.java    |   96 -
 .../apache/zest/runtime/query/QueryImpl.java    |  220 --
 .../service/ImportedServiceInstance.java        |   71 -
 .../runtime/service/ImportedServiceModel.java   |  197 --
 .../ImportedServiceReferenceInstance.java       |  221 --
 .../service/ImportedServicesInstance.java       |  128 --
 .../runtime/service/ImportedServicesModel.java  |   77 -
 .../zest/runtime/service/ServiceInstance.java   |   89 -
 .../zest/runtime/service/ServiceModel.java      |  192 --
 .../service/ServiceReferenceInstance.java       |  323 ---
 .../zest/runtime/service/ServicesInstance.java  |  122 --
 .../zest/runtime/service/ServicesModel.java     |   90 -
 .../runtime/structure/ApplicationInstance.java  |  174 --
 .../runtime/structure/ApplicationModel.java     |  178 --
 .../zest/runtime/structure/LayerInstance.java   |  150 --
 .../zest/runtime/structure/LayerModel.java      |  170 --
 .../runtime/structure/ModuleClassLoader.java    |  182 --
 .../zest/runtime/structure/ModuleInstance.java  |  606 ------
 .../zest/runtime/structure/ModuleModel.java     |  394 ----
 .../zest/runtime/structure/TypeLookupImpl.java  |  543 -----
 .../runtime/structure/UsedLayersInstance.java   |   75 -
 .../zest/runtime/structure/UsedLayersModel.java |   71 -
 .../runtime/structure/Visibilitypredicate.java  |   48 -
 .../zest/runtime/types/ValueTypeFactory.java    |  233 ---
 .../runtime/unitofwork/BuilderEntityState.java  |  173 --
 .../unitofwork/BuilderManyAssociationState.java |   84 -
 .../BuilderNamedAssociationState.java           |   90 -
 .../unitofwork/EntityBuilderInstance.java       |  139 --
 .../zest/runtime/unitofwork/EntityFunction.java |   46 -
 .../runtime/unitofwork/EntityStateStore.java    |   39 -
 .../runtime/unitofwork/ModuleUnitOfWork.java    |  769 -------
 .../unitofwork/UnitOfWorkFactoryMixin.java      |  100 -
 .../runtime/unitofwork/UnitOfWorkInstance.java  |  510 -----
 .../value/ManyAssociationValueState.java        |  106 -
 .../value/NamedAssociationValueState.java       |   85 -
 .../zest/runtime/value/ReferenceProperty.java   |   54 -
 .../runtime/value/ValueBuilderInstance.java     |   87 -
 .../value/ValueBuilderWithPrototype.java        |  202 --
 .../runtime/value/ValueBuilderWithState.java    |   97 -
 .../zest/runtime/value/ValueInstance.java       |  176 --
 .../apache/zest/runtime/value/ValueModel.java   |  145 --
 .../zest/runtime/value/ValueStateInstance.java  |  234 ---
 .../zest/runtime/value/ValueStateModel.java     |  133 --
 .../apache/zest/runtime/value/ValuesModel.java  |   68 -
 .../polygene/api/common/OptionalTest.java       |  202 ++
 .../apache/polygene/api/common/PluginTest.java  |  368 ++++
 .../polygene/api/common/PropertyErrorTest.java  |   68 +
 .../polygene/api/common/PropertyTypeTest.java   |  165 ++
 .../apache/polygene/api/common/RemovalTest.java |  127 ++
 .../polygene/api/common/ValueCompositeTest.java |  244 +++
 .../bootstrap/ApplicationAssemblerTest.java     |  112 ++
 .../polygene/bootstrap/ServiceAssemblyTest.java |   93 +
 .../constraints/PropertyConstraintTest.java     |   79 +
 .../regression/qi230/Qi230IssueTest.java        |  139 ++
 ...faceCollisionWithRelatedReturnTypesTest.java |  202 ++
 ...ceCollisionWithUnrelatedReturnTypesTest.java |   55 +
 .../polygene/regression/qi377/IssueTest.java    |   75 +
 .../qi377/SetAssociationInSideEffectTest.java   |  133 ++
 ...alueCollisionWithRelatedReturnTypesTest.java |  150 ++
 .../polygene/regression/qi382/Qi382Test.java    |  113 ++
 .../polygene/regression/qi383/Qi383Test.java    |   62 +
 .../polygene/regression/qi53/IssueTest.java     |  104 +
 .../polygene/regression/qi55/IssueTest.java     |   55 +
 .../polygene/regression/qi59/IssueTest.java     |   96 +
 .../polygene/regression/qi65/IssueTest.java     |   66 +
 .../polygene/regression/qi74/IssueTest.java     |   61 +
 .../polygene/regression/qi78/IssueTest.java     |   93 +
 .../polygene/regression/qi94/IssueTest.java     |   76 +
 .../apache/polygene/runtime/ZestAPITest.java    |   87 +
 .../apache/polygene/runtime/ZestSPITest.java    |  129 ++
 .../activation/ActivatorOrderTestSupport.java   |  162 ++
 .../activation/ApplicationActivationTest.java   |   91 +
 .../ImportedServiceActivationTest.java          |  210 ++
 .../IntraMixinActivationOrderTest.java          |  213 ++
 .../runtime/activation/LayerActivationTest.java |   91 +
 .../activation/ModuleActivationTest.java        |   91 +
 .../activation/ServiceActivationTest.java       |  145 ++
 .../activation/ServiceActivatorOrderTest.java   |  368 ++++
 .../activation/StructureActivatorOrderTest.java |  264 +++
 .../runtime/appliesto/AppliesToFilterTest.java  |  113 ++
 .../AppliesToOrConditionQI241Test.java          |  251 +++
 .../runtime/appliesto/AppliesToTest.java        |  137 ++
 .../appliesto/FragmentAppliesToTest.java        |  169 ++
 .../association/AssociationAssignmentTest.java  |   84 +
 .../association/AssociationEqualityTest.java    |  458 +++++
 .../DereferenceForBootstrappedConcernsTest.java |  137 ++
 .../bootstrap/docs/DocumentationSupport.java    |   80 +
 .../runtime/composite/AbstractMixinTest.java    |  127 ++
 .../composite/CompositeFactoryImplTest.java     |  160 ++
 .../composite/CompositeModelResolverTest.java   |  149 ++
 .../runtime/composite/FunctionalListTest.java   |   99 +
 .../composite/InterfaceDefaultMethodsTest.java  |  156 ++
 .../composite/InterfaceStaticMethodsTest.java   |   77 +
 .../runtime/composite/MapOverrideTest.java      |  210 ++
 .../polygene/runtime/composite/QI247Test1.java  |  143 ++
 .../polygene/runtime/composite/QI247Test2.java  |  159 ++
 .../polygene/runtime/composite/QI256Test.java   |  344 ++++
 .../runtime/composite/TransientAsClassTest.java |   74 +
 .../composite/TransientClassLoaderTest.java     |   30 +
 .../runtime/composite/UsageGraphTest.java       |  372 ++++
 .../runtime/concerns/GenericConcernTest.java    |   83 +
 .../runtime/concerns/ModuleConcernTest.java     |  103 +
 .../concerns/PropertyInheritanceTest.java       |  113 ++
 .../runtime/constraints/ConstraintsTest.java    |  209 ++
 .../constraints/ConstraintsTest.properties      |   26 +
 .../runtime/defaults/UseDefaultsTest.java       |  120 ++
 .../polygene/runtime/entity/AggregatedTest.java |  169 ++
 .../entity/EntityBuilderWithStateTest.java      |  131 ++
 .../entity/EntityCompositeEqualityTest.java     |   92 +
 .../runtime/entity/EntityCreationTest.java      |   98 +
 .../polygene/runtime/entity/EntityTypeTest.java |   74 +
 .../runtime/entity/EntityVisibilityTest.java    | 1029 ++++++++++
 .../polygene/runtime/entity/LifecycleTest.java  |  122 ++
 .../polygene/runtime/entity/QI273Test.java      |  103 +
 .../entity/associations/AssociationTest.java    |  222 +++
 .../associations/ImmutableAssociationTest.java  |  157 ++
 .../injection/ActivatorInjectionTest.java       |  172 ++
 .../ConstructorInjectionOfThisTest.java         |  175 ++
 .../IllegalUnitOfWorkInjectionTest.java         |   96 +
 .../injection/InvocationInjectionTest.java      |  147 ++
 .../runtime/injection/ServiceInjectionTest.java |  374 ++++
 .../runtime/injection/StateInjectionTest.java   |  111 ++
 .../injection/StateParameterInjectionTest.java  |  102 +
 .../injection/StructureInjectionTest.java       |  202 ++
 .../runtime/injection/ThisInjectionTest.java    |  143 ++
 .../injection/UnitOfWorkInjectionTest.java      |  121 ++
 .../runtime/injection/UsesGenericClassTest.java |   75 +
 .../runtime/injection/UsesGenericListTest.java  |   77 +
 .../runtime/injection/UsesGraphTest.java        |   90 +
 .../runtime/injection/UsesInjectionTest.java    |   93 +
 .../EagerServiceInstantiationTest.java          |   86 +
 .../ServiceInstantiationTests.java              |   78 +
 .../TransientInstantiationTests.java            |   68 +
 .../instantiation/ValueInstantiationTests.java  |  112 ++
 .../runtime/mixin/AssemblyMixinTest.java        |  114 ++
 .../runtime/mixin/AssemblyRoleTest.java         |  129 ++
 .../runtime/mixin/InitializableTest.java        |   99 +
 .../InvokeServiceFromModuleAssemblyTest.java    |   66 +
 .../polygene/runtime/mixin/JDKMixinTest.java    |  197 ++
 .../mixin/MethodInterceptionMixinTest.java      |  101 +
 .../runtime/mixin/MixinPrecedenceTest.java      |  134 ++
 .../mixin/MixinsOnThisInjectionTest.java        |   85 +
 .../runtime/mixin/PrivateMixinTest.java         |  118 ++
 .../polygene/runtime/mixin/Qi228Test.java       |   77 +
 .../objects/ObjectBuilderFactoryTest.java       |  180 ++
 .../runtime/objects/ObjectConcernTest.java      |   75 +
 .../runtime/objects/ObjectVisibilityTest.java   |  900 +++++++++
 .../polygene/runtime/objects/OuterClass.java    |   49 +
 .../runtime/property/ImmutablePropertyTest.java |  135 ++
 .../runtime/property/PropertyEqualityTest.java  |  439 ++++
 .../property/PropertyStringArrayTest.java       |   69 +
 .../polygene/runtime/property/PropertyTest.java |  195 ++
 .../property/ValueNestedBuilderTest.java        |  133 ++
 .../runtime/query/IterableQuerySourceTest.java  |  526 +++++
 .../apache/polygene/runtime/query/Network.java  |  243 +++
 .../runtime/query/NonQueryableTest.java         |   95 +
 .../query/QueryBuilderFactoryImplTest.java      |  167 ++
 .../polygene/runtime/query/model/Alive.java     |   24 +
 .../polygene/runtime/query/model/City.java      |   33 +
 .../runtime/query/model/Describable.java        |   56 +
 .../polygene/runtime/query/model/Domain.java    |   30 +
 .../polygene/runtime/query/model/Female.java    |   34 +
 .../polygene/runtime/query/model/Male.java      |   37 +
 .../polygene/runtime/query/model/Nameable.java  |   29 +
 .../polygene/runtime/query/model/Person.java    |   60 +
 .../polygene/runtime/query/model/Pet.java       |   53 +
 .../query/model/entities/CityEntity.java        |   28 +
 .../query/model/entities/DomainEntity.java      |   28 +
 .../query/model/entities/FemaleEntity.java      |   28 +
 .../query/model/entities/MaleEntity.java        |   28 +
 .../query/model/entities/PersonEntity.java      |   28 +
 .../runtime/query/model/entities/PetEntity.java |   34 +
 .../query/model/values/ContactValue.java        |   35 +
 .../query/model/values/ContactsValue.java       |   36 +
 .../runtime/service/ActivatableServiceTest.java |  100 +
 .../runtime/service/AvailableServiceTest.java   |  191 ++
 .../runtime/service/ComplexActivatableTest.java |  104 +
 .../runtime/service/ConfigurationTest.java      |  147 ++
 .../service/LazyActivatedServiceTest.java       |  119 ++
 .../runtime/service/PassivationTest.java        |  215 ++
 .../runtime/service/ServiceFinderTest.java      |  129 ++
 .../runtime/service/ServiceIdSelectorTest.java  |  118 ++
 .../runtime/service/ServiceVisibilityTest.java  |  897 +++++++++
 .../sideeffects/GenericSideEffectTest.java      |  113 ++
 .../sideeffects/ModuleSideEffectTest.java       |   89 +
 .../sideeffects/SampleTransientTest.java        |   89 +
 .../sideeffects/SpecificSideEffectTest.java     |  102 +
 .../runtime/structure/ApplicationModeTest.java  |  114 ++
 .../structure/CompositeDescriptorTest.java      |   87 +
 .../runtime/structure/MixinVisibilityTest.java  |  444 +++++
 .../polygene/runtime/structure/ModuleTest.java  |  168 ++
 .../PrivateCompositeVisibilityTest.java         |  116 ++
 .../runtime/structure/StructureTest.java        |  135 ++
 .../structure/TypeToCompositeLookupTest.java    |  402 ++++
 .../runtime/threaded/ContextCompositeTest.java  |  144 ++
 .../transients/TransientBuilderFactoryTest.java |  222 +++
 .../transients/TransientVisibilityTest.java     |  912 +++++++++
 .../unitofwork/AutoCloseableUoWTest.java        |   89 +
 .../unitofwork/PrivateEntityUnitOfWorkTest.java |  263 +++
 .../runtime/unitofwork/RemovalTest.java         |  163 ++
 .../unitofwork/UnitOfWorkFactoryTest.java       |  146 ++
 .../polygene/runtime/util/AnnotationsTest.java  |   51 +
 .../runtime/value/AssociationToValueTest.java   |  214 ++
 .../runtime/value/NestedValueBuilderTest.java   |  190 ++
 .../runtime/value/ValueComposite2Test.java      |  141 ++
 .../runtime/value/ValueCompositeBasicsTest.java |  102 +
 .../runtime/value/ValueEqualityTest.java        |  241 +++
 .../ValueInjectionDeserializationTest.java      |  133 ++
 .../value/ValueSerializationRegressionTest.java |   77 +
 .../runtime/value/ValueVisibilityTest.java      |  912 +++++++++
 .../runtime/value/ValueWithAssociationTest.java |  203 ++
 .../visibility/VisibilityInUnitOfWorkTest.java  |  165 ++
 .../service/importer/InstanceImporterTest.java  |   71 +
 .../service/importer/NewObjectImporterTest.java |   64 +
 .../importer/ServiceInstanceImporterTest.java   |   92 +
 .../importer/ServiceSelectorImporterTest.java   |  166 ++
 .../java/org/apache/polygene/test/ASMTest.java  |  588 ++++++
 .../org/apache/polygene/test/Exception1.java    |   29 +
 .../org/apache/polygene/test/Exception2.java    |   29 +
 .../java/org/apache/polygene/test/Other.java    |   54 +
 .../java/org/apache/polygene/test/Some.java     |   32 +
 .../org/apache/polygene/test/SomeMixin.java     |   61 +
 .../apache/polygene/test/SomeMixin_Stubx.java   |  249 +++
 .../java/org/apache/polygene/test/World.java    |   29 +
 .../test/composite/CleanStackTraceTest.java     |  144 ++
 .../memory/MemoryEntityStoreTest.java           |   63 +
 .../apache/zest/api/common/OptionalTest.java    |  202 --
 .../org/apache/zest/api/common/PluginTest.java  |  370 ----
 .../zest/api/common/PropertyErrorTest.java      |   68 -
 .../zest/api/common/PropertyTypeTest.java       |  165 --
 .../org/apache/zest/api/common/RemovalTest.java |  127 --
 .../zest/api/common/ValueCompositeTest.java     |  244 ---
 .../bootstrap/ApplicationAssemblerTest.java     |  112 --
 .../zest/bootstrap/ServiceAssemblyTest.java     |   93 -
 .../constraints/PropertyConstraintTest.java     |   79 -
 .../zest/regression/qi230/Qi230IssueTest.java   |  139 --
 ...faceCollisionWithRelatedReturnTypesTest.java |  202 --
 ...ceCollisionWithUnrelatedReturnTypesTest.java |   55 -
 .../apache/zest/regression/qi377/IssueTest.java |   75 -
 .../qi377/SetAssociationInSideEffectTest.java   |  133 --
 ...alueCollisionWithRelatedReturnTypesTest.java |  150 --
 .../apache/zest/regression/qi382/Qi382Test.java |  113 --
 .../apache/zest/regression/qi383/Qi383Test.java |   62 -
 .../apache/zest/regression/qi53/IssueTest.java  |  104 -
 .../apache/zest/regression/qi55/IssueTest.java  |   55 -
 .../apache/zest/regression/qi59/IssueTest.java  |   96 -
 .../apache/zest/regression/qi65/IssueTest.java  |   66 -
 .../apache/zest/regression/qi74/IssueTest.java  |   61 -
 .../apache/zest/regression/qi78/IssueTest.java  |   93 -
 .../apache/zest/regression/qi94/IssueTest.java  |   76 -
 .../org/apache/zest/runtime/ZestAPITest.java    |   87 -
 .../org/apache/zest/runtime/ZestSPITest.java    |  129 --
 .../activation/ActivatorOrderTestSupport.java   |  162 --
 .../activation/ApplicationActivationTest.java   |   91 -
 .../ImportedServiceActivationTest.java          |  210 --
 .../IntraMixinActivationOrderTest.java          |  213 --
 .../runtime/activation/LayerActivationTest.java |   91 -
 .../activation/ModuleActivationTest.java        |   91 -
 .../activation/ServiceActivationTest.java       |  145 --
 .../activation/ServiceActivatorOrderTest.java   |  368 ----
 .../activation/StructureActivatorOrderTest.java |  264 ---
 .../runtime/appliesto/AppliesToFilterTest.java  |  113 --
 .../AppliesToOrConditionQI241Test.java          |  251 ---
 .../zest/runtime/appliesto/AppliesToTest.java   |  137 --
 .../appliesto/FragmentAppliesToTest.java        |  169 --
 .../association/AssociationAssignmentTest.java  |   84 -
 .../association/AssociationEqualityTest.java    |  458 -----
 .../DereferenceForBootstrappedConcernsTest.java |  137 --
 .../bootstrap/docs/DocumentationSupport.java    |   80 -
 .../runtime/composite/AbstractMixinTest.java    |  127 --
 .../composite/CompositeFactoryImplTest.java     |  160 --
 .../composite/CompositeModelResolverTest.java   |  149 --
 .../runtime/composite/FunctionalListTest.java   |   99 -
 .../composite/InterfaceDefaultMethodsTest.java  |  156 --
 .../composite/InterfaceStaticMethodsTest.java   |   77 -
 .../zest/runtime/composite/MapOverrideTest.java |  210 --
 .../zest/runtime/composite/QI247Test1.java      |  143 --
 .../zest/runtime/composite/QI247Test2.java      |  159 --
 .../zest/runtime/composite/QI256Test.java       |  344 ----
 .../runtime/composite/TransientAsClassTest.java |   75 -
 .../composite/TransientClassLoaderTest.java     |   30 -
 .../zest/runtime/composite/UsageGraphTest.java  |  372 ----
 .../runtime/concerns/GenericConcernTest.java    |   83 -
 .../runtime/concerns/ModuleConcernTest.java     |  103 -
 .../concerns/PropertyInheritanceTest.java       |  113 --
 .../runtime/constraints/ConstraintsTest.java    |  209 --
 .../constraints/ConstraintsTest.properties      |   26 -
 .../zest/runtime/defaults/UseDefaultsTest.java  |  120 --
 .../zest/runtime/entity/AggregatedTest.java     |  169 --
 .../entity/EntityBuilderWithStateTest.java      |  131 --
 .../entity/EntityCompositeEqualityTest.java     |   92 -
 .../zest/runtime/entity/EntityCreationTest.java |   98 -
 .../zest/runtime/entity/EntityTypeTest.java     |   74 -
 .../runtime/entity/EntityVisibilityTest.java    | 1029 ----------
 .../zest/runtime/entity/LifecycleTest.java      |  122 --
 .../apache/zest/runtime/entity/QI273Test.java   |  103 -
 .../entity/associations/AssociationTest.java    |  222 ---
 .../associations/ImmutableAssociationTest.java  |  157 --
 .../injection/ActivatorInjectionTest.java       |  172 --
 .../ConstructorInjectionOfThisTest.java         |  176 --
 .../IllegalUnitOfWorkInjectionTest.java         |   96 -
 .../injection/InvocationInjectionTest.java      |  147 --
 .../runtime/injection/ServiceInjectionTest.java |  374 ----
 .../runtime/injection/StateInjectionTest.java   |  111 --
 .../injection/StateParameterInjectionTest.java  |  102 -
 .../injection/StructureInjectionTest.java       |  202 --
 .../runtime/injection/ThisInjectionTest.java    |  143 --
 .../injection/UnitOfWorkInjectionTest.java      |  121 --
 .../runtime/injection/UsesGenericClassTest.java |   75 -
 .../runtime/injection/UsesGenericListTest.java  |   77 -
 .../zest/runtime/injection/UsesGraphTest.java   |   90 -
 .../runtime/injection/UsesInjectionTest.java    |   93 -
 .../EagerServiceInstantiationTest.java          |   86 -
 .../ServiceInstantiationTests.java              |   78 -
 .../TransientInstantiationTests.java            |   68 -
 .../instantiation/ValueInstantiationTests.java  |  112 --
 .../zest/runtime/mixin/AssemblyMixinTest.java   |  115 --
 .../zest/runtime/mixin/AssemblyRoleTest.java    |  130 --
 .../zest/runtime/mixin/InitializableTest.java   |   99 -
 .../InvokeServiceFromModuleAssemblyTest.java    |   66 -
 .../apache/zest/runtime/mixin/JDKMixinTest.java |  197 --
 .../mixin/MethodInterceptionMixinTest.java      |  101 -
 .../zest/runtime/mixin/MixinPrecedenceTest.java |  134 --
 .../mixin/MixinsOnThisInjectionTest.java        |   85 -
 .../zest/runtime/mixin/PrivateMixinTest.java    |  118 --
 .../apache/zest/runtime/mixin/Qi228Test.java    |   77 -
 .../objects/ObjectBuilderFactoryTest.java       |  180 --
 .../zest/runtime/objects/ObjectConcernTest.java |   75 -
 .../runtime/objects/ObjectVisibilityTest.java   |  900 ---------
 .../apache/zest/runtime/objects/OuterClass.java |   49 -
 .../runtime/property/ImmutablePropertyTest.java |  135 --
 .../runtime/property/PropertyEqualityTest.java  |  439 ----
 .../property/PropertyStringArrayTest.java       |   69 -
 .../zest/runtime/property/PropertyTest.java     |  195 --
 .../property/ValueNestedBuilderTest.java        |  133 --
 .../runtime/query/IterableQuerySourceTest.java  |  526 -----
 .../org/apache/zest/runtime/query/Network.java  |  243 ---
 .../zest/runtime/query/NonQueryableTest.java    |   95 -
 .../query/QueryBuilderFactoryImplTest.java      |  167 --
 .../apache/zest/runtime/query/model/Alive.java  |   24 -
 .../apache/zest/runtime/query/model/City.java   |   33 -
 .../zest/runtime/query/model/Describable.java   |   56 -
 .../apache/zest/runtime/query/model/Domain.java |   30 -
 .../apache/zest/runtime/query/model/Female.java |   34 -
 .../apache/zest/runtime/query/model/Male.java   |   37 -
 .../zest/runtime/query/model/Nameable.java      |   29 -
 .../apache/zest/runtime/query/model/Person.java |   60 -
 .../apache/zest/runtime/query/model/Pet.java    |   53 -
 .../query/model/entities/CityEntity.java        |   28 -
 .../query/model/entities/DomainEntity.java      |   28 -
 .../query/model/entities/FemaleEntity.java      |   28 -
 .../query/model/entities/MaleEntity.java        |   28 -
 .../query/model/entities/PersonEntity.java      |   28 -
 .../runtime/query/model/entities/PetEntity.java |   34 -
 .../query/model/values/ContactValue.java        |   35 -
 .../query/model/values/ContactsValue.java       |   36 -
 .../runtime/service/ActivatableServiceTest.java |  100 -
 .../runtime/service/AvailableServiceTest.java   |  191 --
 .../runtime/service/ComplexActivatableTest.java |  104 -
 .../zest/runtime/service/ConfigurationTest.java |  147 --
 .../service/LazyActivatedServiceTest.java       |  119 --
 .../zest/runtime/service/PassivationTest.java   |  215 --
 .../zest/runtime/service/ServiceFinderTest.java |  129 --
 .../runtime/service/ServiceIdSelectorTest.java  |  118 --
 .../runtime/service/ServiceVisibilityTest.java  |  897 ---------
 .../sideeffects/GenericSideEffectTest.java      |  113 --
 .../sideeffects/ModuleSideEffectTest.java       |   89 -
 .../sideeffects/SampleTransientTest.java        |   89 -
 .../sideeffects/SpecificSideEffectTest.java     |  102 -
 .../runtime/structure/ApplicationModeTest.java  |  114 --
 .../structure/CompositeDescriptorTest.java      |   87 -
 .../runtime/structure/MixinVisibilityTest.java  |  444 -----
 .../zest/runtime/structure/ModuleTest.java      |  168 --
 .../PrivateCompositeVisibilityTest.java         |  116 --
 .../zest/runtime/structure/StructureTest.java   |  135 --
 .../structure/TypeToCompositeLookupTest.java    |  402 ----
 .../runtime/threaded/ContextCompositeTest.java  |  144 --
 .../transients/TransientBuilderFactoryTest.java |  222 ---
 .../transients/TransientVisibilityTest.java     |  912 ---------
 .../unitofwork/AutoCloseableUoWTest.java        |   89 -
 .../unitofwork/PrivateEntityUnitOfWorkTest.java |  263 ---
 .../zest/runtime/unitofwork/RemovalTest.java    |  163 --
 .../unitofwork/UnitOfWorkFactoryTest.java       |  146 --
 .../zest/runtime/util/AnnotationsTest.java      |   51 -
 .../runtime/value/AssociationToValueTest.java   |  214 --
 .../runtime/value/NestedValueBuilderTest.java   |  190 --
 .../zest/runtime/value/ValueComposite2Test.java |  141 --
 .../runtime/value/ValueCompositeBasicsTest.java |  102 -
 .../zest/runtime/value/ValueEqualityTest.java   |  241 ---
 .../ValueInjectionDeserializationTest.java      |  133 --
 .../value/ValueSerializationRegressionTest.java |   77 -
 .../zest/runtime/value/ValueVisibilityTest.java |  912 ---------
 .../runtime/value/ValueWithAssociationTest.java |  203 --
 .../visibility/VisibilityInUnitOfWorkTest.java  |  165 --
 .../service/importer/InstanceImporterTest.java  |   71 -
 .../service/importer/NewObjectImporterTest.java |   64 -
 .../importer/ServiceInstanceImporterTest.java   |   92 -
 .../importer/ServiceSelectorImporterTest.java   |  166 --
 .../test/java/org/apache/zest/test/ASMTest.java |  588 ------
 .../java/org/apache/zest/test/Exception1.java   |   29 -
 .../java/org/apache/zest/test/Exception2.java   |   29 -
 .../test/java/org/apache/zest/test/Other.java   |   54 -
 .../test/java/org/apache/zest/test/Some.java    |   32 -
 .../java/org/apache/zest/test/SomeMixin.java    |   61 -
 .../org/apache/zest/test/SomeMixin_Stubx.java   |  249 ---
 .../test/java/org/apache/zest/test/World.java   |   29 -
 .../test/composite/CleanStackTraceTest.java     |  144 --
 .../memory/MemoryEntityStoreTest.java           |   63 -
 .../runtime/instantiation/My.properties         |   21 +
 .../service/HelloWorldService.properties        |   22 +
 .../zest/runtime/instantiation/My.properties    |   21 -
 .../service/HelloWorldService.properties        |   22 -
 .../memory/MemoryEntityStoreService.java        |   45 +
 .../memory/MemoryMapEntityStoreMixin.java       |  179 ++
 .../polygene/entitystore/memory/package.html    |   24 +
 .../java/org/apache/polygene/spi/ZestSPI.java   |   75 +
 .../org/apache/polygene/spi/cache/Cache.java    |   39 +
 .../apache/polygene/spi/cache/CachePool.java    |   63 +
 .../apache/polygene/spi/cache/NullCache.java    |   50 +
 .../org/apache/polygene/spi/cache/package.html  |   24 +
 .../apache/polygene/spi/entity/EntityState.java |   87 +
 .../polygene/spi/entity/EntityStatus.java       |   32 +
 .../spi/entity/ManyAssociationState.java        |   47 +
 .../spi/entity/NamedAssociationState.java       |   54 +
 .../org/apache/polygene/spi/entity/package.html |   24 +
 .../polygene/spi/entitystore/BackupRestore.java |   50 +
 ...currentEntityStateModificationException.java |   50 +
 .../ConcurrentModificationCheckConcern.java     |  208 ++
 .../DefaultEntityStoreUnitOfWork.java           |  134 ++
 .../EntityAlreadyExistsException.java           |   43 +
 .../entitystore/EntityNotFoundException.java    |   42 +
 .../spi/entitystore/EntityStateVersions.java    |  112 ++
 .../polygene/spi/entitystore/EntityStore.java   |   42 +
 .../spi/entitystore/EntityStoreException.java   |   46 +
 .../spi/entitystore/EntityStoreSPI.java         |   42 +
 .../spi/entitystore/EntityStoreUnitOfWork.java  |   82 +
 .../ReadOnlyEntityStoreException.java           |   32 +
 .../spi/entitystore/StateChangeListener.java    |   32 +
 .../StateChangeNotificationConcern.java         |   62 +
 .../spi/entitystore/StateCommitter.java         |   30 +
 .../entitystore/helpers/DefaultEntityState.java |  258 +++
 .../helpers/DefaultManyAssociationState.java    |  112 ++
 .../helpers/DefaultNamedAssociationState.java   |  125 ++
 .../entitystore/helpers/JSONEntityState.java    |  329 +++
 .../spi/entitystore/helpers/JSONKeys.java       |   65 +
 .../helpers/JSONManyAssociationState.java       |  190 ++
 .../helpers/JSONMapEntityStoreActivation.java   |   62 +
 .../helpers/JSONMapEntityStoreMixin.java        |  525 +++++
 .../helpers/JSONNamedAssociationState.java      |  175 ++
 .../spi/entitystore/helpers/MapEntityStore.java |   86 +
 .../helpers/MapEntityStoreActivation.java       |   52 +
 .../helpers/MapEntityStoreMixin.java            |  518 +++++
 .../spi/entitystore/helpers/Migration.java      |   33 +
 .../spi/entitystore/helpers/StateStore.java     |   33 +
 .../spi/entitystore/helpers/package.html        |   24 +
 .../polygene/spi/entitystore/package.html       |   24 +
 .../polygene/spi/metrics/DefaultMetric.java     |   91 +
 .../spi/metrics/MetricsProviderAdapter.java     |  106 +
 .../spi/metrics/NullMetricsFactory.java         |  134 ++
 .../apache/polygene/spi/metrics/package.html    |   24 +
 .../apache/polygene/spi/module/ModuleSpi.java   |   40 +
 .../org/apache/polygene/spi/module/package.html |   24 +
 .../java/org/apache/polygene/spi/package.html   |   24 +
 .../apache/polygene/spi/query/EntityFinder.java |   85 +
 .../spi/query/EntityFinderException.java        |   43 +
 .../polygene/spi/query/IndexExporter.java       |   56 +
 .../polygene/spi/query/QueryBuilderSPI.java     |   30 +
 .../apache/polygene/spi/query/QuerySource.java  |   57 +
 .../org/apache/polygene/spi/query/package.html  |   24 +
 .../spi/value/ValueDeserializerAdapter.java     | 1000 ++++++++++
 .../spi/value/ValueSerializerAdapter.java       |  597 ++++++
 .../org/apache/polygene/spi/value/package.html  |   24 +
 .../orgjson/OrgJsonValueDeserializer.java       |  485 +++++
 .../OrgJsonValueSerializationService.java       |   32 +
 .../orgjson/OrgJsonValueSerializer.java         |  114 ++
 .../valueserialization/orgjson/package.html     |   24 +
 .../memory/MemoryEntityStoreService.java        |   45 -
 .../memory/MemoryMapEntityStoreMixin.java       |  179 --
 .../apache/zest/entitystore/memory/package.html |   24 -
 .../main/java/org/apache/zest/spi/ZestSPI.java  |   75 -
 .../java/org/apache/zest/spi/cache/Cache.java   |   39 -
 .../org/apache/zest/spi/cache/CachePool.java    |   63 -
 .../org/apache/zest/spi/cache/NullCache.java    |   50 -
 .../java/org/apache/zest/spi/cache/package.html |   24 -
 .../org/apache/zest/spi/entity/EntityState.java |   87 -
 .../apache/zest/spi/entity/EntityStatus.java    |   32 -
 .../zest/spi/entity/ManyAssociationState.java   |   47 -
 .../zest/spi/entity/NamedAssociationState.java  |   54 -
 .../org/apache/zest/spi/entity/package.html     |   24 -
 .../zest/spi/entitystore/BackupRestore.java     |   50 -
 ...currentEntityStateModificationException.java |   51 -
 .../ConcurrentModificationCheckConcern.java     |  208 --
 .../DefaultEntityStoreUnitOfWork.java           |  134 --
 .../EntityAlreadyExistsException.java           |   43 -
 .../entitystore/EntityNotFoundException.java    |   42 -
 .../spi/entitystore/EntityStateVersions.java    |  112 --
 .../zest/spi/entitystore/EntityStore.java       |   42 -
 .../spi/entitystore/EntityStoreException.java   |   46 -
 .../zest/spi/entitystore/EntityStoreSPI.java    |   42 -
 .../spi/entitystore/EntityStoreUnitOfWork.java  |   82 -
 .../ReadOnlyEntityStoreException.java           |   32 -
 .../spi/entitystore/StateChangeListener.java    |   32 -
 .../StateChangeNotificationConcern.java         |   62 -
 .../zest/spi/entitystore/StateCommitter.java    |   30 -
 .../entitystore/helpers/DefaultEntityState.java |  258 ---
 .../helpers/DefaultManyAssociationState.java    |  112 --
 .../helpers/DefaultNamedAssociationState.java   |  125 --
 .../entitystore/helpers/JSONEntityState.java    |  330 ---
 .../zest/spi/entitystore/helpers/JSONKeys.java  |   65 -
 .../helpers/JSONManyAssociationState.java       |  190 --
 .../helpers/JSONMapEntityStoreActivation.java   |   62 -
 .../helpers/JSONMapEntityStoreMixin.java        |  525 -----
 .../helpers/JSONNamedAssociationState.java      |  175 --
 .../spi/entitystore/helpers/MapEntityStore.java |   86 -
 .../helpers/MapEntityStoreActivation.java       |   52 -
 .../helpers/MapEntityStoreMixin.java            |  518 -----
 .../zest/spi/entitystore/helpers/Migration.java |   33 -
 .../spi/entitystore/helpers/StateStore.java     |   33 -
 .../zest/spi/entitystore/helpers/package.html   |   24 -
 .../apache/zest/spi/entitystore/package.html    |   24 -
 .../apache/zest/spi/metrics/DefaultMetric.java  |   91 -
 .../spi/metrics/MetricsProviderAdapter.java     |  106 -
 .../zest/spi/metrics/NullMetricsFactory.java    |  134 --
 .../org/apache/zest/spi/metrics/package.html    |   24 -
 .../org/apache/zest/spi/module/ModuleSpi.java   |   40 -
 .../org/apache/zest/spi/module/package.html     |   24 -
 .../main/java/org/apache/zest/spi/package.html  |   24 -
 .../org/apache/zest/spi/query/EntityFinder.java |   85 -
 .../zest/spi/query/EntityFinderException.java   |   43 -
 .../apache/zest/spi/query/IndexExporter.java    |   56 -
 .../apache/zest/spi/query/QueryBuilderSPI.java  |   30 -
 .../org/apache/zest/spi/query/QuerySource.java  |   57 -
 .../java/org/apache/zest/spi/query/package.html |   24 -
 .../spi/value/ValueDeserializerAdapter.java     | 1000 ----------
 .../zest/spi/value/ValueSerializerAdapter.java  |  597 ------
 .../java/org/apache/zest/spi/value/package.html |   24 -
 .../orgjson/OrgJsonValueDeserializer.java       |  485 -----
 .../OrgJsonValueSerializationService.java       |   32 -
 .../orgjson/OrgJsonValueSerializer.java         |  114 --
 .../valueserialization/orgjson/package.html     |   24 -
 .../helpers/JSONManyAssociationStateTest.java   |  139 ++
 .../spi/metrics/DefaultMetricsTest.java         |  118 ++
 .../spi/property/DefaultValuesTest.java         |   76 +
 .../helpers/JSONManyAssociationStateTest.java   |  139 --
 .../zest/spi/metrics/DefaultMetricsTest.java    |  119 --
 .../zest/spi/property/DefaultValuesTest.java    |   76 -
 core/spi/src/test/resources/logback-test.xml    |    2 +-
 core/testsupport/src/docs/testsupport.txt       |    2 +-
 .../polygene/test/AbstractZestBaseTest.java     |  135 ++
 .../polygene/test/AbstractZestScenarioTest.java |  142 ++
 .../apache/polygene/test/AbstractZestTest.java  |  120 ++
 .../polygene/test/EntityTestAssembler.java      |   47 +
 .../test/cache/AbstractCachePoolTest.java       |  126 ++
 .../cache/AbstractEntityStoreWithCacheTest.java |  168 ++
 .../polygene/test/cache/MemoryCacheImpl.java    |  145 ++
 .../test/cache/MemoryCachePoolMixin.java        |   85 +
 .../test/cache/MemoryCachePoolService.java      |   40 +
 .../org/apache/polygene/test/cache/package.html |   24 +
 ...bstractConfigurationDeserializationTest.java |  121 ++
 .../test/entity/AbstractEntityStoreTest.java    |  654 ++++++
 .../apache/polygene/test/entity/package.html    |   24 +
 .../test/indexing/AbstractAnyQueryTest.java     |  102 +
 .../test/indexing/AbstractComplexQueryTest.java |  334 ++++
 .../test/indexing/AbstractEntityFinderTest.java |  447 +++++
 .../test/indexing/AbstractNamedQueryTest.java   |  335 ++++
 .../test/indexing/AbstractQueryTest.java        |  829 ++++++++
 .../polygene/test/indexing/NameableAssert.java  |  151 ++
 .../apache/polygene/test/indexing/TestData.java |  252 +++
 .../AbstractMultiLayeredIndexingTest.java       |  137 ++
 .../test/indexing/layered/Suite1Case1.java      |   75 +
 .../test/indexing/layered/Suite1Case2.java      |   76 +
 .../test/indexing/layered/TestCase.java         |   33 +
 .../indexing/layered/assembly/AccessLayer.java  |   65 +
 .../layered/assembly/AccountModule.java         |   50 +
 .../layered/assembly/ApplicationAssembler.java  |   71 +
 .../indexing/layered/assembly/ConfigLayer.java  |   37 +
 .../indexing/layered/assembly/ConfigModule.java |   41 +
 .../indexing/layered/assembly/DomainLayer.java  |   38 +
 .../indexing/layered/assembly/FamilyModule.java |   52 +
 .../layered/assembly/IndexingLayer.java         |   38 +
 .../layered/assembly/PersistenceLayer.java      |   37 +
 .../layered/assembly/PersistenceModule.java     |   44 +
 .../layered/assembly/TestExecutionModule.java   |   46 +
 .../layered/assembly/TestSuite1Module.java      |   53 +
 .../layered/assembly/TestSuite2Module.java      |   38 +
 .../layered/assembly/TestSuite3Module.java      |   38 +
 .../polygene/test/indexing/model/Account.java   |   30 +
 .../polygene/test/indexing/model/Address.java   |   32 +
 .../polygene/test/indexing/model/Alive.java     |   27 +
 .../polygene/test/indexing/model/Cat.java       |   27 +
 .../polygene/test/indexing/model/City.java      |   32 +
 .../polygene/test/indexing/model/Dog.java       |   27 +
 .../polygene/test/indexing/model/Domain.java    |   30 +
 .../polygene/test/indexing/model/Female.java    |   32 +
 .../polygene/test/indexing/model/File.java      |   32 +
 .../polygene/test/indexing/model/Host.java      |   30 +
 .../polygene/test/indexing/model/Male.java      |   32 +
 .../polygene/test/indexing/model/Nameable.java  |   31 +
 .../polygene/test/indexing/model/Person.java    |   99 +
 .../polygene/test/indexing/model/Pet.java       |   28 +
 .../polygene/test/indexing/model/Port.java      |   32 +
 .../polygene/test/indexing/model/Protocol.java  |   30 +
 .../test/indexing/model/QueryParam.java         |   32 +
 .../polygene/test/indexing/model/URL.java       |   46 +
 .../polygene/test/indexing/model/package.html   |   24 +
 .../apache/polygene/test/indexing/package.html  |   24 +
 .../test/metrics/MetricValuesProvider.java      |   45 +
 .../polygene/test/mock/MockComposite.java       |   33 +
 .../polygene/test/mock/MockPlayerConcern.java   |   40 +
 .../polygene/test/mock/MockPlayerMixin.java     |   67 +
 .../apache/polygene/test/mock/MockRecorder.java |   25 +
 .../polygene/test/mock/MockResolverType.java    |   25 +
 .../MethodClassMatcherMockResolver.java         |   54 +
 .../test/mock/internal/MockRecorderMixin.java   |   55 +
 .../test/mock/internal/MockRepository.java      |   27 +
 .../test/mock/internal/MockResolver.java        |   40 +
 .../test/mock/internal/MockResolverProxy.java   |   95 +
 .../mock/internal/MockResolverTypeImpl.java     |   39 +
 .../mock/internal/UnresolvableMockResolver.java |   41 +
 .../polygene/test/mock/internal/package.html    |   24 +
 .../org/apache/polygene/test/mock/package.html  |   24 +
 .../java/org/apache/polygene/test/package.html  |   24 +
 .../org/apache/polygene/test/util/Assume.java   |  119 ++
 .../polygene/test/util/FreePortFinder.java      |  221 ++
 .../apache/polygene/test/util/JSONAssert.java   |  130 ++
 .../apache/polygene/test/util/JmxFixture.java   |  120 ++
 .../polygene/test/util/NotYetImplemented.java   |   80 +
 .../apache/polygene/test/util/RepeatRule.java   |   62 +
 .../apache/polygene/test/util/RetryRule.java    |   72 +
 .../org/apache/polygene/test/util/package.html  |   24 +
 .../AbstractCollectionSerializationTest.java    |  433 ++++
 .../test/value/AbstractJsonDateFormatTest.java  |  151 ++
 .../AbstractPlainValueSerializationTest.java    |  295 +++
 ...AbstractValueCompositeSerializationTest.java |  431 ++++
 .../org/apache/polygene/test/value/package.html |   24 +
 .../apache/zest/test/AbstractZestBaseTest.java  |  135 --
 .../zest/test/AbstractZestScenarioTest.java     |  142 --
 .../org/apache/zest/test/AbstractZestTest.java  |  120 --
 .../apache/zest/test/EntityTestAssembler.java   |   47 -
 .../zest/test/cache/AbstractCachePoolTest.java  |  126 --
 .../cache/AbstractEntityStoreWithCacheTest.java |  168 --
 .../apache/zest/test/cache/MemoryCacheImpl.java |  145 --
 .../zest/test/cache/MemoryCachePoolMixin.java   |   85 -
 .../zest/test/cache/MemoryCachePoolService.java |   40 -
 .../org/apache/zest/test/cache/package.html     |   24 -
 ...bstractConfigurationDeserializationTest.java |  121 --
 .../test/entity/AbstractEntityStoreTest.java    |  654 ------
 .../org/apache/zest/test/entity/package.html    |   24 -
 .../test/indexing/AbstractAnyQueryTest.java     |  102 -
 .../test/indexing/AbstractComplexQueryTest.java |  334 ----
 .../test/indexing/AbstractEntityFinderTest.java |  447 -----
 .../test/indexing/AbstractNamedQueryTest.java   |  335 ----
 .../zest/test/indexing/AbstractQueryTest.java   |  829 --------
 .../zest/test/indexing/NameableAssert.java      |  151 --
 .../org/apache/zest/test/indexing/TestData.java |  252 ---
 .../AbstractMultiLayeredIndexingTest.java       |  137 --
 .../zest/test/indexing/layered/Suite1Case1.java |   76 -
 .../zest/test/indexing/layered/Suite1Case2.java |   76 -
 .../zest/test/indexing/layered/TestCase.java    |   33 -
 .../indexing/layered/assembly/AccessLayer.java  |   65 -
 .../layered/assembly/AccountModule.java         |   50 -
 .../layered/assembly/ApplicationAssembler.java  |   71 -
 .../indexing/layered/assembly/ConfigLayer.java  |   37 -
 .../indexing/layered/assembly/ConfigModule.java |   41 -
 .../indexing/layered/assembly/DomainLayer.java  |   38 -
 .../indexing/layered/assembly/FamilyModule.java |   52 -
 .../layered/assembly/IndexingLayer.java         |   38 -
 .../layered/assembly/PersistenceLayer.java      |   37 -
 .../layered/assembly/PersistenceModule.java     |   44 -
 .../layered/assembly/TestExecutionModule.java   |   46 -
 .../layered/assembly/TestSuite1Module.java      |   53 -
 .../layered/assembly/TestSuite2Module.java      |   38 -
 .../layered/assembly/TestSuite3Module.java      |   38 -
 .../zest/test/indexing/model/Account.java       |   30 -
 .../zest/test/indexing/model/Address.java       |   32 -
 .../apache/zest/test/indexing/model/Alive.java  |   27 -
 .../apache/zest/test/indexing/model/Cat.java    |   27 -
 .../apache/zest/test/indexing/model/City.java   |   32 -
 .../apache/zest/test/indexing/model/Dog.java    |   27 -
 .../apache/zest/test/indexing/model/Domain.java |   30 -
 .../apache/zest/test/indexing/model/Female.java |   32 -
 .../apache/zest/test/indexing/model/File.java   |   33 -
 .../apache/zest/test/indexing/model/Host.java   |   31 -
 .../apache/zest/test/indexing/model/Male.java   |   32 -
 .../zest/test/indexing/model/Nameable.java      |   31 -
 .../apache/zest/test/indexing/model/Person.java |   99 -
 .../apache/zest/test/indexing/model/Pet.java    |   28 -
 .../apache/zest/test/indexing/model/Port.java   |   33 -
 .../zest/test/indexing/model/Protocol.java      |   31 -
 .../zest/test/indexing/model/QueryParam.java    |   33 -
 .../apache/zest/test/indexing/model/URL.java    |   47 -
 .../zest/test/indexing/model/package.html       |   24 -
 .../org/apache/zest/test/indexing/package.html  |   24 -
 .../zest/test/metrics/MetricValuesProvider.java |   45 -
 .../apache/zest/test/mock/MockComposite.java    |   33 -
 .../zest/test/mock/MockPlayerConcern.java       |   40 -
 .../apache/zest/test/mock/MockPlayerMixin.java  |   67 -
 .../org/apache/zest/test/mock/MockRecorder.java |   25 -
 .../apache/zest/test/mock/MockResolverType.java |   25 -
 .../MethodClassMatcherMockResolver.java         |   54 -
 .../test/mock/internal/MockRecorderMixin.java   |   55 -
 .../zest/test/mock/internal/MockRepository.java |   27 -
 .../zest/test/mock/internal/MockResolver.java   |   40 -
 .../test/mock/internal/MockResolverProxy.java   |   95 -
 .../mock/internal/MockResolverTypeImpl.java     |   39 -
 .../mock/internal/UnresolvableMockResolver.java |   41 -
 .../apache/zest/test/mock/internal/package.html |   24 -
 .../java/org/apache/zest/test/mock/package.html |   24 -
 .../main/java/org/apache/zest/test/package.html |   24 -
 .../java/org/apache/zest/test/util/Assume.java  |  119 --
 .../apache/zest/test/util/FreePortFinder.java   |  221 --
 .../org/apache/zest/test/util/JSONAssert.java   |  130 --
 .../org/apache/zest/test/util/JmxFixture.java   |  120 --
 .../zest/test/util/NotYetImplemented.java       |   80 -
 .../org/apache/zest/test/util/RepeatRule.java   |   62 -
 .../org/apache/zest/test/util/RetryRule.java    |   72 -
 .../java/org/apache/zest/test/util/package.html |   24 -
 .../AbstractCollectionSerializationTest.java    |  433 ----
 .../test/value/AbstractJsonDateFormatTest.java  |  151 --
 .../AbstractPlainValueSerializationTest.java    |  295 ---
 ...AbstractValueCompositeSerializationTest.java |  431 ----
 .../org/apache/zest/test/value/package.html     |   24 -
 .../polygene/test/cache/MemoryCacheTest.java    |   34 +
 .../polygene/test/cache/RetryRuleTest.java      |   39 +
 .../apache/zest/test/cache/MemoryCacheTest.java |   34 -
 .../apache/zest/test/cache/RetryRuleTest.java   |   39 -
 dependencies.gradle                             |    2 +-
 .../cache/ehcache/EhCacheConfiguration.java     |  143 ++
 .../polygene/cache/ehcache/EhCacheImpl.java     |   89 +
 .../cache/ehcache/EhCachePoolMixin.java         |  155 ++
 .../cache/ehcache/EhCachePoolService.java       |   30 +
 .../ehcache/assembly/EhCacheAssembler.java      |   46 +
 .../cache/ehcache/assembly/package.html         |   24 +
 .../apache/polygene/cache/ehcache/package.html  |   24 +
 .../cache/ehcache/EhCacheConfiguration.java     |  143 --
 .../apache/zest/cache/ehcache/EhCacheImpl.java  |   89 -
 .../zest/cache/ehcache/EhCachePoolMixin.java    |  155 --
 .../zest/cache/ehcache/EhCachePoolService.java  |   30 -
 .../ehcache/assembly/EhCacheAssembler.java      |   46 -
 .../zest/cache/ehcache/assembly/package.html    |   24 -
 .../org/apache/zest/cache/ehcache/package.html  |   24 -
 .../polygene/cache/ehcache/EhCacheTest.java     |   47 +
 .../apache/zest/cache/ehcache/EhCacheTest.java  |   47 -
 .../cache/memcache/MemcacheAssembler.java       |   47 +
 .../cache/memcache/MemcacheConfiguration.java   |   82 +
 .../polygene/cache/memcache/MemcacheImpl.java   |  112 ++
 .../cache/memcache/MemcachePoolMixin.java       |  131 ++
 .../cache/memcache/MemcachePoolService.java     |   33 +
 .../apache/polygene/cache/memcache/package.html |   42 +
 .../zest/cache/memcache/MemcacheAssembler.java  |   47 -
 .../cache/memcache/MemcacheConfiguration.java   |   82 -
 .../zest/cache/memcache/MemcacheImpl.java       |  112 --
 .../zest/cache/memcache/MemcachePoolMixin.java  |  131 --
 .../cache/memcache/MemcachePoolService.java     |   33 -
 .../org/apache/zest/cache/memcache/package.html |   42 -
 .../cache/memcache/MemcacheCachePoolTest.java   |   64 +
 .../cache/memcache/MemcacheCachePoolTest.java   |   64 -
 .../file/FileEntityStoreActivation.java         |   49 +
 .../file/FileEntityStoreConfiguration.java      |   92 +
 .../entitystore/file/FileEntityStoreMixin.java  |  368 ++++
 .../file/FileEntityStoreService.java            |   53 +
 .../file/assembly/FileEntityStoreAssembler.java |   46 +
 .../entitystore/file/assembly/package.html      |   24 +
 .../polygene/entitystore/file/package.html      |   24 +
 .../file/FileEntityStoreActivation.java         |   49 -
 .../file/FileEntityStoreConfiguration.java      |   92 -
 .../entitystore/file/FileEntityStoreMixin.java  |  368 ----
 .../file/FileEntityStoreService.java            |   53 -
 .../file/assembly/FileEntityStoreAssembler.java |   46 -
 .../zest/entitystore/file/assembly/package.html |   24 -
 .../apache/zest/entitystore/file/package.html   |   24 -
 .../entitystore/file/FileEntityStoreTest.java   |   57 +
 .../file/FileEntityStoreWithCacheTest.java      |   53 +
 .../entitystore/file/FileEntityStoreTest.java   |   57 -
 .../file/FileEntityStoreWithCacheTest.java      |   53 -
 .../entitystore/geode/GeodeConfiguration.java   |   83 +
 .../geode/GeodeEntityStoreMixin.java            |  200 ++
 .../geode/GeodeEntityStoreService.java          |   50 +
 .../entitystore/geode/GeodeTopology.java        |   29 +
 .../assembly/GeodeEntityStoreAssembler.java     |   49 +
 .../entitystore/geode/assembly/package.html     |   24 +
 .../polygene/entitystore/geode/package.html     |   24 +
 .../entitystore/geode/GeodeConfiguration.java   |   83 -
 .../geode/GeodeEntityStoreMixin.java            |  200 --
 .../geode/GeodeEntityStoreService.java          |   50 -
 .../zest/entitystore/geode/GeodeTopology.java   |   29 -
 .../assembly/GeodeEntityStoreAssembler.java     |   49 -
 .../entitystore/geode/assembly/package.html     |   24 -
 .../apache/zest/entitystore/geode/package.html  |   24 -
 .../entitystore/geode/GeodeEntityStoreTest.java |   47 +
 .../geode/GeodeEntityStoreWithCacheTest.java    |   43 +
 .../entitystore/geode/GeodeEntityStoreTest.java |   47 -
 .../geode/GeodeEntityStoreWithCacheTest.java    |   43 -
 .../hazelcast/HazelcastAccessors.java           |   32 +
 .../hazelcast/HazelcastConfiguration.java       |   41 +
 .../hazelcast/HazelcastEntityStoreMixin.java    |  170 ++
 .../hazelcast/HazelcastEntityStoreService.java  |   51 +
 .../assembly/HazelcastEntityStoreAssembler.java |   48 +
 .../entitystore/hazelcast/assembly/package.html |   24 +
 .../polygene/entitystore/hazelcast/package.html |   24 +
 .../hazelcast/HazelcastAccessors.java           |   32 -
 .../hazelcast/HazelcastConfiguration.java       |   41 -
 .../hazelcast/HazelcastEntityStoreMixin.java    |  170 --
 .../hazelcast/HazelcastEntityStoreService.java  |   51 -
 .../assembly/HazelcastEntityStoreAssembler.java |   48 -
 .../entitystore/hazelcast/assembly/package.html |   24 -
 .../zest/entitystore/hazelcast/package.html     |   24 -
 .../hazelcast/HazelcastEntityStoreTest.java     |   68 +
 .../HazelcastEntityStoreWithCacheTest.java      |   43 +
 .../hazelcast/HazelcastEntityStoreTest.java     |   68 -
 .../HazelcastEntityStoreWithCacheTest.java      |   43 -
 .../HazelcastEntityStoreService.properties      |   21 +
 .../entitystore/hazelcast/hazelcast.xml         |   40 +
 .../HazelcastEntityStoreService.properties      |   21 -
 .../zest/entitystore/hazelcast/hazelcast.xml    |   40 -
 .../JCloudsMapEntityStoreConfiguration.java     |   52 +
 .../jclouds/JCloudsMapEntityStoreMixin.java     |  274 +++
 .../jclouds/JCloudsMapEntityStoreService.java   |   50 +
 .../assembly/JCloudsEntityStoreAssembler.java   |   49 +
 .../polygene/entitystore/jclouds/package.html   |   24 +
 .../JCloudsMapEntityStoreConfiguration.java     |   52 -
 .../jclouds/JCloudsMapEntityStoreMixin.java     |  274 ---
 .../jclouds/JCloudsMapEntityStoreService.java   |   50 -
 .../assembly/JCloudsEntityStoreAssembler.java   |   49 -
 .../zest/entitystore/jclouds/package.html       |   24 -
 .../jclouds/JCloudsFilesystemTest.java          |   56 +
 .../jclouds/JCloudsTransientTest.java           |   48 +
 .../jclouds/JCloudsWithCacheTest.java           |   43 +
 .../jclouds/JCloudsFilesystemTest.java          |   56 -
 .../jclouds/JCloudsTransientTest.java           |   48 -
 .../jclouds/JCloudsWithCacheTest.java           |   43 -
 .../entitystore/jdbm/JdbmConfiguration.java     |   54 +
 .../jdbm/JdbmEntityStoreActivation.java         |   59 +
 .../entitystore/jdbm/JdbmEntityStoreMixin.java  |  479 +++++
 .../jdbm/JdbmEntityStoreService.java            |   51 +
 .../jdbm/assembly/JdbmEntityStoreAssembler.java |   46 +
 .../entitystore/jdbm/assembly/package.html      |   24 +
 .../polygene/entitystore/jdbm/package.html      |   24 +
 .../entitystore/jdbm/JdbmConfiguration.java     |   54 -
 .../jdbm/JdbmEntityStoreActivation.java         |   59 -
 .../entitystore/jdbm/JdbmEntityStoreMixin.java  |  479 -----
 .../jdbm/JdbmEntityStoreService.java            |   51 -
 .../jdbm/assembly/JdbmEntityStoreAssembler.java |   46 -
 .../zest/entitystore/jdbm/assembly/package.html |   24 -
 .../apache/zest/entitystore/jdbm/package.html   |   24 -
 .../entitystore/jdbm/DocumentationSupport.java  |   39 +
 .../entitystore/jdbm/JdbmEntityStoreTest.java   |   55 +
 .../jdbm/JdbmEntityStoreWithCacheTest.java      |   55 +
 .../entitystore/jdbm/DocumentationSupport.java  |   39 -
 .../entitystore/jdbm/JdbmEntityStoreTest.java   |   55 -
 .../jdbm/JdbmEntityStoreWithCacheTest.java      |   55 -
 .../LevelDBEntityStoreConfiguration.java        |   66 +
 .../leveldb/LevelDBEntityStoreMixin.java        |  299 +++
 .../leveldb/LevelDBEntityStoreService.java      |   58 +
 .../assembly/LevelDBEntityStoreAssembler.java   |   49 +
 .../polygene/entitystore/leveldb/package.html   |   39 +
 .../LevelDBEntityStoreConfiguration.java        |   66 -
 .../leveldb/LevelDBEntityStoreMixin.java        |  299 ---
 .../leveldb/LevelDBEntityStoreService.java      |   58 -
 .../assembly/LevelDBEntityStoreAssembler.java   |   49 -
 .../zest/entitystore/leveldb/package.html       |   39 -
 .../leveldb/JavaLevelDBEntityStoreTest.java     |   66 +
 .../leveldb/JniLevelDBEntityStoreTest.java      |   61 +
 .../LevelDBEntityStoreWithCacheTest.java        |   58 +
 .../leveldb/JavaLevelDBEntityStoreTest.java     |   66 -
 .../leveldb/JniLevelDBEntityStoreTest.java      |   61 -
 .../LevelDBEntityStoreWithCacheTest.java        |   58 -
 .../assembly/MemoryEntityStoreAssembler.java    |   44 +
 .../polygene/entitystore/memory/package.html    |   24 +
 .../assembly/MemoryEntityStoreAssembler.java    |   44 -
 .../apache/zest/entitystore/memory/package.html |   24 -
 .../memory/MemoryEntityStoreTest.java           |   44 +
 .../memory/MemoryEntityStoreWithCacheTest.java  |   39 +
 .../memory/MemoryEntityStoreTest.java           |   44 -
 .../memory/MemoryEntityStoreWithCacheTest.java  |   39 -
 .../entitystore/mongodb/MongoAccessors.java     |   32 +
 .../mongodb/MongoEntityStoreConfiguration.java  |   95 +
 .../mongodb/MongoMapEntityStoreMixin.java       |  305 +++
 .../mongodb/MongoMapEntityStoreService.java     |   51 +
 .../assembly/MongoDBEntityStoreAssembler.java   |   46 +
 .../polygene/entitystore/mongodb/package.html   |   24 +
 .../entitystore/mongodb/MongoAccessors.java     |   32 -
 .../mongodb/MongoEntityStoreConfiguration.java  |   95 -
 .../mongodb/MongoMapEntityStoreMixin.java       |  305 ---
 .../mongodb/MongoMapEntityStoreService.java     |   51 -
 .../assembly/MongoDBEntityStoreAssembler.java   |   46 -
 .../zest/entitystore/mongodb/package.html       |   24 -
 .../mongodb/EmbedMongoMapEntityStoreTest.java   |   92 +
 .../mongodb/MongoMapEntityStoreTest.java        |   92 +
 .../MongoMapEntityStoreWithCacheTest.java       |   87 +
 .../mongodb/EmbedMongoMapEntityStoreTest.java   |   92 -
 .../mongodb/MongoMapEntityStoreTest.java        |   92 -
 .../MongoMapEntityStoreWithCacheTest.java       |   87 -
 .../entitystore/prefs/ListPreferencesNodes.java |   68 +
 .../prefs/PreferencesEntityStoreInfo.java       |   45 +
 .../prefs/PreferencesEntityStoreMixin.java      |  658 ++++++
 .../prefs/PreferencesEntityStoreService.java    |   60 +
 .../PreferenceEntityStoreAssembler.java         |   51 +
 .../entitystore/prefs/assembly/package.html     |   24 +
 .../polygene/entitystore/prefs/package.html     |   24 +
 .../entitystore/prefs/ListPreferencesNodes.java |   68 -
 .../prefs/PreferencesEntityStoreInfo.java       |   45 -
 .../prefs/PreferencesEntityStoreMixin.java      |  658 ------
 .../prefs/PreferencesEntityStoreService.java    |   60 -
 .../PreferenceEntityStoreAssembler.java         |   51 -
 .../entitystore/prefs/assembly/package.html     |   24 -
 .../apache/zest/entitystore/prefs/package.html  |   24 -
 .../entitystore/DocumentationSupport.java       |   39 +
 .../entitystore/PreferencesEntityStoreTest.java |   56 +
 .../zest/entitystore/DocumentationSupport.java  |   39 -
 .../entitystore/PreferencesEntityStoreTest.java |   56 -
 .../entitystore/redis/RedisAccessors.java       |   29 +
 .../redis/RedisEntityStoreConfiguration.java    |   73 +
 .../redis/RedisMapEntityStoreMixin.java         |  175 ++
 .../redis/RedisMapEntityStoreService.java       |   51 +
 .../assembly/RedisEntityStoreAssembler.java     |   49 +
 .../polygene/entitystore/redis/package.html     |   24 +
 .../zest/entitystore/redis/RedisAccessors.java  |   29 -
 .../redis/RedisEntityStoreConfiguration.java    |   73 -
 .../redis/RedisMapEntityStoreMixin.java         |  175 --
 .../redis/RedisMapEntityStoreService.java       |   51 -
 .../assembly/RedisEntityStoreAssembler.java     |   49 -
 .../apache/zest/entitystore/redis/package.html  |   24 -
 .../redis/RedisMapEntityStoreTest.java          |   80 +
 .../redis/RedisMapEntityStoreWithCacheTest.java |   76 +
 .../redis/RedisMapEntityStoreTest.java          |   80 -
 .../redis/RedisMapEntityStoreWithCacheTest.java |   76 -
 .../entitystore/riak/RiakAccessors.java         |   31 +
 .../riak/RiakEntityStoreConfiguration.java      |  179 ++
 .../riak/RiakMapEntityStoreMixin.java           |  384 ++++
 .../riak/RiakMapEntityStoreService.java         |   55 +
 .../riak/assembly/RiakEntityStoreAssembler.java |   50 +
 .../polygene/entitystore/riak/package.html      |   24 +
 .../zest/entitystore/riak/RiakAccessors.java    |   31 -
 .../riak/RiakEntityStoreConfiguration.java      |  179 --
 .../riak/RiakMapEntityStoreMixin.java           |  384 ----
 .../riak/RiakMapEntityStoreService.java         |   55 -
 .../riak/assembly/RiakEntityStoreAssembler.java |   50 -
 .../apache/zest/entitystore/riak/package.html   |   24 -
 .../riak/RiakMapEntityStoreTest.java            |   87 +
 .../riak/RiakMapEntityStoreWithCacheTest.java   |   86 +
 .../riak/RiakMapEntityStoreTest.java            |   87 -
 .../riak/RiakMapEntityStoreWithCacheTest.java   |   86 -
 .../entitystore/sql/SQLEntityStoreMixin.java    |  624 ++++++
 .../entitystore/sql/SQLEntityStoreService.java  |   39 +
 .../AbstractSQLEntityStoreAssembler.java        |   93 +
 .../assembly/DerbySQLEntityStoreAssembler.java  |   48 +
 .../sql/assembly/H2SQLEntityStoreAssembler.java |   48 +
 .../sql/assembly/MySQLEntityStoreAssembler.java |   48 +
 .../PostgreSQLEntityStoreAssembler.java         |   55 +
 .../assembly/SQLiteEntityStoreAssembler.java    |   48 +
 .../entitystore/sql/assembly/package.html       |   24 +
 .../sql/internal/DatabaseSQLService.java        |  124 ++
 .../internal/DatabaseSQLServiceCoreMixin.java   |  159 ++
 .../sql/internal/DatabaseSQLServiceSpi.java     |   81 +
 .../sql/internal/DatabaseSQLServiceState.java   |   35 +
 .../DatabaseSQLServiceStatementsMixin.java      |  118 ++
 .../sql/internal/DatabaseSQLStringsBuilder.java |  389 ++++
 .../DerbySQLDatabaseSQLServiceMixin.java        |   72 +
 .../internal/H2SQLDatabaseSQLServiceMixin.java  |   63 +
 .../internal/MySQLDatabaseSQLServiceMixin.java  |   72 +
 .../PostgreSQLDatabaseSQLServiceMixin.java      |   68 +
 .../internal/PostgreSQLStringBuilderMixin.java  |   45 +
 .../sql/internal/SQLEntityState.java            |  189 ++
 .../internal/SQLiteDatabaseSQLServiceMixin.java |   65 +
 .../polygene/entitystore/sql/internal/SQLs.java |   39 +
 .../entitystore/sql/internal/package.html       |   24 +
 .../polygene/entitystore/sql/package.html       |   24 +
 .../entitystore/sql/SQLEntityStoreMixin.java    |  625 ------
 .../entitystore/sql/SQLEntityStoreService.java  |   39 -
 .../AbstractSQLEntityStoreAssembler.java        |   93 -
 .../assembly/DerbySQLEntityStoreAssembler.java  |   48 -
 .../sql/assembly/H2SQLEntityStoreAssembler.java |   48 -
 .../sql/assembly/MySQLEntityStoreAssembler.java |   48 -
 .../PostgreSQLEntityStoreAssembler.java         |   55 -
 .../assembly/SQLiteEntityStoreAssembler.java    |   48 -
 .../zest/entitystore/sql/assembly/package.html  |   24 -
 .../sql/internal/DatabaseSQLService.java        |  124 --
 .../internal/DatabaseSQLServiceCoreMixin.java   |  159 --
 .../sql/internal/DatabaseSQLServiceSpi.java     |   81 -
 .../sql/internal/DatabaseSQLServiceState.java   |   35 -
 .../DatabaseSQLServiceStatementsMixin.java      |  118 --
 .../sql/internal/DatabaseSQLStringsBuilder.java |  389 ----
 .../DerbySQLDatabaseSQLServiceMixin.java        |   72 -
 .../internal/H2SQLDatabaseSQLServiceMixin.java  |   63 -
 .../internal/MySQLDatabaseSQLServiceMixin.java  |   72 -
 .../PostgreSQLDatabaseSQLServiceMixin.java      |   68 -
 .../internal/PostgreSQLStringBuilderMixin.java  |   45 -
 .../sql/internal/SQLEntityState.java            |  189 --
 .../internal/SQLiteDatabaseSQLServiceMixin.java |   65 -
 .../zest/entitystore/sql/internal/SQLs.java     |   39 -
 .../zest/entitystore/sql/internal/package.html  |   24 -
 .../apache/zest/entitystore/sql/package.html    |   24 -
 .../sql/DerbySQLEntityStoreTest.java            |  109 +
 .../entitystore/sql/H2SQLEntityStoreTest.java   |   86 +
 .../entitystore/sql/MySQLEntityStoreTest.java   |  120 ++
 .../sql/PostgreSQLEntityStoreTest.java          |  150 ++
 .../entitystore/sql/SQLiteEntityStoreTest.java  |   95 +
 .../sql/DerbySQLEntityStoreTest.java            |  109 -
 .../entitystore/sql/H2SQLEntityStoreTest.java   |   86 -
 .../entitystore/sql/MySQLEntityStoreTest.java   |  120 --
 .../sql/PostgreSQLEntityStoreTest.java          |  150 --
 .../entitystore/sql/SQLiteEntityStoreTest.java  |   95 -
 .../src/test/resources/logback.xml              |    4 +-
 .../ElasticSearchClusterConfiguration.java      |   64 +
 .../ElasticSearchConfiguration.java             |   52 +
 .../elasticsearch/ElasticSearchFinder.java      |  523 +++++
 .../ElasticSearchFinderSupport.java             |   67 +
 .../ElasticSearchIndexException.java            |   36 +
 .../ElasticSearchIndexExporter.java             |   53 +
 .../elasticsearch/ElasticSearchIndexer.java     |  376 ++++
 .../elasticsearch/ElasticSearchSupport.java     |   37 +
 .../assembly/ESClientIndexQueryAssembler.java   |   57 +
 .../assembly/ESClusterIndexQueryAssembler.java  |   51 +
 .../ESFilesystemIndexQueryAssembler.java        |   51 +
 .../index/elasticsearch/assembly/package.html   |   24 +
 .../client/ESClientIndexQueryService.java       |   30 +
 .../elasticsearch/client/ESClientSupport.java   |   53 +
 .../index/elasticsearch/client/package.html     |   24 +
 .../cluster/ESClusterIndexQueryService.java     |   32 +
 .../elasticsearch/cluster/ESClusterSupport.java |   77 +
 .../index/elasticsearch/cluster/package.html    |   24 +
 .../ESFilesystemIndexQueryService.java          |   32 +
 .../filesystem/ESFilesystemSupport.java         |   87 +
 .../index/elasticsearch/filesystem/package.html |   24 +
 .../AbstractElasticSearchAssembler.java         |   31 +
 .../internal/AbstractElasticSearchSupport.java  |  154 ++
 .../index/elasticsearch/internal/package.html   |   24 +
 .../polygene/index/elasticsearch/package.html   |   24 +
 .../ElasticSearchClusterConfiguration.java      |   64 -
 .../ElasticSearchConfiguration.java             |   52 -
 .../elasticsearch/ElasticSearchFinder.java      |  523 -----
 .../ElasticSearchFinderSupport.java             |   67 -
 .../ElasticSearchIndexException.java            |   36 -
 .../ElasticSearchIndexExporter.java             |   53 -
 .../elasticsearch/ElasticSearchIndexer.java     |  376 ----
 .../elasticsearch/ElasticSearchSupport.java     |   37 -
 .../assembly/ESClientIndexQueryAssembler.java   |   57 -
 .../assembly/ESClusterIndexQueryAssembler.java  |   51 -
 .../ESFilesystemIndexQueryAssembler.java        |   51 -
 .../index/elasticsearch/assembly/package.html   |   24 -
 .../client/ESClientIndexQueryService.java       |   30 -
 .../elasticsearch/client/ESClientSupport.java   |   53 -
 .../index/elasticsearch/client/package.html     |   24 -
 .../cluster/ESClusterIndexQueryService.java     |   32 -
 .../elasticsearch/cluster/ESClusterSupport.java |   77 -
 .../index/elasticsearch/cluster/package.html    |   24 -
 .../ESFilesystemIndexQueryService.java          |   32 -
 .../filesystem/ESFilesystemSupport.java         |   87 -
 .../index/elasticsearch/filesystem/package.html |   24 -
 .../AbstractElasticSearchAssembler.java         |   31 -
 .../internal/AbstractElasticSearchSupport.java  |  154 --
 .../index/elasticsearch/internal/package.html   |   24 -
 .../zest/index/elasticsearch/package.html       |   24 -
 .../elasticsearch/DocumentationSupport.java     |   60 +
 .../index/elasticsearch/ESEmbeddedRule.java     |  134 ++
 .../ElasticSearchComplexQueryTest.java          |   83 +
 .../elasticsearch/ElasticSearchFinderTest.java  |   87 +
 .../ElasticSearchQueryMultimoduleTest.java      |   66 +
 .../elasticsearch/ElasticSearchQueryTest.java   |  114 ++
 .../index/elasticsearch/ElasticSearchTest.java  |  249 +++
 .../index/elasticsearch/ImmenseTermTest.java    |  156 ++
 .../elasticsearch/DocumentationSupport.java     |   60 -
 .../index/elasticsearch/ESEmbeddedRule.java     |  134 --
 .../ElasticSearchComplexQueryTest.java          |   83 -
 .../elasticsearch/ElasticSearchFinderTest.java  |   87 -
 .../ElasticSearchQueryMultimoduleTest.java      |   66 -
 .../elasticsearch/ElasticSearchQueryTest.java   |  114 --
 .../index/elasticsearch/ElasticSearchTest.java  |  249 ---
 .../index/elasticsearch/ImmenseTermTest.java    |  156 --
 .../src/test/resources/logback-test.xml         |    2 +-
 .../index/rdf/RdfIndexingEngineService.java     |   31 +
 .../index/rdf/UnsupportedLanguageException.java |   39 +
 .../rdf/assembly/RdfMemoryStoreAssembler.java   |   70 +
 .../assembly/RdfNativeSesameStoreAssembler.java |   68 +
 .../assembly/RdfRdbmsSesameStoreAssembler.java  |   69 +
 .../polygene/index/rdf/assembly/package.html    |   24 +
 .../index/rdf/indexing/RdfExporter.java         |  106 +
 .../index/rdf/indexing/RdfIndexingService.java  |  240 +++
 .../polygene/index/rdf/indexing/package.html    |   24 +
 .../org/apache/polygene/index/rdf/package.html  |   24 +
 ...llectingQualifiedIdentityResultCallback.java |   43 +
 .../query/QualifiedIdentityResultCallback.java  |   33 +
 .../index/rdf/query/RdfQueryParser.java         |   38 +
 .../index/rdf/query/RdfQueryParserFactory.java  |   60 +
 .../index/rdf/query/RdfQueryService.java        |  124 ++
 .../index/rdf/query/SesameExpressions.java      |   38 +
 .../SingleQualifiedIdentityResultCallback.java  |   40 +
 .../index/rdf/query/TupleQueryExecutor.java     |  150 ++
 .../index/rdf/query/internal/Namespaces.java    |   86 +
 .../rdf/query/internal/RdfQueryParserImpl.java  |  555 ++++++
 .../index/rdf/query/internal/Triples.java       |  287 +++
 .../index/rdf/query/internal/package.html       |   24 +
 .../polygene/index/rdf/query/package.html       |   24 +
 .../index/rdf/RdfIndexingEngineService.java     |   31 -
 .../index/rdf/UnsupportedLanguageException.java |   39 -
 .../rdf/assembly/RdfMemoryStoreAssembler.java   |   70 -
 .../assembly/RdfNativeSesameStoreAssembler.java |   68 -
 .../assembly/RdfRdbmsSesameStoreAssembler.java  |   69 -
 .../apache/zest/index/rdf/assembly/package.html |   24 -
 .../zest/index/rdf/indexing/RdfExporter.java    |  106 -
 .../index/rdf/indexing/RdfIndexingService.java  |  240 ---
 .../apache/zest/index/rdf/indexing/package.html |   24 -
 .../java/org/apache/zest/index/rdf/package.html |   24 -
 ...llectingQualifiedIdentityResultCallback.java |   43 -
 .../query/QualifiedIdentityResultCallback.java  |   33 -
 .../zest/index/rdf/query/RdfQueryParser.java    |   38 -
 .../index/rdf/query/RdfQueryParserFactory.java  |   60 -
 .../zest/index/rdf/query/RdfQueryService.java   |  124 --
 .../zest/index/rdf/query/SesameExpressions.java |   38 -
 .../SingleQualifiedIdentityResultCallback.java  |   40 -
 .../index/rdf/query/TupleQueryExecutor.java     |  150 --
 .../index/rdf/query/internal/Namespaces.java    |   86 -
 .../rdf/query/internal/RdfQueryParserImpl.java  |  555 ------
 .../zest/index/rdf/query/internal/Triples.java  |  287 ---
 .../zest/index/rdf/query/internal/package.html  |   24 -
 .../apache/zest/index/rdf/query/package.html    |   24 -
 .../polygene/index/rdf/ContainsAllTest.java     |  389 ++++
 .../apache/polygene/index/rdf/ContainsTest.java |  212 ++
 .../index/rdf/DocumentationSupport.java         |   77 +
 .../polygene/index/rdf/MultiLayeredTest.java    |   51 +
 .../polygene/index/rdf/RDFPerformanceTest.java  |  265 +++
 .../polygene/index/rdf/RdfComplexQueryTest.java |   48 +
 .../polygene/index/rdf/RdfEntityFinderTest.java |   45 +
 .../index/rdf/RdfNamedQueryMultimoduleTest.java |   52 +
 .../polygene/index/rdf/RdfNamedQueryTest.java   |  293 +++
 .../index/rdf/RdfQueryMultimoduleTest.java      |   67 +
 .../apache/polygene/index/rdf/RdfQueryTest.java |   89 +
 .../index/rdf/qi173/Qi173IssueTest.java         |  133 ++
 .../index/rdf/qi64/AbstractIssueTest.java       |   70 +
 .../apache/polygene/index/rdf/qi64/Account.java |   25 +
 .../index/rdf/qi64/AccountComposite.java        |   28 +
 .../apache/polygene/index/rdf/qi64/HasName.java |   27 +
 .../AccountService.java                         |   65 +
 .../AccountServiceComposite.java                |   30 +
 .../withPropagationMandatory/IssueTest.java     |   94 +
 .../withPropagationRequired/AccountService.java |   64 +
 .../AccountServiceComposite.java                |   30 +
 .../qi64/withPropagationRequired/IssueTest.java |   94 +
 .../AccountService.java                         |   64 +
 .../AccountServiceComposite.java                |   30 +
 .../withPropagationRequiresNew/IssueTest.java   |   94 +
 .../apache/polygene/index/rdf/qi66/Account.java |   25 +
 .../index/rdf/qi66/AccountComposite.java        |   27 +
 .../apache/polygene/index/rdf/qi66/HasName.java |   27 +
 .../polygene/index/rdf/qi66/Qi66IssueTest.java  |  103 +
 .../polygene/index/rdf/qi95/Qi95IssueTest.java  |  398 ++++
 .../apache/zest/index/rdf/ContainsAllTest.java  |  389 ----
 .../org/apache/zest/index/rdf/ContainsTest.java |  212 --
 .../zest/index/rdf/DocumentationSupport.java    |   77 -
 .../apache/zest/index/rdf/MultiLayeredTest.java |   53 -
 .../zest/index/rdf/RDFPerformanceTest.java      |  265 ---
 .../zest/index/rdf/RdfComplexQueryTest.java     |   48 -
 .../zest/index/rdf/RdfEntityFinderTest.java     |   45 -
 .../index/rdf/RdfNamedQueryMultimoduleTest.java |   52 -
 .../zest/index/rdf/RdfNamedQueryTest.java       |  293 ---
 .../zest/index/rdf/RdfQueryMultimoduleTest.java |   67 -
 .../org/apache/zest/index/rdf/RdfQueryTest.java |   89 -
 .../zest/index/rdf/qi173/Qi173IssueTest.java    |  133 --
 .../zest/index/rdf/qi64/AbstractIssueTest.java  |   70 -
 .../org/apache/zest/index/rdf/qi64/Account.java |   25 -
 .../zest/index/rdf/qi64/AccountComposite.java   |   28 -
 .../org/apache/zest/index/rdf/qi64/HasName.java |   27 -
 .../AccountService.java                         |   65 -
 .../AccountServiceComposite.java                |   30 -
 .../withPropagationMandatory/IssueTest.java     |   94 -
 .../withPropagationRequired/AccountService.java |   64 -
 .../AccountServiceComposite.java                |   30 -
 .../qi64/withPropagationRequired/IssueTest.java |   94 -
 .../AccountService.java                         |   64 -
 .../AccountServiceComposite.java                |   30 -
 .../withPropagationRequiresNew/IssueTest.java   |   94 -
 .../org/apache/zest/index/rdf/qi66/Account.java |   25 -
 .../zest/index/rdf/qi66/AccountComposite.java   |   27 -
 .../org/apache/zest/index/rdf/qi66/HasName.java |   27 -
 .../zest/index/rdf/qi66/Qi66IssueTest.java      |  103 -
 .../zest/index/rdf/qi95/Qi95IssueTest.java      |  398 ----
 .../index/solr/EmbeddedSolrService.java         |  134 ++
 .../polygene/index/solr/SolrAssembler.java      |   49 +
 .../polygene/index/solr/SolrExpressions.java    |   33 +
 .../polygene/index/solr/SolrQueryService.java   |   65 +
 .../apache/polygene/index/solr/SolrSearch.java  |   32 +
 .../solr/internal/SingleTokenTokenizer.java     |   45 +
 .../internal/SingleTokenTokenizerFactory.java   |   33 +
 .../solr/internal/SolrEntityIndexerMixin.java   |  251 +++
 .../solr/internal/SolrEntityQueryMixin.java     |  137 ++
 .../polygene/index/solr/internal/package.html   |   24 +
 .../org/apache/polygene/index/solr/package.html |   24 +
 .../zest/index/solr/EmbeddedSolrService.java    |  134 --
 .../apache/zest/index/solr/SolrAssembler.java   |   49 -
 .../apache/zest/index/solr/SolrExpressions.java |   33 -
 .../zest/index/solr/SolrQueryService.java       |   65 -
 .../org/apache/zest/index/solr/SolrSearch.java  |   32 -
 .../solr/internal/SingleTokenTokenizer.java     |   45 -
 .../internal/SingleTokenTokenizerFactory.java   |   33 -
 .../solr/internal/SolrEntityIndexerMixin.java   |  251 ---
 .../solr/internal/SolrEntityQueryMixin.java     |  137 --
 .../zest/index/solr/internal/package.html       |   24 -
 .../org/apache/zest/index/solr/package.html     |   24 -
 .../index/solr/SolrEntityFinderTest.java        |   48 +
 .../polygene/index/solr/SolrNamedQueryTest.java |   62 +
 .../index/solr/SolrQueryServiceTest.java        |  124 ++
 .../polygene/index/solr/SolrQueryTest.java      |   48 +
 .../zest/index/solr/SolrEntityFinderTest.java   |   48 -
 .../zest/index/solr/SolrNamedQueryTest.java     |   62 -
 .../zest/index/solr/SolrQueryServiceTest.java   |  124 --
 .../apache/zest/index/solr/SolrQueryTest.java   |   48 -
 .../indexing-solr/src/test/resources/schema.xml |    4 +-
 .../index/sql/SQLIndexingEngineService.java     |   45 +
 .../AbstractSQLIndexQueryAssembler.java         |   99 +
 .../assembly/PostgreSQLIndexQueryAssembler.java |   45 +
 .../polygene/index/sql/assembly/package.html    |   24 +
 .../index/sql/internal/SQLEntityFinder.java     |  256 +++
 .../sql/internal/SQLStateChangeListener.java    |   49 +
 .../polygene/index/sql/internal/package.html    |   24 +
 .../org/apache/polygene/index/sql/package.html  |   24 +
 .../index/sql/support/api/SQLAppStartup.java    |   57 +
 .../index/sql/support/api/SQLIndexing.java      |   39 +
 .../index/sql/support/api/SQLQuerying.java      |   75 +
 .../index/sql/support/api/SQLTypeInfo.java      |   58 +
 .../polygene/index/sql/support/api/package.html |   24 +
 .../index/sql/support/common/DBNames.java       |   95 +
 .../support/common/GenericDatabaseExplorer.java |  456 +++++
 .../index/sql/support/common/QNameInfo.java     |  351 ++++
 .../sql/support/common/RebuildingStrategy.java  |   78 +
 .../sql/support/common/ReindexingStrategy.java  |   78 +
 .../index/sql/support/common/package.html       |   24 +
 .../index/sql/support/derby/package.html        |   24 +
 .../postgresql/PostgreSQLAppStartup.java        |  109 +
 .../postgresql/PostgreSQLIndexExporter.java     |  341 ++++
 .../support/postgresql/PostgreSQLIndexing.java  |   89 +
 .../support/postgresql/PostgreSQLQuerying.java  |   62 +
 .../support/postgresql/PostgreSQLService.java   |   53 +
 .../postgresql/PostgreSQLTypeHelper.java        |  129 ++
 .../index/sql/support/postgresql/package.html   |   24 +
 .../support/skeletons/AbstractSQLIndexing.java  | 1067 ++++++++++
 .../support/skeletons/AbstractSQLQuerying.java  | 1884 ++++++++++++++++++
 .../support/skeletons/AbstractSQLStartup.java   | 1751 ++++++++++++++++
 .../skeletons/SQLCompatEntityStateWrapper.java  |  372 ++++
 .../index/sql/support/skeletons/SQLDBState.java |   90 +
 .../sql/support/skeletons/SQLSkeletonUtil.java  |   97 +
 .../index/sql/support/skeletons/package.html    |   24 +
 .../index/sql/support/sqlite/package.html       |   24 +
 .../index/sql/SQLIndexingEngineService.java     |   45 -
 .../AbstractSQLIndexQueryAssembler.java         |   99 -
 .../assembly/PostgreSQLIndexQueryAssembler.java |   45 -
 .../apache/zest/index/sql/assembly/package.html |   24 -
 .../index/sql/internal/SQLEntityFinder.java     |  256 ---
 .../sql/internal/SQLStateChangeListener.java    |   49 -
 .../apache/zest/index/sql/internal/package.html |   24 -
 .../java/org/apache/zest/index/sql/package.html |   24 -
 .../index/sql/support/api/SQLAppStartup.java    |   57 -
 .../zest/index/sql/support/api/SQLIndexing.java |   39 -
 .../zest/index/sql/support/api/SQLQuerying.java |   75 -
 .../zest/index/sql/support/api/SQLTypeInfo.java |   58 -
 .../zest/index/sql/support/api/package.html     |   24 -
 .../zest/index/sql/support/common/DBNames.java  |   95 -
 .../support/common/GenericDatabaseExplorer.java |  456 -----
 .../index/sql/support/common/QNameInfo.java     |  351 ----
 .../sql/support/common/RebuildingStrategy.java  |   78 -
 .../sql/support/common/ReindexingStrategy.java  |   78 -
 .../zest/index/sql/support/common/package.html  |   24 -
 .../zest/index/sql/support/derby/package.html   |   24 -
 .../postgresql/PostgreSQLAppStartup.java        |  109 -
 .../postgresql/PostgreSQLIndexExporter.java     |  341 ----
 .../support/postgresql/PostgreSQLIndexing.java  |   89 -
 .../support/postgresql/PostgreSQLQuerying.java  |   62 -
 .../support/postgresql/PostgreSQLService.java   |   53 -
 .../postgresql/PostgreSQLTypeHelper.java        |  130 --
 .../index/sql/support/postgresql/package.html   |   24 -
 .../support/skeletons/AbstractSQLIndexing.java  | 1067 ----------
 .../support/skeletons/AbstractSQLQuerying.java  | 1884 ------------------
 .../support/skeletons/AbstractSQLStartup.java   | 1751 ----------------
 .../skeletons/SQLCompatEntityStateWrapper.java  |  372 ----
 .../index/sql/support/skeletons/SQLDBState.java |   90 -
 .../sql/support/skeletons/SQLSkeletonUtil.java  |   97 -
 .../index/sql/support/skeletons/package.html    |   24 -
 .../zest/index/sql/support/sqlite/package.html  |   24 -
 .../postgresql/PostgreSQLComplexQueryTest.java  |   67 +
 .../postgresql/PostgreSQLDBIntegrityTest.java   |  150 ++
 .../postgresql/PostgreSQLEntityFinderTest.java  |   67 +
 .../sql/postgresql/PostgreSQLQueryTest.java     |  266 +++
 .../index/sql/postgresql/SQLTestHelper.java     |  125 ++
 .../postgresql/PostgreSQLComplexQueryTest.java  |   67 -
 .../postgresql/PostgreSQLDBIntegrityTest.java   |  150 --
 .../postgresql/PostgreSQLEntityFinderTest.java  |   67 -
 .../sql/postgresql/PostgreSQLQueryTest.java     |  266 ---
 .../index/sql/postgresql/SQLTestHelper.java     |  126 --
 .../indexing-sql/src/test/resources/logback.xml |    2 +-
 .../metrics/codahale/CodahaleCounter.java       |   60 +
 .../metrics/codahale/CodahaleGauge.java         |   41 +
 .../metrics/codahale/CodahaleHealthCheck.java   |   66 +
 .../metrics/codahale/CodahaleHistogram.java     |   41 +
 .../metrics/codahale/CodahaleMeter.java         |   47 +
 .../codahale/CodahaleMetricsAssembler.java      |  122 ++
 .../codahale/CodahaleMetricsDeclaration.java    |   36 +
 .../metrics/codahale/CodahaleMetricsMixin.java  |  269 +++
 .../codahale/CodahaleMetricsProvider.java       |   35 +
 .../metrics/codahale/CodahaleTimer.java         |   41 +
 .../polygene/metrics/codahale/package.html      |   24 +
 .../zest/metrics/codahale/CodahaleCounter.java  |   60 -
 .../zest/metrics/codahale/CodahaleGauge.java    |   41 -
 .../metrics/codahale/CodahaleHealthCheck.java   |   66 -
 .../metrics/codahale/CodahaleHistogram.java     |   41 -
 .../zest/metrics/codahale/CodahaleMeter.java    |   47 -
 .../codahale/CodahaleMetricsAssembler.java      |  122 --
 .../codahale/CodahaleMetricsDeclaration.java    |   36 -
 .../metrics/codahale/CodahaleMetricsMixin.java  |  269 ---
 .../codahale/CodahaleMetricsProvider.java       |   35 -
 .../zest/metrics/codahale/CodahaleTimer.java    |   41 -
 .../apache/zest/metrics/codahale/package.html   |   24 -
 .../metrics/codahale/CodahaleMetricsTest.java   |   79 +
 .../test/metrics/AbstractZestMetricsTest.java   |  338 ++++
 .../metrics/codahale/CodahaleMetricsTest.java   |   79 -
 .../test/metrics/AbstractZestMetricsTest.java   |  338 ----
 .../migration/MigrationConfiguration.java       |   35 +
 .../migration/MigrationEventLogger.java         |  112 ++
 .../polygene/migration/MigrationEvents.java     |   54 +
 .../polygene/migration/MigrationService.java    |  494 +++++
 .../org/apache/polygene/migration/Migrator.java |   70 +
 .../assembly/AbstractMigrationRule.java         |   46 +
 .../assembly/EntityMigrationBuilder.java        |  306 +++
 .../assembly/EntityMigrationOperation.java      |   38 +
 .../migration/assembly/EntityMigrationRule.java |   97 +
 .../migration/assembly/MigrationBuilder.java    |   54 +
 .../migration/assembly/MigrationOperation.java  |   40 +
 .../migration/assembly/MigrationRule.java       |   58 +
 .../migration/assembly/MigrationRules.java      |  124 ++
 .../assembly/PackageMigrationBuilder.java       |   71 +
 .../assembly/VersionMigrationBuilder.java       |   71 +
 .../polygene/migration/assembly/package.html    |   24 +
 .../migration/operation/AddAssociation.java     |   63 +
 .../migration/operation/AddManyAssociation.java |   64 +
 .../operation/AddNamedAssociation.java          |   63 +
 .../migration/operation/AddProperty.java        |   63 +
 .../migration/operation/RemoveAssociation.java  |   64 +
 .../operation/RemoveManyAssociation.java        |   64 +
 .../operation/RemoveNamedAssociation.java       |   63 +
 .../migration/operation/RemoveProperty.java     |   64 +
 .../migration/operation/RenameAssociation.java  |   63 +
 .../migration/operation/RenameEntity.java       |   83 +
 .../operation/RenameManyAssociation.java        |   63 +
 .../operation/RenameNamedAssociation.java       |   62 +
 .../migration/operation/RenameProperty.java     |   63 +
 .../polygene/migration/operation/package.html   |   24 +
 .../org/apache/polygene/migration/package.html  |   24 +
 .../zest/migration/MigrationConfiguration.java  |   35 -
 .../zest/migration/MigrationEventLogger.java    |  112 --
 .../apache/zest/migration/MigrationEvents.java  |   54 -
 .../apache/zest/migration/MigrationService.java |  494 -----
 .../org/apache/zest/migration/Migrator.java     |   70 -
 .../assembly/AbstractMigrationRule.java         |   46 -
 .../assembly/EntityMigrationBuilder.java        |  306 ---
 .../assembly/EntityMigrationOperation.java      |   38 -
 .../migration/assembly/EntityMigrationRule.java |   97 -
 .../migration/assembly/MigrationBuilder.java    |   54 -
 .../migration/assembly/MigrationOperation.java  |   40 -
 .../zest/migration/assembly/MigrationRule.java  |   58 -
 .../zest/migration/assembly/MigrationRules.java |  124 --
 .../assembly/PackageMigrationBuilder.java       |   71 -
 .../assembly/VersionMigrationBuilder.java       |   71 -
 .../apache/zest/migration/assembly/package.html |   24 -
 .../migration/operation/AddAssociation.java     |   63 -
 .../migration/operation/AddManyAssociation.java |   64 -
 .../operation/AddNamedAssociation.java          |   63 -
 .../zest/migration/operation/AddProperty.java   |   63 -
 .../migration/operation/RemoveAssociation.java  |   64 -
 .../operation/RemoveManyAssociation.java        |   64 -
 .../operation/RemoveNamedAssociation.java       |   63 -
 .../migration/operation/RemoveProperty.java     |   64 -
 .../migration/operation/RenameAssociation.java  |   63 -
 .../zest/migration/operation/RenameEntity.java  |   83 -
 .../operation/RenameManyAssociation.java        |   63 -
 .../operation/RenameNamedAssociation.java       |   62 -
 .../migration/operation/RenameProperty.java     |   63 -
 .../zest/migration/operation/package.html       |   24 -
 .../java/org/apache/zest/migration/package.html |   24 -
 .../polygene/migration/MigrationTest.java       |  264 +++
 .../polygene/migration/TestEntity1_0.java       |   43 +
 .../polygene/migration/TestEntity1_1.java       |   43 +
 .../polygene/migration/TestEntity2_0.java       |   45 +
 .../polygene/migration/moved/TestEntity2_0.java |   45 +
 .../apache/zest/migration/MigrationTest.java    |  264 ---
 .../apache/zest/migration/TestEntity1_0.java    |   43 -
 .../apache/zest/migration/TestEntity1_1.java    |   43 -
 .../apache/zest/migration/TestEntity2_0.java    |   45 -
 .../zest/migration/moved/TestEntity2_0.java     |   45 -
 .../index/reindexer/ReindexAllService.java      |   31 +
 .../polygene/index/reindexer/Reindexer.java     |   29 +
 .../index/reindexer/ReindexerConfiguration.java |   40 +
 .../index/reindexer/ReindexerService.java       |   31 +
 .../reindexer/internal/ReindexAllMixin.java     |   48 +
 .../reindexer/internal/ReindexerMixin.java      |  113 ++
 .../index/reindexer/internal/package.html       |   24 +
 .../polygene/index/reindexer/package.html       |   24 +
 .../zest/index/reindexer/ReindexAllService.java |   31 -
 .../apache/zest/index/reindexer/Reindexer.java  |   29 -
 .../index/reindexer/ReindexerConfiguration.java |   40 -
 .../zest/index/reindexer/ReindexerService.java  |   31 -
 .../reindexer/internal/ReindexAllMixin.java     |   48 -
 .../reindexer/internal/ReindexerMixin.java      |  113 --
 .../zest/index/reindexer/internal/package.html  |   24 -
 .../apache/zest/index/reindexer/package.html    |   24 -
 .../polygene/index/reindexer/ReindexerTest.java |  138 ++
 .../zest/index/reindexer/ReindexerTest.java     |  138 --
 .../jackson/JacksonValueDeserializer.java       |  379 ++++
 .../JacksonValueSerializationAssembler.java     |   62 +
 .../JacksonValueSerializationService.java       |   32 +
 .../jackson/JacksonValueSerializer.java         |   92 +
 .../valueserialization/jackson/package.html     |   24 +
 .../jackson/JacksonValueDeserializer.java       |  379 ----
 .../JacksonValueSerializationAssembler.java     |   62 -
 .../JacksonValueSerializationService.java       |   32 -
 .../jackson/JacksonValueSerializer.java         |   92 -
 .../valueserialization/jackson/package.html     |   24 -
 .../JacksonCollectionSerializationTest.java     |   37 +
 ...JacksonConfigurationDeserializationTest.java |   38 +
 .../jackson/JacksonJsonDateFormatTest.java      |   37 +
 .../JacksonPlainValueSerializationTest.java     |   41 +
 .../JacksonValueCompositeSerializationTest.java |   37 +
 .../JacksonCollectionSerializationTest.java     |   37 -
 ...JacksonConfigurationDeserializationTest.java |   38 -
 .../jackson/JacksonJsonDateFormatTest.java      |   37 -
 .../JacksonPlainValueSerializationTest.java     |   41 -
 .../JacksonValueCompositeSerializationTest.java |   37 -
 .../OrgJsonValueSerializationAssembler.java     |   62 +
 .../valueserialization/orgjson/package.html     |   24 +
 .../OrgJsonValueSerializationAssembler.java     |   62 -
 .../valueserialization/orgjson/package.html     |   24 -
 .../OrgJsonCollectionSerializationTest.java     |   37 +
 ...OrgJsonConfigurationDeserializationTest.java |   38 +
 .../orgjson/OrgJsonDateFormatTest.java          |   37 +
 .../OrgJsonPlainValueSerializationTest.java     |   41 +
 .../OrgJsonValueCompositeSerializationTest.java |   37 +
 .../OrgJsonCollectionSerializationTest.java     |   37 -
 ...OrgJsonConfigurationDeserializationTest.java |   38 -
 .../orgjson/OrgJsonDateFormatTest.java          |   37 -
 .../OrgJsonPlainValueSerializationTest.java     |   41 -
 .../OrgJsonValueCompositeSerializationTest.java |   37 -
 .../stax/StaxValueDeserializer.java             |  522 +++++
 .../stax/StaxValueSerializationAssembler.java   |   62 +
 .../stax/StaxValueSerializationService.java     |   32 +
 .../stax/StaxValueSerializer.java               |  134 ++
 .../valueserialization/stax/package.html        |   24 +
 .../stax/StaxValueDeserializer.java             |  522 -----
 .../stax/StaxValueSerializationAssembler.java   |   62 -
 .../stax/StaxValueSerializationService.java     |   32 -
 .../stax/StaxValueSerializer.java               |  134 --
 .../zest/valueserialization/stax/package.html   |   24 -
 .../stax/StaxCollectionSerializationTest.java   |   46 +
 .../StaxConfigurationDeserializationTest.java   |   68 +
 .../stax/StaxPlainValueSerializationTest.java   |   50 +
 .../StaxValueCompositeSerializationTest.java    |   46 +
 .../stax/StaxCollectionSerializationTest.java   |   46 -
 .../StaxConfigurationDeserializationTest.java   |   68 -
 .../stax/StaxPlainValueSerializationTest.java   |   50 -
 .../StaxValueCompositeSerializationTest.java    |   46 -
 .../src/test/resources/configtest.xml           |    2 +-
 .../polygene/library/alarm/AlarmCategory.java   |   37 +
 .../polygene/library/alarm/AlarmClass.java      |   49 +
 .../polygene/library/alarm/AlarmEvent.java      |  123 ++
 .../polygene/library/alarm/AlarmHistory.java    |  269 +++
 .../polygene/library/alarm/AlarmListener.java   |   44 +
 .../polygene/library/alarm/AlarmModel.java      |  133 ++
 .../library/alarm/AlarmModelDescriptor.java     |   43 +
 .../polygene/library/alarm/AlarmNameFormat.java |   73 +
 .../polygene/library/alarm/AlarmPoint.java      |  482 +++++
 .../library/alarm/AlarmPointEntity.java         |   28 +
 .../library/alarm/AlarmPointFactory.java        |   78 +
 .../polygene/library/alarm/AlarmProxy.java      |  211 ++
 .../polygene/library/alarm/AlarmStatus.java     |  108 +
 .../polygene/library/alarm/AlarmSystem.java     |  297 +++
 .../library/alarm/AlarmSystemAssembler.java     |   54 +
 .../library/alarm/AlarmSystemService.java       |   26 +
 .../alarm/ExtendedAlarmModelService.java        |  431 ++++
 .../library/alarm/SimpleAlarmCategory.java      |   40 +
 .../library/alarm/SimpleAlarmModelService.java  |  253 +++
 .../alarm/StandardAlarmModelService.java        |  299 +++
 .../apache/polygene/library/alarm/package.html  |  122 ++
 .../zest/library/alarm/AlarmCategory.java       |   37 -
 .../apache/zest/library/alarm/AlarmClass.java   |   49 -
 .../apache/zest/library/alarm/AlarmEvent.java   |  123 --
 .../apache/zest/library/alarm/AlarmHistory.java |  269 ---
 .../zest/library/alarm/AlarmListener.java       |   44 -
 .../apache/zest/library/alarm/AlarmModel.java   |  133 --
 .../library/alarm/AlarmModelDescriptor.java     |   43 -
 .../zest/library/alarm/AlarmNameFormat.java     |   73 -
 .../apache/zest/library/alarm/AlarmPoint.java   |  482 -----
 .../zest/library/alarm/AlarmPointEntity.java    |   28 -
 .../zest/library/alarm/AlarmPointFactory.java   |   78 -
 .../apache/zest/library/alarm/AlarmProxy.java   |  212 --
 .../apache/zest/library/alarm/AlarmStatus.java  |  108 -
 .../apache/zest/library/alarm/AlarmSystem.java  |  297 ---
 .../library/alarm/AlarmSystemAssembler.java     |   54 -
 .../zest/library/alarm/AlarmSystemService.java  |   26 -
 .../alarm/ExtendedAlarmModelService.java        |  431 ----
 .../zest/library/alarm/SimpleAlarmCategory.java |   40 -
 .../library/alarm/SimpleAlarmModelService.java  |  253 ---
 .../alarm/StandardAlarmModelService.java        |  299 ---
 .../org/apache/zest/library/alarm/package.html  |  122 --
 .../library/alarm/AlarmResources.properties     |   83 +
 .../library/alarm/AlarmResources_sv.properties  |   82 +
 .../library/alarm/AlarmResources.properties     |   83 -
 .../library/alarm/AlarmResources_sv.properties  |   82 -
 .../library/alarm/AlarmHistoryImplTest.java     |  301 +++
 .../library/alarm/AlarmPointImplTest.java       |  240 +++
 .../polygene/library/alarm/AlarmProxyTest.java  |   84 +
 .../library/alarm/AlarmServiceTest.java         |  229 +++
 .../library/alarm/ExtendedAlarmModelTest.java   |  979 +++++++++
 .../library/alarm/SimpleAlarmModelTest.java     |  364 ++++
 .../library/alarm/StandardAlarmModelTest.java   |  491 +++++
 .../library/alarm/AlarmHistoryImplTest.java     |  301 ---
 .../zest/library/alarm/AlarmPointImplTest.java  |  240 ---
 .../zest/library/alarm/AlarmProxyTest.java      |   84 -
 .../zest/library/alarm/AlarmServiceTest.java    |  229 ---
 .../library/alarm/ExtendedAlarmModelTest.java   |  979 ---------
 .../library/alarm/SimpleAlarmModelTest.java     |  364 ----
 .../library/alarm/StandardAlarmModelTest.java   |  491 -----
 .../alarm/user/AlarmDescriptions.properties     |   21 +
 .../user/AlarmDescriptions_en_GB.properties     |   21 +
 .../alarm/user/AlarmDescriptions_sv.properties  |   21 +
 .../alarm/user/AlarmDescriptions.properties     |   21 -
 .../user/AlarmDescriptions_en_GB.properties     |   21 -
 .../alarm/user/AlarmDescriptions_sv.properties  |   21 -
 .../apache/zest/library/appbrowser/Browser.java |    6 +-
 .../library/appbrowser/BrowserException.java    |    2 +-
 .../zest/library/appbrowser/Formatter.java      |    2 +-
 .../library/appbrowser/FormatterFactory.java    |    2 +-
 .../appbrowser/json/AbstractJsonFormatter.java  |    4 +-
 .../json/ApplicationModelFormatter.java         |    6 +-
 .../library/appbrowser/json/ArrayFormatter.java |    4 +-
 .../json/CompositeMethodModelFormatter.java     |    6 +-
 .../json/ConstructorModelFormatter.java         |    4 +-
 .../appbrowser/json/EntityModelFormatter.java   |    4 +-
 .../json/InjectedFieldModelFormatter.java       |    8 +-
 .../appbrowser/json/JsonFormatterFactory.java   |    6 +-
 .../appbrowser/json/LayerModelFormatter.java    |    6 +-
 .../appbrowser/json/MixinModelFormatter.java    |    4 +-
 .../appbrowser/json/ModuleModelFormatter.java   |    6 +-
 .../library/appbrowser/json/NullFormatter.java  |    4 +-
 .../appbrowser/json/ObjectModelFormatter.java   |    4 +-
 .../appbrowser/json/ServiceModelFormatter.java  |    4 +-
 .../appbrowser/json/ValueModelFormatter.java    |    6 +-
 .../zest/library/appbrowser/AppBrowserTest.java |   34 +-
 libraries/circuitbreaker/build.gradle           |    4 +-
 .../library/circuitbreaker/CircuitBreaker.java  |  239 +++
 .../library/circuitbreaker/CircuitBreakers.java |   72 +
 .../circuitbreaker/jmx/CircuitBreakerJMX.java   |  131 ++
 .../jmx/CircuitBreakerJMXMBean.java             |   38 +
 .../jmx/CircuitBreakerManagement.java           |  169 ++
 .../library/circuitbreaker/jmx/package.html     |   24 +
 .../library/circuitbreaker/package.html         |   24 +
 .../service/AbstractBreakOnThrowable.java       |   35 +
 ...stractEnabledCircuitBreakerAvailability.java |   59 +
 .../service/BreakCircuitConcern.java            |   63 +
 .../service/BreaksCircuitOnThrowable.java       |   36 +
 .../service/ServiceCircuitBreaker.java          |   34 +
 .../service/ServiceCircuitBreakerMixin.java     |   52 +
 .../library/circuitbreaker/service/package.html |   24 +
 .../library/circuitbreaker/CircuitBreaker.java  |  239 ---
 .../library/circuitbreaker/CircuitBreakers.java |   72 -
 .../circuitbreaker/jmx/CircuitBreakerJMX.java   |  131 --
 .../jmx/CircuitBreakerJMXMBean.java             |   38 -
 .../jmx/CircuitBreakerManagement.java           |  169 --
 .../library/circuitbreaker/jmx/package.html     |   24 -
 .../zest/library/circuitbreaker/package.html    |   24 -
 .../service/AbstractBreakOnThrowable.java       |   35 -
 ...stractEnabledCircuitBreakerAvailability.java |   59 -
 .../service/BreakCircuitConcern.java            |   63 -
 .../service/BreaksCircuitOnThrowable.java       |   36 -
 .../service/ServiceCircuitBreaker.java          |   34 -
 .../service/ServiceCircuitBreakerMixin.java     |   52 -
 .../library/circuitbreaker/service/package.html |   24 -
 .../BreaksCircuitOnThrowableTest.java           |  125 ++
 .../circuitbreaker/CircuitBreakerTest.java      |  226 +++
 .../jmx/CircuitBreakerManagementSample.java     |  121 ++
 .../BreaksCircuitOnThrowableTest.java           |  125 --
 .../circuitbreaker/CircuitBreakerTest.java      |  226 ---
 .../jmx/CircuitBreakerManagementSample.java     |  121 --
 .../library/constraints/ContainsConstraint.java |   40 +
 .../constraints/GreaterThanConstraint.java      |   40 +
 .../constraints/InstanceOfConstraint.java       |   51 +
 .../library/constraints/LessThanConstraint.java |   40 +
 .../library/constraints/MatchesConstraint.java  |   47 +
 .../constraints/MaxLengthConstraint.java        |   45 +
 .../constraints/MinLengthConstraint.java        |   46 +
 .../NotEmptyCollectionConstraint.java           |   41 +
 .../constraints/NotEmptyStringConstraint.java   |   40 +
 .../library/constraints/OneOfConstraint.java    |   48 +
 .../library/constraints/RangeConstraint.java    |   40 +
 .../library/constraints/URIConstraint.java      |   47 +
 .../library/constraints/URLConstraint.java      |   47 +
 .../constraints/annotation/Contains.java        |   37 +
 .../library/constraints/annotation/Email.java   |   35 +
 .../constraints/annotation/GreaterThan.java     |   37 +
 .../constraints/annotation/InstanceOf.java      |   38 +
 .../constraints/annotation/LessThan.java        |   37 +
 .../library/constraints/annotation/Matches.java |   37 +
 .../constraints/annotation/MaxLength.java       |   37 +
 .../constraints/annotation/MinLength.java       |   37 +
 .../constraints/annotation/NotEmpty.java        |   39 +
 .../library/constraints/annotation/OneOf.java   |   37 +
 .../library/constraints/annotation/Range.java   |   39 +
 .../library/constraints/annotation/URI.java     |   38 +
 .../library/constraints/annotation/URL.java     |   39 +
 .../library/constraints/annotation/package.html |   24 +
 .../polygene/library/constraints/package.html   |   24 +
 .../library/constraints/ContainsConstraint.java |   40 -
 .../constraints/GreaterThanConstraint.java      |   40 -
 .../constraints/InstanceOfConstraint.java       |   51 -
 .../library/constraints/LessThanConstraint.java |   40 -
 .../library/constraints/MatchesConstraint.java  |   47 -
 .../constraints/MaxLengthConstraint.java        |   45 -
 .../constraints/MinLengthConstraint.java        |   46 -
 .../NotEmptyCollectionConstraint.java           |   41 -
 .../constraints/NotEmptyStringConstraint.java   |   40 -
 .../library/constraints/OneOfConstraint.java    |   48 -
 .../library/constraints/RangeConstraint.java    |   40 -
 .../zest/library/constraints/URIConstraint.java |   47 -
 .../zest/library/constraints/URLConstraint.java |   47 -
 .../constraints/annotation/Contains.java        |   37 -
 .../library/constraints/annotation/Email.java   |   35 -
 .../constraints/annotation/GreaterThan.java     |   37 -
 .../constraints/annotation/InstanceOf.java      |   38 -
 .../constraints/annotation/LessThan.java        |   37 -
 .../library/constraints/annotation/Matches.java |   37 -
 .../constraints/annotation/MaxLength.java       |   37 -
 .../constraints/annotation/MinLength.java       |   37 -
 .../constraints/annotation/NotEmpty.java        |   39 -
 .../library/constraints/annotation/OneOf.java   |   37 -
 .../library/constraints/annotation/Range.java   |   39 -
 .../library/constraints/annotation/URI.java     |   38 -
 .../library/constraints/annotation/URL.java     |   39 -
 .../library/constraints/annotation/package.html |   24 -
 .../zest/library/constraints/package.html       |   24 -
 .../library/constraints/ConstraintTest.java     |  284 +++
 .../library/constraints/TestCaseComposite.java  |   78 +
 .../library/constraints/qi70/IssueTest.java     |   45 +
 .../library/constraints/qi70/Sample.java        |   29 +
 .../constraints/qi70/SampleComposite.java       |   30 +
 .../library/constraints/qi70/SampleMixin.java   |   25 +
 .../library/constraints/ConstraintTest.java     |  284 ---
 .../library/constraints/TestCaseComposite.java  |   78 -
 .../library/constraints/qi70/IssueTest.java     |   45 -
 .../zest/library/constraints/qi70/Sample.java   |   29 -
 .../constraints/qi70/SampleComposite.java       |   30 -
 .../library/constraints/qi70/SampleMixin.java   |   25 -
 libraries/fileconfig/src/docs/fileconfig.txt    |    2 +-
 .../library/fileconfig/FileConfiguration.java   |   71 +
 .../fileconfig/FileConfigurationAssembler.java  |   55 +
 .../fileconfig/FileConfigurationDataWiper.java  |   86 +
 .../fileconfig/FileConfigurationOverride.java   |  125 ++
 .../fileconfig/FileConfigurationService.java    |  293 +++
 .../polygene/library/fileconfig/package.html    |   24 +
 .../library/fileconfig/FileConfiguration.java   |   71 -
 .../fileconfig/FileConfigurationAssembler.java  |   55 -
 .../fileconfig/FileConfigurationDataWiper.java  |   86 -
 .../fileconfig/FileConfigurationOverride.java   |  125 --
 .../fileconfig/FileConfigurationService.java    |  293 ---
 .../apache/zest/library/fileconfig/package.html |   24 -
 .../fileconfig/FileConfiguration_mac.properties |   25 +
 .../FileConfiguration_unix.properties           |   25 +
 .../FileConfiguration_windows.properties        |   25 +
 .../fileconfig/FileConfiguration_mac.properties |   25 -
 .../FileConfiguration_unix.properties           |   25 -
 .../FileConfiguration_windows.properties        |   25 -
 .../fileconfig/FileConfigurationTest.java       |  139 ++
 .../fileconfig/FileConfiguration_mac.properties |   28 +
 .../fileconfig/FileConfigurationTest.java       |  139 --
 .../fileconfig/FileConfiguration_mac.properties |   28 -
 libraries/http/src/docs/http.txt                |    4 +-
 .../library/http/AbstractJettyMixin.java        |  192 ++
 .../polygene/library/http/ConstraintInfo.java   |   76 +
 .../library/http/ConstraintService.java         |   65 +
 .../library/http/ContextListenerInfo.java       |   43 +
 .../polygene/library/http/Dispatchers.java      |   51 +
 .../polygene/library/http/FilterInfo.java       |   57 +
 .../polygene/library/http/HttpService.java      |   25 +
 .../apache/polygene/library/http/Interface.java |   34 +
 .../polygene/library/http/InterfaceImpl.java    |   55 +
 .../polygene/library/http/JettyActivation.java  |   55 +
 .../library/http/JettyConfiguration.java        |  170 ++
 .../library/http/JettyConfigurationHelper.java  |  368 ++++
 .../polygene/library/http/JettyMixin.java       |   64 +
 .../polygene/library/http/JettyService.java     |   31 +
 .../library/http/JettyServiceAssembler.java     |   95 +
 .../library/http/SecureJettyConfiguration.java  |  217 ++
 .../polygene/library/http/SecureJettyMixin.java |  116 ++
 .../library/http/SecureJettyService.java        |   28 +
 .../http/SecureJettyServiceAssembler.java       |   38 +
 .../polygene/library/http/ServletInfo.java      |   58 +
 .../apache/polygene/library/http/Servlets.java  |  341 ++++
 .../polygene/library/http/UnitOfWorkFilter.java |   73 +
 .../library/http/UnitOfWorkFilterService.java   |   35 +
 .../polygene/library/http/WelcomeServlet.java   |   48 +
 .../library/http/WelcomeServletService.java     |   33 +
 .../apache/polygene/library/http/package.html   |   24 +
 .../zest/library/http/AbstractJettyMixin.java   |  192 --
 .../zest/library/http/ConstraintInfo.java       |   76 -
 .../zest/library/http/ConstraintService.java    |   65 -
 .../zest/library/http/ContextListenerInfo.java  |   43 -
 .../apache/zest/library/http/Dispatchers.java   |   51 -
 .../apache/zest/library/http/FilterInfo.java    |   57 -
 .../apache/zest/library/http/HttpService.java   |   25 -
 .../org/apache/zest/library/http/Interface.java |   34 -
 .../apache/zest/library/http/InterfaceImpl.java |   55 -
 .../zest/library/http/JettyActivation.java      |   55 -
 .../zest/library/http/JettyConfiguration.java   |  170 --
 .../library/http/JettyConfigurationHelper.java  |  368 ----
 .../apache/zest/library/http/JettyMixin.java    |   64 -
 .../apache/zest/library/http/JettyService.java  |   31 -
 .../library/http/JettyServiceAssembler.java     |   95 -
 .../library/http/SecureJettyConfiguration.java  |  217 --
 .../zest/library/http/SecureJettyMixin.java     |  116 --
 .../zest/library/http/SecureJettyService.java   |   28 -
 .../http/SecureJettyServiceAssembler.java       |   38 -
 .../apache/zest/library/http/ServletInfo.java   |   58 -
 .../org/apache/zest/library/http/Servlets.java  |  341 ----
 .../zest/library/http/UnitOfWorkFilter.java     |   73 -
 .../library/http/UnitOfWorkFilterService.java   |   35 -
 .../zest/library/http/WelcomeServlet.java       |   48 -
 .../library/http/WelcomeServletService.java     |   33 -
 .../org/apache/zest/library/http/package.html   |   24 -
 .../library/http/AbstractJettyTest.java         |   77 +
 .../library/http/AbstractSecureJettyTest.java   |  183 ++
 .../library/http/FooServletContextListener.java |   39 +
 .../http/FooServletContextListenerService.java  |   32 +
 .../library/http/HelloWorldServlet.java         |   49 +
 .../library/http/HelloWorldServletService.java  |   32 +
 .../library/http/JettyJMXStatisticsTest.java    |   69 +
 .../polygene/library/http/JettyServiceTest.java |   92 +
 .../polygene/library/http/JettyTestSuite.java   |   34 +
 .../http/MutualSecureJettyServiceTest.java      |   85 +
 .../library/http/SecureJettyServiceTest.java    |   98 +
 .../zest/library/http/AbstractJettyTest.java    |   77 -
 .../library/http/AbstractSecureJettyTest.java   |  183 --
 .../library/http/FooServletContextListener.java |   39 -
 .../http/FooServletContextListenerService.java  |   32 -
 .../zest/library/http/HelloWorldServlet.java    |   49 -
 .../library/http/HelloWorldServletService.java  |   32 -
 .../library/http/JettyJMXStatisticsTest.java    |   69 -
 .../zest/library/http/JettyServiceTest.java     |   92 -
 .../zest/library/http/JettyTestSuite.java       |   34 -
 .../http/MutualSecureJettyServiceTest.java      |   85 -
 .../library/http/SecureJettyServiceTest.java    |   98 -
 libraries/http/src/test/resources/logback.xml   |    2 +-
 .../http/zest-lib-http-unittests-ca.jceks       |  Bin 0 -> 1075 bytes
 .../zest-lib-http-unittests-client-cert.jceks   |  Bin 0 -> 3395 bytes
 .../zest-lib-http-unittests-server-cert.jceks   |  Bin 0 -> 3380 bytes
 .../http/zest-lib-http-unittests-ca.jceks       |  Bin 1075 -> 0 bytes
 .../zest-lib-http-unittests-client-cert.jceks   |  Bin 3395 -> 0 bytes
 .../zest-lib-http-unittests-server-cert.jceks   |  Bin 3380 -> 0 bytes
 .../http/VirtualHostJettyServiceTest.java       |   24 +-
 .../zest/library/http/dns/LocalManagedDns.java  |    2 +-
 .../http/dns/LocalManagedDnsDescriptor.java     |    2 +-
 ...un.net.spi.nameservice.NameServiceDescriptor |    2 +-
 .../http/src/vhost-test/resources/logback.xml   |    2 +-
 .../library/invocationcache/Cached.java         |   38 +
 .../invocationcache/InvocationCache.java        |   39 +
 .../ReturnCachedValueConcern.java               |   63 +
 .../ReturnCachedValueOnExceptionConcern.java    |   72 +
 .../SimpleInvocationCacheMixin.java             |   71 +
 .../library/invocationcache/package.html        |   24 +
 .../zest/library/invocationcache/Cached.java    |   38 -
 .../invocationcache/InvocationCache.java        |   39 -
 .../ReturnCachedValueConcern.java               |   63 -
 .../ReturnCachedValueOnExceptionConcern.java    |   72 -
 .../SimpleInvocationCacheMixin.java             |   71 -
 .../zest/library/invocationcache/package.html   |   24 -
 .../invocationcache/DocumentationSupport.java   |   52 +
 .../invocationcache/DocumentationSupport.java   |   52 -
 libraries/jmx/build.gradle                      |    4 +-
 .../library/jmx/ApplicationManagerService.java  |  381 ++++
 .../jmx/ConfigurationManagerService.java        |  414 ++++
 .../polygene/library/jmx/JMXAssembler.java      |   43 +
 .../library/jmx/JMXConnectorConfiguration.java  |   44 +
 .../library/jmx/JMXConnectorService.java        |  196 ++
 .../library/jmx/MBeanServerImporter.java        |   46 +
 .../polygene/library/jmx/MBeanTracker.java      |  213 ++
 .../polygene/library/jmx/ModelMBeanBuilder.java |  135 ++
 .../apache/polygene/library/jmx/ZestMBeans.java |   39 +
 .../apache/polygene/library/jmx/package.html    |   24 +
 .../library/jmx/ApplicationManagerService.java  |  381 ----
 .../jmx/ConfigurationManagerService.java        |  414 ----
 .../apache/zest/library/jmx/JMXAssembler.java   |   43 -
 .../library/jmx/JMXConnectorConfiguration.java  |   44 -
 .../zest/library/jmx/JMXConnectorService.java   |  196 --
 .../zest/library/jmx/MBeanServerImporter.java   |   46 -
 .../apache/zest/library/jmx/MBeanTracker.java   |  213 --
 .../zest/library/jmx/ModelMBeanBuilder.java     |  135 --
 .../org/apache/zest/library/jmx/ZestMBeans.java |   39 -
 .../org/apache/zest/library/jmx/package.html    |   24 -
 .../apache/polygene/library/jmx/JMXTest.java    |  220 ++
 .../org/apache/zest/library/jmx/JMXTest.java    |  220 --
 .../polygene/library/groovy/GroovyMixin.java    |  202 ++
 .../apache/polygene/library/groovy/package.html |   24 +
 .../apache/zest/library/groovy/GroovyMixin.java |  202 --
 .../org/apache/zest/library/groovy/package.html |   24 -
 .../library/groovy/GroovyComposite.java         |   31 +
 .../library/groovy/GroovyMixinTest.java         |   53 +
 .../polygene/library/groovy/HelloSpeaker.java   |   27 +
 .../library/groovy/HelloSpeakerMixin.groovy     |   31 +
 .../library/groovy/HelloSpeakerTest.java        |   81 +
 .../apache/polygene/library/groovy/Mixin1.java  |   25 +
 .../zest/library/groovy/GroovyComposite.java    |   31 -
 .../zest/library/groovy/GroovyMixinTest.java    |   53 -
 .../zest/library/groovy/HelloSpeaker.java       |   27 -
 .../library/groovy/HelloSpeakerMixin.groovy     |   31 -
 .../zest/library/groovy/HelloSpeakerTest.java   |   81 -
 .../org/apache/zest/library/groovy/Mixin1.java  |   25 -
 .../polygene/library/groovy/HelloSpeaker.groovy |   29 +
 .../library/groovy/HelloSpeaker.sayHello.groovy |   24 +
 .../polygene/library/groovy/Mixin1.groovy       |   32 +
 .../zest/library/groovy/HelloSpeaker.groovy     |   29 -
 .../library/groovy/HelloSpeaker.sayHello.groovy |   24 -
 .../apache/zest/library/groovy/Mixin1.groovy    |   32 -
 .../library/javascript/JavaScriptMixin.java     |  332 +++
 .../polygene/library/javascript/package.html    |   24 +
 .../library/javascript/JavaScriptMixin.java     |  332 ---
 .../apache/zest/library/javascript/package.html |   24 -
 .../polygene/library/javascript/DomainType.java |   25 +
 .../library/javascript/HelloSpeaker.java        |   31 +
 .../library/javascript/JavaScriptMixinTest.java |   43 +
 .../zest/library/javascript/DomainType.java     |   25 -
 .../zest/library/javascript/HelloSpeaker.java   |   31 -
 .../library/javascript/JavaScriptMixinTest.java |   43 -
 .../polygene/library/javascript/DomainType.js   |   33 +
 .../zest/library/javascript/DomainType.js       |   33 -
 .../polygene/library/locking/LockMixin.java     |   43 +
 .../locking/LockingAbstractComposite.java       |   32 +
 .../polygene/library/locking/ReadLock.java      |   33 +
 .../library/locking/ReadLockConcern.java        |   91 +
 .../polygene/library/locking/WriteLock.java     |   33 +
 .../library/locking/WriteLockConcern.java       |   82 +
 .../polygene/library/locking/package.html       |   24 +
 .../apache/zest/library/locking/LockMixin.java  |   43 -
 .../locking/LockingAbstractComposite.java       |   32 -
 .../apache/zest/library/locking/ReadLock.java   |   33 -
 .../zest/library/locking/ReadLockConcern.java   |   91 -
 .../apache/zest/library/locking/WriteLock.java  |   33 -
 .../zest/library/locking/WriteLockConcern.java  |   82 -
 .../apache/zest/library/locking/package.html    |   24 -
 .../library/locking/DocumentationSupport.java   |   43 +
 .../polygene/library/locking/LockingTest.java   |  132 ++
 .../library/locking/DocumentationSupport.java   |   43 -
 .../zest/library/locking/LockingTest.java       |  132 --
 .../polygene/library/logging/debug/Debug.java   |   49 +
 .../library/logging/debug/DebugConcern.java     |  101 +
 .../polygene/library/logging/debug/package.html |   24 +
 .../records/CompositeDebugRecordEntity.java     |   30 +
 .../logging/debug/records/DebugRecord.java      |   39 +
 .../debug/records/EntityDebugRecordEntity.java  |   29 +
 .../debug/records/ServiceDebugRecordEntity.java |   29 +
 .../library/logging/debug/records/package.html  |   24 +
 .../debug/service/DebugOnConsoleSideEffect.java |  112 ++
 .../service/DebugServiceConfiguration.java      |   30 +
 .../logging/debug/service/DebuggingService.java |   37 +
 .../service/DebuggingServiceComposite.java      |   32 +
 .../debug/service/DebuggingServiceMixin.java    |  181 ++
 .../library/logging/debug/service/package.html  |   24 +
 .../library/logging/log/CategoryLog.java        |   55 +
 .../library/logging/log/CategoryLogConcern.java |  162 ++
 .../library/logging/log/CategoryLogMixin.java   |   87 +
 .../polygene/library/logging/log/LogType.java   |   25 +
 .../polygene/library/logging/log/SimpleLog.java |   53 +
 .../library/logging/log/SimpleLogConcern.java   |  168 ++
 .../library/logging/log/StandardLog.java        |   36 +
 .../library/logging/log/StandardLogConcern.java |   78 +
 .../log/assemblies/LoggingAssembler.java        |   38 +
 .../library/logging/log/assemblies/package.html |   24 +
 .../polygene/library/logging/log/package.html   |   24 +
 .../logging/log/records/CompositeLogRecord.java |   29 +
 .../logging/log/records/EntityLogRecord.java    |   30 +
 .../library/logging/log/records/LogRecord.java  |   43 +
 .../logging/log/records/ServiceLogRecord.java   |   28 +
 .../library/logging/log/records/package.html    |   24 +
 .../log/service/LogOnConsoleSideEffect.java     |   84 +
 .../logging/log/service/LoggingService.java     |   30 +
 .../log/service/LoggingServiceComposite.java    |   31 +
 .../log/service/LoggingServiceMixin.java        |  174 ++
 .../library/logging/log/service/package.html    |   24 +
 .../logging/trace/AbstractTraceConcern.java     |   84 +
 .../logging/trace/ExcludeCompositeFilter.java   |   35 +
 .../polygene/library/logging/trace/Trace.java   |   66 +
 .../library/logging/trace/TraceAllConcern.java  |   57 +
 .../library/logging/trace/TraceConcern.java     |   61 +
 .../logging/trace/TraceOnConsoleSideEffect.java |  100 +
 .../trace/assemblies/TracingAssembler.java      |   40 +
 .../logging/trace/assemblies/package.html       |   24 +
 .../polygene/library/logging/trace/package.html |   24 +
 .../records/CompositeTraceRecordEntity.java     |   31 +
 .../trace/records/EntityTraceRecordEntity.java  |   31 +
 .../trace/records/ServiceTraceRecordEntity.java |   29 +
 .../logging/trace/records/TraceRecord.java      |   45 +
 .../library/logging/trace/records/package.html  |   24 +
 .../service/StandardTraceServiceComposite.java  |   32 +
 .../logging/trace/service/TraceService.java     |   37 +
 .../service/TraceServiceConfiguration.java      |   30 +
 .../trace/service/TraceServiceMixin.java        |  199 ++
 .../library/logging/trace/service/package.html  |   24 +
 .../logging/view/ConsoleViewerComposite.java    |   29 +
 .../logging/view/ConsoleViewerMixin.java        |   30 +
 .../logging/view/LogServiceListener.java        |   25 +
 .../library/logging/view/SwingViewer.java       |   30 +
 .../polygene/library/logging/view/package.html  |   24 +
 .../zest/library/logging/debug/Debug.java       |   49 -
 .../library/logging/debug/DebugConcern.java     |  101 -
 .../zest/library/logging/debug/package.html     |   24 -
 .../records/CompositeDebugRecordEntity.java     |   30 -
 .../logging/debug/records/DebugRecord.java      |   39 -
 .../debug/records/EntityDebugRecordEntity.java  |   29 -
 .../debug/records/ServiceDebugRecordEntity.java |   29 -
 .../library/logging/debug/records/package.html  |   24 -
 .../debug/service/DebugOnConsoleSideEffect.java |  112 --
 .../service/DebugServiceConfiguration.java      |   30 -
 .../logging/debug/service/DebuggingService.java |   37 -
 .../service/DebuggingServiceComposite.java      |   32 -
 .../debug/service/DebuggingServiceMixin.java    |  181 --
 .../library/logging/debug/service/package.html  |   24 -
 .../zest/library/logging/log/CategoryLog.java   |   55 -
 .../library/logging/log/CategoryLogConcern.java |  162 --
 .../library/logging/log/CategoryLogMixin.java   |   87 -
 .../zest/library/logging/log/LogType.java       |   25 -
 .../zest/library/logging/log/SimpleLog.java     |   53 -
 .../library/logging/log/SimpleLogConcern.java   |  168 --
 .../zest/library/logging/log/StandardLog.java   |   36 -
 .../library/logging/log/StandardLogConcern.java |   78 -
 .../log/assemblies/LoggingAssembler.java        |   38 -
 .../library/logging/log/assemblies/package.html |   24 -
 .../zest/library/logging/log/package.html       |   24 -
 .../logging/log/records/CompositeLogRecord.java |   29 -
 .../logging/log/records/EntityLogRecord.java    |   30 -
 .../library/logging/log/records/LogRecord.java  |   43 -
 .../logging/log/records/ServiceLogRecord.java   |   28 -
 .../library/logging/log/records/package.html    |   24 -
 .../log/service/LogOnConsoleSideEffect.java     |   84 -
 .../logging/log/service/LoggingService.java     |   30 -
 .../log/service/LoggingServiceComposite.java    |   31 -
 .../log/service/LoggingServiceMixin.java        |  174 --
 .../library/logging/log/service/package.html    |   24 -
 .../logging/trace/AbstractTraceConcern.java     |   84 -
 .../logging/trace/ExcludeCompositeFilter.java   |   35 -
 .../zest/library/logging/trace/Trace.java       |   66 -
 .../library/logging/trace/TraceAllConcern.java  |   57 -
 .../library/logging/trace/TraceConcern.java     |   61 -
 .../logging/trace/TraceOnConsoleSideEffect.java |  100 -
 .../trace/assemblies/TracingAssembler.java      |   40 -
 .../logging/trace/assemblies/package.html       |   24 -
 .../zest/library/logging/trace/package.html     |   24 -
 .../records/CompositeTraceRecordEntity.java     |   31 -
 .../trace/records/EntityTraceRecordEntity.java  |   31 -
 .../trace/records/ServiceTraceRecordEntity.java |   29 -
 .../logging/trace/records/TraceRecord.java      |   45 -
 .../library/logging/trace/records/package.html  |   24 -
 .../service/StandardTraceServiceComposite.java  |   32 -
 .../logging/trace/service/TraceService.java     |   37 -
 .../service/TraceServiceConfiguration.java      |   30 -
 .../trace/service/TraceServiceMixin.java        |  199 --
 .../library/logging/trace/service/package.html  |   24 -
 .../logging/view/ConsoleViewerComposite.java    |   29 -
 .../logging/view/ConsoleViewerMixin.java        |   30 -
 .../logging/view/LogServiceListener.java        |   25 -
 .../zest/library/logging/view/SwingViewer.java  |   30 -
 .../zest/library/logging/view/package.html      |   24 -
 .../polygene/library/logging/DebuggingTest.java |  140 ++
 .../polygene/library/logging/TracingTest.java   |  257 +++
 .../library/logging/docsupport/LoggingDocs.java |   72 +
 .../zest/library/logging/DebuggingTest.java     |  140 --
 .../zest/library/logging/TracingTest.java       |  257 ---
 .../library/logging/docsupport/LoggingDocs.java |   72 -
 .../DebuggingServiceComposite.properties        |   21 +
 .../DebuggingServiceComposite.properties        |   21 -
 .../polygene/library/metrics/TimingCapture.java |   37 +
 .../metrics/TimingCaptureAllConcern.java        |   88 +
 .../library/metrics/TimingCaptureConcern.java   |   50 +
 .../polygene/library/metrics/package.html       |   24 +
 .../zest/library/metrics/TimingCapture.java     |   37 -
 .../metrics/TimingCaptureAllConcern.java        |   88 -
 .../library/metrics/TimingCaptureConcern.java   |   50 -
 .../apache/zest/library/metrics/package.html    |   24 -
 .../metrics/AbstractTimingCaptureTest.java      |  146 ++
 .../metrics/CodahaleTimingCaptureTest.java      |   59 +
 .../library/metrics/DocumentationSupport.java   |   80 +
 .../metrics/AbstractTimingCaptureTest.java      |  146 --
 .../metrics/CodahaleTimingCaptureTest.java      |   59 -
 .../library/metrics/DocumentationSupport.java   |   80 -
 .../polygene/library/osgi/FallbackStrategy.java |   40 +
 .../library/osgi/OSGiEnabledService.java        |  122 ++
 .../polygene/library/osgi/OSGiImportInfo.java   |   47 +
 .../library/osgi/OSGiServiceExporter.java       |  120 ++
 .../library/osgi/OSGiServiceImporter.java       |  122 ++
 .../apache/polygene/library/osgi/package.html   |   24 +
 .../zest/library/osgi/FallbackStrategy.java     |   40 -
 .../zest/library/osgi/OSGiEnabledService.java   |  122 --
 .../zest/library/osgi/OSGiImportInfo.java       |   47 -
 .../zest/library/osgi/OSGiServiceExporter.java  |  120 --
 .../zest/library/osgi/OSGiServiceImporter.java  |  122 --
 .../org/apache/zest/library/osgi/package.html   |   24 -
 .../library/osgi/DocumentationSupport.java      |   93 +
 .../polygene/library/osgi/OSGiServiceTest.java  |   79 +
 .../zest/library/osgi/DocumentationSupport.java |   93 -
 .../zest/library/osgi/OSGiServiceTest.java      |   79 -
 .../org/apache/polygene/library/rdf/DcRdf.java  |   31 +
 .../apache/polygene/library/rdf/RdfFormat.java  |   26 +
 .../org/apache/polygene/library/rdf/Rdfs.java   |   67 +
 .../apache/polygene/library/rdf/ZestEntity.java |   39 +
 .../polygene/library/rdf/ZestEntityType.java    |   39 +
 .../apache/polygene/library/rdf/ZestRdf.java    |   87 +
 .../rdf/entity/EntityStateSerializer.java       |  241 +++
 .../rdf/entity/EntityTypeSerializer.java        |  169 ++
 .../polygene/library/rdf/entity/package.html    |   24 +
 .../rdf/model/ApplicationSerializer.java        |   46 +
 .../library/rdf/model/ApplicationVisitor.java   |  116 ++
 .../polygene/library/rdf/model/Model2XML.java   |  216 ++
 .../polygene/library/rdf/model/package.html     |   24 +
 .../apache/polygene/library/rdf/package.html    |   24 +
 .../repository/HttpRepositoryConfiguration.java |   52 +
 .../rdf/repository/HttpRepositoryService.java   |   99 +
 .../rdf/repository/MemoryRepositoryService.java |  139 ++
 .../rdf/repository/NativeConfiguration.java     |   43 +
 .../rdf/repository/NativeRepositoryService.java |  232 +++
 .../RdbmsRepositoryConfiguration.java           |   33 +
 .../rdf/repository/RdbmsRepositoryService.java  |  137 ++
 .../rdf/repository/ResetableRepository.java     |   29 +
 .../library/rdf/repository/package.html         |   24 +
 .../rdf/serializer/AbstractSerializer.java      |   81 +
 .../library/rdf/serializer/N3Serializer.java    |   31 +
 .../rdf/serializer/RdfXmlSerializer.java        |   31 +
 .../library/rdf/serializer/Serializer.java      |   35 +
 .../rdf/serializer/SerializerContext.java       |  126 ++
 .../rdf/serializer/TurtleSerializer.java        |   31 +
 .../library/rdf/serializer/package.html         |   24 +
 .../java/org/apache/zest/library/rdf/DcRdf.java |   31 -
 .../org/apache/zest/library/rdf/RdfFormat.java  |   26 -
 .../java/org/apache/zest/library/rdf/Rdfs.java  |   67 -
 .../org/apache/zest/library/rdf/ZestEntity.java |   39 -
 .../apache/zest/library/rdf/ZestEntityType.java |   39 -
 .../org/apache/zest/library/rdf/ZestRdf.java    |   87 -
 .../rdf/entity/EntityStateSerializer.java       |  241 ---
 .../rdf/entity/EntityTypeSerializer.java        |  169 --
 .../apache/zest/library/rdf/entity/package.html |   24 -
 .../rdf/model/ApplicationSerializer.java        |   46 -
 .../library/rdf/model/ApplicationVisitor.java   |  116 --
 .../zest/library/rdf/model/Model2XML.java       |  216 --
 .../apache/zest/library/rdf/model/package.html  |   24 -
 .../org/apache/zest/library/rdf/package.html    |   24 -
 .../repository/HttpRepositoryConfiguration.java |   52 -
 .../rdf/repository/HttpRepositoryService.java   |   99 -
 .../rdf/repository/MemoryRepositoryService.java |  139 --
 .../rdf/repository/NativeConfiguration.java     |   43 -
 .../rdf/repository/NativeRepositoryService.java |  232 ---
 .../RdbmsRepositoryConfiguration.java           |   33 -
 .../rdf/repository/RdbmsRepositoryService.java  |  137 --
 .../rdf/repository/ResetableRepository.java     |   29 -
 .../zest/library/rdf/repository/package.html    |   24 -
 .../rdf/serializer/AbstractSerializer.java      |   81 -
 .../library/rdf/serializer/N3Serializer.java    |   31 -
 .../rdf/serializer/RdfXmlSerializer.java        |   31 -
 .../zest/library/rdf/serializer/Serializer.java |   35 -
 .../rdf/serializer/SerializerContext.java       |  126 --
 .../rdf/serializer/TurtleSerializer.java        |   31 -
 .../zest/library/rdf/serializer/package.html    |   24 -
 .../library/rdf/ApplicationXmlTest.java         |  157 ++
 .../polygene/library/rdf/Model2XMLTest.java     |   83 +
 .../rdf/entity/EntitySerializerTest.java        |  144 ++
 .../rdf/entity/EntityTypeSerializerTest.java    |  127 ++
 .../polygene/library/rdf/entity/Test2Value.java |   29 +
 .../polygene/library/rdf/entity/TestEntity.java |   47 +
 .../polygene/library/rdf/entity/TestValue.java  |   37 +
 .../polygene/library/rdf/entity/test2.xml       |   45 +
 .../rdf/repository/MemoryRepositoryTest.java    |   56 +
 .../rdf/repository/NativeRepositoryTest.java    |   68 +
 .../zest/library/rdf/ApplicationXmlTest.java    |  157 --
 .../apache/zest/library/rdf/Model2XMLTest.java  |   83 -
 .../rdf/entity/EntitySerializerTest.java        |  144 --
 .../rdf/entity/EntityTypeSerializerTest.java    |  127 --
 .../zest/library/rdf/entity/Test2Value.java     |   29 -
 .../zest/library/rdf/entity/TestEntity.java     |   47 -
 .../zest/library/rdf/entity/TestValue.java      |   37 -
 .../org/apache/zest/library/rdf/entity/test.xml |   56 -
 .../apache/zest/library/rdf/entity/test2.xml    |   45 -
 .../rdf/repository/MemoryRepositoryTest.java    |   56 -
 .../rdf/repository/NativeRepositoryTest.java    |   68 -
 .../NativeRepositoryService.properties          |   21 +
 .../NativeRepositoryService.properties          |   21 -
 .../library/rest/client/ClientAssembler.java    |   55 +
 .../library/rest/client/ClientCache.java        |  149 ++
 .../rest/client/RequestWriterDelegator.java     |  102 +
 .../rest/client/ResponseReaderDelegator.java    |   89 +
 .../rest/client/api/ContextResourceClient.java  |  443 ++++
 .../api/ContextResourceClientFactory.java       |  189 ++
 .../library/rest/client/api/ErrorHandler.java   |   86 +
 .../library/rest/client/api/HandlerCommand.java |  222 +++
 .../library/rest/client/api/package.html        |   24 +
 .../polygene/library/rest/client/package.html   |   24 +
 .../client/requestwriter/FormRequestWriter.java |   52 +
 .../ValueCompositeRequestWriter.java            |  112 ++
 .../rest/client/requestwriter/package.html      |   24 +
 .../responsereader/DefaultResponseReader.java   |   65 +
 .../responsereader/JSONResponseReader.java      |   87 +
 .../responsereader/TableResponseReader.java     |  113 ++
 .../rest/client/responsereader/package.html     |   24 +
 .../rest/client/spi/NullResponseHandler.java    |   39 +
 .../library/rest/client/spi/RequestWriter.java  |   41 +
 .../rest/client/spi/ResponseHandler.java        |   34 +
 .../library/rest/client/spi/ResponseReader.java |   32 +
 .../library/rest/client/spi/ResultHandler.java  |   32 +
 .../library/rest/client/spi/package.html        |   24 +
 .../library/rest/client/ClientAssembler.java    |   55 -
 .../zest/library/rest/client/ClientCache.java   |  149 --
 .../rest/client/RequestWriterDelegator.java     |  102 -
 .../rest/client/ResponseReaderDelegator.java    |   89 -
 .../rest/client/api/ContextResourceClient.java  |  446 -----
 .../api/ContextResourceClientFactory.java       |  189 --
 .../library/rest/client/api/ErrorHandler.java   |   86 -
 .../library/rest/client/api/HandlerCommand.java |  222 ---
 .../zest/library/rest/client/api/package.html   |   24 -
 .../zest/library/rest/client/package.html       |   24 -
 .../client/requestwriter/FormRequestWriter.java |   52 -
 .../ValueCompositeRequestWriter.java            |  112 --
 .../rest/client/requestwriter/package.html      |   24 -
 .../responsereader/DefaultResponseReader.java   |   65 -
 .../responsereader/JSONResponseReader.java      |   87 -
 .../responsereader/TableResponseReader.java     |  113 --
 .../rest/client/responsereader/package.html     |   24 -
 .../rest/client/spi/NullResponseHandler.java    |   39 -
 .../library/rest/client/spi/RequestWriter.java  |   41 -
 .../rest/client/spi/ResponseHandler.java        |   34 -
 .../library/rest/client/spi/ResponseReader.java |   32 -
 .../library/rest/client/spi/ResultHandler.java  |   32 -
 .../zest/library/rest/client/spi/package.html   |   24 -
 .../library/rest/client/rest-client.properties  |   27 -
 .../ContextResourceClientFactoryTest.java       |  767 +++++++
 .../rest/client/ContinuousIntegrationTest.java  |  455 +++++
 .../library/rest/client/RssReaderTest.java      |  178 ++
 .../rest/client/docsupport/RestPrimerDocs.java  |  126 ++
 .../ContextResourceClientFactoryTest.java       |  767 -------
 .../rest/client/ContinuousIntegrationTest.java  |  455 -----
 .../zest/library/rest/client/RssReaderTest.java |  178 --
 .../rest/client/docsupport/RestPrimerDocs.java  |  126 --
 .../polygene/library/rest/common/Form.java      |   36 +
 .../polygene/library/rest/common/Resource.java  |   81 +
 .../library/rest/common/ValueAssembler.java     |   46 +
 .../polygene/library/rest/common/link/Link.java |   71 +
 .../library/rest/common/link/Links.java         |   36 +
 .../library/rest/common/link/LinksBuilder.java  |  134 ++
 .../library/rest/common/link/LinksUtil.java     |   70 +
 .../library/rest/common/link/package.html       |   24 +
 .../polygene/library/rest/common/package.html   |   24 +
 .../library/rest/common/table/Cell.java         |   38 +
 .../library/rest/common/table/Column.java       |   35 +
 .../library/rest/common/table/Problem.java      |   35 +
 .../library/rest/common/table/QueryBuilder.java |   66 +
 .../polygene/library/rest/common/table/Row.java |   36 +
 .../library/rest/common/table/Table.java        |   71 +
 .../library/rest/common/table/TableBuilder.java |  332 +++
 .../rest/common/table/TableBuilderFactory.java  |  100 +
 .../library/rest/common/table/TableQuery.java   |  240 +++
 .../rest/common/table/TableResponse.java        |   52 +
 .../library/rest/common/table/package.html      |   24 +
 .../apache/zest/library/rest/common/Form.java   |   36 -
 .../zest/library/rest/common/Resource.java      |   81 -
 .../library/rest/common/ValueAssembler.java     |   46 -
 .../zest/library/rest/common/link/Link.java     |   71 -
 .../zest/library/rest/common/link/Links.java    |   36 -
 .../library/rest/common/link/LinksBuilder.java  |  134 --
 .../library/rest/common/link/LinksUtil.java     |   70 -
 .../zest/library/rest/common/link/package.html  |   24 -
 .../zest/library/rest/common/package.html       |   24 -
 .../zest/library/rest/common/table/Cell.java    |   38 -
 .../zest/library/rest/common/table/Column.java  |   35 -
 .../zest/library/rest/common/table/Problem.java |   35 -
 .../library/rest/common/table/QueryBuilder.java |   66 -
 .../zest/library/rest/common/table/Row.java     |   36 -
 .../zest/library/rest/common/table/Table.java   |   71 -
 .../library/rest/common/table/TableBuilder.java |  332 ---
 .../rest/common/table/TableBuilderFactory.java  |  100 -
 .../library/rest/common/table/TableQuery.java   |  240 ---
 .../rest/common/table/TableResponse.java        |   52 -
 .../zest/library/rest/common/table/package.html |   24 -
 .../rest/server/RestServerException.java        |   34 +
 .../rest/server/api/ContextResource.java        |  919 +++++++++
 .../library/rest/server/api/ContextRestlet.java |  315 +++
 .../api/InteractionConstraintsConcern.java      |   82 +
 .../rest/server/api/ObjectSelection.java        |   92 +
 .../library/rest/server/api/ResourceCreate.java |   29 +
 .../library/rest/server/api/ResourceDelete.java |   32 +
 .../library/rest/server/api/ResourceIndex.java  |   29 +
 .../library/rest/server/api/ResourceUpdate.java |   29 +
 .../rest/server/api/ResourceValidity.java       |  101 +
 .../library/rest/server/api/SubResource.java    |   37 +
 .../library/rest/server/api/SubResources.java   |   41 +
 .../api/constraint/InteractionConstraint.java   |   32 +
 .../InteractionConstraintDeclaration.java       |   33 +
 .../api/constraint/InteractionValidation.java   |   59 +
 .../rest/server/api/constraint/Requires.java    |   67 +
 .../server/api/constraint/RequiresValid.java    |   48 +
 .../server/api/constraint/ServiceAvailable.java |   53 +
 .../rest/server/api/constraint/package.html     |   24 +
 .../library/rest/server/api/dci/Role.java       |   62 +
 .../library/rest/server/api/dci/package.html    |   24 +
 .../library/rest/server/api/package.html        |   24 +
 .../server/assembler/RestServerAssembler.java   |  117 ++
 .../library/rest/server/assembler/package.html  |   24 +
 .../restlet/ConstraintViolationMessages.java    |   85 +
 .../restlet/ExtensionMediaTypeFilter.java       |   88 +
 .../server/restlet/InteractionConstraints.java  |   36 +
 .../restlet/InteractionConstraintsService.java  |  362 ++++
 .../rest/server/restlet/NullCommandResult.java  |   36 +
 .../server/restlet/RequestReaderDelegator.java  |  111 ++
 .../server/restlet/ResponseWriterDelegator.java |  100 +
 .../freemarker/ValueCompositeObjectWrapper.java |   52 +
 .../freemarker/ValueCompositeTemplateModel.java |  122 ++
 .../rest/server/restlet/freemarker/package.html |   24 +
 .../library/rest/server/restlet/package.html    |   24 +
 .../requestreader/DefaultRequestReader.java     |  512 +++++
 .../server/restlet/requestreader/package.html   |   24 +
 .../responsewriter/AbstractResponseWriter.java  |   66 +
 .../responsewriter/DefaultResponseWriter.java   |   58 +
 .../responsewriter/FormResponseWriter.java      |  121 ++
 .../responsewriter/JSONResponseWriter.java      |   64 +
 .../responsewriter/LinksResponseWriter.java     |  154 ++
 .../responsewriter/ResourceResponseWriter.java  |  107 +
 .../ResourceTemplateResponseWriter.java         |  119 ++
 .../responsewriter/RestResponseException.java   |   31 +
 .../responsewriter/TableResponseWriter.java     |  203 ++
 .../ValueCompositeResponseWriter.java           |  120 ++
 .../ValueDescriptorResponseWriter.java          |  119 ++
 .../server/restlet/responsewriter/package.html  |   24 +
 .../library/rest/server/spi/CommandResult.java  |   28 +
 .../library/rest/server/spi/RequestReader.java  |   33 +
 .../library/rest/server/spi/ResponseWriter.java |   32 +
 .../rest/server/spi/ResultConverter.java        |   31 +
 .../library/rest/server/spi/package.html        |   24 +
 .../rest/server/RestServerException.java        |   34 -
 .../rest/server/api/ContextResource.java        |  919 ---------
 .../library/rest/server/api/ContextRestlet.java |  315 ---
 .../api/InteractionConstraintsConcern.java      |   82 -
 .../rest/server/api/ObjectSelection.java        |   92 -
 .../library/rest/server/api/ResourceCreate.java |   29 -
 .../library/rest/server/api/ResourceDelete.java |   32 -
 .../library/rest/server/api/ResourceIndex.java  |   29 -
 .../library/rest/server/api/ResourceUpdate.java |   29 -
 .../rest/server/api/ResourceValidity.java       |  101 -
 .../library/rest/server/api/SubResource.java    |   37 -
 .../library/rest/server/api/SubResources.java   |   41 -
 .../api/constraint/InteractionConstraint.java   |   32 -
 .../InteractionConstraintDeclaration.java       |   33 -
 .../api/constraint/InteractionValidation.java   |   59 -
 .../rest/server/api/constraint/Requires.java    |   67 -
 .../server/api/constraint/RequiresValid.java    |   48 -
 .../server/api/constraint/ServiceAvailable.java |   53 -
 .../rest/server/api/constraint/package.html     |   24 -
 .../zest/library/rest/server/api/dci/Role.java  |   62 -
 .../library/rest/server/api/dci/package.html    |   24 -
 .../zest/library/rest/server/api/package.html   |   24 -
 .../server/assembler/RestServerAssembler.java   |  117 --
 .../library/rest/server/assembler/package.html  |   24 -
 .../restlet/ConstraintViolationMessages.java    |   85 -
 .../restlet/ExtensionMediaTypeFilter.java       |   88 -
 .../server/restlet/InteractionConstraints.java  |   36 -
 .../restlet/InteractionConstraintsService.java  |  362 ----
 .../rest/server/restlet/NullCommandResult.java  |   36 -
 .../server/restlet/RequestReaderDelegator.java  |  111 --
 .../server/restlet/ResponseWriterDelegator.java |  100 -
 .../freemarker/ValueCompositeObjectWrapper.java |   52 -
 .../freemarker/ValueCompositeTemplateModel.java |  122 --
 .../rest/server/restlet/freemarker/package.html |   24 -
 .../library/rest/server/restlet/package.html    |   24 -
 .../requestreader/DefaultRequestReader.java     |  512 -----
 .../server/restlet/requestreader/package.html   |   24 -
 .../responsewriter/AbstractResponseWriter.java  |   66 -
 .../responsewriter/DefaultResponseWriter.java   |   58 -
 .../responsewriter/FormResponseWriter.java      |  121 --
 .../responsewriter/JSONResponseWriter.java      |   64 -
 .../responsewriter/LinksResponseWriter.java     |  154 --
 .../responsewriter/ResourceResponseWriter.java  |  107 -
 .../ResourceTemplateResponseWriter.java         |  119 --
 .../responsewriter/RestResponseException.java   |   31 -
 .../responsewriter/TableResponseWriter.java     |  203 --
 .../ValueCompositeResponseWriter.java           |  120 --
 .../ValueDescriptorResponseWriter.java          |  119 --
 .../server/restlet/responsewriter/package.html  |   24 -
 .../library/rest/server/spi/CommandResult.java  |   28 -
 .../library/rest/server/spi/RequestReader.java  |   33 -
 .../library/rest/server/spi/ResponseWriter.java |   32 -
 .../rest/server/spi/ResultConverter.java        |   31 -
 .../zest/library/rest/server/spi/package.html   |   24 -
 .../library/rest/server/rest-server.properties  |   31 +
 .../rest/server/restlet/responsewriter/form.htm |   61 +
 .../server/restlet/responsewriter/links.atom    |   15 +
 .../server/restlet/responsewriter/links.htm     |   39 +
 .../server/restlet/responsewriter/resource.htm  |   77 +
 .../restlet/responsewriter/selectresource.htm   |   35 +
 .../server/restlet/responsewriter/table.htm     |   53 +
 .../server/restlet/responsewriter/value.htm     |   40 +
 .../library/rest/server/rest-server.properties  |   31 -
 .../rest/server/restlet/responsewriter/form.htm |   61 -
 .../server/restlet/responsewriter/links.atom    |   15 -
 .../server/restlet/responsewriter/links.htm     |   39 -
 .../server/restlet/responsewriter/resource.htm  |   77 -
 .../restlet/responsewriter/selectresource.htm   |   35 -
 .../server/restlet/responsewriter/table.htm     |   53 -
 .../server/restlet/responsewriter/value.htm     |   40 -
 .../rest/server/DocumentationSupport.java       |   41 +
 .../rest/server/DocumentationSupport.java       |   41 -
 .../library/rest/admin/EntitiesResource.java    |  246 +++
 .../library/rest/admin/EntityResource.java      |  528 +++++
 .../rest/admin/ExceptionRepresentation.java     |   53 +
 .../rest/admin/ExtensionMediaTypeFilter.java    |   87 +
 .../library/rest/admin/IndexResource.java       |  130 ++
 .../library/rest/admin/RestApplication.java     |  117 ++
 .../library/rest/admin/RestAssembler.java       |   41 +
 .../polygene/library/rest/admin/RestServer.java |   25 +
 .../library/rest/admin/RestServerComposite.java |   59 +
 .../rest/admin/RestServerConfiguration.java     |   32 +
 .../library/rest/admin/RestServerMixin.java     |   60 +
 .../library/rest/admin/SPARQLResource.java      |  383 ++++
 .../polygene/library/rest/admin/ZestFinder.java |   45 +
 .../library/rest/admin/ZestServerServlet.java   |   44 +
 .../rest/admin/ZestServerServletService.java    |   34 +
 .../polygene/library/rest/admin/package.html    |   24 +
 .../library/rest/admin/EntitiesResource.java    |  246 ---
 .../zest/library/rest/admin/EntityResource.java |  528 -----
 .../rest/admin/ExceptionRepresentation.java     |   53 -
 .../rest/admin/ExtensionMediaTypeFilter.java    |   87 -
 .../zest/library/rest/admin/IndexResource.java  |  130 --
 .../library/rest/admin/RestApplication.java     |  117 --
 .../zest/library/rest/admin/RestAssembler.java  |   41 -
 .../zest/library/rest/admin/RestServer.java     |   25 -
 .../library/rest/admin/RestServerComposite.java |   59 -
 .../rest/admin/RestServerConfiguration.java     |   32 -
 .../library/rest/admin/RestServerMixin.java     |   60 -
 .../zest/library/rest/admin/SPARQLResource.java |  383 ----
 .../zest/library/rest/admin/ZestFinder.java     |   45 -
 .../library/rest/admin/ZestServerServlet.java   |   44 -
 .../rest/admin/ZestServerServletService.java    |   34 -
 .../apache/zest/library/rest/admin/package.html |   24 -
 .../polygene/library/rest/admin/sparqlform.html |   99 +
 .../polygene/library/rest/admin/sparqlhtml.xsl  |  190 ++
 .../zest/library/rest/admin/sparqlform.html     |   99 -
 .../zest/library/rest/admin/sparqlhtml.xsl      |  190 --
 .../library/rest/admin/DomainAssembler.java     |   52 +
 .../library/rest/admin/DummyDataService.java    |  115 ++
 .../polygene/library/rest/admin/Main.java       |   52 +
 .../library/rest/admin/MainAssembler.java       |   76 +
 .../MemoryEntityStoreServiceAssembler.java      |   40 +
 .../polygene/library/rest/admin/Named.java      |   33 +
 .../library/rest/admin/RDFAssembler.java        |   44 +
 .../polygene/library/rest/admin/RestTest.java   |  308 +++
 .../rest/admin/RestletServletAssembler.java     |   42 +
 .../polygene/library/rest/admin/TestEntity.java |   55 +
 .../library/rest/admin/TestEntity2.java         |   31 +
 .../polygene/library/rest/admin/TestRole.java   |   33 +
 .../polygene/library/rest/admin/TestValue.java  |   47 +
 .../polygene/library/rest/admin/TestValue2.java |   35 +
 .../library/rest/admin/DomainAssembler.java     |   52 -
 .../library/rest/admin/DummyDataService.java    |  115 --
 .../apache/zest/library/rest/admin/Main.java    |   52 -
 .../zest/library/rest/admin/MainAssembler.java  |   76 -
 .../MemoryEntityStoreServiceAssembler.java      |   40 -
 .../apache/zest/library/rest/admin/Named.java   |   33 -
 .../zest/library/rest/admin/RDFAssembler.java   |   44 -
 .../zest/library/rest/admin/RestTest.java       |  308 ---
 .../rest/admin/RestletServletAssembler.java     |   42 -
 .../zest/library/rest/admin/TestEntity.java     |   55 -
 .../zest/library/rest/admin/TestEntity2.java    |   31 -
 .../zest/library/rest/admin/TestRole.java       |   33 -
 .../zest/library/rest/admin/TestValue.java      |   47 -
 .../zest/library/rest/admin/TestValue2.java     |   35 -
 libraries/restlet/build.gradle                  |    4 +-
 .../polygene/library/restlet/Command.java       |   29 +
 .../library/restlet/ConversionException.java    |   29 +
 .../polygene/library/restlet/FormField.java     |  105 +
 .../library/restlet/HasDescription.java         |   31 +
 .../polygene/library/restlet/HasName.java       |   28 +
 .../polygene/library/restlet/RestForm.java      |   48 +
 .../polygene/library/restlet/RestLink.java      |   30 +
 .../library/restlet/ZestEntityRestlet.java      |  311 +++
 .../library/restlet/ZestServerServlet.java      |   51 +
 .../library/restlet/ZrestApplication.java       |  260 +++
 .../restlet/assembly/CrudServiceAssembler.java  |   41 +
 .../restlet/assembly/GenericRestLayer.java      |   36 +
 .../assembly/RestApplicationAssembler.java      |   86 +
 .../RestletCrudConnectivityAssembler.java       |   70 +
 .../assembly/RestletCrudModuleAssembler.java    |   66 +
 .../configuration/ConfigurationLayer.java       |   47 +
 .../configuration/ConfigurationModule.java      |   43 +
 .../connectivity/ConnectivityLayer.java         |   41 +
 .../assembly/connectivity/RestModule.java       |   42 +
 .../assembly/connectivity/SecurityModule.java   |   37 +
 .../restlet/assembly/domain/CrudModule.java     |   40 +
 .../restlet/assembly/domain/DomainLayer.java    |   47 +
 .../infrastructue/FileStorageModule.java        |   52 +
 .../assembly/infrastructue/IndexingModule.java  |   56 +
 .../infrastructue/InfrastructureLayer.java      |   63 +
 .../infrastructue/SerializationModule.java      |   54 +
 .../assembly/resource/ResourceLayer.java        |   39 +
 .../library/restlet/crud/EntityList.java        |   33 +
 .../restlet/crud/EntityListResource.java        |  121 ++
 .../library/restlet/crud/EntityRef.java         |   35 +
 .../library/restlet/crud/EntityResource.java    |  228 +++
 .../restlet/crud/HasIdentitySpecification.java  |   44 +
 .../crud/RepositoryNotFoundException.java       |   29 +
 .../library/restlet/filters/NameFilter.java     |   40 +
 .../library/restlet/identity/CanonicalName.java |   56 +
 .../restlet/identity/IdentityManager.java       |  156 ++
 .../identity/IdentityMappingConfiguration.java  |   33 +
 .../InvalidIdentityFormatException.java         |   29 +
 .../library/restlet/metainfo/UserIdentity.java  |   66 +
 .../restlet/repository/CrudRepository.java      |   51 +
 .../library/restlet/repository/EntityName.java  |   64 +
 .../repository/EntityTypeDescriptor.java        |   42 +
 .../repository/MissingRepositoryException.java  |   29 +
 .../restlet/repository/RepositoryLocator.java   |   57 +
 .../repository/SmallCrudRepositoryMixin.java    |  122 ++
 .../restlet/resource/CreationParameterized.java |   33 +
 .../restlet/resource/CreationResource.java      |  118 ++
 .../resource/DefaultResourceFactoryImpl.java    |  101 +
 .../library/restlet/resource/EntryPoint.java    |   31 +
 .../restlet/resource/EntryPointResource.java    |   99 +
 .../restlet/resource/NotPresentException.java   |   25 +
 .../library/restlet/resource/Parameterizer.java |   25 +
 .../restlet/resource/ResourceBuilder.java       |  178 ++
 .../restlet/resource/ResourceFactory.java       |   31 +
 .../restlet/resource/ServerResource.java        |  109 +
 .../serialization/FormRepresentation.java       |  157 ++
 .../serialization/JsonRepresentation.java       |  130 ++
 .../restlet/serialization/ZestConverter.java    |  268 +++
 .../apache/zest/library/restlet/Command.java    |   29 -
 .../library/restlet/ConversionException.java    |   29 -
 .../apache/zest/library/restlet/FormField.java  |  105 -
 .../zest/library/restlet/HasDescription.java    |   31 -
 .../apache/zest/library/restlet/HasName.java    |   28 -
 .../apache/zest/library/restlet/RestForm.java   |   48 -
 .../apache/zest/library/restlet/RestLink.java   |   30 -
 .../zest/library/restlet/ZestEntityRestlet.java |  311 ---
 .../zest/library/restlet/ZestServerServlet.java |   51 -
 .../zest/library/restlet/ZrestApplication.java  |  260 ---
 .../restlet/assembly/CrudServiceAssembler.java  |   41 -
 .../restlet/assembly/GenericRestLayer.java      |   36 -
 .../assembly/RestApplicationAssembler.java      |   86 -
 .../RestletCrudConnectivityAssembler.java       |   70 -
 .../assembly/RestletCrudModuleAssembler.java    |   66 -
 .../configuration/ConfigurationLayer.java       |   47 -
 .../configuration/ConfigurationModule.java      |   43 -
 .../connectivity/ConnectivityLayer.java         |   41 -
 .../assembly/connectivity/RestModule.java       |   42 -
 .../assembly/connectivity/SecurityModule.java   |   37 -
 .../restlet/assembly/domain/CrudModule.java     |   40 -
 .../restlet/assembly/domain/DomainLayer.java    |   47 -
 .../infrastructue/FileStorageModule.java        |   52 -
 .../assembly/infrastructue/IndexingModule.java  |   56 -
 .../infrastructue/InfrastructureLayer.java      |   63 -
 .../infrastructue/SerializationModule.java      |   54 -
 .../assembly/resource/ResourceLayer.java        |   39 -
 .../zest/library/restlet/crud/EntityList.java   |   33 -
 .../restlet/crud/EntityListResource.java        |  122 --
 .../zest/library/restlet/crud/EntityRef.java    |   35 -
 .../library/restlet/crud/EntityResource.java    |  229 ---
 .../restlet/crud/HasIdentitySpecification.java  |   44 -
 .../crud/RepositoryNotFoundException.java       |   29 -
 .../library/restlet/filters/NameFilter.java     |   41 -
 .../library/restlet/identity/CanonicalName.java |   56 -
 .../restlet/identity/IdentityManager.java       |  156 --
 .../identity/IdentityMappingConfiguration.java  |   33 -
 .../InvalidIdentityFormatException.java         |   29 -
 .../library/restlet/metainfo/UserIdentity.java  |   66 -
 .../restlet/repository/CrudRepository.java      |   51 -
 .../library/restlet/repository/EntityName.java  |   64 -
 .../repository/EntityTypeDescriptor.java        |   42 -
 .../repository/MissingRepositoryException.java  |   29 -
 .../restlet/repository/RepositoryLocator.java   |   57 -
 .../repository/SmallCrudRepositoryMixin.java    |  122 --
 .../restlet/resource/CreationParameterized.java |   33 -
 .../restlet/resource/CreationResource.java      |  118 --
 .../resource/DefaultResourceFactoryImpl.java    |  101 -
 .../library/restlet/resource/EntryPoint.java    |   31 -
 .../restlet/resource/EntryPointResource.java    |   99 -
 .../restlet/resource/NotPresentException.java   |   25 -
 .../library/restlet/resource/Parameterizer.java |   25 -
 .../restlet/resource/ResourceBuilder.java       |  178 --
 .../restlet/resource/ResourceFactory.java       |   31 -
 .../restlet/resource/ServerResource.java        |  109 -
 .../serialization/FormRepresentation.java       |  157 --
 .../serialization/JsonRepresentation.java       |  130 --
 .../restlet/serialization/ZestConverter.java    |  268 ---
 ...org.restlet.engine.converter.ConverterHelper |    2 +-
 .../polygene/library/restlet/Customer.java      |   27 +
 .../apache/polygene/library/restlet/Order.java  |   27 +
 .../polygene/library/restlet/OrdersModule.java  |   41 +
 .../polygene/library/restlet/Product.java       |   27 +
 .../library/restlet/TestApplication.java        |   69 +
 .../apache/zest/library/restlet/Customer.java   |   27 -
 .../org/apache/zest/library/restlet/Order.java  |   27 -
 .../zest/library/restlet/OrdersModule.java      |   41 -
 .../apache/zest/library/restlet/Product.java    |   27 -
 .../zest/library/restlet/TestApplication.java   |   70 -
 .../library/scripting/ScriptException.java      |   28 +
 .../library/scripting/ScriptReloadable.java     |   25 +
 .../polygene/library/scripting/ScriptUtil.java  |   32 +
 .../library/scripting/ScriptUtilImpl.java       |   35 +
 .../polygene/library/scripting/package.html     |   24 +
 .../zest/library/scripting/ScriptException.java |   28 -
 .../library/scripting/ScriptReloadable.java     |   25 -
 .../zest/library/scripting/ScriptUtil.java      |   32 -
 .../zest/library/scripting/ScriptUtilImpl.java  |   35 -
 .../apache/zest/library/scripting/package.html  |   24 -
 .../library/scripting/ScriptUtilImplTest.java   |   41 +
 .../library/scripting/ScriptUtilImplTest.java   |   41 -
 libraries/servlet/src/docs/servlet.txt          |    2 +-
 .../polygene/library/servlet/ZestFilter.java    |   51 +
 .../polygene/library/servlet/ZestServlet.java   |   56 +
 .../library/servlet/ZestServletSupport.java     |   44 +
 .../lifecycle/AbstractZestServletBootstrap.java |  143 ++
 .../library/servlet/lifecycle/package.html      |   24 +
 .../polygene/library/servlet/package.html       |   50 +
 .../apache/zest/library/servlet/ZestFilter.java |   51 -
 .../zest/library/servlet/ZestServlet.java       |   56 -
 .../library/servlet/ZestServletSupport.java     |   44 -
 .../lifecycle/AbstractZestServletBootstrap.java |  143 --
 .../zest/library/servlet/lifecycle/package.html |   24 -
 .../apache/zest/library/servlet/package.html    |   50 -
 .../polygene/library/servlet/ServletTest.java   |  112 ++
 .../zest/library/servlet/ServletTest.java       |  112 --
 libraries/shiro-core/src/docs/shiro.txt         |    2 +-
 .../apache/polygene/library/shiro/Shiro.java    |   29 +
 .../shiro/assembly/PasswordDomainAssembler.java |   51 +
 .../assembly/PermissionsDomainAssembler.java    |   42 +
 .../assembly/StandaloneShiroAssembler.java      |   49 +
 .../library/shiro/assembly/package.html         |   24 +
 .../shiro/concerns/RequiresAuthentication.java  |   35 +
 .../library/shiro/concerns/RequiresGuest.java   |   35 +
 .../shiro/concerns/RequiresPermissions.java     |   42 +
 .../library/shiro/concerns/RequiresRoles.java   |   42 +
 .../library/shiro/concerns/RequiresUser.java    |   35 +
 .../library/shiro/concerns/SecurityConcern.java |  184 ++
 .../library/shiro/concerns/package.html         |   24 +
 .../domain/common/IdentifiableSubject.java      |   29 +
 .../library/shiro/domain/common/package.html    |   24 +
 .../passwords/PasswordRealmConfiguration.java   |   44 +
 .../domain/passwords/PasswordRealmMixin.java    |  189 ++
 .../domain/passwords/PasswordRealmService.java  |   34 +
 .../domain/passwords/PasswordSecurable.java     |   34 +
 .../library/shiro/domain/passwords/package.html |   24 +
 .../library/shiro/domain/permissions/Role.java  |   70 +
 .../shiro/domain/permissions/RoleAssignee.java  |   75 +
 .../domain/permissions/RoleAssignment.java      |   33 +
 .../shiro/domain/permissions/RoleFactory.java   |   65 +
 .../shiro/domain/permissions/package.html       |   24 +
 .../shiro/ini/IniSecurityManagerService.java    |  110 +
 .../shiro/ini/ShiroIniConfiguration.java        |   40 +
 .../polygene/library/shiro/ini/package.html     |   24 +
 .../apache/polygene/library/shiro/package.html  |   34 +
 .../org/apache/zest/library/shiro/Shiro.java    |   29 -
 .../shiro/assembly/PasswordDomainAssembler.java |   51 -
 .../assembly/PermissionsDomainAssembler.java    |   42 -
 .../assembly/StandaloneShiroAssembler.java      |   49 -
 .../zest/library/shiro/assembly/package.html    |   24 -
 .../shiro/concerns/RequiresAuthentication.java  |   35 -
 .../library/shiro/concerns/RequiresGuest.java   |   35 -
 .../shiro/concerns/RequiresPermissions.java     |   42 -
 .../library/shiro/concerns/RequiresRoles.java   |   42 -
 .../library/shiro/concerns/RequiresUser.java    |   35 -
 .../library/shiro/concerns/SecurityConcern.java |  184 --
 .../zest/library/shiro/concerns/package.html    |   24 -
 .../domain/common/IdentifiableSubject.java      |   29 -
 .../library/shiro/domain/common/package.html    |   24 -
 .../passwords/PasswordRealmConfiguration.java   |   44 -
 .../domain/passwords/PasswordRealmMixin.java    |  189 --
 .../domain/passwords/PasswordRealmService.java  |   34 -
 .../domain/passwords/PasswordSecurable.java     |   34 -
 .../library/shiro/domain/passwords/package.html |   24 -
 .../library/shiro/domain/permissions/Role.java  |   70 -
 .../shiro/domain/permissions/RoleAssignee.java  |   75 -
 .../domain/permissions/RoleAssignment.java      |   33 -
 .../shiro/domain/permissions/RoleFactory.java   |   65 -
 .../shiro/domain/permissions/package.html       |   24 -
 .../shiro/ini/IniSecurityManagerService.java    |  110 -
 .../shiro/ini/ShiroIniConfiguration.java        |   40 -
 .../apache/zest/library/shiro/ini/package.html  |   24 -
 .../org/apache/zest/library/shiro/package.html  |   34 -
 .../library/shiro/PasswordDomainTest.java       |  148 ++
 .../library/shiro/PermissionsDomainTest.java    |  174 ++
 .../library/shiro/RealmServiceTest.java         |  119 ++
 .../library/shiro/StandaloneShiroTest.java      |  171 ++
 .../zest/library/shiro/PasswordDomainTest.java  |  148 --
 .../library/shiro/PermissionsDomainTest.java    |  174 --
 .../zest/library/shiro/RealmServiceTest.java    |  119 --
 .../zest/library/shiro/StandaloneShiroTest.java |  171 --
 .../src/test/resources/logback-test.xml         |    2 +-
 .../shiro/web/EnvironmentLoaderService.java     |   93 +
 .../library/shiro/web/ShiroFilterService.java   |   31 +
 .../shiro/web/assembly/HttpShiroAssembler.java  |   61 +
 .../library/shiro/web/assembly/package.html     |   24 +
 .../polygene/library/shiro/web/package.html     |   34 +
 .../shiro/web/EnvironmentLoaderService.java     |   93 -
 .../library/shiro/web/ShiroFilterService.java   |   31 -
 .../shiro/web/assembly/HttpShiroAssembler.java  |   61 -
 .../library/shiro/web/assembly/package.html     |   24 -
 .../apache/zest/library/shiro/web/package.html  |   34 -
 .../library/shiro/web/WebHttpShiroTest.java     |   68 +
 .../library/shiro/web/WebRealmServiceTest.java  |  221 ++
 .../library/shiro/web/WebServletShiroTest.java  |   63 +
 .../library/shiro/web/WebHttpShiroTest.java     |   68 -
 .../library/shiro/web/WebRealmServiceTest.java  |  221 --
 .../library/shiro/web/WebServletShiroTest.java  |   63 -
 .../src/test/resources/logback-test.xml         |    2 +-
 libraries/spring/src/docs/spring.txt            |    2 +-
 .../library/spring/bootstrap/Constants.java     |   29 +
 .../bootstrap/ZestApplicationBootstrap.java     |   88 +
 .../internal/ZestNamespaceHandler.java          |   34 +
 .../application/ZestApplicationFactoryBean.java |  119 ++
 .../ZestBootstrapBeanDefinitionParser.java      |  103 +
 .../bootstrap/internal/application/package.html |   24 +
 .../spring/bootstrap/internal/package.html      |   24 +
 .../internal/service/ServiceFactoryBean.java    |   67 +
 .../internal/service/ServiceLocator.java        |  124 ++
 .../ZestServiceBeanDefinitionParser.java        |   55 +
 .../bootstrap/internal/service/package.html     |   24 +
 .../library/spring/bootstrap/package.html       |   24 +
 .../library/spring/importer/SpringImporter.java |   63 +
 .../importer/SpringImporterAssembler.java       |   79 +
 .../library/spring/importer/package.html        |   24 +
 .../apache/polygene/library/spring/package.html |   24 +
 .../library/spring/bootstrap/Constants.java     |   29 -
 .../bootstrap/ZestApplicationBootstrap.java     |   88 -
 .../internal/ZestNamespaceHandler.java          |   34 -
 .../application/ZestApplicationFactoryBean.java |  119 --
 .../ZestBootstrapBeanDefinitionParser.java      |  103 -
 .../bootstrap/internal/application/package.html |   24 -
 .../spring/bootstrap/internal/package.html      |   24 -
 .../internal/service/ServiceFactoryBean.java    |   67 -
 .../internal/service/ServiceLocator.java        |  124 --
 .../ZestServiceBeanDefinitionParser.java        |   55 -
 .../bootstrap/internal/service/package.html     |   24 -
 .../zest/library/spring/bootstrap/package.html  |   24 -
 .../library/spring/importer/SpringImporter.java |   63 -
 .../importer/SpringImporterAssembler.java       |   79 -
 .../zest/library/spring/importer/package.html   |   24 -
 .../org/apache/zest/library/spring/package.html |   24 -
 .../src/main/resources/META-INF/spring.handlers |    2 +-
 .../polygene/library/spring/spring-0.5.xsd      |   64 +
 .../apache/zest/library/spring/spring-0.5.xsd   |   64 -
 .../library/spring/MyZestBootstrapper.java      |   50 +
 .../spring/bootstrap/CommentService.java        |   25 +
 .../bootstrap/CommentServiceComposite.java      |   53 +
 .../spring/bootstrap/CommentServiceHolder.java  |   35 +
 .../spring/bootstrap/TextProcessingService.java |   25 +
 .../spring/bootstrap/ToUppercaseService.java    |   31 +
 .../spring/bootstrap/ZestExportServiceTest.java |   59 +
 .../spring/bootstrap/ZestTestBootstrap.java     |   58 +
 .../library/spring/importer/CommentService.java |   25 +
 .../spring/importer/CommentServiceBean.java     |   36 +
 .../spring/importer/CommentServiceBean2.java    |   36 +
 .../spring/importer/ZestImportServiceTest.java  |  118 ++
 .../zest/library/spring/MyZestBootstrapper.java |   50 -
 .../spring/bootstrap/CommentService.java        |   25 -
 .../bootstrap/CommentServiceComposite.java      |   53 -
 .../spring/bootstrap/CommentServiceHolder.java  |   35 -
 .../spring/bootstrap/TextProcessingService.java |   25 -
 .../spring/bootstrap/ToUppercaseService.java    |   31 -
 .../spring/bootstrap/ZestExportServiceTest.java |   59 -
 .../spring/bootstrap/ZestTestBootstrap.java     |   58 -
 .../library/spring/importer/CommentService.java |   25 -
 .../spring/importer/CommentServiceBean.java     |   36 -
 .../spring/importer/CommentServiceBean2.java    |   36 -
 .../spring/importer/ZestImportServiceTest.java  |  118 --
 .../bootstrap/ZestExportServiceTest-context.xml |   36 +
 .../importer/ZestImportServiceTest-context.xml  |   28 +
 .../bootstrap/ZestExportServiceTest-context.xml |   36 -
 .../importer/ZestImportServiceTest-context.xml  |   28 -
 .../BoneCPDataSourceServiceAssembler.java       |   39 +
 .../bonecp/BoneCPDataSourceServiceImporter.java |   99 +
 .../polygene/library/sql/bonecp/package.html    |   24 +
 .../BoneCPDataSourceServiceAssembler.java       |   39 -
 .../bonecp/BoneCPDataSourceServiceImporter.java |   99 -
 .../apache/zest/library/sql/bonecp/package.html |   24 -
 .../dbcp/DBCPDataSourceServiceAssembler.java    |   39 +
 .../sql/dbcp/DBCPDataSourceServiceImporter.java |   85 +
 .../polygene/library/sql/dbcp/package.html      |   24 +
 .../dbcp/DBCPDataSourceServiceAssembler.java    |   39 -
 .../sql/dbcp/DBCPDataSourceServiceImporter.java |   85 -
 .../apache/zest/library/sql/dbcp/package.html   |   24 -
 .../sql/liquibase/LiquibaseAssembler.java       |   46 +
 .../sql/liquibase/LiquibaseConfiguration.java   |   37 +
 .../library/sql/liquibase/LiquibaseService.java |  126 ++
 .../polygene/library/sql/liquibase/package.html |   24 +
 .../sql/liquibase/LiquibaseAssembler.java       |   46 -
 .../sql/liquibase/LiquibaseConfiguration.java   |   37 -
 .../library/sql/liquibase/LiquibaseService.java |  126 --
 .../zest/library/sql/liquibase/package.html     |   24 -
 .../sql/liquibase/LiquibaseServiceTest.java     |  178 ++
 .../sql/liquibase/LiquibaseServiceTest.java     |  178 --
 ...bstractPooledDataSourceServiceAssembler.java |   46 +
 .../sql/assembly/DataSourceAssembler.java       |   83 +
 .../sql/assembly/DataSourceJMXAssembler.java    |   36 +
 .../assembly/ExternalDataSourceAssembler.java   |   77 +
 .../polygene/library/sql/assembly/package.html  |   24 +
 .../polygene/library/sql/common/Databases.java  |  158 ++
 .../library/sql/common/SQLConfiguration.java    |   40 +
 .../polygene/library/sql/common/SQLUtil.java    |  135 ++
 .../polygene/library/sql/common/package.html    |   24 +
 .../AbstractDataSourceServiceImporterMixin.java |  192 ++
 .../sql/datasource/DataSourceConfiguration.java |   31 +
 .../DataSourceConfigurationState.java           |   45 +
 .../DataSourceServiceImporterActivation.java    |   44 +
 .../library/sql/datasource/DataSources.java     |   95 +
 .../library/sql/datasource/package.html         |   24 +
 .../DataSourceConfigurationManagerService.java  |  302 +++
 .../polygene/library/sql/jmx/package.html       |   24 +
 ...bstractPooledDataSourceServiceAssembler.java |   46 -
 .../sql/assembly/DataSourceAssembler.java       |   83 -
 .../sql/assembly/DataSourceJMXAssembler.java    |   36 -
 .../assembly/ExternalDataSourceAssembler.java   |   77 -
 .../zest/library/sql/assembly/package.html      |   24 -
 .../zest/library/sql/common/Databases.java      |  158 --
 .../library/sql/common/SQLConfiguration.java    |   40 -
 .../apache/zest/library/sql/common/SQLUtil.java |  135 --
 .../apache/zest/library/sql/common/package.html |   24 -
 .../AbstractDataSourceServiceImporterMixin.java |  193 --
 .../sql/datasource/DataSourceConfiguration.java |   31 -
 .../DataSourceConfigurationState.java           |   45 -
 .../DataSourceServiceImporterActivation.java    |   44 -
 .../library/sql/datasource/DataSources.java     |   95 -
 .../zest/library/sql/datasource/package.html    |   24 -
 .../DataSourceConfigurationManagerService.java  |  302 ---
 .../apache/zest/library/sql/jmx/package.html    |   24 -
 .../library/sql/DocumentationSupport.java       |  118 ++
 .../sql/datasource/ExternalDataSourceTest.java  |   67 +
 ...taSourceConfigurationManagerServiceTest.java |  132 ++
 .../zest/library/sql/DocumentationSupport.java  |  118 --
 .../sql/datasource/ExternalDataSourceTest.java  |   67 -
 ...taSourceConfigurationManagerServiceTest.java |  132 --
 .../uid/sequence/PersistedSequencingMixin.java  |   81 +
 .../sequence/PersistingSequencingService.java   |   28 +
 .../polygene/library/uid/sequence/Sequence.java |   33 +
 .../library/uid/sequence/SequenceEntity.java    |   26 +
 .../library/uid/sequence/Sequencing.java        |   35 +
 .../uid/sequence/SequencingException.java       |   37 +
 .../uid/sequence/TransientSequencingMixin.java  |   45 +
 .../sequence/TransientSequencingService.java    |   28 +
 .../assembly/PersistingSequencingAssembler.java |   39 +
 .../assembly/TransientSequencingAssembler.java  |   36 +
 .../library/uid/sequence/assembly/package.html  |   24 +
 .../polygene/library/uid/sequence/package.html  |   24 +
 .../library/uid/uuid/UuidGenerationMixin.java   |   69 +
 .../polygene/library/uid/uuid/UuidService.java  |   25 +
 .../library/uid/uuid/UuidServiceComposite.java  |   28 +
 .../uid/uuid/assembly/UuidServiceAssembler.java |   36 +
 .../library/uid/uuid/assembly/package.html      |   24 +
 .../polygene/library/uid/uuid/package.html      |   24 +
 .../uid/sequence/PersistedSequencingMixin.java  |   81 -
 .../sequence/PersistingSequencingService.java   |   28 -
 .../zest/library/uid/sequence/Sequence.java     |   33 -
 .../library/uid/sequence/SequenceEntity.java    |   26 -
 .../zest/library/uid/sequence/Sequencing.java   |   35 -
 .../uid/sequence/SequencingException.java       |   37 -
 .../uid/sequence/TransientSequencingMixin.java  |   45 -
 .../sequence/TransientSequencingService.java    |   28 -
 .../assembly/PersistingSequencingAssembler.java |   39 -
 .../assembly/TransientSequencingAssembler.java  |   36 -
 .../library/uid/sequence/assembly/package.html  |   24 -
 .../zest/library/uid/sequence/package.html      |   24 -
 .../library/uid/uuid/UuidGenerationMixin.java   |   69 -
 .../zest/library/uid/uuid/UuidService.java      |   25 -
 .../library/uid/uuid/UuidServiceComposite.java  |   28 -
 .../uid/uuid/assembly/UuidServiceAssembler.java |   36 -
 .../zest/library/uid/uuid/assembly/package.html |   24 -
 .../apache/zest/library/uid/uuid/package.html   |   24 -
 .../library/uid/DocumentationSupport.java       |  104 +
 .../uid/sequence/PersistingSequencingTest.java  |  102 +
 .../uid/sequence/TransientSequencingTest.java   |  100 +
 .../library/uid/uuid/UuidServiceTest.java       |  101 +
 .../zest/library/uid/DocumentationSupport.java  |  104 -
 .../uid/sequence/PersistingSequencingTest.java  |  102 -
 .../uid/sequence/TransientSequencingTest.java   |  100 -
 .../zest/library/uid/uuid/UuidServiceTest.java  |  101 -
 libraries/uowfile/src/docs/uowfile.txt          |    2 +-
 .../uowfile/bootstrap/UoWFileAssembler.java     |   48 +
 .../library/uowfile/bootstrap/package.html      |   24 +
 .../ConcurrentUoWFileModificationException.java |   49 +
 ...urrentUoWFileStateModificationException.java |   42 +
 .../library/uowfile/internal/UoWFile.java       |  168 ++
 .../uowfile/internal/UoWFileException.java      |   36 +
 .../uowfile/internal/UoWFileFactory.java        |  186 ++
 .../library/uowfile/internal/package.html       |   24 +
 .../library/uowfile/plural/HasUoWFiles.java     |   90 +
 .../uowfile/plural/HasUoWFilesLifecycle.java    |   69 +
 .../library/uowfile/plural/UoWFilesLocator.java |   29 +
 .../library/uowfile/plural/package.html         |   24 +
 .../library/uowfile/singular/HasUoWFile.java    |   66 +
 .../uowfile/singular/HasUoWFileLifecycle.java   |   57 +
 .../uowfile/singular/UoWFileLocator.java        |   27 +
 .../library/uowfile/singular/package.html       |   24 +
 .../uowfile/bootstrap/UoWFileAssembler.java     |   48 -
 .../zest/library/uowfile/bootstrap/package.html |   24 -
 .../ConcurrentUoWFileModificationException.java |   49 -
 ...urrentUoWFileStateModificationException.java |   42 -
 .../zest/library/uowfile/internal/UoWFile.java  |  168 --
 .../uowfile/internal/UoWFileException.java      |   36 -
 .../uowfile/internal/UoWFileFactory.java        |  186 --
 .../zest/library/uowfile/internal/package.html  |   24 -
 .../library/uowfile/plural/HasUoWFiles.java     |   90 -
 .../uowfile/plural/HasUoWFilesLifecycle.java    |   69 -
 .../library/uowfile/plural/UoWFilesLocator.java |   29 -
 .../zest/library/uowfile/plural/package.html    |   24 -
 .../library/uowfile/singular/HasUoWFile.java    |   66 -
 .../uowfile/singular/HasUoWFileLifecycle.java   |   57 -
 .../uowfile/singular/UoWFileLocator.java        |   27 -
 .../zest/library/uowfile/singular/package.html  |   24 -
 .../library/uowfile/HasUoWFileTest.java         |  433 ++++
 .../library/uowfile/HasUoWFilesTest.java        |  451 +++++
 .../zest/library/uowfile/HasUoWFileTest.java    |  433 ----
 .../zest/library/uowfile/HasUoWFilesTest.java   |  451 -----
 .../polygene/library/uowfile/creation.txt       |    1 +
 .../polygene/library/uowfile/modification.txt   |    1 +
 .../apache/zest/library/uowfile/creation.txt    |    1 -
 .../zest/library/uowfile/modification.txt       |    1 -
 manual/build.gradle                             |    2 +-
 .../src/docs/tutorials/howto-build-system.txt   |    2 +-
 .../src/docs/tutorials/howto-depend-on-zest.txt |   36 +-
 .../src/docs/tutorials/howto-writing-docs.txt   |    8 +-
 .../polygene/manual/recipes/assemble/Docs.java  |   55 +
 .../polygene/manual/recipes/assemble/Main.java  |  174 ++
 .../manual/recipes/concern/AnyMixinType.java    |   39 +
 .../recipes/concern/InventoryConcern.java       |   34 +
 .../manual/recipes/concern/LineItem.java        |   25 +
 .../manual/recipes/concern/MyAnnotation.java    |   24 +
 .../recipes/concern/MyAppliesToFilter.java      |   41 +
 .../recipes/concern/MyGenericConcern.java       |   43 +
 .../polygene/manual/recipes/concern/Order.java  |   34 +
 .../recipes/contextualFragments/TraceAll.java   |   42 +
 .../manual/recipes/createConstraint/Dialer.java |   28 +
 .../createConstraint/DialerComposite.java       |   30 +
 .../createConstraint/HasPhoneNumber.java        |   30 +
 .../ParameterViolationConcern.java              |   59 +
 .../recipes/createConstraint/PhoneNumber.java   |   36 +
 .../createConstraint/PhoneNumberConstraint.java |   34 +
 .../PhoneNumberParameterViolationConcern.java   |   60 +
 .../manual/recipes/createEntity/Accident.java   |   33 +
 .../recipes/createEntity/AccidentValue.java     |   28 +
 .../manual/recipes/createEntity/Car.java        |   39 +
 .../manual/recipes/createEntity/CarEntity.java  |   28 +
 .../recipes/createEntity/CarEntityFactory.java  |   28 +
 .../createEntity/CarEntityFactoryMixin.java     |   57 +
 .../createEntity/CarEntityFactoryService.java   |   30 +
 .../manual/recipes/createEntity/Main.java       |   45 +
 .../recipes/createEntity/Manufacturer.java      |   35 +
 .../createEntity/ManufacturerEntity.java        |   28 +
 .../createEntity/ManufacturerRepository.java    |   31 +
 .../ManufacturerRepositoryMixin.java            |   63 +
 .../ManufacturerRepositoryService.java          |   30 +
 .../recipes/createEntity/MyAssembler.java       |   46 +
 .../manual/recipes/properties/Book.java         |   34 +
 .../manual/recipes/properties/BookFactory.java  |   46 +
 .../manual/recipes/properties/SwingInfo.java    |   33 +
 .../manual/recipes/properties/SwingPanel.java   |   49 +
 .../manual/recipes/properties/pojo/Book.java    |   28 +
 .../recipes/properties/pojo/MutableBook.java    |   29 +
 .../recipes/sideeffects/AnyMixinType.java       |   39 +
 .../manual/recipes/sideeffects/Confirmable.java |   24 +
 .../manual/recipes/sideeffects/HasCustomer.java |   24 +
 .../recipes/sideeffects/HasLineItems.java       |   24 +
 .../recipes/sideeffects/HasSequenceNumber.java  |   24 +
 .../sideeffects/MailNotifySideEffect.java       |   27 +
 .../recipes/sideeffects/MyAnnotation.java       |   24 +
 .../recipes/sideeffects/MyAppliesToFilter.java  |   41 +
 .../sideeffects/MyGenericSideEffect.java        |   52 +
 .../manual/recipes/sideeffects/Order.java       |   24 +
 .../manual/recipes/sideeffects/OrderEntity.java |   32 +
 .../manual/travel/ExpediaService.properties     |   30 +
 .../org/apache/polygene/manual/travel/Main.java |   63 +
 .../manual/travel/OrbitzService.properties      |   30 +
 .../polygene/manual/travel/TravelPlan.java      |   27 +
 .../manual/travel/TravelPlanConfiguration.java  |   37 +
 .../polygene/manual/travel/TravelPlanMixin.java |   52 +
 .../manual/travel/TravelPlanService.java        |   32 +
 .../manual/travel/TravelPlanService.properties  |   31 +
 .../zest/manual/recipes/assemble/Docs.java      |   56 -
 .../zest/manual/recipes/assemble/Main.java      |  174 --
 .../manual/recipes/concern/AnyMixinType.java    |   39 -
 .../recipes/concern/InventoryConcern.java       |   34 -
 .../zest/manual/recipes/concern/LineItem.java   |   25 -
 .../manual/recipes/concern/MyAnnotation.java    |   24 -
 .../recipes/concern/MyAppliesToFilter.java      |   41 -
 .../recipes/concern/MyGenericConcern.java       |   43 -
 .../zest/manual/recipes/concern/Order.java      |   34 -
 .../recipes/contextualFragments/TraceAll.java   |   42 -
 .../manual/recipes/createConstraint/Dialer.java |   28 -
 .../createConstraint/DialerComposite.java       |   30 -
 .../createConstraint/HasPhoneNumber.java        |   30 -
 .../ParameterViolationConcern.java              |   59 -
 .../recipes/createConstraint/PhoneNumber.java   |   36 -
 .../createConstraint/PhoneNumberConstraint.java |   34 -
 .../PhoneNumberParameterViolationConcern.java   |   60 -
 .../manual/recipes/createEntity/Accident.java   |   33 -
 .../recipes/createEntity/AccidentValue.java     |   28 -
 .../zest/manual/recipes/createEntity/Car.java   |   39 -
 .../manual/recipes/createEntity/CarEntity.java  |   28 -
 .../recipes/createEntity/CarEntityFactory.java  |   28 -
 .../createEntity/CarEntityFactoryMixin.java     |   57 -
 .../createEntity/CarEntityFactoryService.java   |   30 -
 .../zest/manual/recipes/createEntity/Main.java  |   45 -
 .../recipes/createEntity/Manufacturer.java      |   35 -
 .../createEntity/ManufacturerEntity.java        |   28 -
 .../createEntity/ManufacturerRepository.java    |   31 -
 .../ManufacturerRepositoryMixin.java            |   63 -
 .../ManufacturerRepositoryService.java          |   30 -
 .../recipes/createEntity/MyAssembler.java       |   46 -
 .../zest/manual/recipes/properties/Book.java    |   34 -
 .../manual/recipes/properties/BookFactory.java  |   46 -
 .../manual/recipes/properties/SwingInfo.java    |   33 -
 .../manual/recipes/properties/SwingPanel.java   |   49 -
 .../manual/recipes/properties/pojo/Book.java    |   28 -
 .../recipes/properties/pojo/MutableBook.java    |   29 -
 .../recipes/sideeffects/AnyMixinType.java       |   39 -
 .../manual/recipes/sideeffects/Confirmable.java |   24 -
 .../manual/recipes/sideeffects/HasCustomer.java |   24 -
 .../recipes/sideeffects/HasLineItems.java       |   24 -
 .../recipes/sideeffects/HasSequenceNumber.java  |   24 -
 .../sideeffects/MailNotifySideEffect.java       |   27 -
 .../recipes/sideeffects/MyAnnotation.java       |   24 -
 .../recipes/sideeffects/MyAppliesToFilter.java  |   41 -
 .../sideeffects/MyGenericSideEffect.java        |   52 -
 .../zest/manual/recipes/sideeffects/Order.java  |   24 -
 .../manual/recipes/sideeffects/OrderEntity.java |   32 -
 .../manual/travel/ExpediaService.properties     |   30 -
 .../org/apache/zest/manual/travel/Main.java     |   63 -
 .../zest/manual/travel/OrbitzService.properties |   30 -
 .../apache/zest/manual/travel/TravelPlan.java   |   27 -
 .../manual/travel/TravelPlanConfiguration.java  |   37 -
 .../zest/manual/travel/TravelPlanMixin.java     |   52 -
 .../zest/manual/travel/TravelPlanService.java   |   32 -
 .../manual/travel/TravelPlanService.properties  |   31 -
 .../moneytransfer/context/PayBillsContext.java  |  153 ++
 .../moneytransfer/context/PayBillsContext2.java |  145 ++
 .../dci/moneytransfer/context/Role.java         |   76 +
 .../context/TransferMoneyContext.java           |  119 ++
 .../context/TransferMoneyContext2.java          |   95 +
 .../moneytransfer/domain/data/BalanceData.java  |   67 +
 .../domain/entity/CheckingAccountEntity.java    |   34 +
 .../domain/entity/CreditorEntity.java           |   34 +
 .../domain/entity/SavingsAccountEntity.java     |   34 +
 .../rolemap/CheckingAccountRolemap.java         |   38 +
 .../moneytransfer/rolemap/CreditorRolemap.java  |   34 +
 .../rolemap/SavingsAccountRolemap.java          |   34 +
 .../moneytransfer/context/PayBillsContext.java  |  153 --
 .../moneytransfer/context/PayBillsContext2.java |  145 --
 .../zest/dci/moneytransfer/context/Role.java    |   76 -
 .../context/TransferMoneyContext.java           |  119 --
 .../context/TransferMoneyContext2.java          |   95 -
 .../moneytransfer/domain/data/BalanceData.java  |   67 -
 .../domain/entity/CheckingAccountEntity.java    |   34 -
 .../domain/entity/CreditorEntity.java           |   34 -
 .../domain/entity/SavingsAccountEntity.java     |   34 -
 .../rolemap/CheckingAccountRolemap.java         |   38 -
 .../moneytransfer/rolemap/CreditorRolemap.java  |   34 -
 .../rolemap/SavingsAccountRolemap.java          |   34 -
 .../dci/moneytransfer/test/AccountIds.java      |   32 +
 .../moneytransfer/test/TransferMoneyTest.java   |  211 ++
 .../moneytransfer/test/TransferMoneyTest2.java  |  215 ++
 .../zest/dci/moneytransfer/test/AccountIds.java |   32 -
 .../moneytransfer/test/TransferMoneyTest.java   |  211 --
 .../moneytransfer/test/TransferMoneyTest2.java  |  215 --
 samples/forum/build.gradle                      |    4 +-
 .../sample/forum/assembler/ForumAssembler.java  |  177 ++
 .../polygene/sample/forum/context/Context.java  |   44 +
 .../polygene/sample/forum/context/Events.java   |   30 +
 .../sample/forum/context/EventsService.java     |  120 ++
 .../forum/context/account/UpdateProfile.java    |   67 +
 .../administration/BoardAdministration.java     |   70 +
 .../administration/ForumAdministration.java     |   92 +
 .../administration/ForumsAdministration.java    |   87 +
 .../administration/ModeratorAdministration.java |   76 +
 .../ModeratorsAdministration.java               |   84 +
 .../administration/UsersAdministration.java     |   56 +
 .../sample/forum/context/login/Login.java       |   56 +
 .../context/moderation/ModerationContext.java   |   28 +
 .../forum/context/signup/Registration.java      |   38 +
 .../sample/forum/context/signup/Signup.java     |   54 +
 .../sample/forum/context/view/ViewBoard.java    |  128 ++
 .../sample/forum/context/view/ViewForum.java    |   62 +
 .../sample/forum/context/view/ViewPost.java     |   91 +
 .../sample/forum/context/view/ViewTopic.java    |   50 +
 .../sample/forum/data/Administrators.java       |   31 +
 .../polygene/sample/forum/data/Moderators.java  |   31 +
 .../sample/forum/data/entity/Board.java         |   50 +
 .../sample/forum/data/entity/Forum.java         |   43 +
 .../sample/forum/data/entity/Forums.java        |   61 +
 .../polygene/sample/forum/data/entity/Post.java |   54 +
 .../sample/forum/data/entity/Topic.java         |   52 +
 .../polygene/sample/forum/data/entity/User.java |   81 +
 .../sample/forum/data/entity/Users.java         |   87 +
 .../forum/domainevent/DomainCommandResult.java  |   36 +
 .../sample/forum/domainevent/DomainEvent.java   |  112 ++
 .../forum/domainevent/DomainEventValue.java     |   53 +
 .../forum/domainevent/ParameterValue.java       |   34 +
 .../sample/forum/rest/ForumRestlet.java         |   39 +
 .../forum/rest/resource/RootResource.java       |   82 +
 .../administration/AdministrationResource.java  |   46 +
 .../resource/administration/ForumsResource.java |   30 +
 .../resource/administration/UsersResource.java  |   41 +
 .../rest/resource/forum/BoardResource.java      |   43 +
 .../rest/resource/forum/ForumResource.java      |   43 +
 .../rest/resource/forum/ForumsResource.java     |   42 +
 .../rest/resource/login/LoginResource.java      |   42 +
 .../rest/resource/signup/SignupResource.java    |   47 +
 .../sample/forum/service/BootstrapData.java     |   89 +
 .../sample/forum/assembler/ForumAssembler.java  |  177 --
 .../zest/sample/forum/context/Context.java      |   44 -
 .../zest/sample/forum/context/Events.java       |   30 -
 .../sample/forum/context/EventsService.java     |  120 --
 .../forum/context/account/UpdateProfile.java    |   67 -
 .../administration/BoardAdministration.java     |   70 -
 .../administration/ForumAdministration.java     |   93 -
 .../administration/ForumsAdministration.java    |   87 -
 .../administration/ModeratorAdministration.java |   76 -
 .../ModeratorsAdministration.java               |   84 -
 .../administration/UsersAdministration.java     |   56 -
 .../zest/sample/forum/context/login/Login.java  |   58 -
 .../context/moderation/ModerationContext.java   |   28 -
 .../forum/context/signup/Registration.java      |   38 -
 .../sample/forum/context/signup/Signup.java     |   54 -
 .../sample/forum/context/view/ViewBoard.java    |  128 --
 .../sample/forum/context/view/ViewForum.java    |   62 -
 .../sample/forum/context/view/ViewPost.java     |   92 -
 .../sample/forum/context/view/ViewTopic.java    |   50 -
 .../zest/sample/forum/data/Administrators.java  |   31 -
 .../zest/sample/forum/data/Moderators.java      |   31 -
 .../zest/sample/forum/data/entity/Board.java    |   50 -
 .../zest/sample/forum/data/entity/Forum.java    |   43 -
 .../zest/sample/forum/data/entity/Forums.java   |   61 -
 .../zest/sample/forum/data/entity/Post.java     |   54 -
 .../zest/sample/forum/data/entity/Topic.java    |   52 -
 .../zest/sample/forum/data/entity/User.java     |   81 -
 .../zest/sample/forum/data/entity/Users.java    |   87 -
 .../forum/domainevent/DomainCommandResult.java  |   36 -
 .../sample/forum/domainevent/DomainEvent.java   |  112 --
 .../forum/domainevent/DomainEventValue.java     |   53 -
 .../forum/domainevent/ParameterValue.java       |   34 -
 .../zest/sample/forum/rest/ForumRestlet.java    |   39 -
 .../forum/rest/resource/RootResource.java       |   82 -
 .../administration/AdministrationResource.java  |   46 -
 .../resource/administration/ForumsResource.java |   30 -
 .../resource/administration/UsersResource.java  |   41 -
 .../rest/resource/forum/BoardResource.java      |   43 -
 .../rest/resource/forum/ForumResource.java      |   43 -
 .../rest/resource/forum/ForumsResource.java     |   42 -
 .../rest/resource/login/LoginResource.java      |   42 -
 .../rest/resource/signup/SignupResource.java    |   47 -
 .../sample/forum/service/BootstrapData.java     |   89 -
 .../apache/polygene/sample/forum/web/Main.java  |   61 +
 .../org/apache/zest/sample/forum/web/Main.java  |   61 -
 .../polygene/sample/rental/domain/Address.java  |   38 +
 .../polygene/sample/rental/domain/Booking.java  |   47 +
 .../polygene/sample/rental/domain/Car.java      |   65 +
 .../sample/rental/domain/CarCategory.java       |   30 +
 .../polygene/sample/rental/domain/Customer.java |   53 +
 .../polygene/sample/rental/domain/Period.java   |   33 +
 .../sample/rental/domain/RentalShop.java        |  252 +++
 .../sample/rental/domain/dev/InitialData.java   |  214 ++
 .../polygene/sample/rental/web/BookingPage.java |   89 +
 .../sample/rental/web/DataInitializer.java      |   27 +
 .../polygene/sample/rental/web/MainPage.java    |  111 ++
 .../apache/polygene/sample/rental/web/Page.java |  180 ++
 .../sample/rental/web/PageMetaInfo.java         |   49 +
 .../sample/rental/web/PageUowManagement.java    |   48 +
 .../sample/rental/web/QuikitContext.java        |   71 +
 .../sample/rental/web/QuikitResolver.java       |  128 ++
 .../sample/rental/web/QuikitServlet.java        |  339 ++++
 .../sample/rental/web/RenderException.java      |   42 +
 .../polygene/sample/rental/web/UrlService.java  |   55 +
 .../sample/rental/web/assembly/PagesModule.java |   45 +
 .../assembly/RentalApplicationAssembler.java    |   57 +
 .../rental/web/assembly/RentalModule.java       |   53 +
 .../rental/web/assembly/StorageModule.java      |   43 +
 .../zest/sample/rental/domain/Address.java      |   38 -
 .../zest/sample/rental/domain/Booking.java      |   47 -
 .../apache/zest/sample/rental/domain/Car.java   |   65 -
 .../zest/sample/rental/domain/CarCategory.java  |   30 -
 .../zest/sample/rental/domain/Customer.java     |   53 -
 .../zest/sample/rental/domain/Period.java       |   33 -
 .../zest/sample/rental/domain/RentalShop.java   |  252 ---
 .../sample/rental/domain/dev/InitialData.java   |  214 --
 .../zest/sample/rental/web/BookingPage.java     |   89 -
 .../zest/sample/rental/web/DataInitializer.java |   27 -
 .../apache/zest/sample/rental/web/MainPage.java |  111 --
 .../org/apache/zest/sample/rental/web/Page.java |  180 --
 .../zest/sample/rental/web/PageMetaInfo.java    |   49 -
 .../sample/rental/web/PageUowManagement.java    |   48 -
 .../zest/sample/rental/web/QuikitContext.java   |   71 -
 .../zest/sample/rental/web/QuikitResolver.java  |  128 --
 .../zest/sample/rental/web/QuikitServlet.java   |  339 ----
 .../zest/sample/rental/web/RenderException.java |   42 -
 .../zest/sample/rental/web/UrlService.java      |   55 -
 .../sample/rental/web/assembly/PagesModule.java |   45 -
 .../assembly/RentalApplicationAssembler.java    |   57 -
 .../rental/web/assembly/RentalModule.java       |   53 -
 .../rental/web/assembly/StorageModule.java      |   46 -
 .../apache/polygene/sample/rental/index.html    |   19 +
 .../polygene/sample/rental/web/BookingPage.html |   51 +
 .../polygene/sample/rental/web/MainPage.html    |   32 +
 .../org/apache/zest/sample/rental/index.html    |   19 -
 .../zest/sample/rental/web/BookingPage.html     |   51 -
 .../apache/zest/sample/rental/web/MainPage.html |   32 -
 samples/rental/src/main/webapp/WEB-INF/web.xml  |    4 +-
 samples/sql-support/build.gradle                |    4 +-
 .../sample/sqlsupport/AppAssembler.java         |  120 ++
 .../apache/polygene/sample/sqlsupport/Main.java |  168 ++
 .../sample/sqlsupport/PretextEntity.java        |   29 +
 .../zest/sample/sqlsupport/AppAssembler.java    |  120 --
 .../org/apache/zest/sample/sqlsupport/Main.java |  168 --
 .../zest/sample/sqlsupport/PretextEntity.java   |   29 -
 samples/swing/build.gradle                      |    4 +-
 .../polygene/sample/swing/binding/Binding.java  |   27 +
 .../swing/binding/IllegalBindingException.java  |   32 +
 .../sample/swing/binding/StateModel.java        |   76 +
 .../sample/swing/binding/SwingAdapter.java      |   73 +
 .../sample/swing/binding/SwingBinding.java      |   27 +
 .../swing/binding/SwingBindingAssembler.java    |   45 +
 .../StringToTextFieldAdapterService.java        |  142 ++
 .../sample/swing/binding/example/Address.java   |   28 +
 .../swing/binding/example/AddressTransient.java |   27 +
 .../binding/example/BoundPersonComposite.java   |   24 +
 .../sample/swing/binding/example/City.java      |   25 +
 .../sample/swing/binding/example/CityValue.java |   26 +
 .../sample/swing/binding/example/Country.java   |   24 +
 .../swing/binding/example/CountryValue.java     |   26 +
 .../sample/swing/binding/example/Form.java      |   98 +
 .../swing/binding/example/HasAddress.java       |   27 +
 .../sample/swing/binding/example/HasCity.java   |   27 +
 .../swing/binding/example/HasCountry.java       |   27 +
 .../sample/swing/binding/example/HasName.java   |   27 +
 .../sample/swing/binding/example/Main.java      |  144 ++
 .../sample/swing/binding/example/Person.java    |   28 +
 .../swing/binding/example/PersonComposite.java  |   27 +
 .../swing/binding/internal/AbstractBinding.java |  117 ++
 .../internal/AssociationFocusLostListener.java  |   59 +
 .../binding/internal/BoundAssociation.java      |   94 +
 .../binding/internal/BoundManyAssociation.java  |  110 +
 .../binding/internal/BoundNamedAssociation.java |  116 ++
 .../swing/binding/internal/BoundProperty.java   |   80 +
 .../internal/PropertyFocusLostListener.java     |   60 +
 .../internal/StateInvocationHandler.java        |  130 ++
 .../zest/sample/swing/binding/Binding.java      |   27 -
 .../swing/binding/IllegalBindingException.java  |   32 -
 .../zest/sample/swing/binding/StateModel.java   |   76 -
 .../zest/sample/swing/binding/SwingAdapter.java |   73 -
 .../zest/sample/swing/binding/SwingBinding.java |   27 -
 .../swing/binding/SwingBindingAssembler.java    |   45 -
 .../StringToTextFieldAdapterService.java        |  142 --
 .../sample/swing/binding/example/Address.java   |   28 -
 .../swing/binding/example/AddressTransient.java |   27 -
 .../binding/example/BoundPersonComposite.java   |   24 -
 .../zest/sample/swing/binding/example/City.java |   25 -
 .../sample/swing/binding/example/CityValue.java |   26 -
 .../sample/swing/binding/example/Country.java   |   24 -
 .../swing/binding/example/CountryValue.java     |   26 -
 .../zest/sample/swing/binding/example/Form.java |   98 -
 .../swing/binding/example/HasAddress.java       |   27 -
 .../sample/swing/binding/example/HasCity.java   |   27 -
 .../swing/binding/example/HasCountry.java       |   27 -
 .../sample/swing/binding/example/HasName.java   |   27 -
 .../zest/sample/swing/binding/example/Main.java |  144 --
 .../sample/swing/binding/example/Person.java    |   28 -
 .../swing/binding/example/PersonComposite.java  |   27 -
 .../swing/binding/internal/AbstractBinding.java |  117 --
 .../internal/AssociationFocusLostListener.java  |   59 -
 .../binding/internal/BoundAssociation.java      |   94 -
 .../binding/internal/BoundManyAssociation.java  |  110 -
 .../binding/internal/BoundNamedAssociation.java |  116 --
 .../swing/binding/internal/BoundProperty.java   |   80 -
 .../internal/PropertyFocusLostListener.java     |   60 -
 .../internal/StateInvocationHandler.java        |  130 --
 settings.gradle                                 |    6 +-
 tests/performance/build.gradle                  |    2 +-
 .../AbstractEntityStorePerformanceTest.java     |  368 ++++
 .../performance/entitystore/ComplexProduct.java |   38 +
 .../test/performance/entitystore/Money.java     |   67 +
 .../test/performance/entitystore/Report.java    |  102 +
 .../performance/entitystore/ReportTypes.java    |   44 +
 .../performance/entitystore/SimpleProduct.java  |   31 +
 .../test/performance/entitystore/package.html   |   24 +
 .../AbstractEntityStorePerformanceTest.java     |  368 ----
 .../performance/entitystore/ComplexProduct.java |   38 -
 .../test/performance/entitystore/Money.java     |   67 -
 .../test/performance/entitystore/Report.java    |  102 -
 .../performance/entitystore/ReportTypes.java    |   44 -
 .../performance/entitystore/SimpleProduct.java  |   31 -
 .../test/performance/entitystore/package.html   |   24 -
 .../jdbm/JdbmEntityStorePerformanceTest.java    |   24 +-
 .../MemoryEntityStorePerformanceTest.java       |   20 +-
 .../sql/DerbySQLEntityStorePerformanceTest.java |   32 +-
 .../PostgreSQLEntityStorePerformanceTest.java   |   38 +-
 .../indexing/rdf/QueryPerformanceTest.java      |   98 +-
 .../CompositeCreationPerformanceTest.java       |   20 +-
 .../composite/InvocationPerformanceTest.java    |   18 +-
 .../PropertyMixinInvocationPerformanceTest.java |   20 +-
 .../object/ObjectCreationPerformanceTest.java   |   12 +-
 .../ServiceInvocationPerformanceTest.java       |   14 +-
 .../README-for-regression-reporting.txt         |    2 +-
 .../polygene/test/regression/Regressions.java   |   30 +
 .../niclas2/ConcernsOnPropertyTest.java         |  115 ++
 .../zest/test/regression/Regressions.java       |   30 -
 .../niclas2/ConcernsOnPropertyTest.java         |  115 --
 tools/envisage/build.gradle                     |    6 +-
 .../org/apache/polygene/envisage/Envisage.java  |  149 ++
 .../apache/polygene/envisage/EnvisageFrame.form |   27 +
 .../apache/polygene/envisage/EnvisageFrame.java |  248 +++
 .../java/org/apache/polygene/envisage/Main.java |   47 +
 .../polygene/envisage/detail/APIPane.form       |   41 +
 .../polygene/envisage/detail/APIPane.java       |  297 +++
 .../envisage/detail/DependencyPane.form         |  212 ++
 .../envisage/detail/DependencyPane.java         |  477 +++++
 .../envisage/detail/DetailModelPane.java        |  232 +++
 .../polygene/envisage/detail/DetailPane.java    |   43 +
 .../polygene/envisage/detail/GeneralPane.form   |   39 +
 .../polygene/envisage/detail/GeneralPane.java   |  235 +++
 .../envisage/detail/ImportedByPane.form         |   88 +
 .../envisage/detail/ImportedByPane.java         |  186 ++
 .../polygene/envisage/detail/MethodPane.form    |   61 +
 .../polygene/envisage/detail/MethodPane.java    |  358 ++++
 .../polygene/envisage/detail/SPIPane.form       |   39 +
 .../polygene/envisage/detail/SPIPane.java       |  296 +++
 .../detail/ServiceConfigurationPane.form        |  127 ++
 .../detail/ServiceConfigurationPane.java        |  354 ++++
 .../envisage/detail/ServiceUsagePane.form       |   39 +
 .../envisage/detail/ServiceUsagePane.java       |  338 ++++
 .../polygene/envisage/detail/StatePane.form     |   61 +
 .../polygene/envisage/detail/StatePane.java     |  380 ++++
 .../polygene/envisage/detail/package.html       |   24 +
 .../polygene/envisage/event/LinkEvent.java      |   44 +
 .../polygene/envisage/event/LinkListener.java   |   29 +
 .../apache/polygene/envisage/event/package.html |   24 +
 .../polygene/envisage/graph/GraphBuilder.java   |  273 +++
 .../polygene/envisage/graph/GraphDisplay.java   |   85 +
 .../polygene/envisage/graph/GraphPane.java      |  167 ++
 .../envisage/graph/StackedGraphDisplay.java     |  584 ++++++
 .../polygene/envisage/graph/StackedLayout.java  |  224 +++
 .../envisage/graph/TreeGraphDisplay.java        |  391 ++++
 .../apache/polygene/envisage/graph/package.html |   24 +
 .../org/apache/polygene/envisage/package.html   |   24 +
 .../polygene/envisage/print/PDFWriter.java      |  827 ++++++++
 .../envisage/print/PrintingException.java       |   30 +
 .../apache/polygene/envisage/print/package.html |   24 +
 .../envisage/tree/StructureModelBuilder.java    |  155 ++
 .../envisage/tree/TreeModelCellRenderer.java    |  156 ++
 .../polygene/envisage/tree/TreeModelPane.java   |  304 +++
 .../envisage/tree/TypeModelBuilder.java         |  155 ++
 .../apache/polygene/envisage/tree/package.html  |   24 +
 .../polygene/envisage/util/ColorUtilities.java  |   61 +
 .../apache/polygene/envisage/util/TableRow.java |   71 +
 .../envisage/util/TableRowUtilities.java        |   64 +
 .../apache/polygene/envisage/util/package.html  |   24 +
 .../java/org/apache/zest/envisage/Envisage.java |  149 --
 .../org/apache/zest/envisage/EnvisageFrame.form |   27 -
 .../org/apache/zest/envisage/EnvisageFrame.java |  248 ---
 .../java/org/apache/zest/envisage/Main.java     |   47 -
 .../apache/zest/envisage/detail/APIPane.form    |   41 -
 .../apache/zest/envisage/detail/APIPane.java    |  297 ---
 .../zest/envisage/detail/DependencyPane.form    |  212 --
 .../zest/envisage/detail/DependencyPane.java    |  477 -----
 .../zest/envisage/detail/DetailModelPane.java   |  232 ---
 .../apache/zest/envisage/detail/DetailPane.java |   43 -
 .../zest/envisage/detail/GeneralPane.form       |   39 -
 .../zest/envisage/detail/GeneralPane.java       |  235 ---
 .../zest/envisage/detail/ImportedByPane.form    |   88 -
 .../zest/envisage/detail/ImportedByPane.java    |  186 --
 .../apache/zest/envisage/detail/MethodPane.form |   61 -
 .../apache/zest/envisage/detail/MethodPane.java |  358 ----
 .../apache/zest/envisage/detail/SPIPane.form    |   39 -
 .../apache/zest/envisage/detail/SPIPane.java    |  296 ---
 .../detail/ServiceConfigurationPane.form        |  127 --
 .../detail/ServiceConfigurationPane.java        |  354 ----
 .../zest/envisage/detail/ServiceUsagePane.form  |   39 -
 .../zest/envisage/detail/ServiceUsagePane.java  |  338 ----
 .../apache/zest/envisage/detail/StatePane.form  |   61 -
 .../apache/zest/envisage/detail/StatePane.java  |  380 ----
 .../apache/zest/envisage/detail/package.html    |   24 -
 .../apache/zest/envisage/event/LinkEvent.java   |   44 -
 .../zest/envisage/event/LinkListener.java       |   29 -
 .../org/apache/zest/envisage/event/package.html |   24 -
 .../zest/envisage/graph/GraphBuilder.java       |  273 ---
 .../zest/envisage/graph/GraphDisplay.java       |   85 -
 .../apache/zest/envisage/graph/GraphPane.java   |  167 --
 .../envisage/graph/StackedGraphDisplay.java     |  584 ------
 .../zest/envisage/graph/StackedLayout.java      |  224 ---
 .../zest/envisage/graph/TreeGraphDisplay.java   |  391 ----
 .../org/apache/zest/envisage/graph/package.html |   24 -
 .../java/org/apache/zest/envisage/package.html  |   24 -
 .../apache/zest/envisage/print/PDFWriter.java   |  827 --------
 .../zest/envisage/print/PrintingException.java  |   30 -
 .../org/apache/zest/envisage/print/package.html |   24 -
 .../envisage/tree/StructureModelBuilder.java    |  155 --
 .../envisage/tree/TreeModelCellRenderer.java    |  156 --
 .../zest/envisage/tree/TreeModelPane.java       |  304 ---
 .../zest/envisage/tree/TypeModelBuilder.java    |  155 --
 .../org/apache/zest/envisage/tree/package.html  |   24 -
 .../zest/envisage/util/ColorUtilities.java      |   61 -
 .../org/apache/zest/envisage/util/TableRow.java |   71 -
 .../zest/envisage/util/TableRowUtilities.java   |   64 -
 .../org/apache/zest/envisage/util/package.html  |   24 -
 .../polygene/envisage/EnvisageFrame.properties  |   21 +
 .../polygene/envisage/detail/APIPane.properties |   23 +
 .../envisage/detail/DependencyPane.properties   |   28 +
 .../envisage/detail/DetailModelPane.properties  |   29 +
 .../envisage/detail/GeneralPane.properties      |   22 +
 .../envisage/detail/ImportedByPane.properties   |   22 +
 .../envisage/detail/MethodPane.properties       |   22 +
 .../polygene/envisage/detail/SPIPane.properties |   23 +
 .../detail/ServiceConfigurationPane.properties  |   24 +
 .../envisage/detail/ServiceUsagePane.properties |   25 +
 .../envisage/detail/StatePane.properties        |   22 +
 .../apache/polygene/envisage/detail/private.png |  Bin 0 -> 506 bytes
 .../apache/polygene/envisage/detail/public.png  |  Bin 0 -> 514 bytes
 .../tree/TreeModelCellRenderer.properties       |   29 +
 .../envisage/tree/TreeModelPane.properties      |   21 +
 .../polygene/envisage/tree/application.png      |  Bin 0 -> 625 bytes
 .../apache/polygene/envisage/tree/entity.png    |  Bin 0 -> 627 bytes
 .../polygene/envisage/tree/importedService.png  |  Bin 0 -> 766 bytes
 .../org/apache/polygene/envisage/tree/layer.png |  Bin 0 -> 697 bytes
 .../apache/polygene/envisage/tree/module.png    |  Bin 0 -> 729 bytes
 .../apache/polygene/envisage/tree/object.png    |  Bin 0 -> 737 bytes
 .../apache/polygene/envisage/tree/service.png   |  Bin 0 -> 803 bytes
 .../apache/polygene/envisage/tree/transient.png |  Bin 0 -> 761 bytes
 .../org/apache/polygene/envisage/tree/value.png |  Bin 0 -> 620 bytes
 .../zest/envisage/EnvisageFrame.properties      |   21 -
 .../zest/envisage/detail/APIPane.properties     |   23 -
 .../envisage/detail/DependencyPane.properties   |   28 -
 .../envisage/detail/DetailModelPane.properties  |   29 -
 .../zest/envisage/detail/GeneralPane.properties |   22 -
 .../envisage/detail/ImportedByPane.properties   |   22 -
 .../zest/envisage/detail/MethodPane.properties  |   22 -
 .../zest/envisage/detail/SPIPane.properties     |   23 -
 .../detail/ServiceConfigurationPane.properties  |   24 -
 .../envisage/detail/ServiceUsagePane.properties |   25 -
 .../zest/envisage/detail/StatePane.properties   |   22 -
 .../org/apache/zest/envisage/detail/private.png |  Bin 506 -> 0 bytes
 .../org/apache/zest/envisage/detail/public.png  |  Bin 514 -> 0 bytes
 .../tree/TreeModelCellRenderer.properties       |   29 -
 .../zest/envisage/tree/TreeModelPane.properties |   21 -
 .../apache/zest/envisage/tree/application.png   |  Bin 625 -> 0 bytes
 .../org/apache/zest/envisage/tree/entity.png    |  Bin 627 -> 0 bytes
 .../zest/envisage/tree/importedService.png      |  Bin 766 -> 0 bytes
 .../org/apache/zest/envisage/tree/layer.png     |  Bin 697 -> 0 bytes
 .../org/apache/zest/envisage/tree/module.png    |  Bin 729 -> 0 bytes
 .../org/apache/zest/envisage/tree/object.png    |  Bin 737 -> 0 bytes
 .../org/apache/zest/envisage/tree/service.png   |  Bin 803 -> 0 bytes
 .../org/apache/zest/envisage/tree/transient.png |  Bin 761 -> 0 bytes
 .../org/apache/zest/envisage/tree/value.png     |  Bin 620 -> 0 bytes
 .../envisage/sample/EnvisageSample.java         |  155 ++
 .../envisage/school/EnvisageSchoolSample.java   |   41 +
 .../envisage/school/SchoolAssembler.java        |  111 ++
 .../school/config/mail/MailConfigAssembler.java |   36 +
 .../school/config/mail/MailConfiguration.java   |   32 +
 .../persistence/PersistenceConfigAssembler.java |   39 +
 .../envisage/school/domain/person/Person.java   |   32 +
 .../envisage/school/domain/person/Role.java     |   25 +
 .../domain/person/assembly/PersonEntity.java    |   75 +
 .../person/assembly/PersonModelAssembler.java   |   45 +
 .../initialdata/SamplePersonInitialData.java    |  110 +
 .../envisage/school/domain/school/School.java   |   36 +
 .../school/domain/school/SchoolRepository.java  |   30 +
 .../envisage/school/domain/school/Student.java  |   31 +
 .../envisage/school/domain/school/Subject.java  |   30 +
 .../domain/school/assembly/SchoolEntity.java    |  120 ++
 .../school/assembly/SchoolModelAssembler.java   |   46 +
 .../assembly/SchoolRepositoryService.java       |   66 +
 .../domain/school/assembly/StudentEntity.java   |   66 +
 .../domain/school/assembly/SubjectEntity.java   |   72 +
 .../school/infrastructure/mail/Mail.java        |   39 +
 .../school/infrastructure/mail/MailService.java |   30 +
 .../mail/assembly/MailServiceAssembler.java     |   44 +
 .../mail/assembly/MailServiceComposite.java     |   55 +
 .../infrastructure/mail/assembly/MailValue.java |   29 +
 .../persistence/PersistenceAssembler.java       |   51 +
 .../school/ui/admin/AdminAssembler.java         |   46 +
 .../school/ui/admin/pages/ListUserPage.java     |   28 +
 .../school/ui/admin/pages/UserDetailPage.java   |   35 +
 .../composites/ListSchoolsPageComposite.java    |   59 +
 .../pages/composites/ListUserPageComposite.java |   29 +
 .../composites/UserDetailPageComposite.java     |   29 +
 .../pages/mixins/AuthenticationConcern.java     |   45 +
 .../ui/admin/pages/mixins/DetailPage.java       |   27 +
 .../school/ui/admin/pages/mixins/Page.java      |   29 +
 .../school/ui/admin/pages/mixins/PageMixin.java |   31 +
 .../admin/pages/mixins/UserDetailPageMixin.java |   52 +
 .../zest/envisage/sample/EnvisageSample.java    |  155 --
 .../envisage/school/EnvisageSchoolSample.java   |   41 -
 .../zest/envisage/school/SchoolAssembler.java   |  111 --
 .../school/config/mail/MailConfigAssembler.java |   36 -
 .../school/config/mail/MailConfiguration.java   |   32 -
 .../persistence/PersistenceConfigAssembler.java |   39 -
 .../envisage/school/domain/person/Person.java   |   32 -
 .../envisage/school/domain/person/Role.java     |   25 -
 .../domain/person/assembly/PersonEntity.java    |   75 -
 .../person/assembly/PersonModelAssembler.java   |   45 -
 .../initialdata/SamplePersonInitialData.java    |  110 -
 .../envisage/school/domain/school/School.java   |   36 -
 .../school/domain/school/SchoolRepository.java  |   30 -
 .../envisage/school/domain/school/Student.java  |   31 -
 .../envisage/school/domain/school/Subject.java  |   30 -
 .../domain/school/assembly/SchoolEntity.java    |  120 --
 .../school/assembly/SchoolModelAssembler.java   |   46 -
 .../assembly/SchoolRepositoryService.java       |   66 -
 .../domain/school/assembly/StudentEntity.java   |   66 -
 .../domain/school/assembly/SubjectEntity.java   |   72 -
 .../school/infrastructure/mail/Mail.java        |   39 -
 .../school/infrastructure/mail/MailService.java |   30 -
 .../mail/assembly/MailServiceAssembler.java     |   44 -
 .../mail/assembly/MailServiceComposite.java     |   55 -
 .../infrastructure/mail/assembly/MailValue.java |   29 -
 .../persistence/PersistenceAssembler.java       |   51 -
 .../school/ui/admin/AdminAssembler.java         |   46 -
 .../school/ui/admin/pages/ListUserPage.java     |   28 -
 .../school/ui/admin/pages/UserDetailPage.java   |   35 -
 .../composites/ListSchoolsPageComposite.java    |   59 -
 .../pages/composites/ListUserPageComposite.java |   29 -
 .../composites/UserDetailPageComposite.java     |   29 -
 .../pages/mixins/AuthenticationConcern.java     |   45 -
 .../ui/admin/pages/mixins/DetailPage.java       |   27 -
 .../school/ui/admin/pages/mixins/Page.java      |   29 -
 .../school/ui/admin/pages/mixins/PageMixin.java |   31 -
 .../admin/pages/mixins/UserDetailPageMixin.java |   52 -
 .../app/templates/ConfigModule/bootstrap.tmpl   |   14 +-
 .../templates/ConfigurationLayer/bootstrap.tmpl |   10 +-
 .../templates/ConnectivityLayer/bootstrap.tmpl  |    8 +-
 .../app/templates/CrudModule/bootstrap.tmpl     |   10 +-
 .../app/templates/DomainLayer/bootstrap.tmpl    |   12 +-
 .../FileConfigurationModule/bootstrap.tmpl      |   12 +-
 .../app/templates/Heroes/Hero.tmpl              |    4 +-
 .../app/templates/Heroes/app.tmpl               |    8 +-
 .../app/templates/Heroes/bootstrap.tmpl         |   14 +-
 .../app/templates/Heroes/web.tmpl               |    2 +-
 .../InfrastructureLayer/bootstrap.tmpl          |   14 +-
 .../JacksonSerializationModule/bootstrap.tmpl   |   16 +-
 .../templates/NoCachingModule/bootstrap.tmpl    |   12 +-
 .../templates/RdfIndexingModule/bootstrap.tmpl  |   14 +-
 .../HardcodedSecurityRepositoryMixin.tmpl       |    2 +-
 .../RestApiModule/SecurityRepository.tmpl       |    6 +-
 .../templates/RestApiModule/SimpleEnroler.tmpl  |    4 +-
 .../templates/RestApiModule/SimpleVerifier.tmpl |    2 +-
 .../app/templates/RestApiModule/bootstrap.tmpl  |   12 +-
 .../HardcodedSecurityRepositoryMixin.tmpl       |    2 +-
 .../SecurityModule/SecurityRepository.tmpl      |    6 +-
 .../app/templates/SecurityModule/bootstrap.tmpl |   10 +-
 .../app/templates/StorageModule/bootstrap.tmpl  |   12 +-
 .../app/templates/buildtool/gradle-app.tmpl     |    8 +-
 .../templates/buildtool/gradle-bootstrap.tmpl   |   14 +-
 .../app/templates/buildtool/gradle-rest.tmpl    |    4 +-
 .../app/templates/buildtool/gradle-root.tmpl    |    4 +-
 .../descriptor/ActivateeDetailDescriptor.java   |   31 +
 .../descriptor/ActivatorDetailDescriptor.java   |  178 ++
 .../descriptor/ApplicationDetailDescriptor.java |  114 ++
 .../ApplicationDetailDescriptorBuilder.java     |  481 +++++
 .../descriptor/CompositeDetailDescriptor.java   |  145 ++
 .../CompositeMethodDetailDescriptor.java        |  136 ++
 .../descriptor/ConstructorDetailDescriptor.java |  146 ++
 .../descriptor/EntityDetailDescriptor.java      |   44 +
 .../ImportedServiceCompositeDescriptor.java     |  103 +
 .../ImportedServiceDetailDescriptor.java        |   75 +
 .../descriptor/InjectableDetailDescriptor.java  |   44 +
 .../InjectedFieldDetailDescriptor.java          |  130 ++
 .../InjectedMethodDetailDescriptor.java         |  143 ++
 .../InjectedParametersDetailDescriptor.java     |   87 +
 .../model/descriptor/LayerDetailDescriptor.java |  164 ++
 .../MethodConcernDetailDescriptor.java          |  142 ++
 .../MethodConcernsDetailDescriptor.java         |   86 +
 .../MethodConstraintDetailDescriptor.java       |   72 +
 .../MethodConstraintsDetailDescriptor.java      |   88 +
 .../MethodSideEffectDetailDescriptor.java       |  141 ++
 .../MethodSideEffectsDetailDescriptor.java      |   88 +
 .../model/descriptor/MixinDetailDescriptor.java |  138 ++
 .../descriptor/ModuleDetailDescriptor.java      |  245 +++
 .../descriptor/ObjectDetailDescriptor.java      |  130 ++
 .../descriptor/ServiceDetailDescriptor.java     |  100 +
 .../tools/model/descriptor/ServiceUsage.java    |   61 +
 .../descriptor/TransientDetailDescriptor.java   |   44 +
 .../model/descriptor/ValueDetailDescriptor.java |   44 +
 .../tools/model/descriptor/package.html         |   24 +
 .../polygene/tools/model/util/APIFinder.java    |   58 +
 .../model/util/DescriptorNameComparator.java    |   37 +
 .../tools/model/util/DescriptorUtilities.java   |  137 ++
 .../polygene/tools/model/util/MethodFinder.java |  116 ++
 .../polygene/tools/model/util/SPIFinder.java    |  171 ++
 .../model/util/ServiceConfigurationFinder.java  |  158 ++
 .../tools/model/util/ServiceUsageFinder.java    |  163 ++
 .../polygene/tools/model/util/StateFinder.java  |   96 +
 .../polygene/tools/model/util/package.html      |   24 +
 .../descriptor/ActivateeDetailDescriptor.java   |   31 -
 .../descriptor/ActivatorDetailDescriptor.java   |  178 --
 .../descriptor/ApplicationDetailDescriptor.java |  114 --
 .../ApplicationDetailDescriptorBuilder.java     |  481 -----
 .../descriptor/CompositeDetailDescriptor.java   |  145 --
 .../CompositeMethodDetailDescriptor.java        |  136 --
 .../descriptor/ConstructorDetailDescriptor.java |  146 --
 .../descriptor/EntityDetailDescriptor.java      |   44 -
 .../ImportedServiceCompositeDescriptor.java     |  103 -
 .../ImportedServiceDetailDescriptor.java        |   75 -
 .../descriptor/InjectableDetailDescriptor.java  |   44 -
 .../InjectedFieldDetailDescriptor.java          |  130 --
 .../InjectedMethodDetailDescriptor.java         |  143 --
 .../InjectedParametersDetailDescriptor.java     |   87 -
 .../model/descriptor/LayerDetailDescriptor.java |  164 --
 .../MethodConcernDetailDescriptor.java          |  142 --
 .../MethodConcernsDetailDescriptor.java         |   86 -
 .../MethodConstraintDetailDescriptor.java       |   72 -
 .../MethodConstraintsDetailDescriptor.java      |   88 -
 .../MethodSideEffectDetailDescriptor.java       |  141 --
 .../MethodSideEffectsDetailDescriptor.java      |   88 -
 .../model/descriptor/MixinDetailDescriptor.java |  138 --
 .../descriptor/ModuleDetailDescriptor.java      |  245 ---
 .../descriptor/ObjectDetailDescriptor.java      |  130 --
 .../descriptor/ServiceDetailDescriptor.java     |  100 -
 .../tools/model/descriptor/ServiceUsage.java    |   61 -
 .../descriptor/TransientDetailDescriptor.java   |   44 -
 .../model/descriptor/ValueDetailDescriptor.java |   44 -
 .../zest/tools/model/descriptor/package.html    |   24 -
 .../apache/zest/tools/model/util/APIFinder.java |   58 -
 .../model/util/DescriptorNameComparator.java    |   37 -
 .../tools/model/util/DescriptorUtilities.java   |  137 --
 .../zest/tools/model/util/MethodFinder.java     |  117 --
 .../apache/zest/tools/model/util/SPIFinder.java |  171 --
 .../model/util/ServiceConfigurationFinder.java  |  158 --
 .../tools/model/util/ServiceUsageFinder.java    |  163 --
 .../zest/tools/model/util/StateFinder.java      |   96 -
 .../apache/zest/tools/model/util/package.html   |   24 -
 .../tools/model/VisitableDetailTest.java        |  156 ++
 .../zest/tools/model/VisitableDetailTest.java   |  156 --
 .../plugin/idea/ZestApplicationComponent.java   |   22 +-
 .../common/ZestAppliesToConstants.java          |    6 +-
 .../appliesTo/common/ZestAppliesToUtil.java     |   14 +-
 ...ToAnnotationDeclaredCorrectlyInspection.java |   22 +-
 .../AbstractCreateElementActionBase.java        |    2 +-
 .../common/actions/ZestCreateActionGroup.java   |    4 +-
 .../ide/plugin/idea/common/facet/ZestFacet.java |    2 +-
 .../common/facet/ZestFacetConfiguration.java    |    4 +-
 .../plugin/idea/common/facet/ZestFacetType.java |    4 +-
 .../common/facet/ui/ZestFacetEditorTab.java     |    2 +-
 .../idea/common/inspections/AbstractFix.java    |    4 +-
 .../common/inspections/AbstractInspection.java  |    4 +-
 .../common/intentions/AbstractIntention.java    |    4 +-
 .../idea/common/psi/PsiAnnotationUtil.java      |    2 +-
 .../plugin/idea/common/psi/PsiClassUtil.java    |    4 +-
 .../psi/search/GlobalSearchScopeUtil.java       |    4 +-
 .../common/resource/ZestResourceBundle.java     |    4 +-
 .../plugin/idea/common/vfs/VirtualFileUtil.java |    2 +-
 ...teConcernFromMixinTypeOrCompositeAction.java |    4 +-
 .../CreateConcernOfInPackageAction.java         |   10 +-
 .../concerns/common/ZestConcernConstants.java   |    8 +-
 .../idea/concerns/common/ZestConcernUtil.java   |   12 +-
 ...nsAnnotationDeclaredCorrectlyInspection.java |   14 +-
 .../intentions/add/AddConcernOnType.java        |   10 +-
 ...larationOnFieldAndConstructorInspection.java |    4 +-
 ...nAnnotationDeclarationOnFieldInspection.java |    8 +-
 .../ZestInvocationAnnotationConstants.java      |    4 +-
 .../common/ZestInvocationAnnotationUtil.java    |   10 +-
 ...onAnnotationDeclaredCorrectlyInspection.java |   16 +-
 .../common/ZestServiceAnnotationConstants.java  |    4 +-
 .../common/ZestServiceAnnotationUtil.java       |    8 +-
 ...ceAnnotationDeclaredCorrectlyInspection.java |   16 +-
 .../common/ReplaceWithStructureAnnotation.java  |    6 +-
 .../ZestStructureAnnotationConstants.java       |   22 +-
 .../common/ZestStructureAnnotationUtil.java     |    8 +-
 ...reAnnotationDeclaredCorrectlyInspection.java |   14 +-
 .../idea/mixins/common/ZestMixinConstants.java  |    4 +-
 .../idea/mixins/common/ZestMixinUtil.java       |   16 +-
 .../inspections/MixinImplementsMixinType.java   |   14 +-
 .../MixinsAnnotationDeclaredOnMixinType.java    |   10 +-
 .../common/ZestSideEffectConstants.java         |    8 +-
 .../sideEffects/common/ZestSideEffectUtil.java  |   12 +-
 ...tsAnnotationDeclaredCorrectlyInspection.java |   16 +-
 .../src/main/resources/META-INF/plugin.xml      |   10 +-
 .../fileTemplates/j2ee/GenericConcernOf.java.ft |    2 +-
 .../resource/ZestResourceBundle.properties      |    4 +-
 tools/shell/build.gradle                        |    2 +-
 tools/shell/src/dist/bin/zest-boot              |    2 +-
 .../templates/default/files/app/build.gradle_   |    8 +-
 .../default/files/bootstrap/build.gradle_       |   14 +-
 .../etc/templates/default/files/build.gradle_   |    4 +-
 .../etc/templates/default/template.properties   |    2 +-
 .../ng2-heroes/files/app/build.gradle_          |    8 +-
 .../ng2-heroes/files/bootstrap/build.gradle_    |   14 +-
 .../templates/ng2-heroes/files/build.gradle_    |    4 +-
 .../ng2-heroes/files/rest/build.gradle_         |    4 +-
 .../templates/ng2-heroes/template.properties    |    2 +-
 .../dist/etc/templates/null/files/build.gradle_ |    4 +-
 .../dist/etc/templates/null/template.properties |    2 +-
 .../templates/restapp/files/app/build.gradle_   |    8 +-
 .../restapp/files/bootstrap/build.gradle_       |   14 +-
 .../etc/templates/restapp/files/build.gradle_   |    4 +-
 .../templates/restapp/files/rest/build.gradle_  |    4 +-
 .../etc/templates/restapp/template.properties   |    2 +-
 .../etc/templates/singleton/files/build.gradle_ |    4 +-
 .../etc/templates/singleton/template.properties |    2 +-
 tools/shell/src/docs/shell.txt                  |    2 +-
 .../polygene/tools/shell/AbstractCommand.java   |   31 +
 .../apache/polygene/tools/shell/Command.java    |   33 +
 .../apache/polygene/tools/shell/FileUtils.java  |  148 ++
 .../tools/shell/HelpNeededException.java        |   24 +
 .../org/apache/polygene/tools/shell/Main.java   |  117 ++
 .../tools/shell/create/CreateProject.java       |   80 +
 .../create/project/AbstractProjectCreator.java  |  106 +
 .../create/project/DefaultProjectCreator.java   |   79 +
 .../create/project/HeroesProjectCreator.java    |   82 +
 .../create/project/NullProjectCreator.java      |   37 +
 .../shell/create/project/ProjectCreator.java    |   34 +
 .../create/project/RestProjectCreator.java      |   90 +
 .../create/project/SingletonProjectCreator.java |   41 +
 .../common/ApplicationAssemblerWriter.java      |  104 +
 .../project/common/ConfigLayerWriter.java       |   79 +
 .../project/common/ConfigModuleWriter.java      |   73 +
 .../project/common/ConnectivityLayerWriter.java |   72 +
 .../create/project/common/CrudModuleWriter.java |   71 +
 .../create/project/common/CustomerWriter.java   |   66 +
 .../project/common/DomainLayerWriter.java       |   80 +
 .../common/FileConfigurationModuleWriter.java   |   74 +
 .../HardCodedSecurityRepositoryMixinWriter.java |   85 +
 .../project/common/IndexingModuleWriter.java    |   82 +
 .../common/InfrastructureLayerWriter.java       |   89 +
 .../create/project/common/OrderItemWriter.java  |   64 +
 .../project/common/OrderModuleWriter.java       |   83 +
 .../create/project/common/OrderWriter.java      |   69 +
 .../project/common/SecurityModuleWriter.java    |   85 +
 .../common/SecurityRepositoryWriter.java        |   69 +
 .../common/SerializationModuleWriter.java       |   86 +
 .../project/common/StorageModuleWriter.java     |   85 +
 .../project/defaultp/ApplicationWriter.java     |  102 +
 .../create/project/defaultp/SettingsWriter.java |   80 +
 .../project/restapp/ApplicationWriter.java      |  136 ++
 .../create/project/restapp/IndexHtmlWriter.java |   68 +
 .../project/restapp/OrderModuleWriter.java      |   88 +
 .../project/restapp/RestModuleWriter.java       |   83 +
 .../create/project/restapp/SettingsWriter.java  |   81 +
 .../project/restapp/SimpleEnrolerWriter.java    |   86 +
 .../project/restapp/SimpleVerifierWriter.java   |   80 +
 .../create/project/restapp/WebXmlWriter.java    |   93 +
 .../project/singleton/SettingsWriter.java       |   76 +
 .../SingletonApplicationAssemblerWriter.java    |  103 +
 .../project/singleton/StartupServiceWriter.java |   68 +
 .../polygene/tools/shell/help/HelpCommand.java  |   62 +
 .../zest/tools/shell/AbstractCommand.java       |   31 -
 .../org/apache/zest/tools/shell/Command.java    |   33 -
 .../org/apache/zest/tools/shell/FileUtils.java  |  148 --
 .../zest/tools/shell/HelpNeededException.java   |   24 -
 .../java/org/apache/zest/tools/shell/Main.java  |  117 --
 .../zest/tools/shell/create/CreateProject.java  |   80 -
 .../create/project/AbstractProjectCreator.java  |  106 -
 .../create/project/DefaultProjectCreator.java   |   79 -
 .../create/project/HeroesProjectCreator.java    |   86 -
 .../create/project/NullProjectCreator.java      |   37 -
 .../shell/create/project/ProjectCreator.java    |   34 -
 .../create/project/RestProjectCreator.java      |   90 -
 .../create/project/SingletonProjectCreator.java |   41 -
 .../common/ApplicationAssemblerWriter.java      |  104 -
 .../project/common/ConfigLayerWriter.java       |   79 -
 .../project/common/ConfigModuleWriter.java      |   73 -
 .../project/common/ConnectivityLayerWriter.java |   72 -
 .../create/project/common/CrudModuleWriter.java |   71 -
 .../create/project/common/CustomerWriter.java   |   66 -
 .../project/common/DomainLayerWriter.java       |   80 -
 .../common/FileConfigurationModuleWriter.java   |   74 -
 .../HardCodedSecurityRepositoryMixinWriter.java |   85 -
 .../project/common/IndexingModuleWriter.java    |   82 -
 .../common/InfrastructureLayerWriter.java       |   89 -
 .../create/project/common/OrderItemWriter.java  |   64 -
 .../project/common/OrderModuleWriter.java       |   83 -
 .../create/project/common/OrderWriter.java      |   69 -
 .../project/common/SecurityModuleWriter.java    |   85 -
 .../common/SecurityRepositoryWriter.java        |   69 -
 .../common/SerializationModuleWriter.java       |   86 -
 .../project/common/StorageModuleWriter.java     |   85 -
 .../project/defaultp/ApplicationWriter.java     |  102 -
 .../create/project/defaultp/SettingsWriter.java |   80 -
 .../project/restapp/ApplicationWriter.java      |  136 --
 .../create/project/restapp/IndexHtmlWriter.java |   68 -
 .../project/restapp/OrderModuleWriter.java      |   88 -
 .../project/restapp/RestModuleWriter.java       |   83 -
 .../create/project/restapp/SettingsWriter.java  |   81 -
 .../project/restapp/SimpleEnrolerWriter.java    |   86 -
 .../project/restapp/SimpleVerifierWriter.java   |   80 -
 .../create/project/restapp/WebXmlWriter.java    |   93 -
 .../project/singleton/SettingsWriter.java       |   76 -
 .../SingletonApplicationAssemblerWriter.java    |  103 -
 .../project/singleton/StartupServiceWriter.java |   68 -
 .../zest/tools/shell/help/HelpCommand.java      |   62 -
 .../polygene/tools/shell/FileUtilsTest.java     |   93 +
 .../polygene/tools/shell/HelpCommandTest.java   |   43 +
 .../tools/shell/HelpNeededExceptionTest.java    |   32 +
 .../apache/polygene/tools/shell/TestHelper.java |   46 +
 .../tools/shell/create/CreateProjectTest.java   |   65 +
 .../project/DefaultProjectCreatorTest.java      |   99 +
 .../create/project/NullProjectCreatorTest.java  |   55 +
 .../create/project/RestProjectCreatorTest.java  |  108 +
 .../apache/zest/tools/shell/FileUtilsTest.java  |   93 -
 .../zest/tools/shell/HelpCommandTest.java       |   43 -
 .../tools/shell/HelpNeededExceptionTest.java    |   32 -
 .../org/apache/zest/tools/shell/TestHelper.java |   46 -
 .../tools/shell/create/CreateProjectTest.java   |   65 -
 .../project/DefaultProjectCreatorTest.java      |   99 -
 .../create/project/NullProjectCreatorTest.java  |   55 -
 .../create/project/RestProjectCreatorTest.java  |  108 -
 .../polygene/tutorials/cargo/package.html       |   46 +
 .../tutorials/cargo/step1/BookingPolicy.java    |   25 +
 .../polygene/tutorials/cargo/step1/Cargo.java   |   25 +
 .../cargo/step1/OverbookingPolicy.java          |   30 +
 .../cargo/step1/SequenceGenerator.java          |   25 +
 .../tutorials/cargo/step1/ShippingService.java  |   25 +
 .../polygene/tutorials/cargo/step1/Voyage.java  |   27 +
 .../cargo/step1/internal/CargoImpl.java         |   39 +
 .../step1/internal/ShippingServiceImpl.java     |   57 +
 .../step1/internal/SimpleSequenceImpl.java      |   34 +
 .../cargo/step1/internal/VoyageImpl.java        |   64 +
 .../polygene/tutorials/cargo/step1/package.html |  101 +
 .../polygene/tutorials/cargo/step2/Cargo.java   |   29 +
 .../tutorials/cargo/step2/CargoComposite.java   |   27 +
 .../tutorials/cargo/step2/HasSequence.java      |   29 +
 .../cargo/step2/OverbookingConcern.java         |   42 +
 .../cargo/step2/SequencingConcern.java          |   46 +
 .../tutorials/cargo/step2/ShippingService.java  |   28 +
 .../cargo/step2/ShippingServiceComposite.java   |   29 +
 .../cargo/step2/ShippingServiceMixin.java       |   36 +
 .../polygene/tutorials/cargo/step2/Voyage.java  |   29 +
 .../tutorials/cargo/step2/VoyageComposite.java  |   27 +
 .../polygene/tutorials/cargo/step2/package.html |   75 +
 .../apache/zest/tutorials/cargo/package.html    |   46 -
 .../tutorials/cargo/step1/BookingPolicy.java    |   25 -
 .../zest/tutorials/cargo/step1/Cargo.java       |   25 -
 .../cargo/step1/OverbookingPolicy.java          |   30 -
 .../cargo/step1/SequenceGenerator.java          |   25 -
 .../tutorials/cargo/step1/ShippingService.java  |   25 -
 .../zest/tutorials/cargo/step1/Voyage.java      |   27 -
 .../cargo/step1/internal/CargoImpl.java         |   39 -
 .../step1/internal/ShippingServiceImpl.java     |   57 -
 .../step1/internal/SimpleSequenceImpl.java      |   34 -
 .../cargo/step1/internal/VoyageImpl.java        |   64 -
 .../zest/tutorials/cargo/step1/package.html     |  101 -
 .../zest/tutorials/cargo/step2/Cargo.java       |   29 -
 .../tutorials/cargo/step2/CargoComposite.java   |   27 -
 .../zest/tutorials/cargo/step2/HasSequence.java |   29 -
 .../cargo/step2/OverbookingConcern.java         |   42 -
 .../cargo/step2/SequencingConcern.java          |   46 -
 .../tutorials/cargo/step2/ShippingService.java  |   28 -
 .../cargo/step2/ShippingServiceComposite.java   |   29 -
 .../cargo/step2/ShippingServiceMixin.java       |   36 -
 .../zest/tutorials/cargo/step2/Voyage.java      |   29 -
 .../tutorials/cargo/step2/VoyageComposite.java  |   27 -
 .../zest/tutorials/cargo/step2/package.html     |   75 -
 .../tutorials/cargo/step1/Step1TestCase.java    |   87 +
 .../cargo/step2/SequencingConcernTest.java      |  124 ++
 .../tutorials/cargo/step2/Step2TestCase.java    |  103 +
 .../tutorials/cargo/step1/Step1TestCase.java    |   87 -
 .../cargo/step2/SequencingConcernTest.java      |  124 --
 .../tutorials/cargo/step2/Step2TestCase.java    |  103 -
 tutorials/composites/src/docs/step2.txt         |    2 +-
 .../polygene/tutorials/composites/package.html  |   51 +
 .../composites/tutorial1/HelloWorld.java        |   70 +
 .../tutorials/composites/tutorial1/package.html |   49 +
 .../tutorial10/HelloWorldComposite.java         |   41 +
 .../composites/tutorial10/HelloWorldMixin.java  |   43 +
 .../composites/tutorial10/HelloWorldState.java  |   39 +
 .../composites/tutorial2/HelloWorld.java        |   35 +
 .../tutorial2/HelloWorldBehaviour.java          |   32 +
 .../composites/tutorial2/HelloWorldMixin.java   |   76 +
 .../composites/tutorial2/HelloWorldState.java   |   43 +
 .../tutorials/composites/tutorial2/package.html |   44 +
 .../composites/tutorial3/HelloWorld.java        |   32 +
 .../tutorial3/HelloWorldBehaviour.java          |   29 +
 .../tutorial3/HelloWorldComposite.java          |   38 +
 .../composites/tutorial3/HelloWorldMixin.java   |   65 +
 .../composites/tutorial3/HelloWorldState.java   |   40 +
 .../tutorials/composites/tutorial3/package.html |   41 +
 .../composites/tutorial4/HelloWorld.java        |   32 +
 .../tutorial4/HelloWorldBehaviour.java          |   37 +
 .../tutorial4/HelloWorldBehaviourMixin.java     |   48 +
 .../tutorial4/HelloWorldComposite.java          |   40 +
 .../composites/tutorial4/HelloWorldState.java   |   46 +
 .../tutorial4/HelloWorldStateMixin.java         |   58 +
 .../tutorials/composites/tutorial4/package.html |   59 +
 .../composites/tutorial5/HelloWorld.java        |   32 +
 .../tutorial5/HelloWorldBehaviour.java          |   35 +
 .../tutorial5/HelloWorldBehaviourConcern.java   |   39 +
 .../tutorial5/HelloWorldBehaviourMixin.java     |   51 +
 .../tutorial5/HelloWorldComposite.java          |   37 +
 .../composites/tutorial5/HelloWorldState.java   |   43 +
 .../tutorial5/HelloWorldStateMixin.java         |   55 +
 .../tutorials/composites/tutorial5/package.html |   63 +
 .../composites/tutorial6/HelloWorld.java        |   32 +
 .../tutorial6/HelloWorldBehaviour.java          |   41 +
 .../tutorial6/HelloWorldBehaviourConcern.java   |   40 +
 .../tutorial6/HelloWorldBehaviourMixin.java     |   49 +
 .../tutorial6/HelloWorldComposite.java          |   37 +
 .../composites/tutorial6/HelloWorldState.java   |   48 +
 .../tutorial6/HelloWorldStateMixin.java         |   55 +
 .../tutorials/composites/tutorial6/package.html |   58 +
 .../composites/tutorial7/HelloWorld.java        |   32 +
 .../tutorial7/HelloWorldBehaviour.java          |   32 +
 .../tutorial7/HelloWorldBehaviourMixin.java     |   46 +
 .../HelloWorldBehaviourSideEffect.java          |   40 +
 .../tutorial7/HelloWorldComposite.java          |   41 +
 .../composites/tutorial7/HelloWorldState.java   |   46 +
 .../tutorial7/HelloWorldStateMixin.java         |   55 +
 .../tutorials/composites/tutorial7/package.html |   72 +
 .../tutorial8/HelloWorldBehaviour.java          |   29 +
 .../tutorial8/HelloWorldBehaviourMixin.java     |   45 +
 .../tutorial8/HelloWorldComposite.java          |   36 +
 .../composites/tutorial8/HelloWorldState.java   |   43 +
 .../tutorial8/HelloWorldStateMixin.java         |   51 +
 .../tutorials/composites/tutorial8/package.html |   60 +
 .../tutorial9/GenericPropertyMixin.java         |   59 +
 .../tutorial9/HelloWorldBehaviour.java          |   29 +
 .../tutorial9/HelloWorldBehaviourMixin.java     |   42 +
 .../tutorial9/HelloWorldComposite.java          |   41 +
 .../composites/tutorial9/HelloWorldState.java   |   40 +
 .../tutorials/composites/tutorial9/package.html |   73 +
 .../zest/tutorials/composites/package.html      |   51 -
 .../composites/tutorial1/HelloWorld.java        |   70 -
 .../tutorials/composites/tutorial1/package.html |   49 -
 .../tutorial10/HelloWorldComposite.java         |   41 -
 .../composites/tutorial10/HelloWorldMixin.java  |   43 -
 .../composites/tutorial10/HelloWorldState.java  |   39 -
 .../composites/tutorial2/HelloWorld.java        |   35 -
 .../tutorial2/HelloWorldBehaviour.java          |   32 -
 .../composites/tutorial2/HelloWorldMixin.java   |   76 -
 .../composites/tutorial2/HelloWorldState.java   |   43 -
 .../tutorials/composites/tutorial2/package.html |   44 -
 .../composites/tutorial3/HelloWorld.java        |   32 -
 .../tutorial3/HelloWorldBehaviour.java          |   29 -
 .../tutorial3/HelloWorldComposite.java          |   38 -
 .../composites/tutorial3/HelloWorldMixin.java   |   65 -
 .../composites/tutorial3/HelloWorldState.java   |   40 -
 .../tutorials/composites/tutorial3/package.html |   41 -
 .../composites/tutorial4/HelloWorld.java        |   32 -
 .../tutorial4/HelloWorldBehaviour.java          |   37 -
 .../tutorial4/HelloWorldBehaviourMixin.java     |   48 -
 .../tutorial4/HelloWorldComposite.java          |   40 -
 .../composites/tutorial4/HelloWorldState.java   |   46 -
 .../tutorial4/HelloWorldStateMixin.java         |   58 -
 .../tutorials/composites/tutorial4/package.html |   59 -
 .../composites/tutorial5/HelloWorld.java        |   32 -
 .../tutorial5/HelloWorldBehaviour.java          |   35 -
 .../tutorial5/HelloWorldBehaviourConcern.java   |   39 -
 .../tutorial5/HelloWorldBehaviourMixin.java     |   51 -
 .../tutorial5/HelloWorldComposite.java          |   37 -
 .../composites/tutorial5/HelloWorldState.java   |   43 -
 .../tutorial5/HelloWorldStateMixin.java         |   55 -
 .../tutorials/composites/tutorial5/package.html |   63 -
 .../composites/tutorial6/HelloWorld.java        |   32 -
 .../tutorial6/HelloWorldBehaviour.java          |   41 -
 .../tutorial6/HelloWorldBehaviourConcern.java   |   40 -
 .../tutorial6/HelloWorldBehaviourMixin.java     |   49 -
 .../tutorial6/HelloWorldComposite.java          |   37 -
 .../composites/tutorial6/HelloWorldState.java   |   48 -
 .../tutorial6/HelloWorldStateMixin.java         |   55 -
 .../tutorials/composites/tutorial6/package.html |   58 -
 .../composites/tutorial7/HelloWorld.java        |   32 -
 .../tutorial7/HelloWorldBehaviour.java          |   32 -
 .../tutorial7/HelloWorldBehaviourMixin.java     |   46 -
 .../HelloWorldBehaviourSideEffect.java          |   40 -
 .../tutorial7/HelloWorldComposite.java          |   41 -
 .../composites/tutorial7/HelloWorldState.java   |   46 -
 .../tutorial7/HelloWorldStateMixin.java         |   55 -
 .../tutorials/composites/tutorial7/package.html |   72 -
 .../tutorial8/HelloWorldBehaviour.java          |   29 -
 .../tutorial8/HelloWorldBehaviourMixin.java     |   45 -
 .../tutorial8/HelloWorldComposite.java          |   36 -
 .../composites/tutorial8/HelloWorldState.java   |   43 -
 .../tutorial8/HelloWorldStateMixin.java         |   51 -
 .../tutorials/composites/tutorial8/package.html |   60 -
 .../tutorial9/GenericPropertyMixin.java         |   59 -
 .../tutorial9/HelloWorldBehaviour.java          |   29 -
 .../tutorial9/HelloWorldBehaviourMixin.java     |   42 -
 .../tutorial9/HelloWorldComposite.java          |   41 -
 .../composites/tutorial9/HelloWorldState.java   |   40 -
 .../tutorials/composites/tutorial9/package.html |   73 -
 .../composites/tutorial1/HelloWorldTest.java    |   85 +
 .../composites/tutorial10/HelloWorldTest.java   |  139 ++
 .../composites/tutorial2/HelloWorldTest.java    |   85 +
 .../composites/tutorial3/HelloWorldTest.java    |   98 +
 .../composites/tutorial4/HelloWorldTest.java    |   97 +
 .../composites/tutorial5/HelloWorldTest.java    |   97 +
 .../composites/tutorial6/HelloWorldTest.java    |  117 ++
 .../composites/tutorial7/HelloWorldTest.java    |  117 ++
 .../composites/tutorial8/HelloWorldTest.java    |  116 ++
 .../composites/tutorial9/HelloWorldTest.java    |  116 ++
 .../composites/tutorial1/HelloWorldTest.java    |   85 -
 .../composites/tutorial10/HelloWorldTest.java   |  139 --
 .../composites/tutorial2/HelloWorldTest.java    |   85 -
 .../composites/tutorial3/HelloWorldTest.java    |   98 -
 .../composites/tutorial4/HelloWorldTest.java    |   97 -
 .../composites/tutorial5/HelloWorldTest.java    |   97 -
 .../composites/tutorial6/HelloWorldTest.java    |  117 --
 .../composites/tutorial7/HelloWorldTest.java    |  117 --
 .../composites/tutorial8/HelloWorldTest.java    |  116 --
 .../composites/tutorial9/HelloWorldTest.java    |  116 --
 .../apache/polygene/tutorials/hello/Hello.java  |   71 +
 .../org/apache/zest/tutorials/hello/Hello.java  |   71 -
 .../polygene/tutorials/hello/HelloTest.java     |   60 +
 .../polygene/tutorials/hello/HelloTest2.java    |   50 +
 .../polygene/tutorials/hello/HelloTest3.java    |   50 +
 .../polygene/tutorials/hello/HelloTest4.java    |   70 +
 .../apache/zest/tutorials/hello/HelloTest.java  |   60 -
 .../apache/zest/tutorials/hello/HelloTest2.java |   50 -
 .../apache/zest/tutorials/hello/HelloTest3.java |   50 -
 .../apache/zest/tutorials/hello/HelloTest4.java |   70 -
 .../polygene/demo/intro/StateModelingDocs.java  |  137 ++
 .../polygene/demo/intro/WhatsAnObjectDocs.java  |   78 +
 .../zest/demo/intro/StateModelingDocs.java      |  137 --
 .../zest/demo/intro/WhatsAnObjectDocs.java      |   78 -
 .../polygene/demo/tenminute/Confirmable.java    |   26 +
 .../polygene/demo/tenminute/HasCustomer.java    |   28 +
 .../polygene/demo/tenminute/HasLineItems.java   |   29 +
 .../demo/tenminute/HasSequenceNumber.java       |   28 +
 .../demo/tenminute/InventoryConcern.java        |   52 +
 .../polygene/demo/tenminute/LineItem.java       |   32 +
 .../demo/tenminute/MailNotifySideEffect.java    |   59 +
 .../apache/polygene/demo/tenminute/Order.java   |   29 +
 .../polygene/demo/tenminute/OrderEntity.java    |   38 +
 .../demo/tenminute/PurchaseLimitConcern.java    |   25 +
 .../elsewhere/inventory/InventoryService.java   |   28 +
 .../polygene/elsewhere/mail/MailService.java    |   26 +
 .../apache/zest/demo/tenminute/Confirmable.java |   26 -
 .../apache/zest/demo/tenminute/HasCustomer.java |   28 -
 .../zest/demo/tenminute/HasLineItems.java       |   29 -
 .../zest/demo/tenminute/HasSequenceNumber.java  |   28 -
 .../zest/demo/tenminute/InventoryConcern.java   |   52 -
 .../apache/zest/demo/tenminute/LineItem.java    |   32 -
 .../demo/tenminute/MailNotifySideEffect.java    |   59 -
 .../org/apache/zest/demo/tenminute/Order.java   |   29 -
 .../apache/zest/demo/tenminute/OrderEntity.java |   38 -
 .../demo/tenminute/PurchaseLimitConcern.java    |   25 -
 .../elsewhere/inventory/InventoryService.java   |   28 -
 .../apache/zest/elsewhere/mail/MailService.java |   26 -
 .../introduction/thirtyminutes/build.gradle     |    2 +-
 .../demo/thirtyminutes/ThirtyMinutesDocs.java   |  289 +++
 .../demo/thirtyminutes/ThirtyMinutesDocs.java   |  290 ---
 .../apache/polygene/demo/twominute/Main.java    |   45 +
 .../apache/polygene/demo/twominute/Speaker.java |   30 +
 .../polygene/demo/twominute/SpeakerMixin.java   |   32 +
 .../org/apache/zest/demo/twominute/Main.java    |   45 -
 .../org/apache/zest/demo/twominute/Speaker.java |   30 -
 .../zest/demo/twominute/SpeakerMixin.java       |   32 -
 .../polygene/tutorials/services/step1/Book.java |   42 +
 .../tutorials/services/step1/Consumer.java      |   41 +
 .../tutorials/services/step1/Library.java       |   39 +
 .../tutorials/services/step1/package.html       |   50 +
 .../polygene/tutorials/services/step2/Book.java |   31 +
 .../tutorials/services/step2/Consumer.java      |   39 +
 .../tutorials/services/step2/Library.java       |   27 +
 .../tutorials/services/step2/LibraryMixin.java  |   49 +
 .../services/step2/LibraryService.java          |   29 +
 .../tutorials/services/step2/package.html       |   61 +
 .../polygene/tutorials/services/step3/Book.java |   31 +
 .../tutorials/services/step3/Consumer.java      |   39 +
 .../tutorials/services/step3/Library.java       |   29 +
 .../services/step3/LibraryActivator.java        |   36 +
 .../tutorials/services/step3/LibraryMixin.java  |  103 +
 .../services/step3/LibraryService.java          |   31 +
 .../tutorials/services/step3/package.html       |   77 +
 .../polygene/tutorials/services/step4/Book.java |   31 +
 .../tutorials/services/step4/Consumer.java      |   39 +
 .../tutorials/services/step4/Library.java       |   27 +
 .../services/step4/LibraryConfiguration.java    |   33 +
 .../tutorials/services/step4/LibraryMixin.java  |  108 +
 .../services/step4/LibraryService.java          |   29 +
 .../polygene/tutorials/services/step5/Book.java |   31 +
 .../tutorials/services/step5/Consumer.java      |   39 +
 .../tutorials/services/step5/Library.java       |   27 +
 .../services/step5/LibraryService.java          |  130 ++
 .../polygene/tutorials/services/step6/Book.java |   31 +
 .../tutorials/services/step6/Consumer.java      |   39 +
 .../tutorials/services/step6/Library.java       |   27 +
 .../services/step6/LibraryService.java          |  122 ++
 .../zest/tutorials/services/step1/Book.java     |   42 -
 .../zest/tutorials/services/step1/Consumer.java |   41 -
 .../zest/tutorials/services/step1/Library.java  |   39 -
 .../zest/tutorials/services/step1/package.html  |   50 -
 .../zest/tutorials/services/step2/Book.java     |   31 -
 .../zest/tutorials/services/step2/Consumer.java |   39 -
 .../zest/tutorials/services/step2/Library.java  |   27 -
 .../tutorials/services/step2/LibraryMixin.java  |   49 -
 .../services/step2/LibraryService.java          |   29 -
 .../zest/tutorials/services/step2/package.html  |   61 -
 .../zest/tutorials/services/step3/Book.java     |   31 -
 .../zest/tutorials/services/step3/Consumer.java |   39 -
 .../zest/tutorials/services/step3/Library.java  |   29 -
 .../services/step3/LibraryActivator.java        |   36 -
 .../tutorials/services/step3/LibraryMixin.java  |  103 -
 .../services/step3/LibraryService.java          |   31 -
 .../zest/tutorials/services/step3/package.html  |   77 -
 .../zest/tutorials/services/step4/Book.java     |   31 -
 .../zest/tutorials/services/step4/Consumer.java |   39 -
 .../zest/tutorials/services/step4/Library.java  |   27 -
 .../services/step4/LibraryConfiguration.java    |   33 -
 .../tutorials/services/step4/LibraryMixin.java  |  108 -
 .../services/step4/LibraryService.java          |   29 -
 .../zest/tutorials/services/step5/Book.java     |   31 -
 .../zest/tutorials/services/step5/Consumer.java |   39 -
 .../zest/tutorials/services/step5/Library.java  |   27 -
 .../services/step5/LibraryService.java          |  130 --
 .../zest/tutorials/services/step6/Book.java     |   31 -
 .../zest/tutorials/services/step6/Consumer.java |   39 -
 .../zest/tutorials/services/step6/Library.java  |   27 -
 .../services/step6/LibraryService.java          |  122 --
 .../services/step4/LibraryService.properties    |   25 +
 .../services/step5/LibraryService.properties    |   25 +
 .../tutorials/services/step6/Library.properties |   25 +
 .../services/step4/LibraryService.properties    |   25 -
 .../services/step5/LibraryService.properties    |   25 -
 .../tutorials/services/step6/Library.properties |   25 -
 .../tutorials/services/step1/LibraryTest.java   |   33 +
 .../tutorials/services/step2/LibraryTest.java   |   46 +
 .../tutorials/services/step3/LibraryTest.java   |   46 +
 .../tutorials/services/step4/LibraryTest.java   |   49 +
 .../tutorials/services/step5/LibraryTest.java   |   49 +
 .../tutorials/services/step6/LibraryTest.java   |   49 +
 .../tutorials/services/step1/LibraryTest.java   |   33 -
 .../tutorials/services/step2/LibraryTest.java   |   46 -
 .../tutorials/services/step3/LibraryTest.java   |   46 -
 .../tutorials/services/step4/LibraryTest.java   |   49 -
 .../tutorials/services/step5/LibraryTest.java   |   49 -
 .../tutorials/services/step6/LibraryTest.java   |   49 -
 5257 files changed, 235065 insertions(+), 235237 deletions(-)
----------------------------------------------------------------------



[66/81] [abbrv] zest-java git commit: ZEST-195 ; Fix file names.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToUtil.java
deleted file mode 100644
index fd56b6b..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/appliesTo/common/ZestAppliesToUtil.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.appliesTo.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collections;
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO;
-import static org.apache.polygene.ide.plugin.idea.appliesTo.common.PolygeneAppliesToConstants.QUALIFIED_NAME_APPLIES_TO_FILTER;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneAppliesToUtil
-{
-    /**
-     * @param searchContext Search context.
-     * @return {@code AppliesToFilter} class given the search context. {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getAppliesToFilterClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getAppliesToFilterClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code AppliesToFilter} class given {@code project} and {@code scope} parameters.
-     *         Returns {@code null} if not found.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getAppliesToFilterClass( @NotNull Project project,
-                                                    @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_APPLIES_TO_FILTER, scope );
-    }
-
-    /**
-     * @param elementWithinJavaClass element within java class.
-     * @return {@code @AppliesTo} annotation declaration of the class that contains the element.
-     *         Returns {@code null} if not found, or {@code element} is an invalid context.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getAppliesToAnnotation( @NotNull PsiElement elementWithinJavaClass )
-    {
-        PsiClass psiClass = getPSIClass( elementWithinJavaClass );
-        return findAnnotation( psiClass, QUALIFIED_NAME_APPLIES_TO );
-    }
-
-    /**
-     * @param annotation annotation to process.
-     * @return {@code @AppliesTo} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is
-     *         {@code null} or annotation is not a {@code @AppliesTo} annotation.
-     * @since 0.1
-     */
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getAppliesToAnnotationValue( @Nullable PsiAnnotation annotation )
-    {
-        if( annotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = annotation.getQualifiedName();
-        if( !QUALIFIED_NAME_APPLIES_TO.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( annotation );
-    }
-
-    /**
-     * @param value annotation member value.
-     * @return Applies to class reference given the {@code value} parameter. Returns {@code null} if it's not a
-     *         class reference.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiJavaCodeReferenceElement getAppliesToValueClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * Returns a {@code boolean} indicator whether the specified {@code psiClass} is implements
-     * {@code AppliesToFilter} class.
-     *
-     * @param psiClass             class to check.
-     * @param appliesToFilterClass {@code AppliesToFilter} class.
-     * @return {@code true} if {@code psiClass} implements {@code AppliesToFilter} class, {@code false} otherwise.
-     * @since 0.1
-     */
-    public static boolean isAnAppliesToFilter( @NotNull PsiClass psiClass, @NotNull PsiClass appliesToFilterClass )
-    {
-        return !psiClass.isInterface() && psiClass.isInheritor( appliesToFilterClass, true );
-    }
-
-    private PolygeneAppliesToUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
new file mode 100644
index 0000000..d53e0e1
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/PolygeneCreateActionGroup.java
@@ -0,0 +1,82 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.actions;
+
+import com.intellij.ide.IdeView;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.psi.JavaDirectoryService;
+import com.intellij.psi.PsiDirectory;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneCreateActionGroup extends DefaultActionGroup
+{
+    public PolygeneCreateActionGroup()
+    {
+        super( message( "polygene.action.group.title" ), true );
+        getTemplatePresentation().setDescription( message( "polygene.action.group.description" ) );
+    }
+
+    public void update( AnActionEvent e )
+    {
+        Presentation presentation = e.getPresentation();
+        presentation.setVisible( shouldActionGroupVisible( e ) );
+    }
+
+    private boolean shouldActionGroupVisible( AnActionEvent e )
+    {
+        Module module = e.getData( LangDataKeys.MODULE );
+        if( module == null )
+        {
+            return false;
+        }
+
+        // TODO: Enable this once PolygeneFacet can be automatically added/removed
+//        if( PolygeneFacet.getInstance( module ) == null )
+//        {
+//            return false;
+//        }
+
+        // Are we on IDE View and under project source folder?
+        Project project = e.getData( PlatformDataKeys.PROJECT );
+        IdeView view = e.getData( LangDataKeys.IDE_VIEW );
+        if( view != null && project != null )
+        {
+            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance( project ).getFileIndex();
+            PsiDirectory[] dirs = view.getDirectories();
+            for( PsiDirectory dir : dirs )
+            {
+                if( projectFileIndex.isInSourceContent( dir.getVirtualFile() ) && JavaDirectoryService.getInstance().getPackage( dir ) != null )
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
deleted file mode 100644
index d53e0e1..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.actions;
-
-import com.intellij.ide.IdeView;
-import com.intellij.openapi.actionSystem.*;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.roots.ProjectFileIndex;
-import com.intellij.openapi.roots.ProjectRootManager;
-import com.intellij.psi.JavaDirectoryService;
-import com.intellij.psi.PsiDirectory;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneCreateActionGroup extends DefaultActionGroup
-{
-    public PolygeneCreateActionGroup()
-    {
-        super( message( "polygene.action.group.title" ), true );
-        getTemplatePresentation().setDescription( message( "polygene.action.group.description" ) );
-    }
-
-    public void update( AnActionEvent e )
-    {
-        Presentation presentation = e.getPresentation();
-        presentation.setVisible( shouldActionGroupVisible( e ) );
-    }
-
-    private boolean shouldActionGroupVisible( AnActionEvent e )
-    {
-        Module module = e.getData( LangDataKeys.MODULE );
-        if( module == null )
-        {
-            return false;
-        }
-
-        // TODO: Enable this once PolygeneFacet can be automatically added/removed
-//        if( PolygeneFacet.getInstance( module ) == null )
-//        {
-//            return false;
-//        }
-
-        // Are we on IDE View and under project source folder?
-        Project project = e.getData( PlatformDataKeys.PROJECT );
-        IdeView view = e.getData( LangDataKeys.IDE_VIEW );
-        if( view != null && project != null )
-        {
-            ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance( project ).getFileIndex();
-            PsiDirectory[] dirs = view.getDirectories();
-            for( PsiDirectory dir : dirs )
-            {
-                if( projectFileIndex.isInSourceContent( dir.getVirtualFile() ) && JavaDirectoryService.getInstance().getPackage( dir ) != null )
-                {
-                    return true;
-                }
-            }
-        }
-
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
new file mode 100644
index 0000000..7342707
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacet.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.Facet;
+import com.intellij.facet.FacetManager;
+import com.intellij.facet.FacetType;
+import com.intellij.openapi.module.Module;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacet extends Facet<PolygeneFacetConfiguration>
+{
+    public PolygeneFacet( @NotNull FacetType facetType,
+                      @NotNull Module module,
+                      String name,
+                      @NotNull PolygeneFacetConfiguration configuration,
+                      Facet underlyingFacet
+    )
+    {
+        super( facetType, module, name, configuration, underlyingFacet );
+    }
+
+    @Nullable
+    public static PolygeneFacet getInstance( @NotNull Module module )
+    {
+        return FacetManager.getInstance( module ).getFacetByType( PolygeneFacetType.ID );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
new file mode 100644
index 0000000..6a6f28e
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetConfiguration.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.FacetConfiguration;
+import com.intellij.facet.ui.FacetEditorContext;
+import com.intellij.facet.ui.FacetEditorTab;
+import com.intellij.facet.ui.FacetValidatorsManager;
+import com.intellij.openapi.util.InvalidDataException;
+import com.intellij.openapi.util.WriteExternalException;
+import org.jdom.Element;
+import org.apache.polygene.ide.plugin.idea.common.facet.ui.PolygeneFacetEditorTab;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetConfiguration
+    implements FacetConfiguration
+{
+    public FacetEditorTab[] createEditorTabs( FacetEditorContext editorContext,
+                                              FacetValidatorsManager validatorsManager )
+    {
+        return new FacetEditorTab[]{
+            new PolygeneFacetEditorTab( editorContext )
+        };
+    }
+
+    public final void readExternal( Element element )
+        throws InvalidDataException
+    {
+        // Do nothing
+    }
+
+    public final void writeExternal( Element element )
+        throws WriteExternalException
+    {
+        // Do nothing
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
new file mode 100644
index 0000000..b45de9f
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/PolygeneFacetType.java
@@ -0,0 +1,122 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet;
+
+import com.intellij.facet.Facet;
+import com.intellij.facet.FacetType;
+import com.intellij.facet.FacetTypeId;
+import com.intellij.facet.autodetecting.FacetDetector;
+import com.intellij.facet.autodetecting.FacetDetectorRegistry;
+import com.intellij.openapi.fileTypes.StdFileTypes;
+import com.intellij.openapi.module.JavaModuleType;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleType;
+import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.vfs.VirtualFileFilter;
+import com.intellij.psi.JavaElementVisitor;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiImportStatement;
+import com.intellij.psi.PsiReferenceExpression;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetType extends FacetType<PolygeneFacet, PolygeneFacetConfiguration>
+{
+    public static final FacetTypeId<PolygeneFacet> ID = new FacetTypeId<PolygeneFacet>();
+
+    public PolygeneFacetType()
+    {
+        super( ID, "PolygeneFacet", "Polygene Facet" );
+    }
+
+    public final PolygeneFacetConfiguration createDefaultConfiguration()
+    {
+        return new PolygeneFacetConfiguration();
+    }
+
+    public final PolygeneFacet createFacet( @NotNull Module module,
+                                        String name,
+                                        @NotNull PolygeneFacetConfiguration configuration,
+                                        @Nullable Facet underlyingFacet )
+    {
+        return new PolygeneFacet( this, module, name, configuration, underlyingFacet );
+    }
+
+    public final boolean isSuitableModuleType( ModuleType moduleType )
+    {
+        return moduleType instanceof JavaModuleType;
+    }
+
+    @Override
+    public final void registerDetectors( FacetDetectorRegistry<PolygeneFacetConfiguration> registry )
+    {
+        registry.registerOnTheFlyDetector(
+            StdFileTypes.JAVA, VirtualFileFilter.ALL, new HasPolygeneImportPackageCondition(),
+            new FacetDetector<PsiFile, PolygeneFacetConfiguration>( "PolygeneFacetDetector" )
+            {
+                @Override
+                public PolygeneFacetConfiguration detectFacet( PsiFile source,
+                                                           Collection<PolygeneFacetConfiguration> existingConfigurations )
+                {
+                    if( !existingConfigurations.isEmpty() )
+                    {
+                        return existingConfigurations.iterator().next();
+                    }
+
+                    return createDefaultConfiguration();
+                }
+            }
+        );
+    }
+
+    private static class HasPolygeneImportPackageCondition
+        implements Condition<PsiFile>
+    {
+        public final boolean value( PsiFile psiFile )
+        {
+            final boolean[] hasPolygeneImportPackage = new boolean[]{ false };
+
+            psiFile.accept( new JavaElementVisitor()
+            {
+                @Override
+                public final void visitImportStatement( PsiImportStatement statement )
+                {
+                    String packageName = statement.getQualifiedName();
+                    if( packageName != null && packageName.startsWith( "org.apache.polygene" ) )
+                    {
+                        hasPolygeneImportPackage[ 0 ] = true;
+                    }
+                }
+
+                @Override
+                public void visitReferenceExpression( PsiReferenceExpression expression )
+                {
+                    // Ignore
+                }
+            } );
+            return hasPolygeneImportPackage[ 0 ];
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacet.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacet.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacet.java
deleted file mode 100644
index 7342707..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacet.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetManager;
-import com.intellij.facet.FacetType;
-import com.intellij.openapi.module.Module;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacet extends Facet<PolygeneFacetConfiguration>
-{
-    public PolygeneFacet( @NotNull FacetType facetType,
-                      @NotNull Module module,
-                      String name,
-                      @NotNull PolygeneFacetConfiguration configuration,
-                      Facet underlyingFacet
-    )
-    {
-        super( facetType, module, name, configuration, underlyingFacet );
-    }
-
-    @Nullable
-    public static PolygeneFacet getInstance( @NotNull Module module )
-    {
-        return FacetManager.getInstance( module ).getFacetByType( PolygeneFacetType.ID );
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetConfiguration.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetConfiguration.java
deleted file mode 100644
index 6a6f28e..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.FacetConfiguration;
-import com.intellij.facet.ui.FacetEditorContext;
-import com.intellij.facet.ui.FacetEditorTab;
-import com.intellij.facet.ui.FacetValidatorsManager;
-import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.WriteExternalException;
-import org.jdom.Element;
-import org.apache.polygene.ide.plugin.idea.common.facet.ui.PolygeneFacetEditorTab;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetConfiguration
-    implements FacetConfiguration
-{
-    public FacetEditorTab[] createEditorTabs( FacetEditorContext editorContext,
-                                              FacetValidatorsManager validatorsManager )
-    {
-        return new FacetEditorTab[]{
-            new PolygeneFacetEditorTab( editorContext )
-        };
-    }
-
-    public final void readExternal( Element element )
-        throws InvalidDataException
-    {
-        // Do nothing
-    }
-
-    public final void writeExternal( Element element )
-        throws WriteExternalException
-    {
-        // Do nothing
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetType.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetType.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetType.java
deleted file mode 100644
index b45de9f..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ZestFacetType.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet;
-
-import com.intellij.facet.Facet;
-import com.intellij.facet.FacetType;
-import com.intellij.facet.FacetTypeId;
-import com.intellij.facet.autodetecting.FacetDetector;
-import com.intellij.facet.autodetecting.FacetDetectorRegistry;
-import com.intellij.openapi.fileTypes.StdFileTypes;
-import com.intellij.openapi.module.JavaModuleType;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleType;
-import com.intellij.openapi.util.Condition;
-import com.intellij.openapi.vfs.VirtualFileFilter;
-import com.intellij.psi.JavaElementVisitor;
-import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiImportStatement;
-import com.intellij.psi.PsiReferenceExpression;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetType extends FacetType<PolygeneFacet, PolygeneFacetConfiguration>
-{
-    public static final FacetTypeId<PolygeneFacet> ID = new FacetTypeId<PolygeneFacet>();
-
-    public PolygeneFacetType()
-    {
-        super( ID, "PolygeneFacet", "Polygene Facet" );
-    }
-
-    public final PolygeneFacetConfiguration createDefaultConfiguration()
-    {
-        return new PolygeneFacetConfiguration();
-    }
-
-    public final PolygeneFacet createFacet( @NotNull Module module,
-                                        String name,
-                                        @NotNull PolygeneFacetConfiguration configuration,
-                                        @Nullable Facet underlyingFacet )
-    {
-        return new PolygeneFacet( this, module, name, configuration, underlyingFacet );
-    }
-
-    public final boolean isSuitableModuleType( ModuleType moduleType )
-    {
-        return moduleType instanceof JavaModuleType;
-    }
-
-    @Override
-    public final void registerDetectors( FacetDetectorRegistry<PolygeneFacetConfiguration> registry )
-    {
-        registry.registerOnTheFlyDetector(
-            StdFileTypes.JAVA, VirtualFileFilter.ALL, new HasPolygeneImportPackageCondition(),
-            new FacetDetector<PsiFile, PolygeneFacetConfiguration>( "PolygeneFacetDetector" )
-            {
-                @Override
-                public PolygeneFacetConfiguration detectFacet( PsiFile source,
-                                                           Collection<PolygeneFacetConfiguration> existingConfigurations )
-                {
-                    if( !existingConfigurations.isEmpty() )
-                    {
-                        return existingConfigurations.iterator().next();
-                    }
-
-                    return createDefaultConfiguration();
-                }
-            }
-        );
-    }
-
-    private static class HasPolygeneImportPackageCondition
-        implements Condition<PsiFile>
-    {
-        public final boolean value( PsiFile psiFile )
-        {
-            final boolean[] hasPolygeneImportPackage = new boolean[]{ false };
-
-            psiFile.accept( new JavaElementVisitor()
-            {
-                @Override
-                public final void visitImportStatement( PsiImportStatement statement )
-                {
-                    String packageName = statement.getQualifiedName();
-                    if( packageName != null && packageName.startsWith( "org.apache.polygene" ) )
-                    {
-                        hasPolygeneImportPackage[ 0 ] = true;
-                    }
-                }
-
-                @Override
-                public void visitReferenceExpression( PsiReferenceExpression expression )
-                {
-                    // Ignore
-                }
-            } );
-            return hasPolygeneImportPackage[ 0 ];
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
new file mode 100644
index 0000000..dc4b121
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/PolygeneFacetEditorTab.java
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.facet.ui;
+
+import com.intellij.facet.ui.FacetEditorContext;
+import com.intellij.facet.ui.FacetEditorTab;
+import com.intellij.openapi.options.ConfigurationException;
+import org.jetbrains.annotations.Nls;
+
+import javax.swing.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneFacetEditorTab extends FacetEditorTab
+{
+    private final FacetEditorContext editorContext;
+
+    public PolygeneFacetEditorTab( FacetEditorContext aContext )
+    {
+        editorContext = aContext;
+    }
+
+    @Nls
+    public final String getDisplayName()
+    {
+        return "Polygene";
+    }
+
+    public JComponent createComponent()
+    {
+        return new JPanel();
+    }
+
+    public final boolean isModified()
+    {
+        return false;
+    }
+
+    public final void apply()
+        throws ConfigurationException
+    {
+        // From UI to configuration
+    }
+
+    public final void reset()
+    {
+        // From Configuration to UI
+    }
+
+    public final void disposeUIResources()
+    {
+        // Do nothing for now
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/ZestFacetEditorTab.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/ZestFacetEditorTab.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/ZestFacetEditorTab.java
deleted file mode 100644
index dc4b121..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/facet/ui/ZestFacetEditorTab.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.facet.ui;
-
-import com.intellij.facet.ui.FacetEditorContext;
-import com.intellij.facet.ui.FacetEditorTab;
-import com.intellij.openapi.options.ConfigurationException;
-import org.jetbrains.annotations.Nls;
-
-import javax.swing.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneFacetEditorTab extends FacetEditorTab
-{
-    private final FacetEditorContext editorContext;
-
-    public PolygeneFacetEditorTab( FacetEditorContext aContext )
-    {
-        editorContext = aContext;
-    }
-
-    @Nls
-    public final String getDisplayName()
-    {
-        return "Polygene";
-    }
-
-    public JComponent createComponent()
-    {
-        return new JPanel();
-    }
-
-    public final boolean isModified()
-    {
-        return false;
-    }
-
-    public final void apply()
-        throws ConfigurationException
-    {
-        // From UI to configuration
-    }
-
-    public final void reset()
-    {
-        // From Configuration to UI
-    }
-
-    public final void disposeUIResources()
-    {
-        // Do nothing for now
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
new file mode 100644
index 0000000..c5f29b4
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.java
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.common.resource;
+
+import com.intellij.CommonBundle;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.PropertyKey;
+
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
+import java.util.ResourceBundle;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneResourceBundle
+{
+
+    @NonNls
+    private static final String RESOURCE_BUNDLE_NAME = "org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle";
+
+    private static Reference<ResourceBundle> BUNDLE_REF;
+
+    private PolygeneResourceBundle()
+    {
+    }
+
+    public static String message( @PropertyKey( resourceBundle = RESOURCE_BUNDLE_NAME ) String key,
+                                  Object... params )
+    {
+        ResourceBundle resourceBundle = getBundle();
+        return CommonBundle.message( resourceBundle, key, params );
+    }
+
+    private static ResourceBundle getBundle()
+    {
+        ResourceBundle bundle = null;
+        if( BUNDLE_REF != null )
+        {
+            bundle = BUNDLE_REF.get();
+        }
+
+        if( bundle == null )
+        {
+            bundle = ResourceBundle.getBundle( PolygeneResourceBundle.class.getName() );
+            BUNDLE_REF = new SoftReference<ResourceBundle>( bundle );
+        }
+
+        return bundle;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.java
deleted file mode 100644
index c5f29b4..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.common.resource;
-
-import com.intellij.CommonBundle;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.PropertyKey;
-
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-import java.util.ResourceBundle;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneResourceBundle
-{
-
-    @NonNls
-    private static final String RESOURCE_BUNDLE_NAME = "org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle";
-
-    private static Reference<ResourceBundle> BUNDLE_REF;
-
-    private PolygeneResourceBundle()
-    {
-    }
-
-    public static String message( @PropertyKey( resourceBundle = RESOURCE_BUNDLE_NAME ) String key,
-                                  Object... params )
-    {
-        ResourceBundle resourceBundle = getBundle();
-        return CommonBundle.message( resourceBundle, key, params );
-    }
-
-    private static ResourceBundle getBundle()
-    {
-        ResourceBundle bundle = null;
-        if( BUNDLE_REF != null )
-        {
-            bundle = BUNDLE_REF.get();
-        }
-
-        if( bundle == null )
-        {
-            bundle = ResourceBundle.getBundle( PolygeneResourceBundle.class.getName() );
-            BUNDLE_REF = new SoftReference<ResourceBundle>( bundle );
-        }
-
-        return bundle;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
new file mode 100644
index 0000000..0bbe3a1
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernConstants.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.common;
+
+import org.jetbrains.annotations.NonNls;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneConcernConstants
+{
+    public static final String QUALIFIED_NAME_CONCERNS = "org.apache.polygene.api.concern.Concerns";
+
+    public static final String QUALIFIED_NAME_CONCERN_OF = "org.apache.polygene.api.concern.ConcernOf";
+    public static final String QUALIFIED_NAME_GENERIC_CONCERN = "org.apache.polygene.api.concern.GenericConcern";
+
+    @NonNls
+    public static final String TEMPLATE_GENERIC_CONCERN_OF = "GenericConcernOf.java";
+
+    private PolygeneConcernConstants()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
new file mode 100644
index 0000000..4499143
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/PolygeneConcernUtil.java
@@ -0,0 +1,228 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.concerns.common;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.*;
+import com.intellij.psi.codeStyle.JavaCodeStyleManager;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static java.util.Collections.emptyList;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
+import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.*;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneConcernUtil
+{
+
+
+    /**
+     * @param searchContext Search context.
+     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericConcernClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getGenericConcernClass( project, searchScope );
+    }
+
+    /**
+     * @param project project.
+     * @param scope   search scope.
+     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiClass getGenericConcernClass( @NotNull Project project,
+                                                   @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_GENERIC_CONCERN, scope ) : null;
+    }
+
+    @Nullable
+    public static PsiClass getConcernOfClass( @NotNull PsiElement searchContext )
+    {
+        Project project = searchContext.getProject();
+        GlobalSearchScope searchScope = determineSearchScope( searchContext );
+        return getConcernOfClass( project, searchScope );
+    }
+
+    @Nullable
+    public static PsiClass getConcernOfClass( @NotNull Project project,
+                                              @Nullable GlobalSearchScope scope )
+    {
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_CONCERN_OF, scope ) : null;
+    }
+
+    @Nullable
+    public static PsiAnnotation getConcernsAnnotation( @NotNull PsiElement element )
+    {
+        PsiClass psiClass = getPSIClass( element );
+        return findAnnotation( psiClass, QUALIFIED_NAME_CONCERNS );
+    }
+
+    @NotNull
+    public static PsiAnnotation addOrReplaceConcernAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
+                                                               @NotNull PsiClass concernClassToAdd )
+    {
+        Project project = modifierListOwner.getProject();
+        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
+        PsiElementFactory factory = psiFacade.getElementFactory();
+        PsiAnnotation existingConcernsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_CONCERNS );
+
+        boolean isReplace = false;
+        PsiAnnotation newConcernsAnnotation;
+        if( existingConcernsAnnotation != null )
+        {
+            // Check duplicate
+            List<PsiAnnotationMemberValue> concernsValues = getConcernsAnnotationValue( existingConcernsAnnotation );
+            for( PsiAnnotationMemberValue concernValue : concernsValues )
+            {
+                PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernValue );
+                if( concernClassReference == null )
+                {
+                    continue;
+                }
+
+                PsiElement concernClass = concernClassReference.resolve();
+                if( concernClassToAdd.equals( concernClass ) )
+                {
+                    return existingConcernsAnnotation;
+                }
+            }
+
+            isReplace = true;
+        }
+
+        String concernAnnotationText = createConcernAnnotationText( existingConcernsAnnotation, concernClassToAdd );
+        newConcernsAnnotation =
+            factory.createAnnotationFromText( concernAnnotationText, modifierListOwner );
+
+        if( isReplace )
+        {
+            // Replace @Concerns instead
+            existingConcernsAnnotation.replace( newConcernsAnnotation );
+        }
+        else
+        {
+            // @Concerns doesn't exists, add it as first child
+            PsiModifierList modifierList = modifierListOwner.getModifierList();
+            modifierList.addBefore( newConcernsAnnotation, modifierList.getFirstChild() );
+        }
+
+        // Shorten all class references if possible
+        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
+        codeStyleManager.shortenClassReferences( newConcernsAnnotation );
+
+        return newConcernsAnnotation;
+    }
+
+    @NotNull
+    private static String createConcernAnnotationText( @Nullable PsiAnnotation concernAnnotationBase,
+                                                       @NotNull PsiClass concernClassToAdd )
+    {
+        StringBuilder annotationTextBuilder = new StringBuilder();
+        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_CONCERNS ).append( "( {" );
+        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernAnnotationBase );
+        for( PsiAnnotationMemberValue concernValue : concernsAnnotationValue )
+        {
+            annotationTextBuilder.append( concernValue.getText() ).append( ", " );
+        }
+        annotationTextBuilder.append( concernClassToAdd.getQualifiedName() ).append( ".class" );
+        annotationTextBuilder.append( "} )" );
+        return annotationTextBuilder.toString();
+    }
+
+    @NotNull
+    public static List<PsiAnnotationMemberValue> getConcernsAnnotationValue( @Nullable PsiAnnotation concernsAnnotation )
+    {
+        if( concernsAnnotation == null )
+        {
+            return emptyList();
+        }
+
+        String concernsQualifiedName = concernsAnnotation.getQualifiedName();
+        if( !QUALIFIED_NAME_CONCERNS.equals( concernsQualifiedName ) )
+        {
+            return emptyList();
+        }
+
+        return getAnnotationDefaultParameterValue( concernsAnnotation );
+    }
+
+    @Nullable
+    public static PsiJavaCodeReferenceElement getConcernClassReference( @NotNull PsiAnnotationMemberValue value )
+    {
+        return getClassReference( value );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} extends {@code ConcernOf}, {@code false} if {@code psiClass} does
+     *         not extends {@code ConcernOf} or {@code ConcernOf} is not found.
+     * @since 0.1
+     */
+    public static boolean isAConcern( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass concernOfClass = getConcernOfClass( psiClass );
+        return concernOfClass != null && psiClass.isInheritor( concernOfClass, true );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if {@code psiClass} extends {@code GenericConcern}, {@code false} if {@code psiClass} does
+     *         not extends {@code GenericConcern} or {@code GenericConcern} is not found.
+     * @since 0.1
+     */
+    public static boolean isAGenericConcern( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isInterface() )
+        {
+            return false;
+        }
+
+        PsiClass genericConcern = getGenericConcernClass( psiClass );
+        return genericConcern != null && psiClass.isInheritor( genericConcern, true );
+    }
+
+    private PolygeneConcernUtil()
+    {
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernConstants.java
deleted file mode 100644
index 0bbe3a1..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernConstants.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.common;
-
-import org.jetbrains.annotations.NonNls;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneConcernConstants
-{
-    public static final String QUALIFIED_NAME_CONCERNS = "org.apache.polygene.api.concern.Concerns";
-
-    public static final String QUALIFIED_NAME_CONCERN_OF = "org.apache.polygene.api.concern.ConcernOf";
-    public static final String QUALIFIED_NAME_GENERIC_CONCERN = "org.apache.polygene.api.concern.GenericConcern";
-
-    @NonNls
-    public static final String TEMPLATE_GENERIC_CONCERN_OF = "GenericConcernOf.java";
-
-    private PolygeneConcernConstants()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernUtil.java
deleted file mode 100644
index 4499143..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/concerns/common/ZestConcernUtil.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.concerns.common;
-
-import com.intellij.openapi.project.Project;
-import com.intellij.psi.*;
-import com.intellij.psi.codeStyle.JavaCodeStyleManager;
-import com.intellij.psi.search.GlobalSearchScope;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.List;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static java.util.Collections.emptyList;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope;
-import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernConstants.*;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneConcernUtil
-{
-
-
-    /**
-     * @param searchContext Search context.
-     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericConcernClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getGenericConcernClass( project, searchScope );
-    }
-
-    /**
-     * @param project project.
-     * @param scope   search scope.
-     * @return {@code GenericConcern} psi class if found, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiClass getGenericConcernClass( @NotNull Project project,
-                                                   @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_GENERIC_CONCERN, scope ) : null;
-    }
-
-    @Nullable
-    public static PsiClass getConcernOfClass( @NotNull PsiElement searchContext )
-    {
-        Project project = searchContext.getProject();
-        GlobalSearchScope searchScope = determineSearchScope( searchContext );
-        return getConcernOfClass( project, searchScope );
-    }
-
-    @Nullable
-    public static PsiClass getConcernOfClass( @NotNull Project project,
-                                              @Nullable GlobalSearchScope scope )
-    {
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        return scope != null ? psiFacade.findClass( QUALIFIED_NAME_CONCERN_OF, scope ) : null;
-    }
-
-    @Nullable
-    public static PsiAnnotation getConcernsAnnotation( @NotNull PsiElement element )
-    {
-        PsiClass psiClass = getPSIClass( element );
-        return findAnnotation( psiClass, QUALIFIED_NAME_CONCERNS );
-    }
-
-    @NotNull
-    public static PsiAnnotation addOrReplaceConcernAnnotation( @NotNull PsiModifierListOwner modifierListOwner,
-                                                               @NotNull PsiClass concernClassToAdd )
-    {
-        Project project = modifierListOwner.getProject();
-        JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project );
-        PsiElementFactory factory = psiFacade.getElementFactory();
-        PsiAnnotation existingConcernsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_CONCERNS );
-
-        boolean isReplace = false;
-        PsiAnnotation newConcernsAnnotation;
-        if( existingConcernsAnnotation != null )
-        {
-            // Check duplicate
-            List<PsiAnnotationMemberValue> concernsValues = getConcernsAnnotationValue( existingConcernsAnnotation );
-            for( PsiAnnotationMemberValue concernValue : concernsValues )
-            {
-                PsiJavaCodeReferenceElement concernClassReference = getConcernClassReference( concernValue );
-                if( concernClassReference == null )
-                {
-                    continue;
-                }
-
-                PsiElement concernClass = concernClassReference.resolve();
-                if( concernClassToAdd.equals( concernClass ) )
-                {
-                    return existingConcernsAnnotation;
-                }
-            }
-
-            isReplace = true;
-        }
-
-        String concernAnnotationText = createConcernAnnotationText( existingConcernsAnnotation, concernClassToAdd );
-        newConcernsAnnotation =
-            factory.createAnnotationFromText( concernAnnotationText, modifierListOwner );
-
-        if( isReplace )
-        {
-            // Replace @Concerns instead
-            existingConcernsAnnotation.replace( newConcernsAnnotation );
-        }
-        else
-        {
-            // @Concerns doesn't exists, add it as first child
-            PsiModifierList modifierList = modifierListOwner.getModifierList();
-            modifierList.addBefore( newConcernsAnnotation, modifierList.getFirstChild() );
-        }
-
-        // Shorten all class references if possible
-        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
-        codeStyleManager.shortenClassReferences( newConcernsAnnotation );
-
-        return newConcernsAnnotation;
-    }
-
-    @NotNull
-    private static String createConcernAnnotationText( @Nullable PsiAnnotation concernAnnotationBase,
-                                                       @NotNull PsiClass concernClassToAdd )
-    {
-        StringBuilder annotationTextBuilder = new StringBuilder();
-        annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_CONCERNS ).append( "( {" );
-        List<PsiAnnotationMemberValue> concernsAnnotationValue = getConcernsAnnotationValue( concernAnnotationBase );
-        for( PsiAnnotationMemberValue concernValue : concernsAnnotationValue )
-        {
-            annotationTextBuilder.append( concernValue.getText() ).append( ", " );
-        }
-        annotationTextBuilder.append( concernClassToAdd.getQualifiedName() ).append( ".class" );
-        annotationTextBuilder.append( "} )" );
-        return annotationTextBuilder.toString();
-    }
-
-    @NotNull
-    public static List<PsiAnnotationMemberValue> getConcernsAnnotationValue( @Nullable PsiAnnotation concernsAnnotation )
-    {
-        if( concernsAnnotation == null )
-        {
-            return emptyList();
-        }
-
-        String concernsQualifiedName = concernsAnnotation.getQualifiedName();
-        if( !QUALIFIED_NAME_CONCERNS.equals( concernsQualifiedName ) )
-        {
-            return emptyList();
-        }
-
-        return getAnnotationDefaultParameterValue( concernsAnnotation );
-    }
-
-    @Nullable
-    public static PsiJavaCodeReferenceElement getConcernClassReference( @NotNull PsiAnnotationMemberValue value )
-    {
-        return getClassReference( value );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} extends {@code ConcernOf}, {@code false} if {@code psiClass} does
-     *         not extends {@code ConcernOf} or {@code ConcernOf} is not found.
-     * @since 0.1
-     */
-    public static boolean isAConcern( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass concernOfClass = getConcernOfClass( psiClass );
-        return concernOfClass != null && psiClass.isInheritor( concernOfClass, true );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if {@code psiClass} extends {@code GenericConcern}, {@code false} if {@code psiClass} does
-     *         not extends {@code GenericConcern} or {@code GenericConcern} is not found.
-     * @since 0.1
-     */
-    public static boolean isAGenericConcern( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isInterface() )
-        {
-            return false;
-        }
-
-        PsiClass genericConcern = getGenericConcernClass( psiClass );
-        return genericConcern != null && psiClass.isInheritor( genericConcern, true );
-    }
-
-    private PolygeneConcernUtil()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
new file mode 100644
index 0000000..25c1267
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneInvocationAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_INVOCATION_ANNOTATION = "org.apache.polygene.api.injection.scope.Invocation";
+
+    private PolygeneInvocationAnnotationConstants()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
new file mode 100644
index 0000000..334918d
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/PolygeneInvocationAnnotationUtil.java
@@ -0,0 +1,129 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
+
+import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
+import static com.intellij.psi.PsiModifier.STATIC;
+import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
+import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult.*;
+import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneInvocationAnnotationUtil
+{
+    /**
+     * Returns {@code @Invocation} annotation if exists.
+     *
+     * @param modifierListOwner modifier list owner to process.
+     * @return {@code @Invocation} annotation if exists, {@code null} otherwise.
+     * @since 0.1
+     */
+    @Nullable
+    public static PsiAnnotation getInvocationAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
+    {
+        return findAnnotation( modifierListOwner, QUALIFIED_NAME_INVOCATION_ANNOTATION );
+    }
+
+    /**
+     * @param psiClass psi class to check.
+     * @return {@code true} if the specified psiClass is injectable by invocation annotation, {@code false} otherwise.
+     */
+    public static boolean isInjectableByInvocationAnnotation( @NotNull PsiClass psiClass )
+    {
+        if( psiClass.isAnnotationType() )
+        {
+            return true;
+        }
+
+        String classQualifiedName = psiClass.getQualifiedName();
+        return "java.lang.reflect.Method".equals( classQualifiedName ) ||
+               "java.lang.reflect.AnnotatedElement".equals( classQualifiedName );
+    }
+
+    /**
+     * Validates whether the variable has {@code @Invocation} annotation declared correctly.
+     *
+     * @param variable variable to check.
+     * @return Look at {@link InvocationAnnotationDeclarationValidationResult}.
+     * @since 0.1
+     */
+    @NotNull
+    public static InvocationAnnotationDeclarationValidationResult isValidInvocationAnnotationDeclaration(
+        @NotNull PsiVariable variable )
+    {
+        PsiAnnotation invocationAnnotation = getInvocationAnnotation( variable );
+        if( invocationAnnotation == null )
+        {
+            return invalidInvocationAnnotationNotDeclared;
+        }
+
+        PsiModifierList modifierList = variable.getModifierList();
+        if( modifierList != null )
+        {
+            if( modifierList.hasModifierProperty( STATIC ) )
+            {
+                return invalidDeclaredOnStaticVariable;
+            }
+        }
+
+        // TODO: Check whether variable is either an instance of java.lang.reflect.Method or
+        // java.lang.reflect.AnnotatedElement or Annotation
+        PsiTypeElement typeElement = variable.getTypeElement();
+        if( typeElement != null )
+        {
+            PsiClass psiClass = getPSIClass( typeElement );
+            if( psiClass != null )
+            {
+                if( !isInjectableByInvocationAnnotation( psiClass ) )
+                {
+                    // Can't be type that is injected by @Structure
+                    if( isInjecteableByStructureAnnotation( variable ) )
+                    {
+                        return invalidTypeIsInjectedViaStructureAnnotation;
+                    }
+
+                    return invalidType;
+                }
+            }
+        }
+
+        return valid;
+    }
+
+    public enum InvocationAnnotationDeclarationValidationResult
+    {
+        invalidInvocationAnnotationNotDeclared,
+        invalidDeclaredOnStaticVariable,
+        invalidTypeIsInjectedViaStructureAnnotation,
+        invalidType,
+        valid,
+    }
+
+    private PolygeneInvocationAnnotationUtil()
+    {
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationConstants.java
deleted file mode 100644
index 25c1267..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneInvocationAnnotationConstants
-{
-    public static final String QUALIFIED_NAME_INVOCATION_ANNOTATION = "org.apache.polygene.api.injection.scope.Invocation";
-
-    private PolygeneInvocationAnnotationConstants()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationUtil.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationUtil.java
deleted file mode 100644
index 334918d..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/invocation/common/ZestInvocationAnnotationUtil.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea.injections.invocation.common;
-
-import com.intellij.psi.*;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import static com.intellij.codeInsight.AnnotationUtil.findAnnotation;
-import static com.intellij.psi.PsiModifier.STATIC;
-import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationConstants.QUALIFIED_NAME_INVOCATION_ANNOTATION;
-import static org.apache.polygene.ide.plugin.idea.injections.invocation.common.PolygeneInvocationAnnotationUtil.InvocationAnnotationDeclarationValidationResult.*;
-import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneInvocationAnnotationUtil
-{
-    /**
-     * Returns {@code @Invocation} annotation if exists.
-     *
-     * @param modifierListOwner modifier list owner to process.
-     * @return {@code @Invocation} annotation if exists, {@code null} otherwise.
-     * @since 0.1
-     */
-    @Nullable
-    public static PsiAnnotation getInvocationAnnotation( @NotNull PsiModifierListOwner modifierListOwner )
-    {
-        return findAnnotation( modifierListOwner, QUALIFIED_NAME_INVOCATION_ANNOTATION );
-    }
-
-    /**
-     * @param psiClass psi class to check.
-     * @return {@code true} if the specified psiClass is injectable by invocation annotation, {@code false} otherwise.
-     */
-    public static boolean isInjectableByInvocationAnnotation( @NotNull PsiClass psiClass )
-    {
-        if( psiClass.isAnnotationType() )
-        {
-            return true;
-        }
-
-        String classQualifiedName = psiClass.getQualifiedName();
-        return "java.lang.reflect.Method".equals( classQualifiedName ) ||
-               "java.lang.reflect.AnnotatedElement".equals( classQualifiedName );
-    }
-
-    /**
-     * Validates whether the variable has {@code @Invocation} annotation declared correctly.
-     *
-     * @param variable variable to check.
-     * @return Look at {@link InvocationAnnotationDeclarationValidationResult}.
-     * @since 0.1
-     */
-    @NotNull
-    public static InvocationAnnotationDeclarationValidationResult isValidInvocationAnnotationDeclaration(
-        @NotNull PsiVariable variable )
-    {
-        PsiAnnotation invocationAnnotation = getInvocationAnnotation( variable );
-        if( invocationAnnotation == null )
-        {
-            return invalidInvocationAnnotationNotDeclared;
-        }
-
-        PsiModifierList modifierList = variable.getModifierList();
-        if( modifierList != null )
-        {
-            if( modifierList.hasModifierProperty( STATIC ) )
-            {
-                return invalidDeclaredOnStaticVariable;
-            }
-        }
-
-        // TODO: Check whether variable is either an instance of java.lang.reflect.Method or
-        // java.lang.reflect.AnnotatedElement or Annotation
-        PsiTypeElement typeElement = variable.getTypeElement();
-        if( typeElement != null )
-        {
-            PsiClass psiClass = getPSIClass( typeElement );
-            if( psiClass != null )
-            {
-                if( !isInjectableByInvocationAnnotation( psiClass ) )
-                {
-                    // Can't be type that is injected by @Structure
-                    if( isInjecteableByStructureAnnotation( variable ) )
-                    {
-                        return invalidTypeIsInjectedViaStructureAnnotation;
-                    }
-
-                    return invalidType;
-                }
-            }
-        }
-
-        return valid;
-    }
-
-    public enum InvocationAnnotationDeclarationValidationResult
-    {
-        invalidInvocationAnnotationNotDeclared,
-        invalidDeclaredOnStaticVariable,
-        invalidTypeIsInjectedViaStructureAnnotation,
-        invalidType,
-        valid,
-    }
-
-    private PolygeneInvocationAnnotationUtil()
-    {
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
new file mode 100644
index 0000000..5a95513
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationConstants.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea.injections.service.common;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneServiceAnnotationConstants
+{
+    public static final String QUALIFIED_NAME_SERVICE_ANNOTATION = "org.apache.polygene.api.injection.scope.Service";
+
+    private PolygeneServiceAnnotationConstants()
+    {
+    }
+}
\ No newline at end of file


[53/81] [abbrv] zest-java git commit: ZEST-195 ; Replace all "zest" with "polygene"

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/forum/build.gradle
----------------------------------------------------------------------
diff --git a/samples/forum/build.gradle b/samples/forum/build.gradle
index d217f9d..2cde092 100644
--- a/samples/forum/build.gradle
+++ b/samples/forum/build.gradle
@@ -25,18 +25,18 @@ description = "Sample of how to build a web forum"
 jar { manifest { name = "Apache Polygene\u2122 Sample - Forum" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.library( 'rest-server' )
-  compile zest.library( 'fileconfig' )
-  compile zest.extension( 'valueserialization-orgjson' )
-  compile zest.extension( 'entitystore-memory' )
-  compile zest.extension( 'entitystore-file' )
-  compile zest.extension( 'indexing-rdf' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'rest-server' )
+  compile polygene.library( 'fileconfig' )
+  compile polygene.extension( 'valueserialization-orgjson' )
+  compile polygene.extension( 'entitystore-memory' )
+  compile polygene.extension( 'entitystore-file' )
+  compile polygene.extension( 'indexing-rdf' )
   compile libraries.servlet_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/rental/build.gradle
----------------------------------------------------------------------
diff --git a/samples/rental/build.gradle b/samples/rental/build.gradle
index 67eb96b..88adfc4 100644
--- a/samples/rental/build.gradle
+++ b/samples/rental/build.gradle
@@ -28,15 +28,15 @@ description = "Sample of implementation of a Car Rental application."
 // To run in an embedded Jetty use:
 //      ../../gradlew appRun
 // And then go to:
-//      http://localhost:8080/org.apache.zest.sample.rental/rental/main
+//      http://localhost:8080/org.apache.polygene.sample.rental/rental/main
 
 jar { manifest { name = "Apache Polygene\u2122 Sample - Car Rental" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.extension( 'valueserialization-orgjson' )
+  compile polygene.core.bootstrap
+  compile polygene.extension( 'valueserialization-orgjson' )
 
   providedCompile libraries.servlet_api
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/QuikitServlet.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/QuikitServlet.java b/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/QuikitServlet.java
index 8db1714..4eec4af 100644
--- a/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/QuikitServlet.java
+++ b/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/QuikitServlet.java
@@ -86,8 +86,8 @@ public class QuikitServlet
 
             ApplicationAssembler assembler = createApplicationAssembler( config );
 
-            Energy4Java zest = new Energy4Java();
-            application = zest.newApplication( assembler );
+            Energy4Java polygene = new Energy4Java();
+            application = polygene.newApplication( assembler );
             application.activate();
             Module module = application.findModule( "WebLayer", "PagesModule" );
             finder = module;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/BookingPage.html
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/BookingPage.html b/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/BookingPage.html
index 49863aa..3c1b5b8 100644
--- a/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/BookingPage.html
+++ b/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/BookingPage.html
@@ -18,7 +18,7 @@
   ~
   -->
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"
-      xmlns:qi="http://zest.apache.org/ns/2009/quikit"
+      xmlns:qi="http://polygene.apache.org/ns/2009/quikit"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/1999/xhtml
                           http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/MainPage.html
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/MainPage.html b/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/MainPage.html
index 95145e8..895a36c 100644
--- a/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/MainPage.html
+++ b/samples/rental/src/main/resources/org/apache/polygene/sample/rental/web/MainPage.html
@@ -19,7 +19,7 @@
   ~
   -->
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"
-      xmlns:qi="http://zest.apache.org/ns/2009/quikit"
+      xmlns:qi="http://polygene.apache.org/ns/2009/quikit"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.w3.org/1999/xhtml
                           http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd">

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/rental/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/webapp/WEB-INF/web.xml b/samples/rental/src/main/webapp/WEB-INF/web.xml
index d02fb4f..02e4228 100644
--- a/samples/rental/src/main/webapp/WEB-INF/web.xml
+++ b/samples/rental/src/main/webapp/WEB-INF/web.xml
@@ -29,7 +29,7 @@
     <servlet-name>QuikitServlet</servlet-name>
     <servlet-class>org.apache.polygene.sample.rental.web.QuikitServlet</servlet-class>
     <init-param>
-      <param-name>zest-assembler</param-name>
+      <param-name>polygene-assembler</param-name>
       <param-value>org.apache.polygene.sample.rental.web.assembly.RentalApplicationAssembler</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/sql-support/build.gradle
----------------------------------------------------------------------
diff --git a/samples/sql-support/build.gradle b/samples/sql-support/build.gradle
index 30c9106..6e3c607 100644
--- a/samples/sql-support/build.gradle
+++ b/samples/sql-support/build.gradle
@@ -26,13 +26,13 @@ jar { manifest { name = "Apache Polygene\u2122 Sample - SQL Support" } }
 
 dependencies {
 
-  compile zest.core.bootstrap
-  compile zest.library( 'sql-dbcp' )
-  compile zest.extension( 'entitystore-preferences' )
-  compile zest.extension( 'entitystore-sql' )
-  compile zest.extension( 'indexing-sql' )
+  compile polygene.core.bootstrap
+  compile polygene.library( 'sql-dbcp' )
+  compile polygene.extension( 'entitystore-preferences' )
+  compile polygene.extension( 'entitystore-sql' )
+  compile polygene.extension( 'indexing-sql' )
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
   runtime libraries.postgres
   runtime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/samples/swing/build.gradle
----------------------------------------------------------------------
diff --git a/samples/swing/build.gradle b/samples/swing/build.gradle
index 7bc8288..2bf5c10 100644
--- a/samples/swing/build.gradle
+++ b/samples/swing/build.gradle
@@ -25,8 +25,8 @@ description = "Sample of how to use the Swing bindings."
 jar { manifest { name = "Apache Polygene\u2122 Sample - Swing Bindings" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  runtime zest.core.runtime
+  compile polygene.core.bootstrap
+  runtime polygene.core.runtime
 }
 
 task( runSwingSample, dependsOn: 'classes', type: JavaExec ) {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/src/bin-dist/README.txt
----------------------------------------------------------------------
diff --git a/src/bin-dist/README.txt b/src/bin-dist/README.txt
index 474b7c5..b2d104d 100644
--- a/src/bin-dist/README.txt
+++ b/src/bin-dist/README.txt
@@ -14,7 +14,7 @@ cool, new and challenging technology. We are especially interested in
 people willing to help improve the SDK, samples, tutorials, documentation
 and other supporting material.
 
-Please see https://zest.apache.org for more information.
+Please see https://polygene.apache.org for more information.
 
 
 Licensing
@@ -40,7 +40,7 @@ distribution's root, you'll find both Maven (go-offline.pom) and Gradle
 needed dependencies jars. Instructions are given into theses files.
 
 If you prefer to use a dependency management system, go to:
-https://zest.apache.org/java/latest/howto-depend-on-zest.html
+https://polygene.apache.org/java/latest/howto-depend-on-polygene.html
 
 
 Thank you for trying out Apache Polygene\u2122 and Composite Oriented Programming.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/src/javadoc/overview.html
----------------------------------------------------------------------
diff --git a/src/javadoc/overview.html b/src/javadoc/overview.html
index 70fe140..9530721 100644
--- a/src/javadoc/overview.html
+++ b/src/javadoc/overview.html
@@ -21,6 +21,6 @@
     <body>
         <h3>Welcome to the Apache Polygene\u2122 (Java Edition) SDK Javadoc.</h3>
         <p>Apache Polygene\u2122 is a framework for domain centric application development, including evolved concepts from AOP, DI and DDD.</p>
-        <p><a href="https://zest.apache.org" target="_blank">zest.apache.org</a></p>
+        <p><a href="https://polygene.apache.org" target="_blank">polygene.apache.org</a></p>
     </body>
 </html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/performance/build.gradle
----------------------------------------------------------------------
diff --git a/tests/performance/build.gradle b/tests/performance/build.gradle
index 006420d..8124869 100644
--- a/tests/performance/build.gradle
+++ b/tests/performance/build.gradle
@@ -24,20 +24,20 @@ jar { manifest { name = "Apache Polygene\u2122 Tests - Performance" } }
 apply plugin: PerformanceTestsPlugin
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
   compile libraries.junit
   compile libraries.slf4j_api
 
-  perfCompile zest.core.testsupport
-  perfCompile zest.library( 'sql-dbcp' )
-  perfCompile zest.extension( 'valueserialization-orgjson' )
-  perfCompile zest.extension( 'entitystore-memory' )
-  perfCompile zest.extension( 'entitystore-jdbm' )
-  perfCompile zest.extension( 'entitystore-sql' )
-  perfCompile zest.extension( 'cache-ehcache' )
-  perfCompile zest.extension( 'indexing-rdf' )
+  perfCompile polygene.core.testsupport
+  perfCompile polygene.library( 'sql-dbcp' )
+  perfCompile polygene.extension( 'valueserialization-orgjson' )
+  perfCompile polygene.extension( 'entitystore-memory' )
+  perfCompile polygene.extension( 'entitystore-jdbm' )
+  perfCompile polygene.extension( 'entitystore-sql' )
+  perfCompile polygene.extension( 'cache-ehcache' )
+  perfCompile polygene.extension( 'indexing-rdf' )
   perfCompile libraries.derby
 
-  perfRuntime zest.core.runtime
+  perfRuntime polygene.core.runtime
   perfRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/performance/src/main/java/org/apache/polygene/test/performance/entitystore/AbstractEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/main/java/org/apache/polygene/test/performance/entitystore/AbstractEntityStorePerformanceTest.java b/tests/performance/src/main/java/org/apache/polygene/test/performance/entitystore/AbstractEntityStorePerformanceTest.java
index a6372ba..9dfb9c3 100644
--- a/tests/performance/src/main/java/org/apache/polygene/test/performance/entitystore/AbstractEntityStorePerformanceTest.java
+++ b/tests/performance/src/main/java/org/apache/polygene/test/performance/entitystore/AbstractEntityStorePerformanceTest.java
@@ -315,7 +315,7 @@ public abstract class AbstractEntityStorePerformanceTest
     private void createPolygeneRuntime( Assembler testSetup )
         throws Exception
     {
-        Energy4Java zest = new Energy4Java();
+        Energy4Java polygene = new Energy4Java();
         Assembler[][][] assemblers = new Assembler[][][]
             {
                 {
@@ -324,7 +324,7 @@ public abstract class AbstractEntityStorePerformanceTest
                     }
                 }
             };
-        application = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+        application = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
         {
         } );
         application.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
index 9c1d1d8..e0c2bcc 100644
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/zest/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
@@ -103,7 +103,7 @@ public class PostgreSQLEntityStorePerformanceTest
         finally
         {
 
-            Energy4Java zest = new Energy4Java();
+            Energy4Java polygene = new Energy4Java();
             Assembler[][][] assemblers = new Assembler[][][]
             {
                 {
@@ -112,7 +112,7 @@ public class PostgreSQLEntityStorePerformanceTest
                     }
                 }
             };
-            Application application = zest.newApplication( new ApplicationAssemblerAdapter( assemblers )
+            Application application = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
             {
             } );
             application.activate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java b/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
index c0f8305..a8e54ee 100644
--- a/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/zest/test/performance/indexing/rdf/QueryPerformanceTest.java
@@ -133,8 +133,8 @@ public class QueryPerformanceTest
     public void setup()
         throws Exception
     {
-        Energy4Java zest = new Energy4Java();
-        application = zest.newApplication( this );
+        Energy4Java polygene = new Energy4Java();
+        application = polygene.newApplication( this );
         module = application.findModule( LAYER_DOMAIN, MODULE_DOMAIN );
         application.activate();
         indexingDataDir = module.findService( RdfIndexingService.class ).get().dataDir();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/regression/README-for-regression-reporting.txt
----------------------------------------------------------------------
diff --git a/tests/regression/README-for-regression-reporting.txt b/tests/regression/README-for-regression-reporting.txt
index 8d8bf13..a558433 100644
--- a/tests/regression/README-for-regression-reporting.txt
+++ b/tests/regression/README-for-regression-reporting.txt
@@ -10,7 +10,7 @@ Regression Test reporting follows the following steps;
 
 4. Commit and push this to the 'origin develop' branch.
 
-5. Ping the community on the dev@zest.apache.org mailing list.
+5. Ping the community on the dev@polygene.apache.org mailing list.
 
 
 Once the reported problem has been solved, the test will be moved to the sub-project's unit test area.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tests/regression/build.gradle
----------------------------------------------------------------------
diff --git a/tests/regression/build.gradle b/tests/regression/build.gradle
index 4b4f4ca..895be0f 100644
--- a/tests/regression/build.gradle
+++ b/tests/regression/build.gradle
@@ -23,12 +23,12 @@ description = "Apache Polygene\u2122 Regression Tests are added by community member
 jar { manifest { name = "Apache Polygene\u2122 Tests - Regression" } }
 
 dependencies {
-  compile zest.core.testsupport
-  compile zest.library( 'logging' )
-  compile zest.extension( 'entitystore-jdbm' )
+  compile polygene.core.testsupport
+  compile polygene.library( 'logging' )
+  compile polygene.extension( 'entitystore-jdbm' )
   compile libraries.slf4j_api
   compile libraries.junit
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
   runtime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/build.gradle
----------------------------------------------------------------------
diff --git a/tools/envisage/build.gradle b/tools/envisage/build.gradle
index a74d63d..1ed01f5 100644
--- a/tools/envisage/build.gradle
+++ b/tools/envisage/build.gradle
@@ -25,16 +25,16 @@ description = "Visualizer of a Apache Polygene\u2122 Application Structure."
 jar { manifest { name = "Apache Polygene\u2122 Envisage" } }
 
 dependencies {
-  compile zest.core.bootstrap
-  compile zest.tool( 'model-detail' )
+  compile polygene.core.bootstrap
+  compile polygene.tool( 'model-detail' )
   compile libraries.jgoodies_looks
   compile libraries.pdfbox
   compile libraries.prefuse
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'indexing-rdf' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/envisage/dev-status.xml b/tools/envisage/dev-status.xml
index 40dade2..e124151 100644
--- a/tools/envisage/dev-status.xml
+++ b/tools/envisage/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/docs/envisage.txt
----------------------------------------------------------------------
diff --git a/tools/envisage/src/docs/envisage.txt b/tools/envisage/src/docs/envisage.txt
index b6c01b6..4aecf37 100644
--- a/tools/envisage/src/docs/envisage.txt
+++ b/tools/envisage/src/docs/envisage.txt
@@ -29,7 +29,7 @@ Envisage can be easily used directly and prior your Application activation:
 
 [snippet,java]
 ----
-source=tools/envisage/src/test/java/org/apache/zest/envisage/school/EnvisageSchoolSample.java
+source=tools/envisage/src/test/java/org/apache/polygene/envisage/school/EnvisageSchoolSample.java
 tag=envisage
 ----
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/DependencyPane.java
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/DependencyPane.java b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/DependencyPane.java
index f39c34f..6dcafad 100644
--- a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/DependencyPane.java
+++ b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/DependencyPane.java
@@ -283,7 +283,7 @@ import org.apache.polygene.tools.model.descriptor.ObjectDetailDescriptor;
         splitPane.setRightComponent( detailPane );
         detailPane.setBorder( BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder( 8, 8, 8, 8 ), null ) );
         final JLabel label1 = new JLabel();
-        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_ClassName.Text" ) );
+        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_ClassName.Text" ) );
         GridBagConstraints gbc;
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
@@ -303,14 +303,14 @@ import org.apache.polygene.tools.model.descriptor.ObjectDetailDescriptor;
         gbc.fill = GridBagConstraints.VERTICAL;
         detailPane.add( spacer2, gbc );
         final JLabel label2 = new JLabel();
-        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_Optional.Text" ) );
+        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_Optional.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 2;
         gbc.anchor = GridBagConstraints.EAST;
         detailPane.add( label2, gbc );
         final JLabel label3 = new JLabel();
-        this.$$$loadLabelText$$$( label3, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_Annotation.Text" ) );
+        this.$$$loadLabelText$$$( label3, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_Annotation.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 4;
@@ -335,7 +335,7 @@ import org.apache.polygene.tools.model.descriptor.ObjectDetailDescriptor;
         gbc.fill = GridBagConstraints.VERTICAL;
         detailPane.add( spacer5, gbc );
         final JLabel label4 = new JLabel();
-        this.$$$loadLabelText$$$( label4, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_InjectionType.Text" ) );
+        this.$$$loadLabelText$$$( label4, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_InjectionType.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 10;
@@ -377,7 +377,7 @@ import org.apache.polygene.tools.model.descriptor.ObjectDetailDescriptor;
         gbc.fill = GridBagConstraints.VERTICAL;
         detailPane.add( spacer6, gbc );
         final JLabel label5 = new JLabel();
-        this.$$$loadLabelText$$$( label5, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_Injection.Text" ) );
+        this.$$$loadLabelText$$$( label5, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_Injection.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 8;
@@ -399,7 +399,7 @@ import org.apache.polygene.tools.model.descriptor.ObjectDetailDescriptor;
         gbc.fill = GridBagConstraints.VERTICAL;
         detailPane.add( spacer7, gbc );
         final JLabel label6 = new JLabel();
-        this.$$$loadLabelText$$$( label6, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/DependencyPane" ).getString( "CTL_InjectedServices.Text" ) );
+        this.$$$loadLabelText$$$( label6, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/DependencyPane" ).getString( "CTL_InjectedServices.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 12;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ImportedByPane.java
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ImportedByPane.java b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ImportedByPane.java
index 07e72ba..ec6646f 100644
--- a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ImportedByPane.java
+++ b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ImportedByPane.java
@@ -91,7 +91,7 @@ import org.apache.polygene.tools.model.descriptor.ImportedServiceDetailDescripto
         contentPane = new JPanel();
         contentPane.setLayout( new GridBagLayout() );
         final JLabel label1 = new JLabel();
-        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ImportedByPane" ).getString( "CTL_Name.Text" ) );
+        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ImportedByPane" ).getString( "CTL_Name.Text" ) );
         GridBagConstraints gbc;
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
@@ -118,7 +118,7 @@ import org.apache.polygene.tools.model.descriptor.ImportedServiceDetailDescripto
         gbc.anchor = GridBagConstraints.WEST;
         contentPane.add( nameLabel, gbc );
         final JLabel label2 = new JLabel();
-        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ImportedByPane" ).getString( "CTL_Class.Text" ) );
+        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ImportedByPane" ).getString( "CTL_Class.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 3;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ServiceConfigurationPane.java
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ServiceConfigurationPane.java b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ServiceConfigurationPane.java
index c822625..69eb8fc 100644
--- a/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ServiceConfigurationPane.java
+++ b/tools/envisage/src/main/java/org/apache/polygene/envisage/detail/ServiceConfigurationPane.java
@@ -194,7 +194,7 @@ import org.apache.polygene.tools.model.util.DescriptorUtilities;
         contentPane = new JPanel();
         contentPane.setLayout( new GridBagLayout() );
         final JLabel label1 = new JLabel();
-        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Name.Text" ) );
+        this.$$$loadLabelText$$$( label1, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Name.Text" ) );
         GridBagConstraints gbc;
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
@@ -228,7 +228,7 @@ import org.apache.polygene.tools.model.util.DescriptorUtilities;
         gbc.fill = GridBagConstraints.VERTICAL;
         contentPane.add( spacer3, gbc );
         final JLabel label2 = new JLabel();
-        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Class.Text" ) );
+        this.$$$loadLabelText$$$( label2, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Class.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 3;
@@ -249,7 +249,7 @@ import org.apache.polygene.tools.model.util.DescriptorUtilities;
         gbc.fill = GridBagConstraints.VERTICAL;
         contentPane.add( spacer4, gbc );
         linkButton = new JButton();
-        this.$$$loadButtonText$$$( linkButton, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Link.Text" ) );
+        this.$$$loadButtonText$$$( linkButton, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Link.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 2;
         gbc.gridy = 7;
@@ -262,7 +262,7 @@ import org.apache.polygene.tools.model.util.DescriptorUtilities;
         gbc.fill = GridBagConstraints.VERTICAL;
         contentPane.add( spacer5, gbc );
         final JLabel label3 = new JLabel();
-        this.$$$loadLabelText$$$( label3, ResourceBundle.getBundle( "org/apache/zest/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Type.Text" ) );
+        this.$$$loadLabelText$$$( label3, ResourceBundle.getBundle( "org/apache/polygene/envisage/detail/ServiceConfigurationPane" ).getString( "CTL_Type.Text" ) );
         gbc = new GridBagConstraints();
         gbc.gridx = 0;
         gbc.gridy = 5;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/DependencyPane.properties
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/DependencyPane.properties b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/DependencyPane.properties
index de083b0..4c1ec6d 100644
--- a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/DependencyPane.properties
+++ b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/DependencyPane.properties
@@ -18,11 +18,11 @@
 #
 #
 
-CTL_ClassName.Text = [CTL_ClassName.Text / org/apache/zest/envisage/detail/DependencyPane]
-CTL_Optional.Text = [CTL_Optional.Text / org/apache/zest/envisage/detail/DependencyPane]
-CTL_Annotation.Text = [CTL_Annotation.Text / org/apache/zest/envisage/detail/DependencyPane]
-CTL_Injection.Text = [CTL_Injection.Text / org/apache/zest/envisage/detail/DependencyPane]
+CTL_ClassName.Text = [CTL_ClassName.Text / org/apache/polygene/envisage/detail/DependencyPane]
+CTL_Optional.Text = [CTL_Optional.Text / org/apache/polygene/envisage/detail/DependencyPane]
+CTL_Annotation.Text = [CTL_Annotation.Text / org/apache/polygene/envisage/detail/DependencyPane]
+CTL_Injection.Text = [CTL_Injection.Text / org/apache/polygene/envisage/detail/DependencyPane]
 CTL_InjectionClass.Text = Class:
-CTL_InjectionType.Text = [CTL_InjectionType.Text / org/apache/zest/envisage/detail/DependencyPane]
+CTL_InjectionType.Text = [CTL_InjectionType.Text / org/apache/polygene/envisage/detail/DependencyPane]
 CTL_InjectionTypeRaw.Text = Raw:
-CTL_InjectedServices.Text=[CTL_InjectedServices.Text / org/apache/zest/envisage/detail/DependencyPane]
\ No newline at end of file
+CTL_InjectedServices.Text=[CTL_InjectedServices.Text / org/apache/polygene/envisage/detail/DependencyPane]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ImportedByPane.properties
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ImportedByPane.properties b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ImportedByPane.properties
index 821791c..5f22b36 100644
--- a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ImportedByPane.properties
+++ b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ImportedByPane.properties
@@ -18,5 +18,5 @@
 #
 #
 
-CTL_Name.Text=[CTL_Name.Text / org/apache/zest/envisage/detail/ImportedByPane]
-CTL_Class.Text=[CTL_Class.Text / org/apache/zest/envisage/detail/ImportedByPane]
\ No newline at end of file
+CTL_Name.Text=[CTL_Name.Text / org/apache/polygene/envisage/detail/ImportedByPane]
+CTL_Class.Text=[CTL_Class.Text / org/apache/polygene/envisage/detail/ImportedByPane]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ServiceConfigurationPane.properties
----------------------------------------------------------------------
diff --git a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ServiceConfigurationPane.properties b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ServiceConfigurationPane.properties
index 75912bc..10aa0b4 100644
--- a/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ServiceConfigurationPane.properties
+++ b/tools/envisage/src/main/resources/org/apache/polygene/envisage/detail/ServiceConfigurationPane.properties
@@ -18,7 +18,7 @@
 #
 #
 
-CTL_Name.Text=[CTL_Name.Text / org/apache/zest/envisage/detail/ServiceConfigurationPane]
-CTL_Class.Text=[CTL_Class.Text / org/apache/zest/envisage/detail/ServiceConfigurationPane]
-CTL_Type.Text=[CTL_Type.Text / org/apache/zest/envisage/detail/ServiceConfigurationPane]
-CTL_Link.Text=[CTL_Link.Text / org/apache/zest/envisage/detail/ServiceConfigurationPane]
\ No newline at end of file
+CTL_Name.Text=[CTL_Name.Text / org/apache/polygene/envisage/detail/ServiceConfigurationPane]
+CTL_Class.Text=[CTL_Class.Text / org/apache/polygene/envisage/detail/ServiceConfigurationPane]
+CTL_Type.Text=[CTL_Type.Text / org/apache/polygene/envisage/detail/ServiceConfigurationPane]
+CTL_Link.Text=[CTL_Link.Text / org/apache/polygene/envisage/detail/ServiceConfigurationPane]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/index.js
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/index.js b/tools/generator-zest/app/index.js
index a009882..73f44e6 100644
--- a/tools/generator-zest/app/index.js
+++ b/tools/generator-zest/app/index.js
@@ -20,7 +20,7 @@
 
 var generators = require( 'yeoman-generator' );
 
-var zest = {};
+var polygene = {};
 
 module.exports = generators.Base.extend(
     {
@@ -133,12 +133,12 @@ module.exports = generators.Base.extend(
                         this.log( 'Caching:', answers.caching );
                         this.log( 'Serialization:', answers.serialization );
                         this.log( 'Features:', answers.features );
-                        zest = answers;
-                        zest.javaPackageDir = zest.packagename.replace( '.', '/' );
-                        zest.singletonApp = false;
+                        polygene = answers;
+                        polygene.javaPackageDir = polygene.packagename.replace( '.', '/' );
+                        polygene.singletonApp = false;
                         if( hasFeature( 'sample (heroes) web application' ) )
                         {
-                            zest.features.push( 'rest api' );
+                            polygene.features.push( 'rest api' );
                         }
                     }.bind( this )
             );
@@ -146,16 +146,16 @@ module.exports = generators.Base.extend(
 
         writing: function ()
         {
-            copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !zest.singeltonApp );
-            copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !zest.singeltonApp );
-            copyPolygeneBootstrap( this, "domain", "DomainLayer", !zest.singeltonApp );
-            copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !zest.singeltonApp );
+            copyPolygeneBootstrap( this, "config", "ConfigurationLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "infrastructure", "InfrastructureLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "domain", "DomainLayer", !polygene.singeltonApp );
+            copyPolygeneBootstrap( this, "connectivity", "ConnectivityLayer", !polygene.singeltonApp );
 
             copyPolygeneBootstrap( this, "config", "ConfigModule", true );
 
             copyPolygeneBootstrap( this, "infrastructure", "FileConfigurationModule", true );
 
-            copyEntityStore( this, zest.entitystore );
+            copyEntityStore( this, polygene.entitystore );
 
             copyPolygeneBootstrap( this, "infrastructure", "RdfIndexingModule", hasIndexing( 'Rdf' ) );
             copyPolygeneBootstrap( this, "infrastructure", "ElasticSearchIndexingModule", hasIndexing( 'Elasticsearch' ) );
@@ -202,7 +202,7 @@ function copyPolygeneBootstrap( ctx, layer, moduleName, condition )
     {
         copyTemplate( ctx,
                       moduleName + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
+                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + layer + '/' + moduleName + '.java' );
     }
 }
 
@@ -210,7 +210,7 @@ function copyEntityStore( ctx, entityStoreName )
 {
     copyTemplate( ctx,
                   'StorageModule/bootstrap.tmpl',
-                  'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
+                  'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/infrastructure/' + entityStoreName + 'StorageModule.java' );
 }
 
 function copyPolygeneApp( ctx, name, condition )
@@ -219,11 +219,11 @@ function copyPolygeneApp( ctx, name, condition )
     {
         copyTemplate( ctx,
                       name + '/bootstrap.tmpl',
-                      'bootstrap/src/main/java/' + zest.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
+                      'bootstrap/src/main/java/' + polygene.javaPackageDir + '/bootstrap/' + name + 'ApplicationAssembler.java' );
 
         copyTemplate( ctx,
                       name + '/app.tmpl',
-                      'app/src/main/java/' + zest.javaPackageDir + '/app/' + name + '.java' );
+                      'app/src/main/java/' + polygene.javaPackageDir + '/app/' + name + '.java' );
 
         copyTemplate( ctx,
                       name + '/webapp/',
@@ -237,7 +237,7 @@ function copyPolygeneDomain( ctx, model, module, clazz, condition )
     {
         copyTemplate( ctx,
                       module + '/' + clazz + '.tmpl',
-                      'model/src/main/java/' + zest.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
+                      'model/src/main/java/' + polygene.javaPackageDir + '/model/' + model + '/' + clazz + '.java' );
     }
 }
 
@@ -249,15 +249,15 @@ function copyRestFeature( ctx, condition )
 
         copyTemplate( ctx,
                       'RestApiModule/SimpleEnroler.tmpl',
-                      'rest/src/main/java/' + zest.javaPackageDir + '/rest/security/SimpleEnroler.java' );
+                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleEnroler.java' );
 
         copyTemplate( ctx,
                       'RestApiModule/SimpleVerifier.tmpl',
-                      'rest/src/main/java/' + zest.javaPackageDir + '/rest/security/SimpleVerifier.java' );
+                      'rest/src/main/java/' + polygene.javaPackageDir + '/rest/security/SimpleVerifier.java' );
 
         copyTemplate( ctx,
                       'RestApiModule/HardcodedSecurityRepositoryMixin.tmpl',
-                      'model/src/main/java/' + zest.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
+                      'model/src/main/java/' + polygene.javaPackageDir + '/model/security/HardcodedSecurityRepositoryMixin.java' );
     }
 }
 
@@ -276,39 +276,39 @@ function copyTemplate( ctx, from, to )
         ctx.templatePath( from ),
         ctx.destinationPath( to ),
         {
-            packageName: zest.packagename,
+            packageName: polygene.packagename,
             hasFeature: hasFeature,
             hasEntityStore: hasEntityStore,
             hasIndexing: hasIndexing,
             hasCaching: hasCaching,
-            zest: zest
+            polygene: polygene
         }
     );
 }
 
 function hasEntityStore( esType )
 {
-    return zest.entitystore === esType;
+    return polygene.entitystore === esType;
 }
 
 function hasIndexing( indexingType )
 {
-    return zest.indexing === indexingType;
+    return polygene.indexing === indexingType;
 }
 
 function hasCaching( cachingType )
 {
-    return zest.caching === cachingType;
+    return polygene.caching === cachingType;
 }
 
 function hasSerialization( serializer )
 {
-    return zest.serialization === serializer;
+    return polygene.serialization === serializer;
 }
 
 function hasFeature( feature )
 {
-    return zest.features.indexOf( feature ) >= 0;
+    return polygene.features.indexOf( feature ) >= 0;
 }
 
 function firstUpper( text )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/Heroes/web.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/Heroes/web.tmpl b/tools/generator-zest/app/templates/Heroes/web.tmpl
index df3ee53..dda4f37 100644
--- a/tools/generator-zest/app/templates/Heroes/web.tmpl
+++ b/tools/generator-zest/app/templates/Heroes/web.tmpl
@@ -23,7 +23,7 @@
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5">
 
-  <display-name><%= zest.name %></display-name>
+  <display-name><%= polygene.name %></display-name>
 
 
   <servlet>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl b/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
index ca538ca..a1206a9 100644
--- a/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
+++ b/tools/generator-zest/app/templates/InfrastructureLayer/bootstrap.tmpl
@@ -47,9 +47,9 @@ public class InfrastructureLayer extends LayeredLayerAssembler
     {
         createModule( layer, FileConfigurationModule.class );
 
-        new <%= zest.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= zest.entitystore %>StorageModule.NAME ) );
-        new <%= zest.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= zest.indexing %>IndexingModule.NAME ) );
-        new <%= zest.serialization %>SerializationModule( typeFinder ).assemble( layer, layer.module( <%= zest.serialization %>SerializationModule.NAME ) );
+        new <%= polygene.entitystore %>StorageModule( configModule ).assemble( layer, layer.module( <%= polygene.entitystore %>StorageModule.NAME ) );
+        new <%= polygene.indexing %>IndexingModule( configModule ).assemble( layer, layer.module( <%= polygene.indexing %>IndexingModule.NAME ) );
+        new <%= polygene.serialization %>SerializationModule( typeFinder ).assemble( layer, layer.module( <%= polygene.serialization %>SerializationModule.NAME ) );
         return layer;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl b/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
index cbcbb7c..467fadd 100644
--- a/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
+++ b/tools/generator-zest/app/templates/StorageModule/bootstrap.tmpl
@@ -24,15 +24,15 @@ import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.entitystore.<%- zest.entitystore.toLowerCase() %>.assembly.<%- zest.entitystore %>EntityStoreAssembler;
+import org.apache.polygene.entitystore.<%- polygene.entitystore.toLowerCase() %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler;
 
-public class <%- zest.entitystore %>StorageModule
+public class <%- polygene.entitystore %>StorageModule
     implements ModuleAssembler
 {
-    public static final String NAME = "<%- zest.entitystore %> Storage Module";
+    public static final String NAME = "<%- polygene.entitystore %> Storage Module";
     private final ModuleAssembly configModule;
 
-    public <%- zest.entitystore %>StorageModule( ModuleAssembly configModule )
+    public <%- polygene.entitystore %>StorageModule( ModuleAssembly configModule )
     {
         this.configModule = configModule;
     }
@@ -41,10 +41,10 @@ public class <%- zest.entitystore %>StorageModule
     public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
         throws AssemblyException
     {
-        new <%- zest.entitystore %>EntityStoreAssembler()
+        new <%- polygene.entitystore %>EntityStoreAssembler()
             .visibleIn( Visibility.application  )
             .withConfig( configModule, Visibility.application )
-            .identifiedBy( "<%- zest.entitystore %>store" )
+            .identifiedBy( "<%- polygene.entitystore %>store" )
             .assemble( module );
         return module;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
index c80f7b3..f307e8b 100644
--- a/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
+++ b/tools/generator-zest/app/templates/buildtool/gradle-app.tmpl
@@ -28,14 +28,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
 
   compile "javax.servlet:servlet-api:2.5"
   compile "org.restlet.jee:org.restlet:2.3.4"
 
-  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$zestVersion"
+  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
   runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
 
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
index 3baa75b..3261944 100644
--- a/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
+++ b/tools/generator-zest/app/templates/buildtool/gradle-bootstrap.tmpl
@@ -21,16 +21,16 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
 
 
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$zestVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
 <% if( hasFeature( 'rest api' ) ) { %>
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
 <% } %>
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= zest.entitystore.toLowerCase() %>:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= zest.indexing.toLowerCase() %>:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= zest.serialization.toLowerCase() %>:$zestVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-<%= polygene.entitystore.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-<%= polygene.indexing.toLowerCase() %>:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-<%= polygene.serialization.toLowerCase() %>:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
index 0d4a80b..5c389c2 100644
--- a/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
+++ b/tools/generator-zest/app/templates/buildtool/gradle-rest.tmpl
@@ -21,7 +21,7 @@
 dependencies {
   compile project( ":model" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl b/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
index d197669..c1960ba 100644
--- a/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
+++ b/tools/generator-zest/app/templates/buildtool/gradle-root.tmpl
@@ -21,7 +21,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = 0
+  polygeneVersion = 0
 }
 
 allprojects() {
@@ -34,13 +34,13 @@ allprojects() {
     mavenLocal()
     mavenCentral()
     maven { name 'restlet-repo'; url 'http://maven.restlet.org/' }
-<% if( zest.entitystore == 'Jdbm' ) { -%>
+<% if( polygene.entitystore == 'Jdbm' ) { -%>
     maven { name 'clojure-repo'; url 'http://clojars.org/repo/' }
 <% } -%>
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/app/templates/buildtool/settings.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-zest/app/templates/buildtool/settings.tmpl b/tools/generator-zest/app/templates/buildtool/settings.tmpl
index a5c128d..3016193 100644
--- a/tools/generator-zest/app/templates/buildtool/settings.tmpl
+++ b/tools/generator-zest/app/templates/buildtool/settings.tmpl
@@ -22,7 +22,7 @@ include 'app',
         'model',
         'rest'
 
-rootProject.name = '<%= zest.entitystore %>'
+rootProject.name = '<%= polygene.entitystore %>'
 
 validateProject(rootProject, "")
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/generator-zest/package.json
----------------------------------------------------------------------
diff --git a/tools/generator-zest/package.json b/tools/generator-zest/package.json
index 43cb59e..25e2d02 100644
--- a/tools/generator-zest/package.json
+++ b/tools/generator-zest/package.json
@@ -1,5 +1,5 @@
 {
-  "name": "generator-zest",
+  "name": "generator-polygene",
   "version": "0.1.0",
   "description": "",
   "files": [

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/model-detail/build.gradle
----------------------------------------------------------------------
diff --git a/tools/model-detail/build.gradle b/tools/model-detail/build.gradle
index 2df83e1..65ac7b1 100644
--- a/tools/model-detail/build.gradle
+++ b/tools/model-detail/build.gradle
@@ -23,12 +23,12 @@ description = "Detailled Model of a Apache Polygene\u2122 Application Structure."
 jar { manifest { name = "Apache Polygene\u2122 Model Detail" }}
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
-  testCompile zest.extension( 'indexing-rdf' )
+  testCompile polygene.core.testsupport
+  testCompile polygene.extension( 'indexing-rdf' )
 
   testRuntime libraries.logback
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/model-detail/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/model-detail/dev-status.xml b/tools/model-detail/dev-status.xml
index 40dade2..e124151 100644
--- a/tools/model-detail/dev-status.xml
+++ b/tools/model-detail/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>stable</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/build.gradle
----------------------------------------------------------------------
diff --git a/tools/qidea/build.gradle b/tools/qidea/build.gradle
index 2e9b77e..2383515 100644
--- a/tools/qidea/build.gradle
+++ b/tools/qidea/build.gradle
@@ -23,11 +23,11 @@ description = "IntelliJ IDEA Plugin for Apache Polygene\u2122 development."
 jar { manifest { name = "Apache Polygene\u2122 IDEA plugin" }}
 
 dependencies {
-  compile zest.core.bootstrap
+  compile polygene.core.bootstrap
 
-  runtime zest.core.runtime
+  runtime polygene.core.runtime
 
-  testCompile zest.core.testsupport
+  testCompile polygene.core.testsupport
 
   testRuntime libraries.logback
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
index 116027c..42d1104 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
@@ -53,11 +53,11 @@ public final class PolygeneApplicationComponent
         "GenericConcernOf.java"
     };
 
-    private final PolygeneFacetType zestFacetType;
+    private final PolygeneFacetType polygeneFacetType;
 
     public PolygeneApplicationComponent()
     {
-        zestFacetType = new PolygeneFacetType();
+        polygeneFacetType = new PolygeneFacetType();
     }
 
     @NotNull
@@ -75,7 +75,7 @@ public final class PolygeneApplicationComponent
     private void registerFacet()
     {
         FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.registerFacetType( zestFacetType );
+        facetTypeRegistry.registerFacetType( polygeneFacetType );
     }
 
     private void registerIntentions()
@@ -92,7 +92,7 @@ public final class PolygeneApplicationComponent
     private void unregisterFacet()
     {
         FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.unregisterFacetType( zestFacetType );
+        facetTypeRegistry.unregisterFacetType( polygeneFacetType );
     }
 
     public final Class[] getInspectionClasses()
@@ -117,7 +117,7 @@ public final class PolygeneApplicationComponent
     public final FileTemplateGroupDescriptor getFileTemplatesDescriptor()
     {
         FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor(
-            message( "zest.file.template.group.title" ), null
+            message( "polygene.file.template.group.title" ), null
         );
 
         FileTypeManager fileTypeManager = FileTypeManager.getInstance();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
index e0350bd..d53e0e1 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/actions/ZestCreateActionGroup.java
@@ -37,8 +37,8 @@ public final class PolygeneCreateActionGroup extends DefaultActionGroup
 {
     public PolygeneCreateActionGroup()
     {
-        super( message( "zest.action.group.title" ), true );
-        getTemplatePresentation().setDescription( message( "zest.action.group.description" ) );
+        super( message( "polygene.action.group.title" ), true );
+        getTemplatePresentation().setDescription( message( "polygene.action.group.description" ) );
     }
 
     public void update( AnActionEvent e )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
index f135464..1369766 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractFix.java
@@ -46,6 +46,6 @@ public abstract class AbstractFix
     @NotNull
     public final String getFamilyName()
     {
-        return message( "zest.quick.fixes.family.name" );
+        return message( "polygene.quick.fixes.family.name" );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
index d2176c9..178d258 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
@@ -32,7 +32,7 @@ import static com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR;
  */
 public abstract class AbstractInspection extends BaseJavaLocalInspectionTool
 {
-    private static final String ZEST_IDEA_INSPECTIONS_NAME = "zest.inspections.name";
+    private static final String ZEST_IDEA_INSPECTIONS_NAME = "polygene.inspections.name";
 
     @Nls @NotNull public String getGroupDisplayName()
     {

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html b/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
index c008984..db2cda2 100644
--- a/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
+++ b/tools/qidea/src/main/resources/inspectionDescriptions/ConcernsAnnotationDeclaredCorrectlyInspection.html
@@ -37,7 +37,7 @@
 -->
 <body>
 <font face="verdana" size="-1">This inspection reports any @Concerns declarations value that does not implement
-    [org.apache.zest.composite.ConcernOf] class.
+    [org.apache.polygene.composite.ConcernOf] class.
 </font>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
index 8767678..8c5f29b 100644
--- a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
+++ b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties
@@ -21,11 +21,11 @@
 # *****************************************************************************
 # Common
 # *****************************************************************************
-zest.quick.fixes.family.name=Polygene
-zest.action.group.title=Polygene
-zest.action.group.description=Polygene
-zest.inspections.name=Polygene issues
-zest.file.template.group.title=Polygene
+polygene.quick.fixes.family.name=Polygene
+polygene.action.group.title=Polygene
+polygene.action.group.description=Polygene
+polygene.inspections.name=Polygene issues
+polygene.file.template.group.title=Polygene
 
 # *****************************************************************************
 # Concern

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/shell/dev-status.xml b/tools/shell/dev-status.xml
index 360ab9c..01d0c15 100644
--- a/tools/shell/dev-status.xml
+++ b/tools/shell/dev-status.xml
@@ -18,10 +18,10 @@
   ~
   ~
   -->
-<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1"
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1
-        http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
   <status>
     <!--none,early,beta,stable,mature-->
     <codebase>beta</codebase>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/bin/zest-boot
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/bin/zest-boot b/tools/shell/src/dist/bin/zest-boot
index cea4593..5a86955 100644
--- a/tools/shell/src/dist/bin/zest-boot
+++ b/tools/shell/src/dist/bin/zest-boot
@@ -16,7 +16,7 @@
 # limitations under the License.
 #
 #
-# This files copies itself to $HOME/bin, renames itself to "zest"
+# This files copies itself to $HOME/bin, renames itself to "polygene"
 # and from then on pretends to be the tools.shell script.
 #
 
@@ -25,13 +25,13 @@ JARNAME=org.apache.polygene.tool.shell-@version@.jar
 MYNAME=`basename $0`
 
 # check if it is executing as boot script or regular script.
-if [ "$MYNAME" == "zest-boot" ] ; then
+if [ "$MYNAME" == "polygene-boot" ] ; then
     mkdir $HOME/bin >/dev/null 2>&1
-    cp $0 $HOME/bin/zest
+    cp $0 $HOME/bin/polygene
     if [ -f $HOME/bin/$JARNAME ] ; then
         echo "JAR file exists."
     else
-        JAR_URL=http://repo1.maven.org/maven2/org/apache/zest/$JARNAME
+        JAR_URL=http://repo1.maven.org/maven2/org/apache/polygene/$JARNAME
 
         # check for wget
         WGET=`which wget`
@@ -47,7 +47,7 @@ if [ "$MYNAME" == "zest-boot" ] ; then
                 curl --output $HOME/bin/ $JAR_URL
             fi
         else
-            wget --output-document=$HOME/bin/ $HOME/bin/zest $JAR_URL
+            wget --output-document=$HOME/bin/ $HOME/bin/polygene $JAR_URL
         fi
     fi
 else
@@ -73,7 +73,7 @@ else
     # Restore the current directory
     cd $CWD
 
-    java -Dzest.home=$ZESTPATH -jar $ZESTPATH/$JARFILE "$@"
+    java -Dpolygene.home=$ZESTPATH -jar $ZESTPATH/$JARFILE "$@"
 fi
 
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/default/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/default/files/app/build.gradle_ b/tools/shell/src/dist/etc/templates/default/files/app/build.gradle_
index 3ee3081..1fed99b 100644
--- a/tools/shell/src/dist/etc/templates/default/files/app/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/default/files/app/build.gradle_
@@ -9,14 +9,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
 
   compile "javax.servlet:servlet-api:2.5"
   compile "org.restlet.jee:org.restlet:2.3.4"
 
-  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$zestVersion"
+  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
   runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
 
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_
index d8cd5ae..37ddd9e 100644
--- a/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/default/files/bootstrap/build.gradle_
@@ -3,14 +3,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
 
 
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$zestVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/default/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/default/files/build.gradle_ b/tools/shell/src/dist/etc/templates/default/files/build.gradle_
index 2def6b6..c5b2044 100644
--- a/tools/shell/src/dist/etc/templates/default/files/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/default/files/build.gradle_
@@ -2,7 +2,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = @version@
+  polygeneVersion = @version@
 }
 
 allprojects() {
@@ -16,8 +16,8 @@ allprojects() {
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_
index 3ee3081..1fed99b 100644
--- a/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/app/build.gradle_
@@ -9,14 +9,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
 
   compile "javax.servlet:servlet-api:2.5"
   compile "org.restlet.jee:org.restlet:2.3.4"
 
-  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$zestVersion"
+  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
   runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
 
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_
index d8cd5ae..37ddd9e 100644
--- a/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/bootstrap/build.gradle_
@@ -3,14 +3,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
 
 
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$zestVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_
index 2def6b6..c5b2044 100644
--- a/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/build.gradle_
@@ -2,7 +2,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = @version@
+  polygeneVersion = @version@
 }
 
 allprojects() {
@@ -16,8 +16,8 @@ allprojects() {
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_
index 6e02dfe..f2630ea 100644
--- a/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/ng2-heroes/files/rest/build.gradle_
@@ -2,7 +2,7 @@
 dependencies {
   compile project( ":model" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/null/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/null/files/build.gradle_ b/tools/shell/src/dist/etc/templates/null/files/build.gradle_
index c7e539c..549574f 100644
--- a/tools/shell/src/dist/etc/templates/null/files/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/null/files/build.gradle_
@@ -2,7 +2,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = @version@
+  polygeneVersion = @version@
 }
 
 allprojects() {
@@ -15,8 +15,8 @@ allprojects() {
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/restapp/files/app/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/restapp/files/app/build.gradle_ b/tools/shell/src/dist/etc/templates/restapp/files/app/build.gradle_
index 3ee3081..1fed99b 100644
--- a/tools/shell/src/dist/etc/templates/restapp/files/app/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/restapp/files/app/build.gradle_
@@ -9,14 +9,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.servlet:$polygeneVersion"
 
   compile "javax.servlet:servlet-api:2.5"
   compile "org.restlet.jee:org.restlet:2.3.4"
 
-  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$zestVersion"
+  runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:$polygeneVersion"
   runtime "org.restlet.jee:org.restlet.ext.servlet:2.3.4"
 
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_ b/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_
index d8cd5ae..37ddd9e 100644
--- a/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/restapp/files/bootstrap/build.gradle_
@@ -3,14 +3,14 @@ dependencies {
   compile project( ":model" )
   compile project( ":rest" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$zestVersion"
-  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.spi:$polygeneVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:$polygeneVersion"
 
 
-  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$zestVersion"
-  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$zestVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.fileconfig:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.entitystore-file:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.indexing-rdf:$polygeneVersion"
+  compile "org.apache.polygene.extension:org.apache.polygene.extension.valueserialization-jackson:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/restapp/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/restapp/files/build.gradle_ b/tools/shell/src/dist/etc/templates/restapp/files/build.gradle_
index 2def6b6..c5b2044 100644
--- a/tools/shell/src/dist/etc/templates/restapp/files/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/restapp/files/build.gradle_
@@ -2,7 +2,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = @version@
+  polygeneVersion = @version@
 }
 
 allprojects() {
@@ -16,8 +16,8 @@ allprojects() {
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/restapp/files/rest/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/restapp/files/rest/build.gradle_ b/tools/shell/src/dist/etc/templates/restapp/files/rest/build.gradle_
index 6e02dfe..f2630ea 100644
--- a/tools/shell/src/dist/etc/templates/restapp/files/rest/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/restapp/files/rest/build.gradle_
@@ -2,7 +2,7 @@
 dependencies {
   compile project( ":model" )
 
-  compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$zestVersion"
+  compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+  compile "org.apache.polygene.library:org.apache.polygene.library.restlet:$polygeneVersion"
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/dist/etc/templates/singleton/files/build.gradle_
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/etc/templates/singleton/files/build.gradle_ b/tools/shell/src/dist/etc/templates/singleton/files/build.gradle_
index c7e539c..549574f 100644
--- a/tools/shell/src/dist/etc/templates/singleton/files/build.gradle_
+++ b/tools/shell/src/dist/etc/templates/singleton/files/build.gradle_
@@ -2,7 +2,7 @@
 version = 1.0
 
 rootProject.ext {
-  zestVersion = @version@
+  polygeneVersion = @version@
 }
 
 allprojects() {
@@ -15,8 +15,8 @@ allprojects() {
   }
 
   dependencies {
-    compile "org.apache.polygene.core:org.apache.polygene.core.api:$zestVersion"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$zestVersion"
+    compile "org.apache.polygene.core:org.apache.polygene.core.api:$polygeneVersion"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:$polygeneVersion"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/docs/quick-start.txt
----------------------------------------------------------------------
diff --git a/tools/shell/src/docs/quick-start.txt b/tools/shell/src/docs/quick-start.txt
index de07cc2..b22db2c 100644
--- a/tools/shell/src/docs/quick-start.txt
+++ b/tools/shell/src/docs/quick-start.txt
@@ -41,7 +41,7 @@ source=tools/shell/src/docs/use-boot.txt
 tag=boot-quick
 ----
 
-The boot script will place the the +zest+ script and the accompanying
+The boot script will place the the +polygene+ script and the accompanying
 jar file into the $HOME/bin directory, which should already be on your PATH.
 
 == Create a small Project ==

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/docs/shell.txt
----------------------------------------------------------------------
diff --git a/tools/shell/src/docs/shell.txt b/tools/shell/src/docs/shell.txt
index 4d7be84..9ebc47c 100644
--- a/tools/shell/src/docs/shell.txt
+++ b/tools/shell/src/docs/shell.txt
@@ -19,7 +19,7 @@
 
 [[tools-shell,Command Line Shell]]
 = Polygene Shell =
-If you have installed the Polygene SDK, there is a +bin/zest+ command line script,
+If you have installed the Polygene SDK, there is a +bin/polygene+ command line script,
 which has sub-functions in it. This list of commands will slowly grow
 for various purposes of doing software development with Apache Polygene.
 
@@ -36,7 +36,7 @@ might want to create. Full list of types to follow below. The command
 takes at least 3 additional arguments;
 
 ---------------------------
-zest create-project type name package
+polygene create-project type name package
 ---------------------------
 
 A directory called _name_ will be created in the current directory, and all
@@ -66,8 +66,8 @@ Module in that layer. In Polygene, all applications must have at least one Layer
 This is useful for really small applications or demos, not expected to become large in the future. It is
 also currently required that the infrastructure is configuration free, otherwise it is not possible to set up.
 
-The template will configure the File EntityStore and RDF Indexing subsystems, hardcoded to the +zest/store+ and
-+zest/index+ respectively in the current directory where the application is started. This may not be suitable, in
+The template will configure the File EntityStore and RDF Indexing subsystems, hardcoded to the +polygene/store+ and
++polygene/index+ respectively in the current directory where the application is started. This may not be suitable, in
 which case you should look at the <<tools-shell-create-project-default>> template.
 
 [[tools-shell-create-project-default,Create Default Project]]

http://git-wip-us.apache.org/repos/asf/zest-java/blob/54b69c48/tools/shell/src/docs/use-boot.txt
----------------------------------------------------------------------
diff --git a/tools/shell/src/docs/use-boot.txt b/tools/shell/src/docs/use-boot.txt
index e1e22ae..c2a1e6a 100644
--- a/tools/shell/src/docs/use-boot.txt
+++ b/tools/shell/src/docs/use-boot.txt
@@ -21,24 +21,24 @@ THIS FILE CONTAINS SNIPPETS for quick-start.txt and shell.txt. DO NOT INCLUDE IN
 
 
 START SNIPPET: boot-quick
-wget http://zest.apache.org/latest/shell/zest-boot
-sh zest-boot
+wget http://polygene.apache.org/latest/shell/polygene-boot
+sh polygene-boot
 END SNIPPET: boot-quick
 
 START SNIPPET: boot-sdk
-wget http://zest.apache.org/latest/shell/zest-boot
-sh zest-boot sdk
+wget http://polygene.apache.org/latest/shell/polygene-boot
+sh polygene-boot sdk
 END SNIPPET: boot-sdk
 
 START SNIPPET: create-singleton
-zest create-project singleton com.acme.quick quickstart
+polygene create-project singleton com.acme.quick quickstart
 cd quickstart
 ./gradlew assemble
 ./gradlew run
 END SNIPPET: create-singleton
 
 START SNIPPET: create-ngheroes
-zest create-project ng-heroes com.acme.heroes heroes
+polygene create-project ng-heroes com.acme.heroes heroes
 cd heroes
 ./gradlew assemble
 ./gradlew run


[59/81] [abbrv] zest-java git commit: ZEST-195 ; Clean up the mistakes in the rename.

Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneBootstrapBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneBootstrapBeanDefinitionParser.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneBootstrapBeanDefinitionParser.java
new file mode 100644
index 0000000..96508d6
--- /dev/null
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/PolygeneBootstrapBeanDefinitionParser.java
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap.internal.application;
+
+import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
+import org.springframework.beans.BeanInstantiationException;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.beans.factory.xml.XmlReaderContext;
+import org.w3c.dom.Element;
+
+import static org.apache.polygene.library.spring.bootstrap.Constants.BEAN_ID_POLYGENE_APPLICATION;
+import static org.springframework.beans.BeanUtils.instantiateClass;
+import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
+import static org.springframework.util.Assert.hasText;
+import static org.springframework.util.ClassUtils.forName;
+
+public final class PolygeneBootstrapBeanDefinitionParser
+        implements BeanDefinitionParser
+{
+
+    private static final String CLASS = "class";
+
+    @Override
+    public final BeanDefinition parse( Element anElement, ParserContext aParserContext )
+    {
+        PolygeneApplicationBootstrap bootstrap = createPolygeneApplicationBootstrap( anElement, aParserContext );
+        AbstractBeanDefinition factoryBeanDefinition = createPolygeneApplicationFactoryBeanDefinition( bootstrap );
+        registerBean( aParserContext, factoryBeanDefinition );
+        return factoryBeanDefinition;
+    }
+
+    private PolygeneApplicationBootstrap createPolygeneApplicationBootstrap( Element anElement, ParserContext aParserContext )
+    {
+        String bootstrapClassString = anElement.getAttribute( CLASS );
+        hasText( bootstrapClassString );
+        XmlReaderContext readerContext = aParserContext.getReaderContext();
+
+        Class<?> bootstrapClass;
+        try
+        {
+            bootstrapClass = forName( bootstrapClassString, getClass().getClassLoader() );
+        } catch ( ClassNotFoundException e )
+        {
+            readerContext.error( "Polygene bootstrap class [" + bootstrapClassString + "] is not found.", anElement );
+            return null;
+        }
+
+        if ( !PolygeneApplicationBootstrap.class.isAssignableFrom( bootstrapClass ) )
+        {
+            readerContext.error( CLASS + "attribute is not an instance of [" + PolygeneApplicationBootstrap.class.getName()
+                    + "] class", anElement );
+            return null;
+        }
+
+        PolygeneApplicationBootstrap bootstrap = null;
+        try
+        {
+            bootstrap = (PolygeneApplicationBootstrap) instantiateClass( bootstrapClass );
+        } catch ( BeanInstantiationException e )
+        {
+            readerContext.error( "Fail to instantiate Polygene bootstrap class [" + bootstrapClassString + "]", anElement,
+                    e );
+        }
+        return bootstrap;
+    }
+
+    private AbstractBeanDefinition createPolygeneApplicationFactoryBeanDefinition(
+        final PolygeneApplicationBootstrap applicationBootstrap
+    )
+    {
+        BeanDefinitionBuilder builder = rootBeanDefinition( PolygeneApplicationFactoryBean.class );
+        builder.addConstructorArgValue( applicationBootstrap );
+        return builder.getBeanDefinition();
+    }
+
+    private void registerBean( ParserContext aParserContext, BeanDefinition aBeanDefinition )
+    {
+        BeanDefinitionRegistry registry = aParserContext.getRegistry();
+        registry.registerBeanDefinition( BEAN_ID_POLYGENE_APPLICATION, aBeanDefinition );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestApplicationFactoryBean.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestApplicationFactoryBean.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestApplicationFactoryBean.java
deleted file mode 100644
index 742052c..0000000
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestApplicationFactoryBean.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap.internal.application;
-
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.*;
-import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanInitializationException;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.util.Assert;
-
-/**
- * This class responsible to handle the lifecycle of Polygene application.
- */
-public final class PolygeneApplicationFactoryBean
-        implements FactoryBean, DisposableBean, InitializingBean, ApplicationContextAware
-{
-
-    private final PolygeneApplicationBootstrap applicationBootstrap;
-
-    private Application application;
-
-    public PolygeneApplicationFactoryBean( final PolygeneApplicationBootstrap applicationBootstrap )
-    {
-        Assert.notNull( applicationBootstrap, "'applicationBootstrap' must not be null" );
-        this.applicationBootstrap = applicationBootstrap;
-    }
-
-    @Override
-    public final Application getObject() throws Exception
-    {
-        if ( this.application == null )
-        {
-            this.application = this.createApplication();
-        }
-        return this.application;
-    }
-
-    @Override
-    public final Class<Application> getObjectType()
-    {
-        return Application.class;
-    }
-
-    @Override
-    public final boolean isSingleton()
-    {
-        return true;
-    }
-
-    @Override
-    public final void destroy() throws Exception
-    {
-        this.getObject().passivate();
-    }
-
-    @Override
-    public final void afterPropertiesSet() throws Exception
-    {
-        this.getObject().activate();
-    }
-
-    private Application createApplication()
-    {
-        Energy4Java energy4Java = new Energy4Java();
-        try
-        {
-            return energy4Java.newApplication( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-                        throws AssemblyException
-                {
-                    final ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
-                    PolygeneApplicationFactoryBean.this.applicationBootstrap.assemble( applicationAssembly );
-                    return applicationAssembly;
-                }
-            } );
-        } catch ( AssemblyException e )
-        {
-            throw new BeanInitializationException( "Fail to bootstrap Polygene application.", e );
-        }
-
-    }
-
-    @Override
-    public void setApplicationContext( final ApplicationContext applicationContext ) throws BeansException
-    {
-        if ( this.applicationBootstrap instanceof ApplicationContextAware )
-        {
-            // propagate application context to the application bootstrap
-            ApplicationContextAware aware = (ApplicationContextAware) this.applicationBootstrap;
-            aware.setApplicationContext( applicationContext );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestBootstrapBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestBootstrapBeanDefinitionParser.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestBootstrapBeanDefinitionParser.java
deleted file mode 100644
index 83daf0f..0000000
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/application/ZestBootstrapBeanDefinitionParser.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap.internal.application;
-
-import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
-import org.springframework.beans.BeanInstantiationException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.beans.factory.xml.XmlReaderContext;
-import org.w3c.dom.Element;
-
-import static org.apache.polygene.library.spring.bootstrap.Constants.BEAN_ID_ZEST_APPLICATION;
-import static org.springframework.beans.BeanUtils.instantiateClass;
-import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
-import static org.springframework.util.Assert.hasText;
-import static org.springframework.util.ClassUtils.forName;
-
-public final class PolygeneBootstrapBeanDefinitionParser
-        implements BeanDefinitionParser
-{
-
-    private static final String CLASS = "class";
-
-    @Override
-    public final BeanDefinition parse( Element anElement, ParserContext aParserContext )
-    {
-        PolygeneApplicationBootstrap bootstrap = createPolygeneApplicationBootstrap( anElement, aParserContext );
-        AbstractBeanDefinition factoryBeanDefinition = createPolygeneApplicationFactoryBeanDefinition( bootstrap );
-        registerBean( aParserContext, factoryBeanDefinition );
-        return factoryBeanDefinition;
-    }
-
-    private PolygeneApplicationBootstrap createPolygeneApplicationBootstrap( Element anElement, ParserContext aParserContext )
-    {
-        String bootstrapClassString = anElement.getAttribute( CLASS );
-        hasText( bootstrapClassString );
-        XmlReaderContext readerContext = aParserContext.getReaderContext();
-
-        Class<?> bootstrapClass;
-        try
-        {
-            bootstrapClass = forName( bootstrapClassString, getClass().getClassLoader() );
-        } catch ( ClassNotFoundException e )
-        {
-            readerContext.error( "Polygene bootstrap class [" + bootstrapClassString + "] is not found.", anElement );
-            return null;
-        }
-
-        if ( !PolygeneApplicationBootstrap.class.isAssignableFrom( bootstrapClass ) )
-        {
-            readerContext.error( CLASS + "attribute is not an instance of [" + PolygeneApplicationBootstrap.class.getName()
-                    + "] class", anElement );
-            return null;
-        }
-
-        PolygeneApplicationBootstrap bootstrap = null;
-        try
-        {
-            bootstrap = (PolygeneApplicationBootstrap) instantiateClass( bootstrapClass );
-        } catch ( BeanInstantiationException e )
-        {
-            readerContext.error( "Fail to instantiate Polygene bootstrap class [" + bootstrapClassString + "]", anElement,
-                    e );
-        }
-        return bootstrap;
-    }
-
-    private AbstractBeanDefinition createPolygeneApplicationFactoryBeanDefinition(
-        final PolygeneApplicationBootstrap applicationBootstrap
-    )
-    {
-        BeanDefinitionBuilder builder = rootBeanDefinition( PolygeneApplicationFactoryBean.class );
-        builder.addConstructorArgValue( applicationBootstrap );
-        return builder.getBeanDefinition();
-    }
-
-    private void registerBean( ParserContext aParserContext, BeanDefinition aBeanDefinition )
-    {
-        BeanDefinitionRegistry registry = aParserContext.getRegistry();
-        registry.registerBeanDefinition( BEAN_ID_ZEST_APPLICATION, aBeanDefinition );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/PolygeneServiceBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/PolygeneServiceBeanDefinitionParser.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/PolygeneServiceBeanDefinitionParser.java
new file mode 100644
index 0000000..401fd39
--- /dev/null
+++ b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/PolygeneServiceBeanDefinitionParser.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap.internal.service;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.support.AbstractBeanDefinition;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.xml.BeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.w3c.dom.Element;
+
+import static org.apache.polygene.library.spring.bootstrap.Constants.BEAN_ID_POLYGENE_APPLICATION;
+import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
+
+public final class PolygeneServiceBeanDefinitionParser
+    implements BeanDefinitionParser
+{
+    private static final String SERVICE_ID = "id";
+
+    @Override
+    public final BeanDefinition parse( Element anElement, ParserContext aParserContext )
+    {
+        String serviceId = anElement.getAttribute( SERVICE_ID );
+
+        // Service factory bean
+        BeanDefinitionBuilder builder = rootBeanDefinition( ServiceFactoryBean.class );
+        builder.addConstructorArgReference( BEAN_ID_POLYGENE_APPLICATION );
+        builder.addConstructorArgValue( serviceId );
+        AbstractBeanDefinition definition = builder.getBeanDefinition();
+
+        // Register service factory bean
+        BeanDefinitionRegistry definitionRegistry = aParserContext.getRegistry();
+        definitionRegistry.registerBeanDefinition( serviceId, definition );
+
+        return definition;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/ZestServiceBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/ZestServiceBeanDefinitionParser.java b/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/ZestServiceBeanDefinitionParser.java
deleted file mode 100644
index 7c9b5cc..0000000
--- a/libraries/spring/src/main/java/org/apache/polygene/library/spring/bootstrap/internal/service/ZestServiceBeanDefinitionParser.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap.internal.service;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.support.BeanDefinitionRegistry;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Element;
-
-import static org.apache.polygene.library.spring.bootstrap.Constants.BEAN_ID_ZEST_APPLICATION;
-import static org.springframework.beans.factory.support.BeanDefinitionBuilder.rootBeanDefinition;
-
-public final class PolygeneServiceBeanDefinitionParser
-    implements BeanDefinitionParser
-{
-    private static final String SERVICE_ID = "id";
-
-    @Override
-    public final BeanDefinition parse( Element anElement, ParserContext aParserContext )
-    {
-        String serviceId = anElement.getAttribute( SERVICE_ID );
-
-        // Service factory bean
-        BeanDefinitionBuilder builder = rootBeanDefinition( ServiceFactoryBean.class );
-        builder.addConstructorArgReference( BEAN_ID_ZEST_APPLICATION );
-        builder.addConstructorArgValue( serviceId );
-        AbstractBeanDefinition definition = builder.getBeanDefinition();
-
-        // Register service factory bean
-        BeanDefinitionRegistry definitionRegistry = aParserContext.getRegistry();
-        definitionRegistry.registerBeanDefinition( serviceId, definition );
-
-        return definition;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyPolygeneBootstrapper.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyPolygeneBootstrapper.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyPolygeneBootstrapper.java
new file mode 100644
index 0000000..1aa3c8b
--- /dev/null
+++ b/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyPolygeneBootstrapper.java
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring;
+
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+// START SNIPPET: code
+public class MyPolygeneBootstrapper extends PolygeneApplicationBootstrap
+        implements ApplicationContextAware
+{
+    private ApplicationContext applicationContext;
+
+    @Override
+    public void assemble(ApplicationAssembly assembly) throws AssemblyException
+    {
+        // Normal assembly of an application.
+// END SNIPPET: code
+// START SNIPPET: code
+    }
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
+    {
+        this.applicationContext = applicationContext;
+    }
+
+}
+// END SNIPPET: code

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyZestBootstrapper.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyZestBootstrapper.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyZestBootstrapper.java
deleted file mode 100644
index 1aa3c8b..0000000
--- a/libraries/spring/src/test/java/org/apache/polygene/library/spring/MyZestBootstrapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring;
-
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.library.spring.bootstrap.PolygeneApplicationBootstrap;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-// START SNIPPET: code
-public class MyPolygeneBootstrapper extends PolygeneApplicationBootstrap
-        implements ApplicationContextAware
-{
-    private ApplicationContext applicationContext;
-
-    @Override
-    public void assemble(ApplicationAssembly assembly) throws AssemblyException
-    {
-        // Normal assembly of an application.
-// END SNIPPET: code
-// START SNIPPET: code
-    }
-
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
-    {
-        this.applicationContext = applicationContext;
-    }
-
-}
-// END SNIPPET: code

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest.java
new file mode 100644
index 0000000..7c5f447
--- /dev/null
+++ b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneExportServiceTest.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.junit.Assert.*;
+import static org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap.COMMENT_SERVICE_ID;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public final class PolygeneExportServiceTest
+{
+    @Autowired
+    private ApplicationContext appContext;
+
+    @Test
+    public final void testCommentService()
+    {
+        assertTrue( appContext.containsBean( COMMENT_SERVICE_ID ) );
+
+        CommentService commentService = (CommentService) appContext.getBean( COMMENT_SERVICE_ID );
+        assertNotNull( commentService );
+
+        String beerComment = commentService.comment( "beer" );
+        assertEquals( "BEER IS GOOD.", beerComment );
+
+        String colaComment = commentService.comment( "cola" );
+        assertEquals( "COLA IS GOOD.", colaComment );
+
+        String colaBeerComment = commentService.comment( "cola+beer" );
+        assertEquals( "COLA+BEER IS BAAAD.", colaBeerComment );
+
+        CommentServiceHolder holder = (CommentServiceHolder) appContext.getBean( "commentServiceHolder" );
+        assertTrue( commentService == holder.service() );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneTestBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneTestBootstrap.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneTestBootstrap.java
new file mode 100644
index 0000000..6cb12e0
--- /dev/null
+++ b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/PolygeneTestBootstrap.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.bootstrap;
+
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+public final class PolygeneTestBootstrap extends PolygeneApplicationBootstrap
+        implements ApplicationContextAware
+{
+    private static final String LAYER = "layer";
+
+    private static final String MODULE = "module";
+
+    static final String COMMENT_SERVICE_ID = "commentService";
+
+    private static final String TO_UPPERCASE_SERVICE_ID = "toUppercaseService";
+
+    private ApplicationContext applicationContext;
+
+    public final void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException
+    {
+        LayerAssembly layerAssembly = applicationAssembly.layer( LAYER );
+        ModuleAssembly moduleAssembly = layerAssembly.module( MODULE );
+        moduleAssembly.services( CommentServiceComposite.class ).identifiedBy( COMMENT_SERVICE_ID );
+        // inject Spring bean as a service
+        moduleAssembly.importedServices( TextProcessingService.class )
+                .setMetaInfo( this.applicationContext.getBean( TO_UPPERCASE_SERVICE_ID ) );
+    }
+
+    public void setApplicationContext( ApplicationContext applicationContext ) throws BeansException
+    {
+        this.applicationContext = applicationContext;
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest.java
deleted file mode 100644
index 7c5f447..0000000
--- a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestExportServiceTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import static org.junit.Assert.*;
-import static org.apache.polygene.library.spring.bootstrap.PolygeneTestBootstrap.COMMENT_SERVICE_ID;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration
-public final class PolygeneExportServiceTest
-{
-    @Autowired
-    private ApplicationContext appContext;
-
-    @Test
-    public final void testCommentService()
-    {
-        assertTrue( appContext.containsBean( COMMENT_SERVICE_ID ) );
-
-        CommentService commentService = (CommentService) appContext.getBean( COMMENT_SERVICE_ID );
-        assertNotNull( commentService );
-
-        String beerComment = commentService.comment( "beer" );
-        assertEquals( "BEER IS GOOD.", beerComment );
-
-        String colaComment = commentService.comment( "cola" );
-        assertEquals( "COLA IS GOOD.", colaComment );
-
-        String colaBeerComment = commentService.comment( "cola+beer" );
-        assertEquals( "COLA+BEER IS BAAAD.", colaBeerComment );
-
-        CommentServiceHolder holder = (CommentServiceHolder) appContext.getBean( "commentServiceHolder" );
-        assertTrue( commentService == holder.service() );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestTestBootstrap.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestTestBootstrap.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestTestBootstrap.java
deleted file mode 100644
index 86406fa..0000000
--- a/libraries/spring/src/test/java/org/apache/polygene/library/spring/bootstrap/ZestTestBootstrap.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.bootstrap;
-
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-public final class PolygeneTestBootstrap
-        extends PolygeneApplicationBootstrap
-        implements ApplicationContextAware
-{
-    private static final String LAYER = "layer";
-
-    private static final String MODULE = "module";
-
-    static final String COMMENT_SERVICE_ID = "commentService";
-
-    private static final String TO_UPPERCASE_SERVICE_ID = "toUppercaseService";
-
-    private ApplicationContext applicationContext;
-
-    public final void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException
-    {
-        LayerAssembly layerAssembly = applicationAssembly.layer( LAYER );
-        ModuleAssembly moduleAssembly = layerAssembly.module( MODULE );
-        moduleAssembly.services( CommentServiceComposite.class ).identifiedBy( COMMENT_SERVICE_ID );
-        // inject Spring bean as a service
-        moduleAssembly.importedServices( TextProcessingService.class )
-                .setMetaInfo( this.applicationContext.getBean( TO_UPPERCASE_SERVICE_ID ) );
-    }
-
-    public void setApplicationContext( ApplicationContext applicationContext ) throws BeansException
-    {
-        this.applicationContext = applicationContext;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest.java
new file mode 100644
index 0000000..74bbec4
--- /dev/null
+++ b/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/PolygeneImportServiceTest.java
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.library.spring.importer;
+
+import java.util.stream.StreamSupport;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.injection.scope.Service;
+import org.apache.polygene.api.injection.scope.Structure;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.service.ServiceReference;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import static org.apache.polygene.api.service.qualifier.ServiceQualifier.withId;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration
+public final class PolygeneImportServiceTest
+{
+    @Autowired ApplicationContext appContext;
+
+    @Service CommentService service;
+
+    @Test
+    public final void givenImportedSpringServicesWhenServiceIsInjectedThenUseSpringService()
+        throws ActivationException, AssemblyException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            public void assemble( ModuleAssembly module ) throws AssemblyException
+            {
+                module.objects( PolygeneImportServiceTest.class );
+                // START SNIPPET: import
+                new SpringImporterAssembler( appContext ).assemble( module );
+                // END SNIPPET: import
+            }
+        };
+
+        assembler.module().injectTo( this );
+
+        assertThat( "service can be called", service.comment( "beer" ), equalTo( "beer is good." ) );
+    }
+
+    @Service Iterable<ServiceReference<CommentService>> services;
+
+    @Test
+    public final void givenImportedSpringServicesWhenServicesAreInjectedThenCanIdentifyByName()
+        throws ActivationException, AssemblyException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            public void assemble( ModuleAssembly module ) throws AssemblyException
+            {
+                module.objects( PolygeneImportServiceTest.class );
+
+                new SpringImporterAssembler( appContext ).assemble( module );
+            }
+        };
+
+        assembler.module().injectTo(this);
+
+        CommentService service = StreamSupport.stream( services.spliterator(), false )
+                                              .filter( withId( "commentService2" ) )
+                                              .findFirst().map( ServiceReference::get ).orElse( null );
+        assertThat( "service with correct id has been selected", service.comment( "pizza" ), equalTo( "pizza is good." ) );
+    }
+
+    @Structure ServiceFinder finder;
+
+    @Test
+    public final void givenImportedSpringServicesWhenServicesAreFoundThenCanIdentifyByName()
+        throws ActivationException, AssemblyException
+    {
+        SingletonAssembler assembler = new SingletonAssembler()
+        {
+            public void assemble( ModuleAssembly module ) throws AssemblyException
+            {
+                module.objects( PolygeneImportServiceTest.class );
+
+                new SpringImporterAssembler( appContext ).assemble( module );
+            }
+        };
+
+        assembler.module().injectTo( this );
+
+        CommentService foundService = finder.findServices( CommentService.class )
+                                            .filter( withId( "commentService2" ) )
+                                            .findFirst().map( ServiceReference::get )
+                                            .orElse( null );
+        assertThat( "service with correct id has been selected", foundService.comment( "pizza" ), equalTo( "pizza is good." ) );
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/ZestImportServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/ZestImportServiceTest.java b/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/ZestImportServiceTest.java
deleted file mode 100644
index 74bbec4..0000000
--- a/libraries/spring/src/test/java/org/apache/polygene/library/spring/importer/ZestImportServiceTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.library.spring.importer;
-
-import java.util.stream.StreamSupport;
-import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.service.ServiceFinder;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import static org.apache.polygene.api.service.qualifier.ServiceQualifier.withId;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-@RunWith( SpringJUnit4ClassRunner.class )
-@ContextConfiguration
-public final class PolygeneImportServiceTest
-{
-    @Autowired ApplicationContext appContext;
-
-    @Service CommentService service;
-
-    @Test
-    public final void givenImportedSpringServicesWhenServiceIsInjectedThenUseSpringService()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.objects( PolygeneImportServiceTest.class );
-                // START SNIPPET: import
-                new SpringImporterAssembler( appContext ).assemble( module );
-                // END SNIPPET: import
-            }
-        };
-
-        assembler.module().injectTo( this );
-
-        assertThat( "service can be called", service.comment( "beer" ), equalTo( "beer is good." ) );
-    }
-
-    @Service Iterable<ServiceReference<CommentService>> services;
-
-    @Test
-    public final void givenImportedSpringServicesWhenServicesAreInjectedThenCanIdentifyByName()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.objects( PolygeneImportServiceTest.class );
-
-                new SpringImporterAssembler( appContext ).assemble( module );
-            }
-        };
-
-        assembler.module().injectTo(this);
-
-        CommentService service = StreamSupport.stream( services.spliterator(), false )
-                                              .filter( withId( "commentService2" ) )
-                                              .findFirst().map( ServiceReference::get ).orElse( null );
-        assertThat( "service with correct id has been selected", service.comment( "pizza" ), equalTo( "pizza is good." ) );
-    }
-
-    @Structure ServiceFinder finder;
-
-    @Test
-    public final void givenImportedSpringServicesWhenServicesAreFoundThenCanIdentifyByName()
-        throws ActivationException, AssemblyException
-    {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module ) throws AssemblyException
-            {
-                module.objects( PolygeneImportServiceTest.class );
-
-                new SpringImporterAssembler( appContext ).assemble( module );
-            }
-        };
-
-        assembler.module().injectTo( this );
-
-        CommentService foundService = finder.findServices( CommentService.class )
-                                            .filter( withId( "commentService2" ) )
-                                            .findFirst().map( ServiceReference::get )
-                                            .orElse( null );
-        assertThat( "service with correct id has been selected", foundService.comment( "pizza" ), equalTo( "pizza is good." ) );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java b/libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java
index edd75d8..3d2e9a2 100644
--- a/libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java
+++ b/libraries/sql/src/test/java/org/apache/polygene/library/sql/datasource/ExternalDataSourceTest.java
@@ -32,7 +32,7 @@ import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 
 public class ExternalDataSourceTest
-        extends AbstractPolygeneTest
+    extends AbstractPolygeneTest
 {
 
     @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/PersistingSequencingTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/PersistingSequencingTest.java b/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/PersistingSequencingTest.java
index ceed35e..25be0f6 100644
--- a/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/PersistingSequencingTest.java
+++ b/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/PersistingSequencingTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.uid.sequence;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.Service;
@@ -26,7 +27,6 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.uid.sequence.assembly.PersistingSequencingAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 import static org.junit.Assert.*;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/TransientSequencingTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/TransientSequencingTest.java b/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/TransientSequencingTest.java
index 1e1fdd1..e8f8f40 100644
--- a/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/TransientSequencingTest.java
+++ b/libraries/uid/src/test/java/org/apache/polygene/library/uid/sequence/TransientSequencingTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.uid.sequence;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.Service;
@@ -26,7 +27,6 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.uid.sequence.assembly.TransientSequencingAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/libraries/uid/src/test/java/org/apache/polygene/library/uid/uuid/UuidServiceTest.java
----------------------------------------------------------------------
diff --git a/libraries/uid/src/test/java/org/apache/polygene/library/uid/uuid/UuidServiceTest.java b/libraries/uid/src/test/java/org/apache/polygene/library/uid/uuid/UuidServiceTest.java
index 60ccb75..af5a490 100644
--- a/libraries/uid/src/test/java/org/apache/polygene/library/uid/uuid/UuidServiceTest.java
+++ b/libraries/uid/src/test/java/org/apache/polygene/library/uid/uuid/UuidServiceTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.polygene.library.uid.uuid;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.Service;
@@ -26,7 +27,6 @@ import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.library.uid.uuid.assembly.UuidServiceAssembler;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/manual/src/docs/tutorials/howto-depend-on-zest.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-depend-on-zest.txt b/manual/src/docs/tutorials/howto-depend-on-zest.txt
index 8b3901b..d71fd71 100644
--- a/manual/src/docs/tutorials/howto-depend-on-zest.txt
+++ b/manual/src/docs/tutorials/howto-depend-on-zest.txt
@@ -50,24 +50,24 @@ You simply declare dependencies on Polygene\u2122 artifacts:
     <dependency>
         <groupId>org.apache.polygene.core</groupId>
         <artifactId>org.apache.polygene.core.bootstrap</artifactId>
-        <version>ZEST_VERSION</version>
+        <version>POLYGENE_VERSION</version>
     </dependency>
     <dependency>
         <groupId>org.apache.polygene.core</groupId>
         <artifactId>org.apache.polygene.core.runtime</artifactId>
-        <version>ZEST_VERSION</version>
+        <version>POLYGENE_VERSION</version>
         <scope>runtime</scope>
     </dependency>
     <dependency>
         <groupId>org.apache.polygene.core</groupId>
         <artifactId>org.apache.polygene.core.testsupport</artifactId>
-        <version>ZEST_VERSION</version>
+        <version>POLYGENE_VERSION</version>
         <scope>test</scope>
     </dependency>
 </dependencies>
 ----
 
-Where `ZEST_VERSION` is the Polygene\u2122 version you want to use.
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
 
 If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
 
@@ -91,13 +91,13 @@ You simply declare dependencies on Polygene\u2122 artifacts:
 [source,groovy]
 ----
 dependencies {
-    compile     "org.apache.polygene.core:org.apache.polygene.core.bootstrap:ZEST_VERSION"
-    runtime     "org.apache.polygene.core:org.apache.polygene.core.runtime:ZEST_VERSION"
-    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:ZEST_VERSION"
+    compile     "org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION"
+    runtime     "org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION"
+    testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION"
 }
 ----
 
-Where `ZEST_VERSION` is the Polygene\u2122 version you want to use.
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
 
 If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
 
@@ -115,12 +115,12 @@ You simply declare dependencies on Polygene\u2122 artifacts:
 
 [source,ruby]
 ----
-compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:ZEST_VERSION'
-package(:war).with :libs => 'org.apache.polygene.core:org.apache.polygene.core.runtime:ZEST_VERSION'
-test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:ZEST_VERSION'
+compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION'
+package(:war).with :libs => 'org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION'
+test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION'
 ----
 
-Where `ZEST_VERSION` is the Polygene\u2122 version you want to use.
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
 
 If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
 
@@ -137,17 +137,17 @@ You simply declare dependencies on Polygene\u2122 artifacts:
 [source,scala]
 ----
 libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.bootstrap" % "ZEST_VERSION" \
+    "org.apache.polygene.core" % "org.apache.polygene.core.bootstrap" % "POLYGENE_VERSION" \
     withSources() withJavadoc()
 libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.runtime" % "ZEST_VERSION" % "runtime" \
+    "org.apache.polygene.core" % "org.apache.polygene.core.runtime" % "POLYGENE_VERSION" % "runtime" \
     withSources() withJavadoc()
 libraryDependencies += \
-    "org.apache.polygene.core" % "org.apache.polygene.core.testsupport" % "ZEST_VERSION" % "test" \
+    "org.apache.polygene.core" % "org.apache.polygene.core.testsupport" % "POLYGENE_VERSION" % "test" \
     withSources() withJavadoc()
 ----
 
-Where `ZEST_VERSION` is the Polygene\u2122 version you want to use.
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
 
 If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository:
 
@@ -166,16 +166,16 @@ You simply declare dependencies on Polygene\u2122 artifacts:
 <ivy-module>
     <dependencies>
         <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.bootstrap"
-                    rev="ZEST_VERSION"  conf="default" />
+                    rev="POLYGENE_VERSION"  conf="default" />
         <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.runtime"
-                    rev="ZEST_VERSION"  conf="runtime" />
+                    rev="POLYGENE_VERSION"  conf="runtime" />
         <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.testsupport"
-                    rev="ZEST_VERSION"  conf="test" />
+                    rev="POLYGENE_VERSION"  conf="test" />
     </dependencies>
 </ivy-module>
 ----
 
-Where `ZEST_VERSION` is the Polygene\u2122 version you want to use.
+Where `POLYGENE_VERSION` is the Polygene\u2122 version you want to use.
 
 If you want to use +-SNAPSHOT+ versions, you need to register the Apache Snapshots repository in a `ivysettings.xml` file:
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/manual/src/docs/tutorials/howto-releasing-apache.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/tutorials/howto-releasing-apache.txt b/manual/src/docs/tutorials/howto-releasing-apache.txt
index 2854c88..62dc155 100644
--- a/manual/src/docs/tutorials/howto-releasing-apache.txt
+++ b/manual/src/docs/tutorials/howto-releasing-apache.txt
@@ -164,14 +164,14 @@ They can be resolved by:
 - marking them as `INVALID` or `WONTFIX`
 - changing their fix version to another unreleased version
 
-See the https://issues.apache.org/jira/browse/ZEST[ZEST] project on JIRA.
+See the https://issues.apache.org/jira/browse/POLYGENE[POLYGENE] project on JIRA.
 
 
 === Prepare Release-Notes
 
 Apache Polygene\u2122 release-notes are generated from JIRA issues.
 
-Open the target Polygene\u2122 version's release-notes in https://issues.apache.org/jira/browse/ZEST/?selectedTab=com.atlassian.jira.jira-projects-plugin:roadmap-panel[JIRA] and review them.
+Open the target Polygene\u2122 version's release-notes in https://issues.apache.org/jira/browse/POLYGENE/?selectedTab=com.atlassian.jira.jira-projects-plugin:roadmap-panel[JIRA] and review them.
 
 JIRA can produces release-notes as HTML or plain-text.
 Set it up to generate plain-text release-notes.
@@ -187,7 +187,7 @@ Convert to Asciidoc:
 [source,shell]
 ----
 cat "apache-polygene-java-<RELEASE-VERSION>-release-notes.txt" | \
-  sed -e "s/\[ZEST-\([0-9]\)*\]/https:\/\/issues.apache.org\/jira\/browse\/ZEST-\1[ZEST-\1]/" | \
+  sed -e "s/\[POLYGENE-\([0-9]\)*\]/https:\/\/issues.apache.org\/jira\/browse\/POLYGENE-\1[POLYGENE-\1]/" | \
   sed -e "s/    \* /- /" |�sed -e "s/^\*\*/====/" \
   > "apache-polygene-java-<RELEASE-VERSION>-release-notes.adoc"
 ----
@@ -197,7 +197,7 @@ Convert to Markdown:
 [source,shell]
 ----
 cat "apache-polygene-java-<RELEASE-VERSION>-release-notes.txt" | \
-  sed -e "s/\[ZEST-\([0-9]*\)\]/[ZEST-\1](https:\/\/issues.apache.org\/jira\/browse\/ZEST-\1)/" | \
+  sed -e "s/\[POLYGENE-\([0-9]*\)\]/[POLYGENE-\1](https:\/\/issues.apache.org\/jira\/browse\/POLYGENE-\1)/" | \
   sed -e "s/    \* /- /" |�sed -e "s/^\*\*/####/" \
   > "apache-polygene-java-<RELEASE-VERSION>-release-notes.md"
 ----

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tests/regression/README-for-regression-reporting.txt
----------------------------------------------------------------------
diff --git a/tests/regression/README-for-regression-reporting.txt b/tests/regression/README-for-regression-reporting.txt
index a558433..872a2ed 100644
--- a/tests/regression/README-for-regression-reporting.txt
+++ b/tests/regression/README-for-regression-reporting.txt
@@ -3,7 +3,7 @@ Regression Test reporting follows the following steps;
 
 1. Go to http://ops4j1.jira.com/browse/QI and create a new JIRA issue about the problem.
 
-2. Create a package named org.apache.polygene.tests.regression.qi123 (for QI-123) in $ZEST/tests/regression/src/main/java.
+2. Create a package named org.apache.polygene.tests.regression.qi123 (for QI-123) in $POLYGENE/tests/regression/src/main/java.
    NOTE: observe that the test MUST sit in the src/MAIN/java and not under src/test
 
 3. Create a JUnit or TestNG test capturing the issue described in JIRA.

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
new file mode 100644
index 0000000..42d1104
--- /dev/null
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/PolygeneApplicationComponent.java
@@ -0,0 +1,133 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.polygene.ide.plugin.idea;
+
+import com.intellij.codeInspection.InspectionToolProvider;
+import com.intellij.facet.FacetTypeRegistry;
+import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
+import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptor;
+import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory;
+import com.intellij.openapi.components.ApplicationComponent;
+import com.intellij.openapi.fileTypes.FileTypeManager;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.apache.polygene.ide.plugin.idea.appliesTo.inspections.AppliesToAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.common.facet.PolygeneFacetType;
+import org.apache.polygene.ide.plugin.idea.concerns.inspections.ConcernsAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.invocation.inspections.InvocationAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.service.inspections.ServiceAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.injections.structure.inspections.StructureAnnotationDeclaredCorrectlyInspection;
+import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinImplementsMixinType;
+import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinsAnnotationDeclaredOnMixinType;
+import org.apache.polygene.ide.plugin.idea.sideEffects.inspections.SideEffectsAnnotationDeclaredCorrectlyInspection;
+
+import javax.swing.*;
+
+import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
+
+/**
+ * @author edward.yakop@gmail.com
+ * @since 0.1
+ */
+public final class PolygeneApplicationComponent
+    implements ApplicationComponent, InspectionToolProvider, FileTemplateGroupDescriptorFactory
+{
+    @NonNls
+    private static String[] FILE_TEMPLATES = {
+        "GenericConcernOf.java"
+    };
+
+    private final PolygeneFacetType polygeneFacetType;
+
+    public PolygeneApplicationComponent()
+    {
+        polygeneFacetType = new PolygeneFacetType();
+    }
+
+    @NotNull
+    public final String getComponentName()
+    {
+        return "PolygeneApplicationComponent";
+    }
+
+    public final void initComponent()
+    {
+        registerFacet();
+        registerIntentions();
+    }
+
+    private void registerFacet()
+    {
+        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
+        facetTypeRegistry.registerFacetType( polygeneFacetType );
+    }
+
+    private void registerIntentions()
+    {
+//        IntentionManager intentionManager = IntentionManager.getInstance();
+//        intentionManager.registerIntentionAndMetaData( new AddConcernOnType(), "intention.category.control.flow" );
+    }
+
+    public final void disposeComponent()
+    {
+        unregisterFacet();
+    }
+
+    private void unregisterFacet()
+    {
+        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
+        facetTypeRegistry.unregisterFacetType( polygeneFacetType );
+    }
+
+    public final Class[] getInspectionClasses()
+    {
+        return new Class[]{
+            // Concerns
+            ConcernsAnnotationDeclaredCorrectlyInspection.class,
+            // Mixins
+            MixinImplementsMixinType.class,
+            MixinsAnnotationDeclaredOnMixinType.class,
+            // Side effects
+            SideEffectsAnnotationDeclaredCorrectlyInspection.class,
+            // Injections
+            InvocationAnnotationDeclaredCorrectlyInspection.class,
+            ServiceAnnotationDeclaredCorrectlyInspection.class,
+            StructureAnnotationDeclaredCorrectlyInspection.class,
+            // AppliesTo
+            AppliesToAnnotationDeclaredCorrectlyInspection.class
+        };
+    }
+
+    public final FileTemplateGroupDescriptor getFileTemplatesDescriptor()
+    {
+        FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor(
+            message( "polygene.file.template.group.title" ), null
+        );
+
+        FileTypeManager fileTypeManager = FileTypeManager.getInstance();
+        for( @NonNls String template : FILE_TEMPLATES )
+        {
+            Icon icon = fileTypeManager.getFileTypeByFileName( template ).getIcon();
+            group.addTemplate( new FileTemplateDescriptor( template, icon ) );
+        }
+
+        return group;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
deleted file mode 100644
index 42d1104..0000000
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/ZestApplicationComponent.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you 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.polygene.ide.plugin.idea;
-
-import com.intellij.codeInspection.InspectionToolProvider;
-import com.intellij.facet.FacetTypeRegistry;
-import com.intellij.ide.fileTemplates.FileTemplateDescriptor;
-import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptor;
-import com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory;
-import com.intellij.openapi.components.ApplicationComponent;
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.apache.polygene.ide.plugin.idea.appliesTo.inspections.AppliesToAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.common.facet.PolygeneFacetType;
-import org.apache.polygene.ide.plugin.idea.concerns.inspections.ConcernsAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.invocation.inspections.InvocationAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.service.inspections.ServiceAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.injections.structure.inspections.StructureAnnotationDeclaredCorrectlyInspection;
-import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinImplementsMixinType;
-import org.apache.polygene.ide.plugin.idea.mixins.inspections.MixinsAnnotationDeclaredOnMixinType;
-import org.apache.polygene.ide.plugin.idea.sideEffects.inspections.SideEffectsAnnotationDeclaredCorrectlyInspection;
-
-import javax.swing.*;
-
-import static org.apache.polygene.ide.plugin.idea.common.resource.PolygeneResourceBundle.message;
-
-/**
- * @author edward.yakop@gmail.com
- * @since 0.1
- */
-public final class PolygeneApplicationComponent
-    implements ApplicationComponent, InspectionToolProvider, FileTemplateGroupDescriptorFactory
-{
-    @NonNls
-    private static String[] FILE_TEMPLATES = {
-        "GenericConcernOf.java"
-    };
-
-    private final PolygeneFacetType polygeneFacetType;
-
-    public PolygeneApplicationComponent()
-    {
-        polygeneFacetType = new PolygeneFacetType();
-    }
-
-    @NotNull
-    public final String getComponentName()
-    {
-        return "PolygeneApplicationComponent";
-    }
-
-    public final void initComponent()
-    {
-        registerFacet();
-        registerIntentions();
-    }
-
-    private void registerFacet()
-    {
-        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.registerFacetType( polygeneFacetType );
-    }
-
-    private void registerIntentions()
-    {
-//        IntentionManager intentionManager = IntentionManager.getInstance();
-//        intentionManager.registerIntentionAndMetaData( new AddConcernOnType(), "intention.category.control.flow" );
-    }
-
-    public final void disposeComponent()
-    {
-        unregisterFacet();
-    }
-
-    private void unregisterFacet()
-    {
-        FacetTypeRegistry facetTypeRegistry = FacetTypeRegistry.getInstance();
-        facetTypeRegistry.unregisterFacetType( polygeneFacetType );
-    }
-
-    public final Class[] getInspectionClasses()
-    {
-        return new Class[]{
-            // Concerns
-            ConcernsAnnotationDeclaredCorrectlyInspection.class,
-            // Mixins
-            MixinImplementsMixinType.class,
-            MixinsAnnotationDeclaredOnMixinType.class,
-            // Side effects
-            SideEffectsAnnotationDeclaredCorrectlyInspection.class,
-            // Injections
-            InvocationAnnotationDeclaredCorrectlyInspection.class,
-            ServiceAnnotationDeclaredCorrectlyInspection.class,
-            StructureAnnotationDeclaredCorrectlyInspection.class,
-            // AppliesTo
-            AppliesToAnnotationDeclaredCorrectlyInspection.class
-        };
-    }
-
-    public final FileTemplateGroupDescriptor getFileTemplatesDescriptor()
-    {
-        FileTemplateGroupDescriptor group = new FileTemplateGroupDescriptor(
-            message( "polygene.file.template.group.title" ), null
-        );
-
-        FileTypeManager fileTypeManager = FileTypeManager.getInstance();
-        for( @NonNls String template : FILE_TEMPLATES )
-        {
-            Icon icon = fileTypeManager.getFileTypeByFileName( template ).getIcon();
-            group.addTemplate( new FileTemplateDescriptor( template, icon ) );
-        }
-
-        return group;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
index 178d258..a6d0a38 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/common/inspections/AbstractInspection.java
@@ -32,11 +32,11 @@ import static com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR;
  */
 public abstract class AbstractInspection extends BaseJavaLocalInspectionTool
 {
-    private static final String ZEST_IDEA_INSPECTIONS_NAME = "polygene.inspections.name";
+    private static final String POLYGENE_IDEA_INSPECTIONS_NAME = "polygene.inspections.name";
 
     @Nls @NotNull public String getGroupDisplayName()
     {
-        return PolygeneResourceBundle.message( ZEST_IDEA_INSPECTIONS_NAME );
+        return PolygeneResourceBundle.message( POLYGENE_IDEA_INSPECTIONS_NAME );
     }
 
     @NotNull

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
----------------------------------------------------------------------
diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
index 90dfd83..2a5d3bf 100644
--- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
+++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java
@@ -41,7 +41,7 @@ public final class PolygeneStructureAnnotationConstants
                 "org.apache.polygene.structure.Module",
                 "org.apache.polygene.structure.Layer",
                 "org.apache.polygene.structure.Application",
-                "org.apache.polygene.PolygeneAPI",
+                "org.apache.polygene.api.PolygeneAPI",
                 "org.apache.polygene.spi.PolygeneSPI"
             };
         sort( VALID_STRUCTURE_INJECTION_TYPE );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tools/shell/src/dist/bin/zest-boot
----------------------------------------------------------------------
diff --git a/tools/shell/src/dist/bin/zest-boot b/tools/shell/src/dist/bin/zest-boot
index 5a86955..5c0306a 100644
--- a/tools/shell/src/dist/bin/zest-boot
+++ b/tools/shell/src/dist/bin/zest-boot
@@ -59,7 +59,7 @@ else
     # Up one level
     cd ..
     # Get the home directory of Polygene
-    ZESTPATH=`pwd`
+    POLYGENEPATH=`pwd`
 
     # Figure out if we are executing from within the SDK or the QuickStart
     if [ -f libs/$JARNAME ] ; then
@@ -73,7 +73,7 @@ else
     # Restore the current directory
     cd $CWD
 
-    java -Dpolygene.home=$ZESTPATH -jar $ZESTPATH/$JARFILE "$@"
+    java -Dpolygene.home=$POLYGENEPATH -jar $POLYGENEPATH/$JARFILE "$@"
 fi
 
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/Step2TestCase.java
----------------------------------------------------------------------
diff --git a/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/Step2TestCase.java b/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/Step2TestCase.java
index e6f59e7..ac71082 100644
--- a/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/Step2TestCase.java
+++ b/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/Step2TestCase.java
@@ -19,11 +19,11 @@
  */
 package org.apache.polygene.tutorials.cargo.step2;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.junit.Assert.assertEquals;
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
index 46589ed..d752fdd 100644
--- a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
+++ b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest.java
@@ -19,11 +19,11 @@
  */
 package org.apache.polygene.tutorials.hello;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.value.ValueBuilder;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest4.java
----------------------------------------------------------------------
diff --git a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest4.java b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest4.java
index 72ae7ef..1ff59eb 100644
--- a/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest4.java
+++ b/tutorials/hello/src/test/java/org/apache/polygene/tutorials/hello/HelloTest4.java
@@ -21,13 +21,13 @@ package org.apache.polygene.tutorials.hello;
 
 import org.apache.polygene.api.identity.Identity;
 import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.api.entity.EntityBuilder;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step2/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step2/LibraryTest.java b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step2/LibraryTest.java
index f8eaa7e..440b9bb 100644
--- a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step2/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step2/LibraryTest.java
@@ -19,10 +19,10 @@
  */
 package org.apache.polygene.tutorials.services.step2;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 public class LibraryTest
     extends AbstractPolygeneTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step3/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step3/LibraryTest.java b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step3/LibraryTest.java
index ef33f00..f3c0197 100644
--- a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step3/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step3/LibraryTest.java
@@ -19,10 +19,10 @@
  */
 package org.apache.polygene.tutorials.services.step3;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 
 public class LibraryTest
     extends AbstractPolygeneTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step4/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step4/LibraryTest.java b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step4/LibraryTest.java
index 02c648e..c62d14d 100644
--- a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step4/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step4/LibraryTest.java
@@ -19,10 +19,10 @@
  */
 package org.apache.polygene.tutorials.services.step4;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 public class LibraryTest

http://git-wip-us.apache.org/repos/asf/zest-java/blob/b02063bd/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step6/LibraryTest.java
----------------------------------------------------------------------
diff --git a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step6/LibraryTest.java b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step6/LibraryTest.java
index 562715d..b13b7da 100644
--- a/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step6/LibraryTest.java
+++ b/tutorials/services/src/test/java/org/apache/polygene/tutorials/services/step6/LibraryTest.java
@@ -19,10 +19,10 @@
  */
 package org.apache.polygene.tutorials.services.step6;
 
+import org.apache.polygene.test.AbstractPolygeneTest;
 import org.junit.Test;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.test.AbstractPolygeneTest;
 import org.apache.polygene.test.EntityTestAssembler;
 
 public class LibraryTest