polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [22/28] zest-java git commit: ZEST-180, ZEST-186, ZEST-187, ZEST-188 Big Identity refactoring UnitOfWorkFactory is auto added to all modules that doesn't declare one IdentityGenerator is auto-added to all modules that deosn't declare one. Removed DCI/DDD
Date Sun, 23 Oct 2016 14:24:03 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
index f1b37f0..2555748 100755
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/RdfNamedQueryTest.java
@@ -52,195 +52,242 @@ public class RdfNamedQueryTest extends AbstractNamedQueryTest
 
     private static String[] queryStrings =
     {
-        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+// START-SNIPPET: query1
+        "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "\n" + "}", // script01
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "\n" + "}", // script01
+// END-SNIPPET
 
+// START-SNIPPET: query2
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Domain>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "FILTER (?v0 = \"Gaming\")\n" + "}", // script02
+// END-SNIPPET
 
-        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+// START-SNIPPET: query3
+        "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "\n" + "}", // script03
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "\n" + "}", // script03
+// END-SNIPPET
 
+// START-SNIPPET: query4
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
             + "PREFIX ns2: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:placeOfBirth ?v0. \n" + "?v0 ns2:name ?v1. \n" + "FILTER (?v1 = \"Kuala Lumpur\")\n" + "}", // script04
+// END-SNIPPET
 
+// START-SNIPPET: query5
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
             + "PREFIX ns2: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:mother ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:mother ?v0. \n"
             + "?v0 ns1:placeOfBirth ?v1. \n" + "?v1 ns2:name ?v2. \n" + "FILTER (?v2 = \"Kuala Lumpur\")\n" + "}", // script05
+// END-SNIPPET
 
+// START-SNIPPET: query6
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "FILTER (?v0 >= \"1973\")\n" + "}", // script06
+// END-SNIPPET
 
+// START-SNIPPET: query7
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
             + "PREFIX ns2: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "?entity ns1:placeOfBirth ?v1. \n" + "?v1 ns2:name ?v2. \n"
             + "FILTER ((?v0 >= \"1900\") && (?v2 = \"Penang\"))\n" + "}", // script07
+// END-SNIPPET
 
+// START-SNIPPET: query8
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "FILTER ((?v0 = \"1970\") || (?v0 = \"1975\"))\n" + "}", // script08
+// END-SNIPPET
 
+// START-SNIPPET: query9
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Female>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "FILTER ((?v0 = \"1970\") || (?v0 = \"1975\"))\n" + "}", // script09
+// END-SNIPPET
 
+// START-SNIPPET: query10
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "FILTER (!(?v0 = \"1975\"))\n" + "}", // script10
+// END-SNIPPET
 
+// START-SNIPPET: query11
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "OPTIONAL {?entity ns1:email ?v0}. \n" + "FILTER (bound(?v0))\n" + "}", // script11
+// END-SNIPPET
 
+// START-SNIPPET: query12
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "OPTIONAL {?entity ns1:email ?v0}. \n" + "FILTER (! bound(?v0))\n" + "}", // script12
+// END-SNIPPET
 
-        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+// START-SNIPPET: query13
+        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.identity.HasIdentity#> \n"
             + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
             + "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Male#> \n"
-            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "OPTIONAL {?entity ns1:wife ?v0}. \n" + "FILTER (bound(?v0))\n" + "}", // script13
+// END-SNIPPET
 
-        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+// START-SNIPPET: query14
+        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.identity.HasIdentity#> \n"
             + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
             + "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Male#> \n"
-            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Male>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "OPTIONAL {?entity ns1:wife ?v0}. \n" + "FILTER (! bound(?v0))\n" + "}", // script14
+// END-SNIPPET
 
-        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+// START-SNIPPET: query15
+        "PREFIX ns0: <urn:zest:type:org.apache.zest.api.identity.HasIdentity#> \n"
             + "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
             + "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Male#> \n"
-            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "OPTIONAL {?entity ns1:wife ?v0}. \n" + "FILTER (! bound(?v0))\n" + "}", // script15
+// END-SNIPPET
 
+// START-SNIPPET: query16
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "\n" + "}", // script16
+// END-SNIPPET
 
+// START-SNIPPET: query17
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "\n" + "} ", // script17
+// END-SNIPPET
 
+// START-SNIPPET: query18
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "\n" + "}\n", // script18
+// END-SNIPPET
 
+// START-SNIPPET: query19
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "FILTER (?v0 > \"D\")\n" + "} ", // script19
+// END-SNIPPET
 
+// START-SNIPPET: query20
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
             + "PREFIX ns2: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:yearOfBirth ?v0. \n" + "?entity ns2:name ?v1. \n" + "FILTER (?v0 > \"1973\")\n" + "}\n"
             , // script20
+// END-SNIPPET
 
+// START-SNIPPET: query21
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Person#> \n"
             + "PREFIX ns2: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Person>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n"
             + "?entity ns1:placeOfBirth ?v0. \n" + "?v0 ns2:name ?v1. \n" + "?entity ns1:yearOfBirth ?v2. \n" + "\n"
             + "}", // script21
+// END-SNIPPET
 
+// START-SNIPPET: query22
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Nameable>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "FILTER regex(?v0,\"J.*Doe\")\n" + "}", // script22
+// END-SNIPPET
 
+// START-SNIPPET: query23
         "", // script23
+// END-SNIPPET
 
+// START-SNIPPET: query24
         "PREFIX ns1: <urn:zest:type:org.apache.zest.test.indexing.model.Nameable#> \n"
