http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-jdbm/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jdbm/build.gradle b/extensions/entitystore-jdbm/build.gradle index 4cfbdea..c195e0c 100644 --- a/extensions/entitystore-jdbm/build.gradle +++ b/extensions/entitystore-jdbm/build.gradle @@ -34,7 +34,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testRuntimeOnly libraries.logback }
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java index ec1f703..312c002 100644 --- a/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java +++ b/extensions/entitystore-jdbm/src/main/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreMixin.java @@ -140,7 +140,7 @@ public class JdbmEntityStoreMixin changes.visitMap( new MapChanger() { @Override - public Writer newEntity( final EntityReference ref, EntityDescriptor descriptor ) + public Writer newEntity( EntityReference ref, EntityDescriptor descriptor ) throws IOException { return new StringWriter( 1000 ) @@ -160,7 +160,7 @@ public class JdbmEntityStoreMixin } @Override - public Writer updateEntity( final EntityReference ref, EntityDescriptor descriptor ) + public Writer updateEntity( MapChange mapChange ) throws IOException { return new StringWriter( 1000 ) @@ -171,7 +171,7 @@ public class JdbmEntityStoreMixin { super.close(); - Long stateIndex = getStateIndex( ref.identity() ); + Long stateIndex = getStateIndex( mapChange.reference().identity() ); byte[] stateArray = toString().getBytes( "UTF-8" ); recordManager.update( stateIndex, stateArray, serializer ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java index 2d1351b..bd3cef4 100644 --- a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java +++ b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -49,7 +48,6 @@ public class JdbmEntityStoreTest new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); - new OrgJsonValueSerializationAssembler().assemble( module ); new JdbmEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java index 0b633ea..b6bed70 100644 --- a/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java +++ b/extensions/entitystore-jdbm/src/test/java/org/apache/polygene/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -49,7 +48,6 @@ public class JdbmEntityStoreWithCacheTest new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); - new OrgJsonValueSerializationAssembler().assemble( module ); new JdbmEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-leveldb/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-leveldb/build.gradle b/extensions/entitystore-leveldb/build.gradle index 4fa7608..98b8460 100644 --- a/extensions/entitystore-leveldb/build.gradle +++ b/extensions/entitystore-leveldb/build.gradle @@ -36,7 +36,6 @@ dependencies { runtimeOnly libraries.leveldb_jni_all testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testRuntimeOnly libraries.logback } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java index bcc9975..1db246e 100644 --- a/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java +++ b/extensions/entitystore-leveldb/src/main/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreMixin.java @@ -234,7 +234,7 @@ public class LevelDBEntityStoreMixin @Override public void applyChanges( MapChanges changes ) - throws IOException + throws Exception { final WriteBatch writeBatch = db.createWriteBatch(); try @@ -243,7 +243,7 @@ public class LevelDBEntityStoreMixin { @Override - public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor ) throws IOException { return new StringWriter( 1000 ) @@ -262,7 +262,7 @@ public class LevelDBEntityStoreMixin } @Override - public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer updateEntity( MapChange mapChange ) throws IOException { return new StringWriter( 1000 ) @@ -274,7 +274,8 @@ public class LevelDBEntityStoreMixin { super.close(); String jsonState = toString(); - writeBatch.put( ref.identity().toString().getBytes( charset ), jsonState.getBytes( charset ) ); + writeBatch.put( mapChange.reference().identity().toString().getBytes( charset ), + jsonState.getBytes( charset ) ); } }; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java index 1b5ff6a..c5d4cdc 100644 --- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java +++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JavaLevelDBEntityStoreTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -46,7 +45,6 @@ public class JavaLevelDBEntityStoreTest super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java index e0f14b2..819d930 100644 --- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java +++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/JniLevelDBEntityStoreTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -45,7 +44,6 @@ public class JniLevelDBEntityStoreTest ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java index f512a14..9840501 100644 --- a/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java +++ b/extensions/entitystore-leveldb/src/test/java/org/apache/polygene/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.library.fileconfig.FileConfigurationAssembler; import org.apache.polygene.library.fileconfig.FileConfigurationOverride; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -44,7 +43,6 @@ public class LevelDBEntityStoreWithCacheTest super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-memory/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/build.gradle b/extensions/entitystore-memory/build.gradle index 0f3e713..f46ae73 100644 --- a/extensions/entitystore-memory/build.gradle +++ b/extensions/entitystore-memory/build.gradle @@ -28,7 +28,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testRuntimeOnly libraries.logback } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java index ed74805..f36cca5 100644 --- a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java +++ b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreTest.java @@ -19,24 +19,19 @@ */ package org.apache.polygene.entitystore.memory; -import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; public class MemoryEntityStoreTest extends AbstractEntityStoreTest { - // START SNIPPET: assembly @Override public void assemble( ModuleAssembly module ) - throws AssemblyException { new MemoryEntityStoreAssembler().assemble( module ); // END SNIPPET: assembly - new OrgJsonValueSerializationAssembler().assemble( module ); super.assemble( module ); // START SNIPPET: assembly } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java index c3ccaff..28dc102 100644 --- a/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java +++ b/extensions/entitystore-memory/src/test/java/org/apache/polygene/entitystore/memory/MemoryEntityStoreWithCacheTest.java @@ -23,7 +23,6 @@ import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; public class MemoryEntityStoreWithCacheTest extends AbstractEntityStoreWithCacheTest @@ -33,7 +32,6 @@ public class MemoryEntityStoreWithCacheTest throws AssemblyException { super.assemble( module ); - new OrgJsonValueSerializationAssembler().assemble( module ); new MemoryEntityStoreAssembler().assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-mongodb/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/build.gradle b/extensions/entitystore-mongodb/build.gradle index 12d23c4..8ace38e 100644 --- a/extensions/entitystore-mongodb/build.gradle +++ b/extensions/entitystore-mongodb/build.gradle @@ -33,7 +33,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testImplementation libraries.embed_mongo testRuntimeOnly libraries.logback http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java index bda729c..106325d 100644 --- a/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java +++ b/extensions/entitystore-mongodb/src/main/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreMixin.java @@ -222,14 +222,14 @@ public class MongoMapEntityStoreMixin @Override public void applyChanges( MapChanges changes ) - throws IOException + throws Exception { final MongoCollection<Document> entities = db.getCollection( collectionName ); changes.visitMap( new MapChanger() { @Override - public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor ) throws IOException { return new StringWriter( 1000 ) @@ -249,7 +249,7 @@ public class MongoMapEntityStoreMixin } @Override - public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer updateEntity( MapChange mapChange ) throws IOException { return new StringWriter( 1000 ) @@ -261,9 +261,9 @@ public class MongoMapEntityStoreMixin super.close(); Document bsonState = Document.parse( toString() ); Document entity = new Document(); - entity.put( IDENTITY_COLUMN, ref.identity().toString() ); + entity.put( IDENTITY_COLUMN, mapChange.reference().identity().toString() ); entity.put( STATE_COLUMN, bsonState ); - entities.replaceOne( byIdentity( ref ), entity ); + entities.replaceOne( byIdentity( mapChange.reference() ), entity ); } }; } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java index 68652a4..2341777 100644 --- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java +++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/EmbedMongoMapEntityStoreTest.java @@ -31,7 +31,6 @@ import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssemb import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; import org.apache.polygene.test.util.FreePortFinder; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Rule; @@ -76,8 +75,6 @@ public class EmbedMongoMapEntityStoreTest extends AbstractEntityStoreTest ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); - new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java index f893aff..aa9b9e3 100644 --- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java +++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreTest.java @@ -20,14 +20,13 @@ package org.apache.polygene.entitystore.mongodb; import com.mongodb.Mongo; -import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; -import org.junit.BeforeClass; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; +import org.junit.BeforeClass; import static org.apache.polygene.test.util.Assume.assumeConnectivity; @@ -55,8 +54,6 @@ public class MongoMapEntityStoreTest ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); - // START SNIPPET: assembly new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); // END SNIPPET: assembly http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java index de356f1..cad95ea 100644 --- a/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java +++ b/extensions/entitystore-mongodb/src/test/java/org/apache/polygene/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java @@ -20,14 +20,13 @@ package org.apache.polygene.entitystore.mongodb; import com.mongodb.Mongo; -import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; -import org.junit.BeforeClass; import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.entitystore.mongodb.assembly.MongoDBEntityStoreAssembler; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; +import org.junit.BeforeClass; import static org.apache.polygene.test.util.Assume.assumeConnectivity; @@ -53,8 +52,6 @@ public class MongoMapEntityStoreWithCacheTest ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); - new MongoDBEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class ).declareDefaults(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-preferences/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/build.gradle b/extensions/entitystore-preferences/build.gradle index 2c8bbff..b4681d6 100644 --- a/extensions/entitystore-preferences/build.gradle +++ b/extensions/entitystore-preferences/build.gradle @@ -32,7 +32,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.core.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testRuntimeOnly libraries.logback } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java index fa32a71..4d6e65a 100644 --- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java +++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java @@ -43,7 +43,8 @@ import org.apache.polygene.api.injection.scope.Uses; import org.apache.polygene.api.property.PropertyDescriptor; import org.apache.polygene.api.service.ServiceActivation; import org.apache.polygene.api.service.ServiceDescriptor; -import org.apache.polygene.api.service.qualifier.Tagged; +import org.apache.polygene.api.serialization.Serialization; +import org.apache.polygene.api.serialization.SerializationException; import org.apache.polygene.api.structure.Application; import org.apache.polygene.api.structure.ModuleDescriptor; import org.apache.polygene.api.time.SystemTime; @@ -56,8 +57,6 @@ import org.apache.polygene.api.unitofwork.NoSuchEntityException; import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException; import org.apache.polygene.api.usecase.Usecase; import org.apache.polygene.api.usecase.UsecaseBuilder; -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.api.value.ValueSerializationException; import org.apache.polygene.spi.PolygeneSPI; import org.apache.polygene.spi.entity.EntityState; import org.apache.polygene.spi.entity.EntityStatus; @@ -80,7 +79,7 @@ import org.slf4j.LoggerFactory; * (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the * next line). * </p> - * <p>Nested ValuesComposites, Collections and Maps are stored using available ValueSerialization service.</p> + * <p>Nested ValuesComposites, Collections and Maps are stored using available StateSerialization service.</p> */ public class PreferencesEntityStoreMixin implements ServiceActivation, EntityStore, EntityStoreSPI @@ -98,8 +97,7 @@ public class PreferencesEntityStoreMixin private Application application; @Service - @Tagged( ValueSerialization.Formats.JSON ) - private ValueSerialization valueSerialization; + private Serialization serialization; private Preferences root; @@ -263,16 +261,16 @@ public class PreferencesEntityStoreMixin else { // Load as string even though it's a number - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName() - .name(), null ); + String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName() + .name(), null ); Object value; - if( json == null ) + if( string == null ) { value = null; } else { - value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json ); + value = serialization.deserialize( module, propertyType, string ); } properties.put( persistentPropertyDescriptor.qualifiedName(), value ); } @@ -289,27 +287,27 @@ public class PreferencesEntityStoreMixin || propertyType instanceof CollectionType || propertyType instanceof EnumType ) { - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); + String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); Object value; - if( json == null ) + if( string == null ) { value = null; } else { - value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json ); + value = serialization.deserialize( module, propertyType, string ); } properties.put( persistentPropertyDescriptor.qualifiedName(), value ); } else { - String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); - if( json == null ) + String string = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null ); + if( string == null ) { if( persistentPropertyDescriptor.resolveInitialValue( module ) != null ) { properties.put( persistentPropertyDescriptor.qualifiedName(), - persistentPropertyDescriptor.resolveInitialValue( module ) ); + persistentPropertyDescriptor.resolveInitialValue( module ) ); } else { @@ -318,7 +316,7 @@ public class PreferencesEntityStoreMixin } else { - Object value = valueSerialization.deserialize( module, propertyType, json ); + Object value = serialization.deserialize( module, propertyType, string ); properties.put( persistentPropertyDescriptor.qualifiedName(), value ); } } @@ -402,7 +400,7 @@ public class PreferencesEntityStoreMixin namedAssociations ); } - catch( ValueSerializationException | BackingStoreException e ) + catch( SerializationException | BackingStoreException e ) { throw new EntityStoreException( e ); } @@ -528,8 +526,8 @@ public class PreferencesEntityStoreMixin else { // Store as string even though it's a number - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); + String string = serialization.serialize( value ); + propsPrefs.put( persistentProperty.qualifiedName().name(), string ); } } else if( primaryType.equals( Boolean.class ) ) @@ -542,13 +540,13 @@ public class PreferencesEntityStoreMixin || valueType instanceof CollectionType || valueType instanceof EnumType ) { - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); + String string = serialization.serialize( value ); + propsPrefs.put( persistentProperty.qualifiedName().name(), string ); } else { - String jsonString = valueSerialization.serialize( value ); - propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString ); + String string = serialization.serialize( value ); + propsPrefs.put( persistentProperty.qualifiedName().name(), string ); } } } ); @@ -616,7 +614,7 @@ public class PreferencesEntityStoreMixin } } } - catch( ValueSerializationException e ) + catch( SerializationException e ) { throw new EntityStoreException( "Could not store EntityState", e ); } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreTest.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreTest.java index 0f52e46..9801ded 100644 --- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreTest.java +++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreTest.java @@ -25,7 +25,6 @@ import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreInfo; import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreService; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.Rule; import org.junit.rules.TemporaryFolder; @@ -51,6 +50,5 @@ public class PreferencesEntityStoreTest PreferencesEntityStoreInfo metaInfo = new PreferencesEntityStoreInfo( node ); Thread.currentThread().setContextClassLoader( cl ); module.services( PreferencesEntityStoreService.class ).setMetaInfo( metaInfo ).instantiateOnStartup(); - new OrgJsonValueSerializationAssembler().assemble( module ); } } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-redis/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-redis/build.gradle b/extensions/entitystore-redis/build.gradle index afe5978..da29e7d 100644 --- a/extensions/entitystore-redis/build.gradle +++ b/extensions/entitystore-redis/build.gradle @@ -33,7 +33,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.internals.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testRuntimeOnly libraries.logback } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java index c080082..0fcb2c5 100644 --- a/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java +++ b/extensions/entitystore-redis/src/main/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreMixin.java @@ -98,14 +98,14 @@ public class RedisMapEntityStoreMixin @Override public void applyChanges( MapChanges changes ) - throws IOException + throws Exception { try( Jedis jedis = pool.getResource() ) { changes.visitMap( new MapChanger() { @Override - public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor ) throws IOException { return new StringWriter( 1000 ) @@ -125,7 +125,7 @@ public class RedisMapEntityStoreMixin } @Override - public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer updateEntity( MapChange mapChange ) throws IOException { return new StringWriter( 1000 ) @@ -135,10 +135,12 @@ public class RedisMapEntityStoreMixin throws IOException { super.close(); - String statusCode = jedis.set( ref.identity().toString(), toString(), "XX" ); + String statusCode = jedis.set( mapChange.reference().identity().toString(), + toString(), + "XX" ); if( !"OK".equals( statusCode ) ) { - throw new EntityNotFoundException( ref ); + throw new EntityNotFoundException( mapChange.reference() ); } } }; http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java index e5ef9f8..e654afc 100644 --- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java +++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java @@ -23,10 +23,9 @@ import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler; -import org.apache.polygene.test.internal.DockerRule; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; +import org.apache.polygene.test.internal.DockerRule; import org.junit.ClassRule; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; @@ -46,7 +45,6 @@ public class RedisMapEntityStoreTest super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); // START SNIPPET: assembly new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); // END SNIPPET: assembly http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java index f4499a1..1dba76a 100644 --- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java +++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java @@ -23,10 +23,9 @@ import org.apache.polygene.api.common.Visibility; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ModuleAssembly; import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler; -import org.apache.polygene.test.internal.DockerRule; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; +import org.apache.polygene.test.internal.DockerRule; import org.junit.ClassRule; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; @@ -44,7 +43,6 @@ public class RedisMapEntityStoreWithCacheTest super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class ) .declareDefaults(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-riak/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-riak/build.gradle b/extensions/entitystore-riak/build.gradle index a36ca6c..98200ac 100644 --- a/extensions/entitystore-riak/build.gradle +++ b/extensions/entitystore-riak/build.gradle @@ -34,7 +34,6 @@ dependencies { runtimeOnly polygene.core.runtime testImplementation polygene.internals.testsupport - testImplementation polygene.extension( 'valueserialization-orgjson' ) testImplementation libraries.awaitility testRuntimeOnly libraries.logback http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java index bb461cd..9417df5 100644 --- a/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java +++ b/extensions/entitystore-riak/src/main/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreMixin.java @@ -199,8 +199,7 @@ public class RiakMapEntityStoreMixin implements ServiceActivation, MapEntityStor } @Override - public void passivateService() - throws Exception + public void passivateService() throws Exception { riakClient.shutdown(); riakClient = null; @@ -248,7 +247,7 @@ public class RiakMapEntityStoreMixin implements ServiceActivation, MapEntityStor changes.visitMap( new MapChanger() { @Override - public Writer newEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer newEntity( EntityReference ref, EntityDescriptor entityDescriptor ) { return new StringWriter( 1000 ) { @@ -272,7 +271,7 @@ public class RiakMapEntityStoreMixin implements ServiceActivation, MapEntityStor } @Override - public Writer updateEntity( final EntityReference ref, EntityDescriptor entityDescriptor ) + public Writer updateEntity( MapChange mapChange ) { return new StringWriter( 1000 ) { @@ -282,12 +281,13 @@ public class RiakMapEntityStoreMixin implements ServiceActivation, MapEntityStor try { super.close(); - Location location = new Location( namespace, ref.identity().toString() ); + EntityReference reference = mapChange.reference(); + Location location = new Location( namespace, reference.identity().toString() ); FetchValue fetch = new FetchValue.Builder( location ).build(); FetchValue.Response response = riakClient.execute( fetch ); if( response.isNotFound() ) { - throw new EntityNotFoundException( ref ); + throw new EntityNotFoundException( reference ); } StoreValue store = new StoreValue.Builder( toString() ) .withLocation( location ) http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java index 67904db..c43d846 100644 --- a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java +++ b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreTest.java @@ -24,7 +24,6 @@ import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.entity.AbstractEntityStoreTest; import org.apache.polygene.test.internal.DockerRule; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.ClassRule; public class RiakMapEntityStoreTest extends AbstractEntityStoreTest @@ -58,7 +57,6 @@ public class RiakMapEntityStoreTest extends AbstractEntityStoreTest super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); // START SNIPPET: assembly new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); // END SNIPPET: assembly http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java index 99cf561..ac4f3ec 100644 --- a/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java +++ b/extensions/entitystore-riak/src/test/java/org/apache/polygene/entitystore/riak/RiakMapEntityStoreWithCacheTest.java @@ -27,7 +27,6 @@ import org.apache.polygene.entitystore.riak.assembly.RiakEntityStoreAssembler; import org.apache.polygene.test.EntityTestAssembler; import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest; import org.apache.polygene.test.internal.DockerRule; -import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler; import org.junit.ClassRule; public class RiakMapEntityStoreWithCacheTest extends AbstractEntityStoreWithCacheTest @@ -60,7 +59,6 @@ public class RiakMapEntityStoreWithCacheTest extends AbstractEntityStoreWithCach super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().assemble( config ); - new OrgJsonValueSerializationAssembler().assemble( module ); new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class ) .declareDefaults(); http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-sql/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/entitystore-sql/build.gradle b/extensions/entitystore-sql/build.gradle index e481c85..4490768 100644 --- a/extensions/entitystore-sql/build.gradle +++ b/extensions/entitystore-sql/build.gradle @@ -27,7 +27,9 @@ jar { manifest { name = "Apache Polygene⢠Extension - EntityStore - SQL" } } dependencies { api polygene.core.bootstrap api polygene.library( 'sql' ) + api libraries.jooq + implementation polygene.library( 'sql-liquibase' ) implementation libraries.javaSqlGenerator implementation( libraries.javaSqlGeneratorImpl ) { exclude group: 'junit' @@ -37,7 +39,6 @@ dependencies { testImplementation polygene.internals.testsupport testImplementation polygene.library( 'sql-dbcp' ) - testImplementation polygene.extension( 'valueserialization-orgjson' ) testImplementation libraries.derby // Needed at compile time for polite test shutdown testImplementation libraries.docker_junit http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java deleted file mode 100644 index 123a613..0000000 --- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreMixin.java +++ /dev/null @@ -1,624 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.polygene.entitystore.sql; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Spliterator; -import java.util.Spliterators; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Consumer; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; -import org.apache.polygene.api.common.Optional; -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.identity.Identity; -import org.apache.polygene.api.identity.IdentityGenerator; -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.service.ServiceActivation; -import org.apache.polygene.api.service.qualifier.Tagged; -import org.apache.polygene.api.structure.Application; -import org.apache.polygene.api.structure.ModuleDescriptor; -import org.apache.polygene.api.type.ValueType; -import org.apache.polygene.api.unitofwork.NoSuchEntityTypeException; -import org.apache.polygene.api.usecase.Usecase; -import org.apache.polygene.api.value.ValueSerialization; -import org.apache.polygene.entitystore.sql.internal.DatabaseSQLService; -import org.apache.polygene.entitystore.sql.internal.DatabaseSQLService.EntityValueResult; -import org.apache.polygene.entitystore.sql.internal.SQLEntityState; -import org.apache.polygene.entitystore.sql.internal.SQLEntityState.DefaultSQLEntityState; -import org.apache.polygene.library.sql.common.SQLUtil; -import org.apache.polygene.spi.PolygeneSPI; -import org.apache.polygene.spi.entity.EntityState; -import org.apache.polygene.spi.entity.EntityStatus; -import org.apache.polygene.spi.entitystore.DefaultEntityStoreUnitOfWork; -import org.apache.polygene.spi.entitystore.EntityNotFoundException; -import org.apache.polygene.spi.entitystore.EntityStore; -import org.apache.polygene.spi.entitystore.EntityStoreException; -import org.apache.polygene.spi.entitystore.EntityStoreSPI; -import org.apache.polygene.spi.entitystore.EntityStoreUnitOfWork; -import org.apache.polygene.spi.entitystore.StateCommitter; -import org.apache.polygene.spi.entitystore.helpers.DefaultEntityState; -import org.apache.polygene.spi.entitystore.helpers.JSONKeys; -import org.apache.polygene.spi.entitystore.helpers.Migration; -import org.apache.polygene.spi.entitystore.helpers.StateStore; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.json.JSONWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SQL EntityStore core Mixin. - */ -// TODO Rewrite reusing JSONMapEntityStoreMixin -// Old notes: -// Most of this code is copy-paste from {@link org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin}. -// Refactor stuff that has to do with general things than actual MapEntityStore from MapEntityStoreMixin -// so that this class could extend some "AbstractJSONEntityStoreMixin". -public class SQLEntityStoreMixin - implements EntityStore, EntityStoreSPI, StateStore, ServiceActivation -{ - - private static final Logger LOGGER = LoggerFactory.getLogger( SQLEntityStoreMixin.class ); - - @Service - private DatabaseSQLService database; - - @This - private EntityStoreSPI entityStoreSPI; - - @Structure - private PolygeneSPI spi; - - @Structure - private Application application; - - @Service - @Tagged( ValueSerialization.Formats.JSON ) - private ValueSerialization valueSerialization; - - @Optional - @Service - private Migration migration; - - private String uuid; - - private final AtomicInteger count = new AtomicInteger(); - - @Service - private IdentityGenerator identityGenerator; - - @Override - public void activateService() - throws Exception - { - uuid = UUID.randomUUID().toString() + "-"; - count.set( 0 ); - database.startDatabase(); - } - - @Override - public void passivateService() - throws Exception - { - database.stopDatabase(); - } - - @Override - public StateCommitter applyChanges( final EntityStoreUnitOfWork unitofwork, final Iterable<EntityState> states ) - { - return new StateCommitter() - { - @Override - public void commit() - { - Connection connection = null; - PreparedStatement insertPS = null; - PreparedStatement updatePS = null; - PreparedStatement removePS = null; - try - { - connection = database.getConnection(); - connection.setAutoCommit( false ); - insertPS = database.prepareInsertEntityStatement( connection ); - updatePS = database.prepareUpdateEntityStatement( connection ); - removePS = database.prepareRemoveEntityStatement( connection ); - for( EntityState state : states ) - { - EntityStatus status = state.status(); - DefaultEntityState defState = ( (SQLEntityState) state ).getDefaultEntityState(); - Long entityPK = ( (SQLEntityState) state ).getEntityPK(); - if( EntityStatus.REMOVED.equals( status ) ) - { - database.populateRemoveEntityStatement( removePS, entityPK, state.entityReference() ); - removePS.addBatch(); - } - else - { - StringWriter writer = new StringWriter(); - writeEntityState( defState, writer, unitofwork.identity().toString() ); - writer.flush(); - if( EntityStatus.UPDATED.equals( status ) ) - { - Long entityOptimisticLock = ( (SQLEntityState) state ).getEntityOptimisticLock(); - database.populateUpdateEntityStatement( updatePS, entityPK, entityOptimisticLock, - defState.entityReference(), writer.toString(), - unitofwork.currentTime() ); - updatePS.addBatch(); - } - else if( EntityStatus.NEW.equals( status ) ) - { - database.populateInsertEntityStatement( insertPS, defState.entityReference(), - writer.toString(), unitofwork.currentTime() ); - insertPS.addBatch(); - } - } - } - - removePS.executeBatch(); - insertPS.executeBatch(); - updatePS.executeBatch(); - - connection.commit(); - } - catch( SQLException sqle ) - { - SQLUtil.rollbackQuietly( connection ); - throw new EntityStoreException( "Unable to apply state changes", - SQLUtil.withAllSQLExceptions( sqle ) ); - } - catch( RuntimeException re ) - { - SQLUtil.rollbackQuietly( connection ); - throw new EntityStoreException( re ); - } - finally - { - SQLUtil.closeQuietly( insertPS ); - SQLUtil.closeQuietly( updatePS ); - SQLUtil.closeQuietly( removePS ); - SQLUtil.closeQuietly( connection ); - } - } - - @Override - public void cancel() - { - } - }; - } - - @Override - public EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork, - ModuleDescriptor module, - EntityReference entityRef - ) - { - EntityValueResult valueResult = getValue( entityRef ); - DefaultEntityState state = readEntityState( module, valueResult.getReader() ); - return new DefaultSQLEntityState( state, valueResult.getEntityPK(), valueResult.getEntityOptimisticLock() ); - } - - @Override - public String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference entityRef ) - { - EntityValueResult valueResult = getValue( entityRef ); - Reader entityState = valueResult.getReader(); - try - { - JSONObject jsonObject = new JSONObject( new JSONTokener( entityState ) ); - final String version = jsonObject.getString( JSONKeys.VERSION ); - return version; - } - catch( JSONException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public EntityState newEntityState( EntityStoreUnitOfWork unitOfWork, - EntityReference entityRef, - EntityDescriptor entityDescriptor - ) - { - return new DefaultSQLEntityState( - new DefaultEntityState( unitOfWork.currentTime(), entityRef, entityDescriptor ) ); - } - - @Override - public EntityStoreUnitOfWork newUnitOfWork( ModuleDescriptor module, Usecase usecase, Instant currentTime ) - { - return new DefaultEntityStoreUnitOfWork( module, entityStoreSPI, newUnitOfWorkId(), usecase, currentTime ); - } - - @Override - public Stream<EntityState> entityStates( final ModuleDescriptor module ) - { - try - { - Connection connection = database.getConnection(); - PreparedStatement ps = database.prepareGetAllEntitiesStatement( connection ); - database.populateGetAllEntitiesStatement( ps ); - ResultSet rs = ps.executeQuery(); - return StreamSupport.stream( - new Spliterators.AbstractSpliterator<EntityState>( Long.MAX_VALUE, Spliterator.ORDERED ) - { - @Override - public boolean tryAdvance( final Consumer<? super EntityState> action ) - { - try - { - if( !rs.next() ) { return false; } - EntityState entityState = readEntityState( module, - database.getEntityValue( rs ).getReader() ); - action.accept( entityState ); - return true; - } - catch( SQLException ex ) - { - SQLUtil.closeQuietly( rs, ex ); - SQLUtil.closeQuietly( ps, ex ); - SQLUtil.closeQuietly( connection, ex ); - throw new EntityStoreException( "Unable to get next entity state", - SQLUtil.withAllSQLExceptions( ex ) ); - } - } - }, - false - ).onClose( - () -> - { - SQLUtil.closeQuietly( rs ); - SQLUtil.closeQuietly( ps ); - SQLUtil.closeQuietly( connection ); - } - ); - } - catch( SQLException ex ) - { - throw new EntityStoreException( "Unable to get entity states", SQLUtil.withAllSQLExceptions( ex ) ); - } - } - - protected Identity newUnitOfWorkId() - { - return identityGenerator.generate( EntityStore.class ); - } - - protected DefaultEntityState readEntityState( ModuleDescriptor module, Reader entityState ) - throws EntityStoreException - { - try - { - JSONObject jsonObject = new JSONObject( new JSONTokener( entityState ) ); - final EntityStatus[] status = { EntityStatus.LOADED }; - - String version = jsonObject.getString( JSONKeys.VERSION ); - Instant modified = Instant.ofEpochMilli( jsonObject.getLong( JSONKeys.MODIFIED ) ); - String identity = jsonObject.getString( JSONKeys.IDENTITY ); - - // Check if version is correct - String currentAppVersion = jsonObject.optString( JSONKeys.APPLICATION_VERSION, "0.0" ); - if( !currentAppVersion.equals( application.version() ) ) - { - if( migration != null ) - { - migration.migrate( jsonObject, application.version(), this ); - } - else - { - // Do nothing - set version to be correct - jsonObject.put( JSONKeys.APPLICATION_VERSION, application.version() ); - } - - LOGGER.trace( "Updated version nr on {} from {} to {}", - identity, currentAppVersion, application.version() ); - - // State changed - status[ 0 ] = EntityStatus.UPDATED; - } - - String type = jsonObject.getString( JSONKeys.TYPE ); - - EntityDescriptor entityDescriptor = module.entityDescriptor( type ); - if( entityDescriptor == null ) - { - throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() ); - } - - Map<QualifiedName, Object> properties = new HashMap<>(); - JSONObject props = jsonObject.getJSONObject( JSONKeys.PROPERTIES ); - entityDescriptor.state().properties().forEach( - propertyDescriptor -> - { - Object jsonValue; - try - { - jsonValue = props.get( - propertyDescriptor.qualifiedName().name() ); - if( JSONObject.NULL.equals( jsonValue ) ) - { - properties.put( propertyDescriptor.qualifiedName(), null ); - } - else - { - Object value = valueSerialization.deserialize( module, - propertyDescriptor.valueType(), - jsonValue.toString() ); - properties.put( propertyDescriptor.qualifiedName(), value ); - } - } - catch( JSONException e ) - { - // Value not found, default it - Object initialValue = propertyDescriptor.resolveInitialValue( module ); - properties.put( propertyDescriptor.qualifiedName(), initialValue ); - status[ 0 ] = EntityStatus.UPDATED; - } - } - ); - - Map<QualifiedName, EntityReference> associations = new HashMap<>(); - JSONObject assocs = jsonObject.getJSONObject( JSONKeys.ASSOCIATIONS ); - entityDescriptor.state().associations().forEach( - associationType -> - { - try - { - Object jsonValue = assocs.get( associationType.qualifiedName().name() ); - EntityReference value = jsonValue == JSONObject.NULL - ? null - : EntityReference.parseEntityReference( (String) jsonValue ); - associations.put( associationType.qualifiedName(), value ); - } - catch( JSONException e ) - { - // Association not found, default it to null - associations.put( associationType.qualifiedName(), null ); - status[ 0 ] = EntityStatus.UPDATED; - } - } - ); - - JSONObject manyAssocs = jsonObject.getJSONObject( JSONKeys.MANY_ASSOCIATIONS ); - Map<QualifiedName, List<EntityReference>> manyAssociations = new HashMap<>(); - entityDescriptor.state().manyAssociations().forEach( - manyAssociationType -> - { - List<EntityReference> references = new ArrayList<>(); - try - { - JSONArray jsonValues = manyAssocs.getJSONArray( manyAssociationType.qualifiedName().name() ); - for( int i = 0; i < jsonValues.length(); i++ ) - { - Object jsonValue = jsonValues.getString( i ); - EntityReference value = jsonValue == JSONObject.NULL - ? null - : EntityReference.parseEntityReference( (String) jsonValue ); - references.add( value ); - } - manyAssociations.put( manyAssociationType.qualifiedName(), references ); - } - catch( JSONException e ) - { - // ManyAssociation not found, default to empty one - manyAssociations.put( manyAssociationType.qualifiedName(), references ); - } - } ); - - JSONObject namedAssocs = jsonObject.has( JSONKeys.NAMED_ASSOCIATIONS ) - ? jsonObject.getJSONObject( JSONKeys.NAMED_ASSOCIATIONS ) - : new JSONObject(); - Map<QualifiedName, Map<String, EntityReference>> namedAssociations = new HashMap<>(); - entityDescriptor.state().namedAssociations().forEach( - namedAssociationType -> - { - Map<String, EntityReference> references = new LinkedHashMap<>(); - try - { - JSONObject jsonValues = namedAssocs.getJSONObject( namedAssociationType.qualifiedName().name() ); - JSONArray names = jsonValues.names(); - if( names != null ) - { - for( int idx = 0; idx < names.length(); idx++ ) - { - String name = names.getString( idx ); - String jsonValue = jsonValues.getString( name ); - references.put( name, EntityReference.parseEntityReference( jsonValue ) ); - } - } - namedAssociations.put( namedAssociationType.qualifiedName(), references ); - } - catch( JSONException e ) - { - // NamedAssociation not found, default to empty one - namedAssociations.put( namedAssociationType.qualifiedName(), references ); - } - } ); - - return new DefaultEntityState( version, modified, - EntityReference.parseEntityReference( identity ), status[ 0 ], - entityDescriptor, - properties, associations, manyAssociations, namedAssociations ); - } - catch( JSONException e ) - { - throw new EntityStoreException( e ); - } - } - - @Override - public JSONObject jsonStateOf( String id ) - throws IOException - { - JSONObject jsonObject; - try( Reader reader = getValue( EntityReference.parseEntityReference( id ) ).getReader() ) - { - jsonObject = new JSONObject( new JSONTokener( reader ) ); - } - catch( JSONException e ) - { - throw new IOException( e ); - } - return jsonObject; - } - - protected EntityValueResult getValue( EntityReference ref ) - { - Connection connection = null; - PreparedStatement ps = null; - ResultSet rs = null; - try - { - connection = database.getConnection(); - ps = database.prepareGetEntityStatement( connection ); - database.populateGetEntityStatement( ps, ref ); - rs = ps.executeQuery(); - if( !rs.next() ) - { - throw new EntityNotFoundException( ref ); - } - return database.getEntityValue( rs ); - } - catch( SQLException sqle ) - { - throw new EntityStoreException( "Unable to get Entity " + ref, SQLUtil.withAllSQLExceptions( sqle ) ); - } - finally - { - SQLUtil.closeQuietly( rs ); - SQLUtil.closeQuietly( ps ); - SQLUtil.closeQuietly( connection ); - } - } - - protected void writeEntityState( DefaultEntityState state, Writer writer, String version ) - throws EntityStoreException - { - try - { - JSONWriter json = new JSONWriter( writer ); - JSONWriter properties = json.object() - .key( JSONKeys.IDENTITY ) - .value( state.entityReference().identity().toString() ) - .key( JSONKeys.APPLICATION_VERSION ) - .value( application.version() ) - .key( JSONKeys.TYPE ) - .value( state.entityDescriptor().types().findFirst().get().getName() ) - .key( JSONKeys.VERSION ) - .value( version ) - .key( JSONKeys.MODIFIED ) - .value( state.lastModified().toEpochMilli() ) - .key( JSONKeys.PROPERTIES ) - .object(); - - state.entityDescriptor().state().properties().forEach( - persistentProperty -> - { - try - { - Object value = state.properties().get( persistentProperty.qualifiedName() ); - json.key( persistentProperty.qualifiedName().name() ); - if( value == null || ValueType.isPrimitiveValue( value ) ) - { - json.value( value ); - } - else - { - String serialized = valueSerialization.serialize( value ); - if( serialized.startsWith( "{" ) ) - { - json.value( new JSONObject( serialized ) ); - } - else if( serialized.startsWith( "[" ) ) - { - json.value( new JSONArray( serialized ) ); - } - else - { - json.value( serialized ); - } - } - } - catch( JSONException e ) - { - throw new EntityStoreException( - "Could not store EntityState", e ); - } - } ); - - JSONWriter associations = properties.endObject().key( JSONKeys.ASSOCIATIONS ).object(); - for( Map.Entry<QualifiedName, EntityReference> stateNameEntityRefEntry : state.associations().entrySet() ) - { - EntityReference value = stateNameEntityRefEntry.getValue(); - associations.key( stateNameEntityRefEntry.getKey().name() ) - .value( value != null ? value.identity().toString() : null ); - } - - JSONWriter manyAssociations = associations.endObject().key( JSONKeys.MANY_ASSOCIATIONS ).object(); - for( Map.Entry<QualifiedName, List<EntityReference>> stateNameListEntry : state.manyAssociations().entrySet() ) - { - JSONWriter assocs = manyAssociations.key( stateNameListEntry.getKey().name() ).array(); - for( EntityReference entityReference : stateNameListEntry.getValue() ) - { - assocs.value( entityReference.identity().toString() ); - } - assocs.endArray(); - } - - JSONWriter namedAssociations = manyAssociations.endObject().key( JSONKeys.NAMED_ASSOCIATIONS ).object(); - for( Map.Entry<QualifiedName, Map<String, EntityReference>> stateNameMapEntry : state.namedAssociations().entrySet() ) - { - JSONWriter assocs = namedAssociations.key( stateNameMapEntry.getKey().name() ).object(); - for( Map.Entry<String, EntityReference> entry : stateNameMapEntry.getValue().entrySet() ) - { - assocs.key( entry.getKey() ).value( entry.getValue().identity().toString() ); - } - assocs.endObject(); - } - namedAssociations.endObject().endObject(); - } - catch( JSONException e ) - { - throw new EntityStoreException( "Could not store EntityState", e ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.java deleted file mode 100644 index fe8c4aa..0000000 --- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLEntityStoreService.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.entitystore.sql; - -import org.apache.polygene.api.concern.Concerns; -import org.apache.polygene.api.mixin.Mixins; -import org.apache.polygene.api.service.ServiceActivation; -import org.apache.polygene.api.service.ServiceComposite; -import org.apache.polygene.spi.entitystore.ConcurrentModificationCheckConcern; -import org.apache.polygene.spi.entitystore.EntityStateVersions; -import org.apache.polygene.spi.entitystore.EntityStore; -import org.apache.polygene.spi.entitystore.StateChangeNotificationConcern; - -/** - * SQL EntityStore service. - */ -@Concerns( { StateChangeNotificationConcern.class, ConcurrentModificationCheckConcern.class } ) -@Mixins( { SQLEntityStoreMixin.class } ) -public interface SQLEntityStoreService - extends EntityStore, EntityStateVersions, ServiceComposite, ServiceActivation -{ -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/17b11697/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMapping.java ---------------------------------------------------------------------- diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMapping.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMapping.java new file mode 100644 index 0000000..67f6066 --- /dev/null +++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SQLMapEntityStoreMapping.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.entitystore.sql; + +import org.jooq.DataType; +import org.jooq.impl.SQLDataType; + +/** + * Mapping for the entities table. + * + * If you change this once the table is created you'll have to ALTER it yourself. + */ +public interface SQLMapEntityStoreMapping +{ + default String defaultSchemaName() + { + return "POLYGENE_ES"; + } + + default String tableName() + { + return "POLYGENE_ENTITIES"; + } + + default String identityColumnName() + { + return "ENTITY_IDENTITY"; + } + + default String versionColumnName() + { + return "ENTITY_VERSION"; + } + + default String stateColumnName() + { + return "ENTITY_STATE"; + } + + default DataType<String> identityDataType() + { + return SQLDataType.VARCHAR( 64 ); + } + + default DataType<String> versionDataType() + { + return SQLDataType.VARCHAR( 64 ); + } + + default DataType<String> stateDataType() + { + return SQLDataType.VARCHAR( 10 * 1024 ); + } +}