-            + "PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> \n"
+            + "PREFIX ns0: <urn:zest:type:org.apache.zest.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" + "SELECT DISTINCT ?identity\n"
+            + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n" + "SELECT DISTINCT ?reference\n"
             + "WHERE {\n" + "?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.test.indexing.model.Domain>. \n"
-            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?identity. \n" + "?entity ns1:name ?v0. \n"
+            + "?entity rdf:type ?entityType. \n" + "?entity ns0:identity ?reference. \n" + "?entity ns1:name ?v0. \n"
             + "FILTER (?v0 = ?domain)\n" + "}" // script24
-
+// END-SNIPPET
     };
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi173/Qi173IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi173/Qi173IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi173/Qi173IssueTest.java
index a9a7fba..b0a4d04 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi173/Qi173IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi173/Qi173IssueTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi173;
 
+import org.apache.zest.api.identity.Identity;
 import org.junit.Assert;
 import org.junit.Test;
 import org.apache.zest.api.entity.EntityBuilder;
@@ -104,7 +105,7 @@ public class Qi173IssueTest
         uow.discard();
     }
 
-    private String createCar( String manufacturer, String model, int year )
+    private Identity createCar(String manufacturer, String model, int year )
     {
         UnitOfWork uow = unitOfWorkFactory.currentUnitOfWork();
         EntityBuilder<Car> builder = uow.newEntityBuilder( Car.class );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/AbstractIssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/AbstractIssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/AbstractIssueTest.java
index 14043d0..399364d 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/AbstractIssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/AbstractIssueTest.java
@@ -20,6 +20,7 @@
 package org.apache.zest.index.rdf.qi64;
 
 import org.apache.zest.api.entity.EntityBuilder;
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.zest.bootstrap.AssemblyException;
@@ -36,12 +37,12 @@ public abstract class AbstractIssueTest
     /**
      * Creates a new Apaxhe Zest account.
      *
-     * @return The new account identity.
+     * @return The new account reference.
      *
      * @throws org.apache.zest.api.unitofwork.UnitOfWorkCompletionException
      *          Thrown if creational fail.
      */
-    protected final String newZestAccount()
+    protected final Identity newZestAccount()
         throws UnitOfWorkCompletionException
     {
         UnitOfWork work = unitOfWorkFactory.newUnitOfWork();
@@ -50,7 +51,7 @@ public abstract class AbstractIssueTest
         accountComposite.name().set( DEFAULT_ACCOUNT_NAME );
         accountComposite = entityBuilder.newInstance();
 
-        String identity = accountComposite.identity().get();
+        Identity identity = accountComposite.identity().get();
         work.complete();
         return identity;
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/AccountService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/AccountService.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/AccountService.java
index 4c24478..8827496 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/AccountService.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/AccountService.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi64.withPropagationMandatory;
 
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.structure.Module;
@@ -34,7 +35,7 @@ import static org.apache.zest.index.rdf.qi64.withPropagationMandatory.AccountSer
 public interface AccountService
 {
     @UnitOfWorkPropagation( MANDATORY )
-    AccountComposite getAccountById( String anId );
+    AccountComposite getAccountById( Identity anId );
 
     public class AccountServiceMixin
         implements AccountService
@@ -45,7 +46,7 @@ public interface AccountService
         @Structure
         Module module;
 
-        public AccountComposite getAccountById( String anId )
+        public AccountComposite getAccountById( Identity anId )
         {
             // Use current unit of work
             UnitOfWork work = uowf.currentUnitOfWork();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/IssueTest.java
index 4d1e7fa..9a71b97 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationMandatory/IssueTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi64.withPropagationMandatory;
 
+import org.apache.zest.api.identity.Identity;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -53,7 +54,7 @@ public final class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertNull( unitOfWorkFactory.currentUnitOfWork() );
@@ -66,7 +67,7 @@ public final class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertFalse( unitOfWorkFactory.isUnitOfWorkActive() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/AccountService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/AccountService.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/AccountService.java
index f3c0fbb..f18bbff 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/AccountService.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/AccountService.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi64.withPropagationRequired;
 
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.structure.Module;
@@ -33,7 +34,7 @@ import static org.apache.zest.index.rdf.qi64.withPropagationRequired.AccountServ
 public interface AccountService
 {
     @UnitOfWorkPropagation
-    AccountComposite getAccountById( String anId );
+    AccountComposite getAccountById( Identity anId );
 
     public class AccountServiceMixin
         implements AccountService
@@ -44,7 +45,7 @@ public interface AccountService
         @Structure
         Module module;
 
-        public AccountComposite getAccountById( String anId )
+        public AccountComposite getAccountById( Identity anId )
         {
             // Use current unit of work
             UnitOfWork work = uowf.currentUnitOfWork();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/IssueTest.java
index 783608b..faf0836 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequired/IssueTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi64.withPropagationRequired;
 
+import org.apache.zest.api.identity.Identity;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -49,7 +50,7 @@ public final class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertFalse( unitOfWorkFactory.isUnitOfWorkActive() );
@@ -65,7 +66,7 @@ public final class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertFalse( unitOfWorkFactory.isUnitOfWorkActive() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/AccountService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/AccountService.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/AccountService.java
index 6653fab..55a791b 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/AccountService.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/AccountService.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi64.withPropagationRequiresNew;
 
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.structure.Module;
@@ -33,7 +34,7 @@ import static org.apache.zest.index.rdf.qi64.withPropagationRequiresNew.AccountS
 public interface AccountService
 {
     @UnitOfWorkPropagation( UnitOfWorkPropagation.Propagation.REQUIRES_NEW )
-    AccountComposite getAccountById( String anId );
+    AccountComposite getAccountById( Identity anId );
 
     public class AccountServiceMixin
         implements AccountService
@@ -44,7 +45,7 @@ public interface AccountService
         @Structure
         Module module;
 
-        public AccountComposite getAccountById( String anId )
+        public AccountComposite getAccountById( Identity anId )
         {
             // Use current unit of work
             UnitOfWork work = uowf.currentUnitOfWork();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/IssueTest.java
index 62bf4b3..6b89e33 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi64/withPropagationRequiresNew/IssueTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.index.rdf.qi64.withPropagationRequiresNew;
 
+import org.apache.zest.api.identity.Identity;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -50,7 +51,7 @@ public class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertFalse( unitOfWorkFactory.isUnitOfWorkActive() );
@@ -66,7 +67,7 @@ public class IssueTest
         throws Throwable
     {
         // Bootstrap the account
-        String id = newZestAccount();
+        Identity id = newZestAccount();
 
         // Make sure there's no unit of work
         assertFalse( unitOfWorkFactory.isUnitOfWorkActive() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi66/Qi66IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi66/Qi66IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi66/Qi66IssueTest.java
index e39a0fc..ecdbac8 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi66/Qi66IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/zest/index/rdf/qi66/Qi66IssueTest.java
@@ -19,6 +19,7 @@
  */
 package org.apache.zest.index.rdf.qi66;
 
+import org.apache.zest.api.identity.Identity;
 import org.junit.Test;
 import org.apache.zest.api.entity.EntityBuilder;
 import org.apache.zest.api.unitofwork.UnitOfWork;
@@ -50,7 +51,7 @@ public class Qi66IssueTest
     public final void testCompleteAfterFind()
         throws Exception
     {
-        String accountIdentity = newZestAccount();
+        Identity accountIdentity = newZestAccount();
 
         UnitOfWork work = unitOfWorkFactory.newUnitOfWork();
         AccountComposite account = work.get( AccountComposite.class, accountIdentity );
@@ -70,11 +71,11 @@ public class Qi66IssueTest
     /**
      * Creates a new Apache Zest account.
      *
-     * @return The identity of Zest account.
+     * @return The reference of Zest account.
      *
      * @throws UnitOfWorkCompletionException Thrown if creational fail.
      */
-    private String newZestAccount()
+    private Identity newZestAccount()
         throws UnitOfWorkCompletionException
     {
         UnitOfWork work = unitOfWorkFactory.newUnitOfWork();
@@ -82,7 +83,7 @@ public class Qi66IssueTest
         AccountComposite accountComposite = entityBuilder.instance();
         accountComposite.name().set( ACCOUNT_NAME );
         accountComposite = entityBuilder.newInstance();
-        String accoutnIdentity = accountComposite.identity().get();
+        Identity accoutnIdentity = accountComposite.identity().get();
         work.complete();
 
         return accoutnIdentity;

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/EmbeddedSolrService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/EmbeddedSolrService.java b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/EmbeddedSolrService.java
index 3aecee8..0c956cb 100644
--- a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/EmbeddedSolrService.java
+++ b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/EmbeddedSolrService.java
@@ -90,7 +90,7 @@ public interface EmbeddedSolrService extends ServiceComposite
 
          try
          {
-            File directory = new File( fileConfig.dataDirectory(), descriptor.identity() );
+            File directory = new File( fileConfig.dataDirectory(), descriptor.identity().toString() );
             directory.mkdir();
 
             System.setProperty( "solr.solr.home", directory.getAbsolutePath() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
index 5eabfbc..d1feb62 100644
--- a/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
+++ b/extensions/indexing-solr/src/main/java/org/apache/zest/index/solr/internal/SolrEntityIndexerMixin.java
@@ -112,7 +112,7 @@ public abstract class SolrEntityIndexerMixin
                             {
                                 deleted = new ArrayList<>();
                             }
-                            deleted.add( entityState.identity().identity() );
+                            deleted.add( entityState.entityReference().identity().toString() );
                         }
                         else if( entityState.status().equals( EntityStatus.UPDATED ) )
                         {
@@ -157,7 +157,7 @@ public abstract class SolrEntityIndexerMixin
         stateSerializer.serialize( entityState, false, graph );
 
         SolrInputDocument input = new SolrInputDocument();
-        input.addField( "id", entityState.identity().identity() );
+        input.addField( "id", entityState.entityReference().identity() );
         input.addField( "type", entityState.entityDescriptor().types().findFirst().get().getName() );
         input.addField( "lastModified", java.util.Date.from( entityState.lastModified() ) );
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-solr/src/test/resources/schema.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/resources/schema.xml b/extensions/indexing-solr/src/test/resources/schema.xml
index a48c41f..8b20f44 100644
--- a/extensions/indexing-solr/src/test/resources/schema.xml
+++ b/extensions/indexing-solr/src/test/resources/schema.xml
@@ -403,7 +403,7 @@ but may be good for SKUs.  Can insert dashes in the wrong place and still match.
             "encoder" - how to encode the following value into a playload
                float -> org.apache.lucene.analysis.payloads.FloatEncoder,
                integer -> o.a.l.a.p.IntegerEncoder
-               identity -> o.a.l.a.p.IdentityEncoder
+               reference -> o.a.l.a.p.IdentityEncoder
                    Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor.
                 -->
                 <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/assembly/AbstractSQLIndexQueryAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
index 45e8b8b..9cb073d 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/assembly/AbstractSQLIndexQueryAssembler.java
@@ -21,6 +21,8 @@ package org.apache.zest.index.sql.assembly;
 
 import java.io.IOException;
 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.bootstrap.Assemblers;
 import org.apache.zest.bootstrap.AssemblyException;
 import org.apache.zest.bootstrap.ModuleAssembly;
@@ -34,13 +36,13 @@ import org.sql.generation.api.vendor.SQLVendorProvider;
 public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
     extends Assemblers.VisibilityIdentityConfig<AssemblerType>
 {
-    public static final String DEFAULT_IDENTITY = "indexing-sql";
+    public static final Identity DEFAULT_IDENTITY = new StringIdentity( "indexing-sql" );
 
     private Class<? extends ReindexingStrategy> reindexingStrategy = ReindexingStrategy.NeverNeed.class;
 
     public AbstractSQLIndexQueryAssembler()
     {
-        identifiedBy( DEFAULT_IDENTITY );
+        identifiedBy( DEFAULT_IDENTITY.toString() );
     }
 
     @SuppressWarnings( "unchecked" )
@@ -70,7 +72,7 @@ public abstract class AbstractSQLIndexQueryAssembler<AssemblerType>
                 throw new AssemblyException( "SQL Vendor could not be determined." );
             }
             module.services( getIndexQueryServiceType() )
-                .identifiedBy( identity() )
+                .identifiedBy( identity().toString() )
                 .setMetaInfo( sqlVendor )
                 .visibleIn( visibility() )
                 .instantiateOnStartup();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java
index 68a5d18..54e3baf 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/internal/SQLEntityFinder.java
@@ -136,7 +136,7 @@ public class SQLEntityFinder
                         Integer i = 0;
                         while( rs.next() && ( maxResults == null || i < maxResults ) )
                         {
-                            resultList.add( new EntityReference( rs.getString( 1 ) ) );
+                            resultList.add( EntityReference.parseEntityReference( rs.getString( 1 ) ) );
                             ++i;
                         }
                     }
@@ -188,7 +188,7 @@ public class SQLEntityFinder
                     rs = ps.executeQuery();
                     if( rs.next() )
                     {
-                        result = new EntityReference( rs.getString( 1 ) );
+                        result = EntityReference.parseEntityReference( rs.getString( 1 ) );
                     }
                 }
                 finally

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
index d8b7253..ed7cbfb 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLIndexing.java
@@ -37,7 +37,7 @@ import javax.sql.DataSource;
 import org.apache.zest.api.ZestAPI;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.HasIdentity;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
@@ -218,7 +218,7 @@ public abstract class AbstractSQLIndexing
 //                        // throw new
 //                        // UnsupportedOperationException("Did not understand what to do with state [id = "
 //                        // +
-//                        // eState.identity().identity() + ", status = " + status + "].");
+//                        // eState.reference().reference() + ", status = " + status + "].");
 //                    }
                 }
 
@@ -330,7 +330,7 @@ public abstract class AbstractSQLIndexing
     )
         throws SQLException
     {
-        ps.setString( startingIndex, state.identity().identity() );
+        ps.setString( startingIndex, state.entityReference().identity().toString() );
         ps.setTimestamp( startingIndex + 1, Timestamp.from( state.lastModified() ) );
         ps.setString( startingIndex + 2, state.version() );
         ps.setString( startingIndex + 3, this._app.version() );
@@ -344,7 +344,7 @@ public abstract class AbstractSQLIndexing
         // TODO build cache: Zest Identity -> PK
         Long entityPK = null;
         PreparedStatement ps = queryPKPS.getValue();
-        ps.setString( 1, state.identity().identity() );
+        ps.setString( 1, state.entityReference().identity().toString() );
         ResultSet rs = null;
         try
         {
@@ -651,7 +651,7 @@ public abstract class AbstractSQLIndexing
 
                         ps.setInt( 1, qNamePK[0] );
                         ps.setLong( 2, entityPK );
-                        ps.setString( 3, ref.identity() );
+                        ps.setString( 3, ref.identity().toString() );
                         ps.addBatch();
 
                         qNamePK[0] += 1;
@@ -682,7 +682,7 @@ public abstract class AbstractSQLIndexing
                             ps.setInt( 1, qNamePK[0] );
                             ps.setLong( 2, entityPK );
                             ps.setInt( 3, index );
-                            ps.setString( 4, ref.identity() );
+                            ps.setString( 4, ref.identity().toString() );
                             ps.addBatch();
                             qNamePK[0] += 1;
                         }
@@ -710,7 +710,7 @@ public abstract class AbstractSQLIndexing
         Integer result = propertyPK;
         if( property != null )
         {
-            if( !qName.type().equals( Identity.class.getName() ) )
+            if( !qName.type().equals( HasIdentity.class.getName() ) )
             {
                 QNameInfo info = this._state.qNameInfos().get().get( qName );
                 if( info.getCollectionDepth() > 0 )
@@ -1005,7 +1005,7 @@ public abstract class AbstractSQLIndexing
         this.clearAllEntitysQNames( clearPropertiesPS, entityPK );
 
         // Update state
-        ps.setString( 1, state.identity().identity() );
+        ps.setString( 1, state.entityReference().identity().toString() );
         ps.setTimestamp( 2, Timestamp.from( state.lastModified() ) );
         ps.setString( 3, state.version() );
         ps.setString( 4, this._app.version() );
@@ -1035,7 +1035,7 @@ public abstract class AbstractSQLIndexing
     private void removeEntity( EntityState state, PreparedStatement ps )
         throws SQLException
     {
-        ps.setString( 1, state.identity().identity() );
+        ps.setString( 1, state.entityReference().identity().toString() );
         ps.addBatch();
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLQuerying.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLQuerying.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLQuerying.java
index a236449..c6cc0d6 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLQuerying.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLQuerying.java
@@ -35,7 +35,7 @@ import org.apache.zest.api.ZestAPI;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.composite.Composite;
 import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.HasIdentity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.injection.scope.Uses;
@@ -989,7 +989,7 @@ public abstract class AbstractSQLQuerying
                     QualifiedName qName
                         = QualifiedName.fromAccessor( predicate.property().accessor() );
                     String columnName;
-                    if( qName.type().equals( Identity.class.getName() ) )
+                    if( qName.type().equals( HasIdentity.class.getName() ) )
                     {
                         columnName = DBNames.ENTITY_TABLE_IDENTITY_COLUMN_NAME;
                     }
@@ -1485,7 +1485,7 @@ public abstract class AbstractSQLQuerying
                     Class<?> declaringType = ( (Member) ref.accessor() ).getDeclaringClass();
                     String colName;
                     Integer tableIdx;
-                    if( Identity.class.equals( declaringType ) )
+                    if( HasIdentity.class.equals( declaringType ) )
                     {
                         colName = DBNames.ENTITY_TABLE_IDENTITY_COLUMN_NAME;
                         tableIdx = tableIndex - 1;
@@ -1547,7 +1547,7 @@ public abstract class AbstractSQLQuerying
         {
             QualifiedName qName = qNameStack.pop();
             PropertyFunction<?> ref = refStack.pop();
-            if( !qName.type().equals( Identity.class.getName() ) )
+            if( !qName.type().equals( HasIdentity.class.getName() ) )
             {
                 QNameInfo info = this._state.qNameInfos().get().get( qName );
                 if( info == null )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLStartup.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLStartup.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLStartup.java
index a733f36..b09e52d 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLStartup.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/AbstractSQLStartup.java
@@ -54,7 +54,7 @@ import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.composite.CompositeDescriptor;
 import org.apache.zest.api.configuration.Configuration;
 import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.HasIdentity;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
@@ -1487,7 +1487,7 @@ public abstract class AbstractSQLStartup
     )
     {
         QualifiedName qName = pType.qualifiedName();
-        if( !newQNames.contains( qName ) && !qName.name().equals( Identity.class.getName() ) )
+        if( !newQNames.contains( qName ) && !qName.name().equals( HasIdentity.class.getName() ) )
         {
             newQNames.add( qName );
             QNameInfo info = qNameInfos.get( qName );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
index 3a42b55..6f1bf97 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/zest/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
@@ -97,9 +97,9 @@ class SQLCompatEntityStateWrapper
     }
 
     @Override
-    public EntityReference identity()
+    public EntityReference entityReference()
     {
-        return wrappedEntityState.identity();
+        return wrappedEntityState.entityReference();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java
index b185899..0aa0f96 100644
--- a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java
+++ b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java
@@ -24,6 +24,8 @@ import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.MetricPredicate;
 import com.yammer.metrics.reporting.ConsoleReporter;
 import java.util.concurrent.TimeUnit;
+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.EntityComposite;
@@ -66,7 +68,7 @@ public class NoMetricsInstalledTest extends AbstractZestTest
         UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
         try
         {
-            Person p = uow.get( Person.class, "" + id );
+            Person p = uow.get( Person.class, new StringIdentity( "" + id ) );
         }
         finally
         {
@@ -81,7 +83,7 @@ public class NoMetricsInstalledTest extends AbstractZestTest
         UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
         try
         {
-            uow.newEntity( Person.class, "" + id );
+            uow.newEntity( Person.class, new StringIdentity( "" + id ) );
             uow.complete();
         }
         finally

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java
index 2d388e6..06ea2b4 100644
--- a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java
+++ b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java
@@ -24,6 +24,7 @@ import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.MetricPredicate;
 import com.yammer.metrics.reporting.ConsoleReporter;
 import java.util.concurrent.TimeUnit;
+import org.apache.zest.api.identity.StringIdentity;
 import org.junit.Test;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.entity.EntityComposite;
@@ -67,7 +68,7 @@ public class YammerTest extends AbstractZestTest
         UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
         try
         {
-            Person p = uow.get( Person.class, "" + id );
+            Person p = uow.get( Person.class, new StringIdentity( "" + id ) );
         }
         finally
         {
@@ -82,7 +83,7 @@ public class YammerTest extends AbstractZestTest
         UnitOfWork uow = unitOfWorkFactory.newUnitOfWork();
         try
         {
-            uow.newEntity( Person.class, "" + id );
+            uow.newEntity( Person.class, new StringIdentity( "" + id ) );
             uow.complete();
         }
         finally

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/migration/src/test/java/org/apache/zest/migration/MigrationTest.java
----------------------------------------------------------------------
diff --git a/extensions/migration/src/test/java/org/apache/zest/migration/MigrationTest.java b/extensions/migration/src/test/java/org/apache/zest/migration/MigrationTest.java
index dddc7a7..1da1f7b 100644
--- a/extensions/migration/src/test/java/org/apache/zest/migration/MigrationTest.java
+++ b/extensions/migration/src/test/java/org/apache/zest/migration/MigrationTest.java
@@ -22,6 +22,7 @@ package org.apache.zest.migration;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
 import org.hamcrest.CoreMatchers;
 import org.json.JSONException;
@@ -103,8 +104,8 @@ public class MigrationTest
     public void testMigration()
         throws UnitOfWorkCompletionException, IOException, ActivationException, AssemblyException
     {
+        Identity id;
         // Set up version 1
-        String id;
         StringInputOutput data_v1 = new StringInputOutput();
         {
             SingletonAssembler v1 = new SingletonAssembler()
@@ -267,15 +268,7 @@ public class MigrationTest
         public <SenderThrowableType extends Throwable> void receiveFrom( Sender<? extends String, SenderThrowableType> sender )
             throws IOException, SenderThrowableType
         {
-            sender.sendTo( new Receiver<String, IOException>()
-            {
-                @Override
-                public void receive( String item )
-                    throws IOException
-                {
-                    builder.append( item ).append( "\n" );
-                }
-            } );
+            sender.sendTo((Receiver<String, IOException>) item -> builder.append( item ).append( "\n" ));
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/reindexer/src/main/java/org/apache/zest/index/reindexer/internal/ReindexerMixin.java
----------------------------------------------------------------------
diff --git a/extensions/reindexer/src/main/java/org/apache/zest/index/reindexer/internal/ReindexerMixin.java b/extensions/reindexer/src/main/java/org/apache/zest/index/reindexer/internal/ReindexerMixin.java
index 6fcd666..c3a3af4 100644
--- a/extensions/reindexer/src/main/java/org/apache/zest/index/reindexer/internal/ReindexerMixin.java
+++ b/extensions/reindexer/src/main/java/org/apache/zest/index/reindexer/internal/ReindexerMixin.java
@@ -23,7 +23,7 @@ package org.apache.zest.index.reindexer.internal;
 import java.util.ArrayList;
 import org.apache.zest.api.common.QualifiedName;
 import org.apache.zest.api.configuration.Configuration;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.HasIdentity;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.injection.scope.This;
@@ -43,20 +43,6 @@ import org.slf4j.LoggerFactory;
 public class ReindexerMixin
     implements Reindexer
 {
-    private static QualifiedName identityQN;
-
-    static
-    {
-        try
-        {
-            identityQN = QualifiedName.fromAccessor( Identity.class.getMethod( "identity" ) );
-        }
-        catch( NoSuchMethodException e )
-        {
-            throw new InternalError( "Zest Core Runtime codebase is corrupted. Contact Zest team: ReindexerMixin" );
-        }
-    }
-
     @This
     private Configuration<ReindexerConfiguration> configuration;
 
@@ -117,7 +103,7 @@ public class ReindexerMixin
             throws RuntimeException
         {
             count++;
-            item.setPropertyValue( identityQN, item.identity().identity() );
+            item.setPropertyValue( HasIdentity.IDENTITY_STATE_NAME, item.entityReference().identity() );
             states.add( item );
 
             if( states.size() >= loadValue )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxConfigurationDeserializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxConfigurationDeserializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxConfigurationDeserializationTest.java
index c024652..a97acba 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxConfigurationDeserializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/zest/valueserialization/stax/StaxConfigurationDeserializationTest.java
@@ -20,6 +20,7 @@
 
 package org.apache.zest.valueserialization.stax;
 
+import org.apache.zest.api.identity.StringIdentity;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.apache.zest.api.injection.scope.Service;
@@ -51,7 +52,7 @@ public class StaxConfigurationDeserializationTest
         ValueBuilder<ConfigSerializationConfig> builder = valueBuilderFactory.newValueBuilder( ConfigSerializationConfig.class );
         builder.prototype().name().set( "main" );
         builder.prototype().host().set( createHost() );
-        builder.prototype().identity().set( "configtest" );
+        builder.prototype().identity().set( new StringIdentity( "configtest" )  );
         ConfigSerializationConfig value = builder.newInstance();
 
         valueSerialization.serialize( value, System.out );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmEvent.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmEvent.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmEvent.java
index b531efe..70e9f40 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmEvent.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmEvent.java
@@ -23,6 +23,8 @@ package org.apache.zest.library.alarm;
 import java.time.Instant;
 import java.util.Locale;
 import java.util.ResourceBundle;
+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.mixin.Mixins;
 import org.apache.zest.api.property.Property;
@@ -36,14 +38,14 @@ import org.apache.zest.api.value.ValueComposite;
  */
 @Mixins( AlarmEvent.Mixin.class )
 public interface AlarmEvent
-    extends ValueComposite
+    extends ValueComposite, HasIdentity
 {
     /**
-     * Returns the identity of the AlarmPoint that generated the event.
+     * Returns the reference of the AlarmPoint that generated the event.
      *
      * @return the AlarmPoint causing this event.
      */
-    Property<String> alarmIdentity();
+    Property<Identity> identity();
 
     /**
      * Returns the AlarmStatus prior to the Event.
@@ -106,14 +108,14 @@ public interface AlarmEvent
         @Override
         public String name( Locale locale )
         {
-            ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get(), locale );
+            ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get().toString(), locale );
             return bundle.getString( systemName().get() );
         }
 
         @Override
         public String description( Locale locale )
         {
-            ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get(), locale );
+            ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get().toString(), locale );
             String eventDescriptionId = "EVENT_" + systemName().get().toUpperCase() + "_DESCRIPTION";
             return bundle.getString( eventDescriptionId );
         }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPoint.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPoint.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPoint.java
index 67a8e21..9f5714c 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPoint.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPoint.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.ResourceBundle;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.common.UseDefaults;
+import org.apache.zest.api.identity.HasIdentity;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.This;
 import org.apache.zest.api.property.Property;
@@ -106,7 +107,7 @@ import org.apache.zest.api.property.Property;
  * the Alarms.
  * </p>
  */
-public interface AlarmPoint
+public interface AlarmPoint extends HasIdentity
 {
     String STATUS_NORMAL = "Normal";
     String STATUS_ACTIVATED = "Activated";

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPointFactory.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPointFactory.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPointFactory.java
index c18859a..fc709bb 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPointFactory.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmPointFactory.java
@@ -21,6 +21,7 @@
 package org.apache.zest.library.alarm;
 
 import org.apache.zest.api.entity.EntityBuilder;
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.ServiceComposite;
@@ -32,7 +33,7 @@ import org.apache.zest.api.value.ValueBuilderFactory;
 @Mixins( AlarmPointFactory.Mixin.class )
 public interface AlarmPointFactory extends ServiceComposite
 {
-    AlarmPoint create( String identity, String systemName, String categoryName, AlarmClass alarmClass );
+    AlarmPoint create(Identity identity, String systemName, String categoryName, AlarmClass alarmClass );
 
     abstract class Mixin
         implements AlarmPointFactory
@@ -45,7 +46,7 @@ public interface AlarmPointFactory extends ServiceComposite
         private ValueBuilderFactory vbf;
 
         @Override
-        public AlarmPoint create( String identity, String systemName, String categoryName, AlarmClass alarmClass )
+        public AlarmPoint create( Identity identity, String systemName, String categoryName, AlarmClass alarmClass )
         {
             UnitOfWork uow = uowf.currentUnitOfWork();
             EntityBuilder<AlarmPoint> builder = uow.newEntityBuilder( AlarmPoint.class, identity );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmProxy.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmProxy.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmProxy.java
index c009b71..af9cf31 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmProxy.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmProxy.java
@@ -27,6 +27,7 @@ import org.apache.zest.api.composite.TransientBuilder;
 import org.apache.zest.api.composite.TransientBuilderFactory;
 import org.apache.zest.api.composite.TransientComposite;
 import org.apache.zest.api.concern.Concerns;
+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.Uses;
@@ -46,7 +47,7 @@ public interface AlarmProxy extends AlarmPoint, TransientComposite
     interface Factory extends ServiceComposite
     {
         @UnitOfWorkPropagation( UnitOfWorkPropagation.Propagation.REQUIRED )
-        AlarmProxy create( String identity, String systemName, String categoryName, AlarmClass alarmClass );
+        AlarmProxy create( Identity identity, String systemName, String categoryName, AlarmClass alarmClass );
     }
 
     abstract class FactoryMixin
@@ -62,7 +63,7 @@ public interface AlarmProxy extends AlarmPoint, TransientComposite
         private AlarmPointFactory factory;
 
         @Override
-        public AlarmProxy create( String identity, String systemName, String categoryName, AlarmClass alarmClass )
+        public AlarmProxy create( Identity identity, String systemName, String categoryName, AlarmClass alarmClass )
         {
             UnitOfWork unitOfWork = uowf.currentUnitOfWork();
             AlarmPoint alarmPoint;
@@ -75,6 +76,7 @@ public interface AlarmProxy extends AlarmPoint, TransientComposite
                 alarmPoint = factory.create( identity, systemName, categoryName, alarmClass );
             }
             TransientBuilder<AlarmProxy> builder = tbf.newTransientBuilder( AlarmProxy.class );
+            builder.prototype().identity().set(identity);
             builder.prototype().category().set( alarmPoint.category().get() );
             builder.prototype().alarmClass().set( alarmClass );
             builder.use( identity );
@@ -89,9 +91,6 @@ public interface AlarmProxy extends AlarmPoint, TransientComposite
         @Structure
         private UnitOfWorkFactory uowf;
 
-        @Uses
-        String identity;
-
         @Override
         @UnitOfWorkPropagation( UnitOfWorkPropagation.Propagation.REQUIRED )
         public void trigger( String trigger )
@@ -207,7 +206,7 @@ public interface AlarmProxy extends AlarmPoint, TransientComposite
 
         private AlarmPoint findAlarmPoint()
         {
-            return uowf.currentUnitOfWork().get( AlarmPoint.class, identity );
+            return uowf.currentUnitOfWork().get( AlarmPoint.class, identity().get() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystem.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystem.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystem.java
index b848c6a..1006ac6 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystem.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystem.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.zest.api.entity.EntityBuilder;
+import org.apache.zest.api.identity.StringIdentity;
 import org.apache.zest.api.injection.scope.Service;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
@@ -213,7 +214,7 @@ public interface AlarmSystem
         public AlarmPoint createAlarm( String name, AlarmCategory category )
         {
             UnitOfWork uow = uowf.currentUnitOfWork();
-            EntityBuilder<AlarmPoint> builder = uow.newEntityBuilder( AlarmPoint.class );
+            EntityBuilder<AlarmPoint> builder = uow.newEntityBuilder( AlarmPoint.class, new StringIdentity( name ) );
             builder.instance().category().set( category );
             AlarmPoint.AlarmState state = builder.instanceFor( AlarmPoint.AlarmState.class );
             state.systemName().set( name );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystemAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystemAssembler.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystemAssembler.java
index 0061dfe..0096212 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystemAssembler.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/AlarmSystemAssembler.java
@@ -34,7 +34,7 @@ public class AlarmSystemAssembler
         ServiceDeclaration alarmSystem = module.services( AlarmSystemService.class ).visibleIn( visibility() );
         if( hasIdentity() )
         {
-            alarmSystem.identifiedBy( identity() );
+            alarmSystem.identifiedBy( identity().toString() );
         }
         module.services( SimpleAlarmModelService.class ).setMetaInfo( new AlarmModelDescriptor( "Simple", false ) );
         module.services( StandardAlarmModelService.class ).setMetaInfo( new AlarmModelDescriptor( "Standard", true ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/ExtendedAlarmModelService.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/ExtendedAlarmModelService.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/ExtendedAlarmModelService.java
index 3bd5c3a..69eb78e 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/ExtendedAlarmModelService.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/ExtendedAlarmModelService.java
@@ -25,7 +25,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.ServiceComposite;
@@ -279,7 +279,7 @@ public interface ExtendedAlarmModelService
                 ( status.name(null).equals( AlarmPoint.STATUS_DEACTIVATED ) ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACTIVATED );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ACTIVATION );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_ACTIVATION );
             }
             return null;
         }
@@ -297,12 +297,12 @@ public interface ExtendedAlarmModelService
             if( status.name(null).equals( AlarmPoint.STATUS_ACKNOWLEDGED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_DEACTIVATION );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_DEACTIVATION );
             }
             else if( status.name(null).equals( AlarmPoint.STATUS_ACTIVATED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_DEACTIVATED );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_DEACTIVATION );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_DEACTIVATION );
             }
             return null;
         }
@@ -320,12 +320,12 @@ public interface ExtendedAlarmModelService
             if( status.name(null).equals( AlarmPoint.STATUS_DEACTIVATED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
             }
             else if( status.name(null).equals( AlarmPoint.STATUS_ACTIVATED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACKNOWLEDGED );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_ACKNOWLEDGEMENT );
             }
             return null;
         }
@@ -346,7 +346,7 @@ public interface ExtendedAlarmModelService
                 return null;
             }
             AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_BLOCKED );
-            return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_BLOCKING );
+            return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_BLOCKING );
         }
 
         /**
@@ -362,7 +362,7 @@ public interface ExtendedAlarmModelService
             if( status.name(null).equals( AlarmPoint.STATUS_BLOCKED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_UNBLOCKING );
+                return createEvent( alarm.identity().get(), status, newStatus, AlarmPoint.EVENT_UNBLOCKING );
             }
             return null;
         }
@@ -382,7 +382,7 @@ public interface ExtendedAlarmModelService
                 return null;
             }
             AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_DISABLED );
-            return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_DISABLING );
+            return createEvent( alarm.identity().get() , status, newStatus, AlarmPoint.EVENT_DISABLING );
         }
 
         /**
@@ -398,7 +398,7 @@ public interface ExtendedAlarmModelService
             if( status.name(null).equals( AlarmPoint.STATUS_DISABLED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
-                return createEvent( ( (Identity) alarm ), status, newStatus, AlarmPoint.EVENT_ENABLING );
+                return createEvent( ( alarm.identity().get() ), status, newStatus, AlarmPoint.EVENT_ENABLING );
             }
             return null;
         }
@@ -420,7 +420,7 @@ public interface ExtendedAlarmModelService
         {
             ValueBuilder<AlarmEvent> builder = vbf.newValueBuilder( AlarmEvent.class );
             AlarmEvent prototype = builder.prototype();
-            prototype.alarmIdentity().set( alarmId.identity().get() );
+            prototype.identity().set( alarmId );
             prototype.eventTime().set( Instant.now() );
             prototype.newStatus().set( newStatus );
             prototype.oldStatus().set( oldStatus );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/libraries/alarm/src/main/java/org/apache/zest/library/alarm/SimpleAlarmModelService.java
----------------------------------------------------------------------
diff --git a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/SimpleAlarmModelService.java b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/SimpleAlarmModelService.java
index 8f9e7dc..b3c4a4c 100644
--- a/libraries/alarm/src/main/java/org/apache/zest/library/alarm/SimpleAlarmModelService.java
+++ b/libraries/alarm/src/main/java/org/apache/zest/library/alarm/SimpleAlarmModelService.java
@@ -25,7 +25,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
-import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.identity.Identity;
 import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.mixin.Mixins;
 import org.apache.zest.api.service.ServiceComposite;
@@ -203,7 +203,7 @@ public interface SimpleAlarmModelService extends AlarmModel, ServiceComposite
             if( oldStatus.name(null).equals( AlarmPoint.STATUS_NORMAL ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_ACTIVATED );
-                return createEvent( (Identity) alarm, oldStatus, newStatus, AlarmPoint.EVENT_ACTIVATION );
+                return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_ACTIVATION );
             }
             return null;
         }
@@ -221,7 +221,7 @@ public interface SimpleAlarmModelService extends AlarmModel, ServiceComposite
             if( oldStatus.name(null).equals( AlarmPoint.STATUS_ACTIVATED ) )
             {
                 AlarmStatus newStatus = createStatus( AlarmPoint.STATUS_NORMAL );
-                return createEvent( (Identity) alarm, oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
+                return createEvent( alarm.identity().get(), oldStatus, newStatus, AlarmPoint.EVENT_DEACTIVATION );
             }
             return null;
         }
@@ -242,7 +242,7 @@ public interface SimpleAlarmModelService extends AlarmModel, ServiceComposite
         {
             ValueBuilder<AlarmEvent> builder = vbf.newValueBuilder( AlarmEvent.class );
             AlarmEvent prototype = builder.prototype();
-            prototype.alarmIdentity().set( alarmId.identity().get() );
+            prototype.identity().set( alarmId );
             prototype.eventTime().set( Instant.now() );
             prototype.newStatus().set( newStatus );
             prototype.oldStatus().set( oldStatus );


Mime
View raw message