You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2017/03/11 15:17:34 UTC
[1/3] polygene-java git commit: Fixed Serialization missing in
RdfIndexingAssembler,
causing failed tests. Fixed additional issues in Yeoman generator.
Repository: polygene-java
Updated Branches:
refs/heads/develop 41c759b2c -> b8aea70ac
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxCollectionSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxCollectionSerializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxCollectionSerializationTest.java
index ae1267b..04ed30a 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxCollectionSerializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxCollectionSerializationTest.java
@@ -19,6 +19,7 @@
*/
package org.apache.polygene.valueserialization.stax;
+import org.apache.polygene.valueserialization.stax.assembly.StaxValueSerializationAssembler;
import org.junit.BeforeClass;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxConfigurationDeserializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxConfigurationDeserializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxConfigurationDeserializationTest.java
index 3c52f82..052072f 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxConfigurationDeserializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxConfigurationDeserializationTest.java
@@ -21,6 +21,7 @@
package org.apache.polygene.valueserialization.stax;
import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.valueserialization.stax.assembly.StaxValueSerializationAssembler;
import org.junit.Ignore;
import org.junit.Test;
import org.apache.polygene.api.injection.scope.Service;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java
index 1d1c456..11f1e7d 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxPlainValueSerializationTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.valueserialization.stax;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.value.AbstractPlainValueSerializationTest;
+import org.apache.polygene.valueserialization.stax.assembly.StaxValueSerializationAssembler;
import org.junit.BeforeClass;
import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxValueCompositeSerializationTest.java b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxValueCompositeSerializationTest.java
index 57a7e9a..65d66f6 100644
--- a/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxValueCompositeSerializationTest.java
+++ b/extensions/valueserialization-stax/src/test/java/org/apache/polygene/valueserialization/stax/StaxValueCompositeSerializationTest.java
@@ -19,6 +19,7 @@
*/
package org.apache.polygene.valueserialization.stax;
+import org.apache.polygene.valueserialization.stax.assembly.StaxValueSerializationAssembler;
import org.junit.BeforeClass;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
index 3979194..21a2e0c 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/RestletCrudConnectivityAssembler.java
@@ -38,7 +38,7 @@ import org.apache.polygene.library.restlet.resource.EntryPointResource;
import org.apache.polygene.library.restlet.resource.ResourceBuilder;
import org.apache.polygene.library.restlet.serialization.FormRepresentation;
import org.apache.polygene.library.restlet.serialization.JsonRepresentation;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class RestletCrudConnectivityAssembler
implements Assembler
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
index 87f5241..e564c0d 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/configuration/ConfigurationModule.java
@@ -26,7 +26,7 @@ import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class ConfigurationModule
implements ModuleAssembler
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
----------------------------------------------------------------------
diff --git a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
index 736edaa..77d1166 100644
--- a/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
+++ b/libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java
@@ -25,7 +25,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class SerializationModule
implements ModuleAssembler
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index a982fbb..5b9c045 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -81,6 +81,7 @@ include 'core:api',
'extensions:valueserialization-stax',
'tools:model-detail',
'tools:envisage',
+ 'tools:generator-polygene',
// 'tools:qidea',
'tests:regression',
'tests:performance',
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
index b152d3a..0c925da 100644
--- a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl
@@ -25,7 +25,7 @@ import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class ConfigModule
implements ModuleAssembler
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
index 2bbc875..a4d3919 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/MetricsModule/bootstrap.tmpl
@@ -41,7 +41,7 @@ public class <%- polygene.metrics %>MetricsModule
public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
throws AssemblyException
{
- new <%- polygene.metrics %>Assembler(Visibility.application, Visibility.module).assemble( module );
+ new <%- polygene.metrics %>MetricsAssembler().assemble( module );
return module;
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
index ea455cd..62b3586 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/SerializationModule/bootstrap.tmpl
@@ -24,7 +24,7 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
-import org.apache.polygene.valueserialization.<%- polygene.serialization.toLowerCase() %>.<%- polygene.serialization %>ValueSerializationAssembler;
+import org.apache.polygene.valueserialization.<%- polygene.serialization.toLowerCase() %>.assembly.<%- polygene.serialization %>ValueSerializationAssembler;
public class <%- polygene.serialization %>ValueSerializationModule
implements ModuleAssembler
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/tools/generator-polygene/build.gradle
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/build.gradle b/tools/generator-polygene/build.gradle
new file mode 100644
index 0000000..64bd9f0
--- /dev/null
+++ b/tools/generator-polygene/build.gradle
@@ -0,0 +1,68 @@
+def allEntityStores = [
+ 'Cassandra',
+ 'File',
+ 'DerbySQL',
+ 'Geode',
+ 'H2SQL',
+ 'Hazelcast',
+ 'JClouds',
+ 'Jdbm',
+ 'LevelDB',
+ 'Memory',
+ 'MongoDB',
+ 'MySQL',
+ 'Preferences',
+ 'Redis',
+ 'Riak',
+ 'PostgresSQL',
+ 'SQLite'
+]
+
+def allIndexing = [
+ "Rdf",
+ "ElasticSearch",
+ "Solr",
+ "SQL"
+]
+
+def allCaching = [
+ "None",
+ "EhCache",
+ "Memcache"
+]
+
+def allMetrics = [
+ "None",
+ "Codahale"
+]
+
+def allValueSerialization = [
+ "Jackson",
+ "Stax"
+]
+
+def featureCombinations(array, result) {
+ if (array?.empty) {
+ return []
+ }
+ return [array, featureCombinations(array.tail())]
+}
+
+def allFeatures = [
+ 'rest api',
+ 'jmx',
+ 'security'
+].forEach( {
+
+});
+
+def allFeatureCombos = [
+
+]
+
+def allCombos = [
+
+]
+
+println allFeatures
+
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/tools/generator-polygene/test/generator_test.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/test/generator_test.js b/tools/generator-polygene/test/generator_test.js
index 0e8ef8b..e215d4c 100644
--- a/tools/generator-polygene/test/generator_test.js
+++ b/tools/generator-polygene/test/generator_test.js
@@ -3,17 +3,127 @@ var helpers = require('yeoman-test');
var assert = require('yeoman-assert');
var shell = require('shelljs');
-// See http://yeoman.io/authoring/testing.html
-describe('polygene-generator', function () {
- it('generates a buildable gradle project', function () {
- return helpers.run(path.join(__dirname, '../app'))
- .withPrompts({
- name: 'test-project',
- packageName: 'org.apache.polygene.generator.test'
- })
- .then(function(dir) {
- assert.file(['gradlew', 'settings.gradle', 'build.gradle']);
- assert(shell.exec(path.join(dir, 'gradlew') + ' build').code == 0);
+//See http://yeoman.io/authoring/testing.html
+
+describe('polygene-generator-defaults', function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test'
+ })
+ .then(buildAndVerify);
+ });
+});
+
+[
+ 'Cassandra',
+ 'File',
+ 'Geode',
+ 'Hazelcast',
+ 'JClouds',
+ 'Jdbm',
+ 'LevelDB',
+ 'MongoDB',
+ 'Preferences',
+ 'Redis',
+ 'Riak',
+ 'SQL',
+ 'Memory' // Somehow the last EntityStore is used in subsequent test arrays. Pick the fastest.
+].forEach(function (entityStore) {
+ describe('polygene-generator-default-and-' + entityStore.toLowerCase() + "-entitystore", function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project with ' + entityStore + ' as the Entity Store', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test',
+ entitystore: entityStore
+ })
+ .then(buildAndVerify);
+ });
+ });
+});
+
+[
+ 'Rdf',
+ 'ElasticSearch',
+ 'Solr',
+ 'SQL'
+].forEach(function (indexing) {
+ describe('polygene-generator-default-and-' + indexing.toLowerCase() + '-indexing', function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project with '+ indexing + ' as the Indexing system', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test',
+ indexing: indexing
+ })
+ .then(buildAndVerify);
+ });
+ });
+});
+
+[
+ 'None',
+ 'Memcache',
+ 'EhCache'
+].forEach(function (caching) {
+ describe('polygene-generator-default-and-' + caching.toLowerCase() + '-caching', function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project with '+caching+' as the Caching system', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test',
+ caching: caching
+ })
+ .then(buildAndVerify);
});
- });
+ });
});
+
+[
+ 'Jackson',
+ // 'Johnzon',
+ 'Stax'
+].forEach(function (serialization) {
+ describe('polygene-generator-default-and-' + serialization.toLowerCase() + '-caching', function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project with '+serialization+' as the Serialization system', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test',
+ serialization: serialization
+ })
+ .then(buildAndVerify);
+ });
+ });
+});
+
+[
+ 'None',
+ 'Codahale'
+].forEach(function (metrics) {
+ describe('polygene-generator-default-and-' + metrics.toLowerCase() + '-caching', function () {
+ this.timeout(10000);
+ it('generates a Gradle buildable Apache Polygene project with '+metrics+' as the Metrics system', function () {
+ return helpers.run(path.join(__dirname, '../app'))
+ .withPrompts({
+ name: 'test-project',
+ packageName: 'org.apache.polygene.generator.test',
+ metrics: metrics
+ })
+ .then(buildAndVerify);
+ });
+ });
+});
+
+
+function buildAndVerify(dir) {
+ assert.file(['gradlew', 'settings.gradle', 'build.gradle']);
+ assert(shell.exec(path.join(dir, 'gradlew') + ' build').code == 0);
+}
\ No newline at end of file
[2/3] polygene-java git commit: Fixed Serialization missing in
RdfIndexingAssembler,
causing failed tests. Fixed additional issues in Yeoman generator.
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
deleted file mode 100644
index 3198347..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreMixin.java
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.prefs;
-
-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.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
-import java.util.stream.Stream;
-import org.apache.polygene.api.cache.CacheOptions;
-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.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.structure.Application;
-import org.apache.polygene.api.structure.ModuleDescriptor;
-import org.apache.polygene.api.time.SystemTime;
-import org.apache.polygene.api.type.CollectionType;
-import org.apache.polygene.api.type.EnumType;
-import org.apache.polygene.api.type.MapType;
-import org.apache.polygene.api.type.ValueCompositeType;
-import org.apache.polygene.api.type.ValueType;
-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;
-import org.apache.polygene.spi.entitystore.DefaultEntityStoreUnitOfWork;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Implementation of EntityStore that is backed by the Preferences API.
- *
- * <p>@see Preferences</p>
- * <p>
- * Associations are stored as the reference of the referenced Entity, ManyAssociations are stored as multi-line strings
- * (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>
- */
-public class PreferencesEntityStoreMixin
- implements ServiceActivation, EntityStore, EntityStoreSPI
-{
- @Structure
- private PolygeneSPI spi;
-
- @This
- private EntityStoreSPI entityStoreSpi;
-
- @Uses
- private ServiceDescriptor descriptor;
-
- @Structure
- private Application application;
-
- @Service
- @Tagged( ValueSerialization.Formats.JSON )
- private ValueSerialization valueSerialization;
-
- private Preferences root;
-
- public Logger logger;
-
- public ScheduledThreadPoolExecutor reloadExecutor;
-
- @Service
- private IdentityGenerator identityGenerator;
-
- @Override
- public void activateService()
- throws Exception
- {
- root = getApplicationRoot();
- logger = LoggerFactory.getLogger( PreferencesEntityStoreService.class.getName() );
- logger.info( "Preferences store:" + root.absolutePath() );
-
- // Reload underlying store every 60 seconds
- reloadExecutor = new ScheduledThreadPoolExecutor( 1 );
- reloadExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy( false );
- reloadExecutor.scheduleAtFixedRate( () -> {
- try
- {
- //noinspection SynchronizeOnNonFinalField
- synchronized( root )
- {
- root.sync();
- }
- }
- catch( BackingStoreException e )
- {
- logger.warn( "Could not reload preferences", e );
- }
- }, 0, 60, TimeUnit.SECONDS );
- }
-
- private Preferences getApplicationRoot()
- {
- PreferencesEntityStoreInfo storeInfo = descriptor.metaInfo( PreferencesEntityStoreInfo.class );
-
- Preferences preferences;
- if( storeInfo == null )
- {
- // Default to use system root + application name
- preferences = Preferences.systemRoot();
- String name = application.name();
- preferences = preferences.node( name );
- }
- else
- {
- preferences = storeInfo.rootNode();
- }
-
- return preferences;
- }
-
- @Override
- public void passivateService()
- throws Exception
- {
- reloadExecutor.shutdown();
- reloadExecutor.awaitTermination( 10, TimeUnit.SECONDS );
- }
-
- @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 )
- {
- UsecaseBuilder builder = UsecaseBuilder.buildUsecase( "polygene.entitystore.preferences.visit" );
- Usecase visitUsecase = builder.withMetaInfo( CacheOptions.NEVER ).newUsecase();
- EntityStoreUnitOfWork uow = newUnitOfWork( module, visitUsecase, SystemTime.now() );
-
- try
- {
- return Stream.of( root.childrenNames() )
- .map( EntityReference::parseEntityReference )
- .map( ref -> uow.entityStateOf( module, ref ) )
- .onClose( uow::discard );
- }
- catch( BackingStoreException e )
- {
- throw new EntityStoreException( e );
- }
- }
-
- @Override
- public EntityState newEntityState( EntityStoreUnitOfWork unitOfWork,
- EntityReference reference,
- EntityDescriptor entityDescriptor
- )
- {
- return new DefaultEntityState( unitOfWork.currentTime(), reference, entityDescriptor );
- }
-
- @Override
- public EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork,
- ModuleDescriptor module,
- EntityReference reference
- )
- {
- try
- {
- if( !root.nodeExists( reference.identity().toString() ) )
- {
- throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() );
- }
-
- Preferences entityPrefs = root.node( reference.identity().toString() );
-
- String type = entityPrefs.get( "type", null );
- EntityStatus status = EntityStatus.LOADED;
-
- EntityDescriptor entityDescriptor = module.entityDescriptor( type );
- if( entityDescriptor == null )
- {
- throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
- }
-
- Map<QualifiedName, Object> properties = new HashMap<>();
- final Preferences propsPrefs = entityPrefs.node( "properties" );
- entityDescriptor.state().properties().forEach(
- persistentPropertyDescriptor ->
- {
- if( persistentPropertyDescriptor.qualifiedName().name().equals( "reference" ) )
- {
- // Fake reference property
- properties.put( persistentPropertyDescriptor.qualifiedName(), reference.identity().toString() );
- }
- else
- {
- ValueType propertyType = persistentPropertyDescriptor.valueType();
- Class<?> primaryType = propertyType.primaryType();
- if( Number.class.isAssignableFrom( primaryType ) )
- {
- if( primaryType.equals( Long.class ) )
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- this.getNumber( propsPrefs, module, persistentPropertyDescriptor, LONG_PARSER ) );
- }
- else if( primaryType.equals( Integer.class ) )
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- this.getNumber( propsPrefs, module, persistentPropertyDescriptor, INT_PARSER ) );
- }
- else if( primaryType.equals( Double.class ) )
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- this.getNumber( propsPrefs, module, persistentPropertyDescriptor, DOUBLE_PARSER ) );
- }
- else if( primaryType.equals( Float.class ) )
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- this.getNumber( propsPrefs, module, persistentPropertyDescriptor, FLOAT_PARSER ) );
- }
- else
- {
- // Load as string even though it's a number
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName()
- .name(), null );
- Object value;
- if( json == null )
- {
- value = null;
- }
- else
- {
- value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
- }
- properties.put( persistentPropertyDescriptor.qualifiedName(), value );
- }
- }
- else if( primaryType.equals( Boolean.class ) )
- {
- Boolean initialValue = (Boolean) persistentPropertyDescriptor.resolveInitialValue(module);
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- propsPrefs.getBoolean( persistentPropertyDescriptor.qualifiedName().name(),
- initialValue == null ? false : initialValue ) );
- }
- else if( propertyType instanceof ValueCompositeType
- || propertyType instanceof MapType
- || propertyType instanceof CollectionType
- || propertyType instanceof EnumType )
- {
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
- Object value;
- if( json == null )
- {
- value = null;
- }
- else
- {
- value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
- }
- properties.put( persistentPropertyDescriptor.qualifiedName(), value );
- }
- else
- {
- String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
- if( json == null )
- {
- if( persistentPropertyDescriptor.resolveInitialValue( module ) != null )
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(),
- persistentPropertyDescriptor.resolveInitialValue( module ) );
- }
- else
- {
- properties.put( persistentPropertyDescriptor.qualifiedName(), null );
- }
- }
- else
- {
- Object value = valueSerialization.deserialize( module, propertyType, json );
- properties.put( persistentPropertyDescriptor.qualifiedName(), value );
- }
- }
- }
- } );
-
- // Associations
- Map<QualifiedName, EntityReference> associations = new HashMap<>();
- final Preferences assocs = entityPrefs.node( "associations" );
- entityDescriptor.state().associations().forEach( associationType -> {
- String associatedEntity = assocs.get( associationType.qualifiedName().name(), null );
- EntityReference value = associatedEntity == null
- ? null
- : EntityReference.parseEntityReference( associatedEntity );
- associations.put( associationType.qualifiedName(), value );
- } );
-
- // ManyAssociations
- Map<QualifiedName, List<EntityReference>> manyAssociations = new HashMap<>();
- Preferences manyAssocs = entityPrefs.node( "manyassociations" );
- entityDescriptor.state().manyAssociations().forEach( manyAssociationType -> {
- List<EntityReference> references = new ArrayList<>();
- String entityReferences = manyAssocs.get( manyAssociationType
- .qualifiedName()
- .name(), null );
- if( entityReferences == null )
- {
- // ManyAssociation not found, default to empty one
- manyAssociations.put( manyAssociationType.qualifiedName(), references );
- }
- else
- {
- String[] refs = entityReferences.split( "\n" );
- for( String ref : refs )
- {
- EntityReference value = ref == null
- ? null
- : EntityReference.parseEntityReference( ref );
- references.add( value );
- }
- manyAssociations.put( manyAssociationType.qualifiedName(), references );
- }
- } );
-
- // NamedAssociations
- Map<QualifiedName, Map<String, EntityReference>> namedAssociations = new HashMap<>();
- Preferences namedAssocs = entityPrefs.node( "namedassociations" );
- entityDescriptor.state().namedAssociations().forEach( namedAssociationType -> {
- Map<String, EntityReference> references = new LinkedHashMap<>();
- String entityReferences = namedAssocs.get( namedAssociationType.qualifiedName().name(), null );
- if( entityReferences == null )
- {
- // NamedAssociation not found, default to empty one
- namedAssociations.put( namedAssociationType.qualifiedName(), references );
- }
- else
- {
- String[] namedRefs = entityReferences.split( "\n" );
- if( namedRefs.length % 2 != 0 )
- {
- throw new EntityStoreException( "Invalid NamedAssociation storage format" );
- }
- for( int idx = 0; idx < namedRefs.length; idx += 2 )
- {
- String name = namedRefs[ idx ];
- String ref = namedRefs[ idx + 1 ];
- references.put( name, EntityReference.parseEntityReference( ref ) );
- }
- namedAssociations.put( namedAssociationType.qualifiedName(), references );
- }
- } );
-
- return new DefaultEntityState( entityPrefs.get( "version", "" ),
- Instant.ofEpochMilli(entityPrefs.getLong( "modified", unitOfWork.currentTime().toEpochMilli() )),
- reference,
- status,
- entityDescriptor,
- properties,
- associations,
- manyAssociations,
- namedAssociations
- );
- }
- catch( ValueSerializationException | BackingStoreException e )
- {
- throw new EntityStoreException( e );
- }
- }
-
- @Override
- public String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference reference )
- {
- try
- {
- if( !root.nodeExists( reference.identity().toString() ) )
- {
- throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() );
- }
-
- Preferences entityPrefs = root.node( reference.identity().toString() );
- return entityPrefs.get( "version", "" );
- }
- catch( BackingStoreException e )
- {
- throw new EntityStoreException( e );
- }
- }
-
- @Override
- public StateCommitter applyChanges( final EntityStoreUnitOfWork unitofwork, final Iterable<EntityState> state )
- {
- return new StateCommitter()
- {
- @SuppressWarnings( "SynchronizeOnNonFinalField" )
- @Override
- public void commit()
- {
- try
- {
- synchronized( root )
- {
- for( EntityState entityState : state )
- {
- DefaultEntityState state = (DefaultEntityState) entityState;
- if( state.status().equals( EntityStatus.NEW ) )
- {
- Preferences entityPrefs = root.node( state.entityReference().identity().toString() );
- writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() );
- }
- else if( state.status().equals( EntityStatus.UPDATED ) )
- {
- Preferences entityPrefs = root.node( state.entityReference().identity().toString() );
- writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() );
- }
- else if( state.status().equals( EntityStatus.REMOVED ) )
- {
- root.node( state.entityReference().identity().toString() ).removeNode();
- }
- }
- root.flush();
- }
- }
- catch( BackingStoreException e )
- {
- throw new EntityStoreException( e );
- }
- }
-
- @Override
- public void cancel()
- {
- }
- };
- }
-
- protected void writeEntityState( DefaultEntityState state,
- Preferences entityPrefs,
- Identity identity,
- Instant lastModified
- )
- throws EntityStoreException
- {
- try
- {
- // Store into Preferences API
- entityPrefs.put( "type", state.entityDescriptor().types().findFirst().get().getName() );
- entityPrefs.put( "version", identity.toString() );
- entityPrefs.putLong( "modified", lastModified.toEpochMilli() );
-
- // Properties
- Preferences propsPrefs = entityPrefs.node( "properties" );
- state.entityDescriptor().state().properties()
- .filter( property -> !property.qualifiedName().name().equals( "reference" ) )
- .forEach( persistentProperty ->
- {
- Object value = state.properties().get( persistentProperty.qualifiedName() );
-
- if( value == null )
- {
- propsPrefs.remove( persistentProperty.qualifiedName().name() );
- }
- else
- {
- ValueType valueType = persistentProperty.valueType();
- Class<?> primaryType = valueType.primaryType();
- if( Number.class.isAssignableFrom( primaryType ) )
- {
- if( primaryType.equals( Long.class ) )
- {
- propsPrefs.putLong( persistentProperty.qualifiedName().name(), (Long) value );
- }
- else if( primaryType.equals( Integer.class ) )
- {
- propsPrefs.putInt( persistentProperty.qualifiedName()
- .name(), (Integer) value );
- }
- else if( primaryType.equals( Double.class ) )
- {
- propsPrefs.putDouble( persistentProperty.qualifiedName()
- .name(), (Double) value );
- }
- else if( primaryType.equals( Float.class ) )
- {
- propsPrefs.putFloat( persistentProperty.qualifiedName()
- .name(), (Float) value );
- }
- else
- {
- // Store as string even though it's a number
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
- }
- }
- else if( primaryType.equals( Boolean.class ) )
- {
- propsPrefs.putBoolean( persistentProperty.qualifiedName()
- .name(), (Boolean) value );
- }
- else if( valueType instanceof ValueCompositeType
- || valueType instanceof MapType
- || valueType instanceof CollectionType
- || valueType instanceof EnumType )
- {
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
- }
- else
- {
- String jsonString = valueSerialization.serialize( value );
- propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
- }
- }
- } );
-
- // Associations
- if( !state.associations().isEmpty() )
- {
- Preferences assocsPrefs = entityPrefs.node( "associations" );
- for( Map.Entry<QualifiedName, EntityReference> association : state.associations().entrySet() )
- {
- if( association.getValue() == null )
- {
- assocsPrefs.remove( association.getKey().name() );
- }
- else
- {
- assocsPrefs.put( association.getKey().name(), association.getValue().identity().toString() );
- }
- }
- }
-
- // ManyAssociations
- if( !state.manyAssociations().isEmpty() )
- {
- Preferences manyAssocsPrefs = entityPrefs.node( "manyassociations" );
- for( Map.Entry<QualifiedName, List<EntityReference>> manyAssociation : state.manyAssociations()
- .entrySet() )
- {
- StringBuilder manyAssocs = new StringBuilder();
- for( EntityReference entityReference : manyAssociation.getValue() )
- {
- if( manyAssocs.length() > 0 )
- {
- manyAssocs.append( "\n" );
- }
- manyAssocs.append( entityReference.identity().toString() );
- }
- if( manyAssocs.length() > 0 )
- {
- manyAssocsPrefs.put( manyAssociation.getKey().name(), manyAssocs.toString() );
- }
- }
- }
-
- // NamedAssociations
- if( !state.namedAssociations().isEmpty() )
- {
- Preferences namedAssocsPrefs = entityPrefs.node( "namedassociations" );
- for( Map.Entry<QualifiedName, Map<String, EntityReference>> namedAssociation : state.namedAssociations()
- .entrySet() )
- {
- StringBuilder namedAssocs = new StringBuilder();
- for( Map.Entry<String, EntityReference> namedRef : namedAssociation.getValue().entrySet() )
- {
- if( namedAssocs.length() > 0 )
- {
- namedAssocs.append( "\n" );
- }
- namedAssocs.append( namedRef.getKey() ).append( "\n" ).append( namedRef.getValue().identity().toString() );
- }
- if( namedAssocs.length() > 0 )
- {
- namedAssocsPrefs.put( namedAssociation.getKey().name(), namedAssocs.toString() );
- }
- }
- }
- }
- catch( ValueSerializationException e )
- {
- throw new EntityStoreException( "Could not store EntityState", e );
- }
- }
-
- protected Identity newUnitOfWorkId()
- {
- return identityGenerator.generate(EntityStore.class);
- }
-
- private interface NumberParser<T>
- {
- T parse( String str );
- }
-
- private static final NumberParser<Long> LONG_PARSER = Long::parseLong;
-
- private static final NumberParser<Integer> INT_PARSER = Integer::parseInt;
-
- private static final NumberParser<Double> DOUBLE_PARSER = Double::parseDouble;
-
- private static final NumberParser<Float> FLOAT_PARSER = Float::parseFloat;
-
- private <T> T getNumber( Preferences prefs, ModuleDescriptor module, PropertyDescriptor pDesc, NumberParser<T> parser )
- {
- Object initialValue = pDesc.resolveInitialValue( module );
- String str = prefs.get( pDesc.qualifiedName().name(), initialValue == null ? null : initialValue.toString() );
- T result = null;
- if( str != null )
- {
- result = parser.parse( str );
- }
- return result;
- }
-
- private static class UnknownType
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java
deleted file mode 100644
index a3801de..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.entitystore.prefs;
-
-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;
-
-/**
- * EntityStore backed by Preferences API.
- * <p>
- * A root node is created in the System preferences, whose name
- * is the same as the Application name (default:"Application").
- * </p>
- * <p>
- * Each entity is stored under its identity name.
- * </p>
- * <p>
- * Property types are converted to native Preferences API types
- * as much as possible. All others will be serialized to a string using JSON.
- * </p>
- * <p>
- * Associations are stored as the identity of the referenced Entity, ManyAssociations are stored as multi-line strings
- * (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the
- * next line).
- * </p>
- * <p>
- * The main use of the EntityStore is for storage of ConfigurationComposites for ServiceComposites.
- * </p>
- * @see org.apache.polygene.api.service.ServiceComposite
- * @see org.apache.polygene.api.configuration.Configuration
- */
-@Concerns( ConcurrentModificationCheckConcern.class )
-@Mixins( PreferencesEntityStoreMixin.class )
-public interface PreferencesEntityStoreService
- extends EntityStore, ServiceComposite, EntityStateVersions, ServiceActivation
-{
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java
deleted file mode 100644
index 4371047..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/PreferenceEntityStoreAssembler.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.prefs.assembly;
-
-import java.util.prefs.Preferences;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreInfo;
-import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreService;
-
-public class PreferenceEntityStoreAssembler
- extends Assemblers.VisibilityIdentity<PreferenceEntityStoreAssembler>
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- String applicationName = module.layer().application().name();
-
- Preferences root = Preferences.userRoot();
- Preferences node = root.node( applicationName );
- PreferencesEntityStoreInfo info = new PreferencesEntityStoreInfo( node );
- ServiceDeclaration service = module.services( PreferencesEntityStoreService.class )
- .setMetaInfo( info )
- .visibleIn( visibility() )
- .instantiateOnStartup();
- if( hasIdentity() )
- {
- service.identifiedBy( identity() );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html
deleted file mode 100644
index 564de79..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/assembly/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- ~
- -->
-<html>
- <body>
- <h2>Preferences EntityStore Assembly.</h2>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html
deleted file mode 100644
index 8e39337..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- ~
- ~
- -->
-<html>
- <body>
- <h2>Preferences EntityStore.</h2>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
index 7715f9e..53f049a 100644
--- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
+++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/DocumentationSupport.java
@@ -21,7 +21,7 @@ package org.apache.polygene.entitystore;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.prefs.assembly.PreferenceEntityStoreAssembler;
+import org.apache.polygene.entitystore.preferences.assembly.PreferencesEntityStoreAssembler;
import org.apache.polygene.test.AbstractPolygeneTest;
public class DocumentationSupport
@@ -32,7 +32,7 @@ public class DocumentationSupport
public void assemble( ModuleAssembly module )
throws AssemblyException
{
- new PreferenceEntityStoreAssembler().assemble( module );
+ new PreferencesEntityStoreAssembler().assemble( module );
}
// END SNIPPET: assembly
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
index f2cf4e4..10be81e 100644
--- a/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
+++ b/extensions/entitystore-preferences/src/test/java/org/apache/polygene/entitystore/PreferencesEntityStoreTest.java
@@ -22,8 +22,8 @@ package org.apache.polygene.entitystore;
import java.util.prefs.Preferences;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreInfo;
-import org.apache.polygene.entitystore.prefs.PreferencesEntityStoreService;
+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;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
new file mode 100644
index 0000000..1477c6b
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql.assembly;
+
+/**
+ * This is a dummy Assembler to support the Yeoman Polygene Generator, which require naming conventions for
+ * the systems that it supports.
+ */
+public class SQLEntityStoreAssembler extends H2SQLEntityStoreAssembler
+{}
+
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-elasticsearch/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/build.gradle b/extensions/indexing-elasticsearch/build.gradle
index fac6eec..faa63b8 100644
--- a/extensions/indexing-elasticsearch/build.gradle
+++ b/extensions/indexing-elasticsearch/build.gradle
@@ -34,6 +34,7 @@ dependencies {
runtimeOnly polygene.core.runtime
testImplementation polygene.core.testsupport
+ testImplementation polygene.extension( 'valueserialization-jackson' )
testRuntimeOnly libraries.logback
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
index 6b6feab..ecd35fb 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ElasticSearchQueryTest.java
@@ -30,6 +30,7 @@ import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.indexing.AbstractQueryTest;
import org.apache.polygene.test.util.NotYetImplemented;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
@@ -78,6 +79,9 @@ public class ElasticSearchQueryTest extends AbstractQueryTest
testName.getMethodName() ) );
esConfig.indexNonAggregatedAssociations().set( Boolean.TRUE );
+ // Serialization
+ new JacksonValueSerializationAssembler().assemble( module );
+
// FileConfig
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/build.gradle b/extensions/indexing-rdf/build.gradle
index 2eb52e9..ad465a4 100644
--- a/extensions/indexing-rdf/build.gradle
+++ b/extensions/indexing-rdf/build.gradle
@@ -33,7 +33,7 @@ dependencies {
runtimeOnly polygene.core.runtime
testImplementation polygene.core.testsupport
- testImplementation polygene.extension( 'valueserialization-orgjson' )
+ testImplementation polygene.extension( 'valueserialization-jackson' )
testImplementation polygene.extension( 'entitystore-preferences' )
testImplementation polygene.extension( 'entitystore-jdbm' )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java
index 8f11649..fa2c6ae 100644
--- a/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java
+++ b/extensions/indexing-rdf/src/main/java/org/apache/polygene/index/rdf/query/RdfQueryParserFactory.java
@@ -43,6 +43,7 @@ public interface RdfQueryParserFactory
{
@Structure
private PolygeneSPI spi;
+
@Service
@Tagged( ValueSerialization.Formats.JSON )
private ValueSerializer valueSerializer;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java
index 23c8f13..21f5d46 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryMultimoduleTest.java
@@ -27,6 +27,7 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler;
import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class RdfNamedQueryMultimoduleTest
extends RdfNamedQueryTest
@@ -47,6 +48,7 @@ public class RdfNamedQueryMultimoduleTest
ModuleAssembly indexModule = layer.module( "index" );
new DefaultUnitOfWorkAssembler().assemble( indexModule );
new RdfMemoryStoreAssembler( Visibility.layer, Visibility.module ).assemble( indexModule );
+ new JacksonValueSerializationAssembler().assemble( indexModule );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
index e327387..6ebbee8 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfNamedQueryTest.java
@@ -27,6 +27,8 @@ import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler;
import org.apache.polygene.index.rdf.query.SesameExpressions;
import org.apache.polygene.test.indexing.AbstractNamedQueryTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
+import org.slf4j.LoggerFactory;
public class RdfNamedQueryTest extends AbstractNamedQueryTest
{
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java
index 0ed4774..d9d0cf1 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/RdfQueryMultimoduleTest.java
@@ -28,6 +28,7 @@ import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
import org.apache.polygene.library.rdf.repository.NativeConfiguration;
import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
@@ -53,6 +54,7 @@ public class RdfQueryMultimoduleTest
ModuleAssembly indexModule = layer.module( "index" );
new RdfNativeSesameStoreAssembler( Visibility.layer, Visibility.module ).assemble( indexModule );
new DefaultUnitOfWorkAssembler().assemble( indexModule );
+ new JacksonValueSerializationAssembler().assemble( indexModule );
LayerAssembly configLayer = module.layer().application().layer( "config" );
module.layer().uses( configLayer );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
index 1d57ef0..9dd94b7 100644
--- a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
+++ b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.apache.polygene.bootstrap.unitofwork.DefaultUnitOfWorkAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
import org.junit.Rule;
import org.junit.Test;
import org.apache.polygene.api.common.Visibility;
@@ -43,7 +44,6 @@ import org.apache.polygene.index.rdf.assembly.RdfMemoryStoreAssembler;
import org.apache.polygene.index.rdf.assembly.RdfNativeSesameStoreAssembler;
import org.apache.polygene.library.rdf.repository.NativeConfiguration;
import org.apache.polygene.test.EntityTestAssembler;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
import org.junit.rules.TemporaryFolder;
import static org.junit.Assert.assertTrue;
@@ -221,6 +221,7 @@ public class Qi95IssueTest
public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
throws AssemblyException
{
+ addModule( layer, name, new JacksonValueSerializationAssembler() );
return addModule( layer, name, new RdfNativeSesameStoreAssembler() );
}
};
@@ -241,6 +242,7 @@ public class Qi95IssueTest
public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
throws AssemblyException
{
+ addModule( layer, name, new JacksonValueSerializationAssembler() );
return addModule( layer, name, new RdfMemoryStoreAssembler() );
}
};
@@ -322,7 +324,7 @@ public class Qi95IssueTest
public void assemble( ModuleAssembly module )
throws AssemblyException
{
- new OrgJsonValueSerializationAssembler().assemble( module );
+ new JacksonValueSerializationAssembler().assemble( module );
new JdbmEntityStoreAssembler().visibleIn( Visibility.application ).assemble( module );
new DefaultUnitOfWorkAssembler().assemble( module );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/build.gradle b/extensions/indexing-solr/build.gradle
index 608bec3..fd991f6 100644
--- a/extensions/indexing-solr/build.gradle
+++ b/extensions/indexing-solr/build.gradle
@@ -34,6 +34,7 @@ dependencies {
runtimeOnly polygene.core.runtime
testImplementation polygene.core.testsupport
+ testImplementation polygene.extension( 'valueserialization-jackson' )
testRuntimeOnly libraries.logback
testRuntimeOnly libraries.servlet_api
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
deleted file mode 100644
index 38b97e3..0000000
--- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrAssembler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.index.solr.assembly;
-
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
-import org.apache.polygene.index.solr.EmbeddedSolrService;
-import org.apache.polygene.index.solr.SolrQueryService;
-import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
-import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
-
-public class SolrAssembler extends Assemblers.VisibilityIdentity
-{
- @Override
- public void assemble( ModuleAssembly module ) throws AssemblyException
- {
- module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup();
- ServiceDeclaration queryService = module.services( SolrQueryService.class );
- queryService.
- taggedWith( "solr", "search", "indexing", "query" ).
- identifiedBy( identity() ).
- visibleIn( visibility() ).
- instantiateOnStartup();
- module.services( OrgJsonValueSerializationService.class ).taggedWith( ValueSerialization.Formats.JSON );
- module.objects( EntityStateSerializer.class );
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java
new file mode 100644
index 0000000..fa6b59c
--- /dev/null
+++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/assembly/SolrIndexingAssembler.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.index.solr.assembly;
+
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.index.solr.EmbeddedSolrService;
+import org.apache.polygene.index.solr.SolrQueryService;
+import org.apache.polygene.library.rdf.entity.EntityStateSerializer;
+import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationService;
+
+public class SolrIndexingAssembler extends Assemblers.VisibilityIdentityConfig<SolrIndexingAssembler>
+{
+ @Override
+ public void assemble( ModuleAssembly module ) throws AssemblyException
+ {
+ module.services( EmbeddedSolrService.class ).identifiedBy( "solr" ).instantiateOnStartup();
+ ServiceDeclaration queryService = module.services( SolrQueryService.class );
+ queryService.
+ taggedWith( "solr", "search", "indexing", "query" ).
+ identifiedBy( identity() ).
+ visibleIn( visibility() ).
+ instantiateOnStartup();
+ module.objects( EntityStateSerializer.class );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
index d51ca13..c67e70b 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrEntityFinderTest.java
@@ -21,7 +21,7 @@ package org.apache.polygene.index.solr;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.solr.assembly.SolrAssembler;
+import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.indexing.AbstractEntityFinderTest;
@@ -44,6 +44,6 @@ public class SolrEntityFinderTest
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
.assemble( module );
- new SolrAssembler().assemble( module );
+ new SolrIndexingAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
index fab66ac..daba9b3 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrNamedQueryTest.java
@@ -23,7 +23,7 @@ import java.util.function.Predicate;
import org.apache.polygene.api.composite.Composite;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.solr.assembly.SolrAssembler;
+import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.indexing.AbstractNamedQueryTest;
@@ -46,7 +46,7 @@ public class SolrNamedQueryTest
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
.assemble( module );
- new SolrAssembler().assemble( module );
+ new SolrIndexingAssembler().assemble( module );
}
@Override
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
index c5b06f9..01d3440 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryServiceTest.java
@@ -21,7 +21,7 @@ package org.apache.polygene.index.solr;
import java.util.ArrayList;
import java.util.List;
-import org.apache.polygene.index.solr.assembly.SolrAssembler;
+import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
@@ -64,7 +64,7 @@ public class SolrQueryServiceTest
new EntityTestAssembler().assemble( module );
// START SNIPPET: assembly
- new SolrAssembler().assemble( module );
+ new SolrIndexingAssembler().assemble( module );
// END SNIPPET: assembly
module.entities( TestEntity.class );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
index 376574c..f61b665 100644
--- a/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
+++ b/extensions/indexing-solr/src/test/java/org/apache/polygene/index/solr/SolrQueryTest.java
@@ -21,7 +21,7 @@ package org.apache.polygene.index.solr;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.index.solr.assembly.SolrAssembler;
+import org.apache.polygene.index.solr.assembly.SolrIndexingAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationAssembler;
import org.apache.polygene.library.fileconfig.FileConfigurationOverride;
import org.apache.polygene.test.indexing.AbstractQueryTest;
@@ -44,6 +44,6 @@ public class SolrQueryTest
new FileConfigurationAssembler()
.withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) )
.assemble( module );
- new SolrAssembler().assemble( module );
+ new SolrIndexingAssembler().assemble( module );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-sql/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/build.gradle b/extensions/indexing-sql/build.gradle
index e0e50e8..0c8a21e 100644
--- a/extensions/indexing-sql/build.gradle
+++ b/extensions/indexing-sql/build.gradle
@@ -38,6 +38,7 @@ dependencies {
testImplementation polygene.internals.testsupport
testImplementation polygene.library( 'sql-dbcp' )
+ testImplementation polygene.extension( 'valueserialization-jackson' )
testRuntimeOnly libraries.logback
testRuntimeOnly libraries.derby
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java
new file mode 100644
index 0000000..af137de
--- /dev/null
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/assembly/SQLIndexingAssembler.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.index.sql.assembly;
+
+public class SQLIndexingAssembler extends PostgreSQLIndexQueryAssembler
+{
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
index 7e9b843..a737c06 100644
--- a/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
+++ b/extensions/metrics-codahale/src/main/java/org/apache/polygene/metrics/codahale/assembly/CodahaleMetricsAssembler.java
@@ -36,7 +36,7 @@ import org.apache.polygene.bootstrap.ServiceDeclaration;
import org.apache.polygene.metrics.codahale.CodahaleMetricsProvider;
public class CodahaleMetricsAssembler
- extends Assemblers.VisibilityIdentity<CodahaleMetricsAssembler>
+ extends Assemblers.VisibilityIdentityConfig<CodahaleMetricsAssembler>
{
private final CodahaleMetricsDeclaration declaration = new CodahaleMetricsDeclaration();
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java
deleted file mode 100644
index 8f6421d..0000000
--- a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.valueserialization.jackson;
-
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-
-/**
- * Assemble a ValueSerialization Service producing and consuming JSON documents.
- */
-public class JacksonValueSerializationAssembler
- extends Assemblers.Visibility<JacksonValueSerializationAssembler>
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( JacksonValueSerializationService.class ).
- visibleIn( visibility() ).
- taggedWith( ValueSerialization.Formats.JSON );
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java
new file mode 100644
index 0000000..7bff000
--- /dev/null
+++ b/extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/assembly/JacksonValueSerializationAssembler.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.valueserialization.jackson.assembly;
+
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationService;
+
+/**
+ * Assemble a ValueSerialization Service producing and consuming JSON documents.
+ */
+public class JacksonValueSerializationAssembler
+ extends Assemblers.Visibility<JacksonValueSerializationAssembler>
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ module.services( JacksonValueSerializationService.class )
+ .visibleIn( visibility() )
+ .taggedWith( ValueSerialization.Formats.JSON );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java
index 8160c55..f4069c3 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonCollectionSerializationTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.value.AbstractCollectionSerializationTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class JacksonCollectionSerializationTest
extends AbstractCollectionSerializationTest
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java
index fb59e8e..1948d62 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonConfigurationDeserializationTest.java
@@ -23,6 +23,7 @@ package org.apache.polygene.valueserialization.jackson;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.entity.AbstractConfigurationDeserializationTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class JacksonConfigurationDeserializationTest
extends AbstractConfigurationDeserializationTest
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java
index 78f27b0..bbc141d 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonJsonDateFormatTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.value.AbstractJsonDateFormatTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class JacksonJsonDateFormatTest
extends AbstractJsonDateFormatTest
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java
index b4ad6a4..cdcce17 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonPlainValueSerializationTest.java
@@ -21,6 +21,7 @@ package org.apache.polygene.valueserialization.jackson;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.value.AbstractPlainValueSerializationTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class JacksonPlainValueSerializationTest
extends AbstractPlainValueSerializationTest
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java
index 49f7eba..2a757ab 100644
--- a/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java
+++ b/extensions/valueserialization-jackson/src/test/java/org/apache/polygene/valueserialization/jackson/JacksonValueCompositeSerializationTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.valueserialization.jackson;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.test.value.AbstractValueCompositeSerializationTest;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
public class JacksonValueCompositeSerializationTest
extends AbstractValueCompositeSerializationTest
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java
deleted file mode 100644
index e972acb..0000000
--- a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.valueserialization.stax;
-
-import org.apache.polygene.api.value.ValueSerialization;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-
-/**
- * Assemble a ValueSerialization Service producing and consuming XML documents.
- */
-public class StaxValueSerializationAssembler
- extends Assemblers.Visibility<StaxValueSerializationAssembler>
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( StaxValueSerializationService.class ).
- visibleIn( visibility() ).
- taggedWith( ValueSerialization.Formats.XML );
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java
new file mode 100644
index 0000000..8eaede4
--- /dev/null
+++ b/extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/assembly/StaxValueSerializationAssembler.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.valueserialization.stax.assembly;
+
+import org.apache.polygene.api.value.ValueSerialization;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.valueserialization.stax.StaxValueSerializationService;
+
+/**
+ * Assemble a ValueSerialization Service producing and consuming XML documents.
+ */
+public class StaxValueSerializationAssembler
+ extends Assemblers.Visibility<StaxValueSerializationAssembler>
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ module.services( StaxValueSerializationService.class )
+ .visibleIn( visibility() )
+ .taggedWith( ValueSerialization.Formats.XML );
+ }
+}
[3/3] polygene-java git commit: Fixed Serialization missing in
RdfIndexingAssembler,
causing failed tests. Fixed additional issues in Yeoman generator.
Posted by ni...@apache.org.
Fixed Serialization missing in RdfIndexingAssembler, causing failed tests. Fixed additional issues in Yeoman generator.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/b8aea70a
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/b8aea70a
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/b8aea70a
Branch: refs/heads/develop
Commit: b8aea70ac345bd99e8848a8ffd880f0e57dc3440
Parents: 41c759b
Author: niclas <ni...@spicter.com>
Authored: Sat Mar 11 23:17:25 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Sat Mar 11 23:17:25 2017 +0800
----------------------------------------------------------------------
.../cache/memcache/MemcacheAssembler.java | 47 --
.../memcache/assembly/MemcacheAssembler.java | 49 ++
.../cache/memcache/MemcacheCachePoolTest.java | 1 +
.../cassandra/CassandraMapEntityStoreTest.java | 2 +-
.../preferences/ListPreferencesNodes.java | 68 ++
.../preferences/PreferencesEntityStoreInfo.java | 45 ++
.../PreferencesEntityStoreMixin.java | 658 +++++++++++++++++++
.../PreferencesEntityStoreService.java | 60 ++
.../PreferencesEntityStoreAssembler.java | 51 ++
.../preferences/assembly/package.html | 24 +
.../entitystore/preferences/package.html | 24 +
.../entitystore/prefs/ListPreferencesNodes.java | 68 --
.../prefs/PreferencesEntityStoreInfo.java | 45 --
.../prefs/PreferencesEntityStoreMixin.java | 658 -------------------
.../prefs/PreferencesEntityStoreService.java | 60 --
.../PreferenceEntityStoreAssembler.java | 51 --
.../entitystore/prefs/assembly/package.html | 24 -
.../polygene/entitystore/prefs/package.html | 24 -
.../entitystore/DocumentationSupport.java | 4 +-
.../entitystore/PreferencesEntityStoreTest.java | 4 +-
.../sql/assembly/SQLEntityStoreAssembler.java | 28 +
extensions/indexing-elasticsearch/build.gradle | 1 +
.../elasticsearch/ElasticSearchQueryTest.java | 4 +
extensions/indexing-rdf/build.gradle | 2 +-
.../index/rdf/query/RdfQueryParserFactory.java | 1 +
.../index/rdf/RdfNamedQueryMultimoduleTest.java | 2 +
.../polygene/index/rdf/RdfNamedQueryTest.java | 2 +
.../index/rdf/RdfQueryMultimoduleTest.java | 2 +
.../polygene/index/rdf/qi95/Qi95IssueTest.java | 6 +-
extensions/indexing-solr/build.gradle | 1 +
.../index/solr/assembly/SolrAssembler.java | 48 --
.../solr/assembly/SolrIndexingAssembler.java | 47 ++
.../index/solr/SolrEntityFinderTest.java | 4 +-
.../polygene/index/solr/SolrNamedQueryTest.java | 4 +-
.../index/solr/SolrQueryServiceTest.java | 4 +-
.../polygene/index/solr/SolrQueryTest.java | 4 +-
extensions/indexing-sql/build.gradle | 1 +
.../sql/assembly/SQLIndexingAssembler.java | 24 +
.../assembly/CodahaleMetricsAssembler.java | 2 +-
.../JacksonValueSerializationAssembler.java | 41 --
.../JacksonValueSerializationAssembler.java | 42 ++
.../JacksonCollectionSerializationTest.java | 1 +
...JacksonConfigurationDeserializationTest.java | 1 +
.../jackson/JacksonJsonDateFormatTest.java | 1 +
.../JacksonPlainValueSerializationTest.java | 1 +
.../JacksonValueCompositeSerializationTest.java | 1 +
.../stax/StaxValueSerializationAssembler.java | 41 --
.../StaxValueSerializationAssembler.java | 42 ++
.../stax/StaxCollectionSerializationTest.java | 1 +
.../StaxConfigurationDeserializationTest.java | 1 +
.../stax/StaxPlainValueSerializationTest.java | 1 +
.../StaxValueCompositeSerializationTest.java | 1 +
.../RestletCrudConnectivityAssembler.java | 2 +-
.../configuration/ConfigurationModule.java | 2 +-
.../infrastructue/SerializationModule.java | 2 +-
settings.gradle | 1 +
.../ConfigModule/bootstrap.tmpl | 2 +-
.../MetricsModule/bootstrap.tmpl | 2 +-
.../SerializationModule/bootstrap.tmpl | 2 +-
tools/generator-polygene/build.gradle | 68 ++
tools/generator-polygene/test/generator_test.js | 134 +++-
61 files changed, 1402 insertions(+), 1142 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/MemcacheAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/MemcacheAssembler.java b/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/MemcacheAssembler.java
deleted file mode 100644
index bbc58cb..0000000
--- a/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/MemcacheAssembler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.cache.memcache;
-
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ServiceDeclaration;
-
-/**
- * Memcache CachePool Assembler.
- */
-public class MemcacheAssembler
- extends Assemblers.VisibilityIdentityConfig<MemcacheAssembler>
-{
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- ServiceDeclaration service = module.services( MemcachePoolService.class ).visibleIn( visibility() );
- if( hasIdentity() )
- {
- service.identifiedBy( identity() );
- }
- if( hasConfig() )
- {
- configModule().entities( MemcacheConfiguration.class ).visibleIn( configVisibility() );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/assembly/MemcacheAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/assembly/MemcacheAssembler.java b/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/assembly/MemcacheAssembler.java
new file mode 100644
index 0000000..e2cbc11
--- /dev/null
+++ b/extensions/cache-memcache/src/main/java/org/apache/polygene/cache/memcache/assembly/MemcacheAssembler.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.cache.memcache.assembly;
+
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.cache.memcache.MemcacheConfiguration;
+import org.apache.polygene.cache.memcache.MemcachePoolService;
+
+/**
+ * Memcache CachePool Assembler.
+ */
+public class MemcacheAssembler
+ extends Assemblers.VisibilityIdentityConfig<MemcacheAssembler>
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ ServiceDeclaration service = module.services( MemcachePoolService.class ).visibleIn( visibility() );
+ if( hasIdentity() )
+ {
+ service.identifiedBy( identity() );
+ }
+ if( hasConfig() )
+ {
+ configModule().entities( MemcacheConfiguration.class ).visibleIn( configVisibility() );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java b/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
index 7d5d98b..7843eb3 100644
--- a/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
+++ b/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
@@ -22,6 +22,7 @@ package org.apache.polygene.cache.memcache;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.cache.memcache.assembly.MemcacheAssembler;
import org.apache.polygene.test.internal.DockerRule;
import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.cache.AbstractCachePoolTest;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
index 45e35e1..af97dc9 100644
--- a/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
+++ b/extensions/entitystore-cassandra/src/test/java/org/apache/polygene/entitystore/cassandra/CassandraMapEntityStoreTest.java
@@ -27,7 +27,7 @@ import org.apache.polygene.test.EntityTestAssembler;
import org.apache.polygene.test.entity.AbstractEntityStoreTest;
import org.apache.polygene.test.entity.CanRemoveAll;
import org.apache.polygene.test.internal.DockerRule;
-import org.apache.polygene.valueserialization.jackson.JacksonValueSerializationAssembler;
+import org.apache.polygene.valueserialization.jackson.assembly.JacksonValueSerializationAssembler;
import org.junit.ClassRule;
/**
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/ListPreferencesNodes.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/ListPreferencesNodes.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/ListPreferencesNodes.java
new file mode 100644
index 0000000..ad30f02
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/ListPreferencesNodes.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.preferences;
+
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+
+public class ListPreferencesNodes
+{
+ public static void main( String[] args )
+ throws Exception
+ {
+ Preferences preferences = Preferences.userRoot();
+ printNode( preferences, "" );
+ }
+
+ private static void printNode( Preferences node, String indent )
+ throws BackingStoreException
+ {
+ System.out.print( indent );
+ String name = node.name();
+ if( "".equals( name ) )
+ {
+ name = "/";
+ }
+
+ System.out.print( name );
+ String[] nodes = node.keys();
+ if( nodes.length > 0 )
+ {
+ System.out.print( " { " );
+ boolean first = true;
+ for( String key : nodes )
+ {
+ if( !first )
+ {
+ System.out.print( ", " );
+ }
+ first = false;
+ System.out.print( key );
+ }
+ System.out.print( " }" );
+ }
+ System.out.println();
+ for( String childName : node.childrenNames() )
+ {
+ Preferences child = node.node( childName );
+ printNode( child, indent + " " );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreInfo.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreInfo.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreInfo.java
new file mode 100644
index 0000000..fc59c15
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreInfo.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.preferences;
+
+import java.io.Serializable;
+import java.util.prefs.Preferences;
+
+/**
+ * @author edward.yakop@gmail.com
+ */
+public final class PreferencesEntityStoreInfo
+ implements Serializable
+{
+ private Preferences rootNode;
+
+ public PreferencesEntityStoreInfo( Preferences aRootNode )
+ {
+ rootNode = aRootNode;
+ }
+
+ /**
+ * @return root preference node to use.
+ */
+ public Preferences rootNode()
+ {
+ return rootNode;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/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
new file mode 100644
index 0000000..fa32a71
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreMixin.java
@@ -0,0 +1,658 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.preferences;
+
+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.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.prefs.BackingStoreException;
+import java.util.prefs.Preferences;
+import java.util.stream.Stream;
+import org.apache.polygene.api.cache.CacheOptions;
+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.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.structure.Application;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+import org.apache.polygene.api.time.SystemTime;
+import org.apache.polygene.api.type.CollectionType;
+import org.apache.polygene.api.type.EnumType;
+import org.apache.polygene.api.type.MapType;
+import org.apache.polygene.api.type.ValueCompositeType;
+import org.apache.polygene.api.type.ValueType;
+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;
+import org.apache.polygene.spi.entitystore.DefaultEntityStoreUnitOfWork;
+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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of EntityStore that is backed by the Preferences API.
+ *
+ * <p>@see Preferences</p>
+ * <p>
+ * Associations are stored as the reference of the referenced Entity, ManyAssociations are stored as multi-line strings
+ * (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>
+ */
+public class PreferencesEntityStoreMixin
+ implements ServiceActivation, EntityStore, EntityStoreSPI
+{
+ @Structure
+ private PolygeneSPI spi;
+
+ @This
+ private EntityStoreSPI entityStoreSpi;
+
+ @Uses
+ private ServiceDescriptor descriptor;
+
+ @Structure
+ private Application application;
+
+ @Service
+ @Tagged( ValueSerialization.Formats.JSON )
+ private ValueSerialization valueSerialization;
+
+ private Preferences root;
+
+ public Logger logger;
+
+ public ScheduledThreadPoolExecutor reloadExecutor;
+
+ @Service
+ private IdentityGenerator identityGenerator;
+
+ @Override
+ public void activateService()
+ throws Exception
+ {
+ root = getApplicationRoot();
+ logger = LoggerFactory.getLogger( PreferencesEntityStoreService.class.getName() );
+ logger.info( "Preferences store:" + root.absolutePath() );
+
+ // Reload underlying store every 60 seconds
+ reloadExecutor = new ScheduledThreadPoolExecutor( 1 );
+ reloadExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy( false );
+ reloadExecutor.scheduleAtFixedRate( () -> {
+ try
+ {
+ //noinspection SynchronizeOnNonFinalField
+ synchronized( root )
+ {
+ root.sync();
+ }
+ }
+ catch( BackingStoreException e )
+ {
+ logger.warn( "Could not reload preferences", e );
+ }
+ }, 0, 60, TimeUnit.SECONDS );
+ }
+
+ private Preferences getApplicationRoot()
+ {
+ PreferencesEntityStoreInfo storeInfo = descriptor.metaInfo( PreferencesEntityStoreInfo.class );
+
+ Preferences preferences;
+ if( storeInfo == null )
+ {
+ // Default to use system root + application name
+ preferences = Preferences.systemRoot();
+ String name = application.name();
+ preferences = preferences.node( name );
+ }
+ else
+ {
+ preferences = storeInfo.rootNode();
+ }
+
+ return preferences;
+ }
+
+ @Override
+ public void passivateService()
+ throws Exception
+ {
+ reloadExecutor.shutdown();
+ reloadExecutor.awaitTermination( 10, TimeUnit.SECONDS );
+ }
+
+ @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 )
+ {
+ UsecaseBuilder builder = UsecaseBuilder.buildUsecase( "polygene.entitystore.preferences.visit" );
+ Usecase visitUsecase = builder.withMetaInfo( CacheOptions.NEVER ).newUsecase();
+ EntityStoreUnitOfWork uow = newUnitOfWork( module, visitUsecase, SystemTime.now() );
+
+ try
+ {
+ return Stream.of( root.childrenNames() )
+ .map( EntityReference::parseEntityReference )
+ .map( ref -> uow.entityStateOf( module, ref ) )
+ .onClose( uow::discard );
+ }
+ catch( BackingStoreException e )
+ {
+ throw new EntityStoreException( e );
+ }
+ }
+
+ @Override
+ public EntityState newEntityState( EntityStoreUnitOfWork unitOfWork,
+ EntityReference reference,
+ EntityDescriptor entityDescriptor
+ )
+ {
+ return new DefaultEntityState( unitOfWork.currentTime(), reference, entityDescriptor );
+ }
+
+ @Override
+ public EntityState entityStateOf( EntityStoreUnitOfWork unitOfWork,
+ ModuleDescriptor module,
+ EntityReference reference
+ )
+ {
+ try
+ {
+ if( !root.nodeExists( reference.identity().toString() ) )
+ {
+ throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() );
+ }
+
+ Preferences entityPrefs = root.node( reference.identity().toString() );
+
+ String type = entityPrefs.get( "type", null );
+ EntityStatus status = EntityStatus.LOADED;
+
+ EntityDescriptor entityDescriptor = module.entityDescriptor( type );
+ if( entityDescriptor == null )
+ {
+ throw new NoSuchEntityTypeException( type, module.name(), module.typeLookup() );
+ }
+
+ Map<QualifiedName, Object> properties = new HashMap<>();
+ final Preferences propsPrefs = entityPrefs.node( "properties" );
+ entityDescriptor.state().properties().forEach(
+ persistentPropertyDescriptor ->
+ {
+ if( persistentPropertyDescriptor.qualifiedName().name().equals( "reference" ) )
+ {
+ // Fake reference property
+ properties.put( persistentPropertyDescriptor.qualifiedName(), reference.identity().toString() );
+ }
+ else
+ {
+ ValueType propertyType = persistentPropertyDescriptor.valueType();
+ Class<?> primaryType = propertyType.primaryType();
+ if( Number.class.isAssignableFrom( primaryType ) )
+ {
+ if( primaryType.equals( Long.class ) )
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ this.getNumber( propsPrefs, module, persistentPropertyDescriptor, LONG_PARSER ) );
+ }
+ else if( primaryType.equals( Integer.class ) )
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ this.getNumber( propsPrefs, module, persistentPropertyDescriptor, INT_PARSER ) );
+ }
+ else if( primaryType.equals( Double.class ) )
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ this.getNumber( propsPrefs, module, persistentPropertyDescriptor, DOUBLE_PARSER ) );
+ }
+ else if( primaryType.equals( Float.class ) )
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ this.getNumber( propsPrefs, module, persistentPropertyDescriptor, FLOAT_PARSER ) );
+ }
+ else
+ {
+ // Load as string even though it's a number
+ String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName()
+ .name(), null );
+ Object value;
+ if( json == null )
+ {
+ value = null;
+ }
+ else
+ {
+ value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
+ }
+ properties.put( persistentPropertyDescriptor.qualifiedName(), value );
+ }
+ }
+ else if( primaryType.equals( Boolean.class ) )
+ {
+ Boolean initialValue = (Boolean) persistentPropertyDescriptor.resolveInitialValue(module);
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ propsPrefs.getBoolean( persistentPropertyDescriptor.qualifiedName().name(),
+ initialValue == null ? false : initialValue ) );
+ }
+ else if( propertyType instanceof ValueCompositeType
+ || propertyType instanceof MapType
+ || propertyType instanceof CollectionType
+ || propertyType instanceof EnumType )
+ {
+ String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
+ Object value;
+ if( json == null )
+ {
+ value = null;
+ }
+ else
+ {
+ value = valueSerialization.deserialize( module, persistentPropertyDescriptor.valueType(), json );
+ }
+ properties.put( persistentPropertyDescriptor.qualifiedName(), value );
+ }
+ else
+ {
+ String json = propsPrefs.get( persistentPropertyDescriptor.qualifiedName().name(), null );
+ if( json == null )
+ {
+ if( persistentPropertyDescriptor.resolveInitialValue( module ) != null )
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(),
+ persistentPropertyDescriptor.resolveInitialValue( module ) );
+ }
+ else
+ {
+ properties.put( persistentPropertyDescriptor.qualifiedName(), null );
+ }
+ }
+ else
+ {
+ Object value = valueSerialization.deserialize( module, propertyType, json );
+ properties.put( persistentPropertyDescriptor.qualifiedName(), value );
+ }
+ }
+ }
+ } );
+
+ // Associations
+ Map<QualifiedName, EntityReference> associations = new HashMap<>();
+ final Preferences assocs = entityPrefs.node( "associations" );
+ entityDescriptor.state().associations().forEach( associationType -> {
+ String associatedEntity = assocs.get( associationType.qualifiedName().name(), null );
+ EntityReference value = associatedEntity == null
+ ? null
+ : EntityReference.parseEntityReference( associatedEntity );
+ associations.put( associationType.qualifiedName(), value );
+ } );
+
+ // ManyAssociations
+ Map<QualifiedName, List<EntityReference>> manyAssociations = new HashMap<>();
+ Preferences manyAssocs = entityPrefs.node( "manyassociations" );
+ entityDescriptor.state().manyAssociations().forEach( manyAssociationType -> {
+ List<EntityReference> references = new ArrayList<>();
+ String entityReferences = manyAssocs.get( manyAssociationType
+ .qualifiedName()
+ .name(), null );
+ if( entityReferences == null )
+ {
+ // ManyAssociation not found, default to empty one
+ manyAssociations.put( manyAssociationType.qualifiedName(), references );
+ }
+ else
+ {
+ String[] refs = entityReferences.split( "\n" );
+ for( String ref : refs )
+ {
+ EntityReference value = ref == null
+ ? null
+ : EntityReference.parseEntityReference( ref );
+ references.add( value );
+ }
+ manyAssociations.put( manyAssociationType.qualifiedName(), references );
+ }
+ } );
+
+ // NamedAssociations
+ Map<QualifiedName, Map<String, EntityReference>> namedAssociations = new HashMap<>();
+ Preferences namedAssocs = entityPrefs.node( "namedassociations" );
+ entityDescriptor.state().namedAssociations().forEach( namedAssociationType -> {
+ Map<String, EntityReference> references = new LinkedHashMap<>();
+ String entityReferences = namedAssocs.get( namedAssociationType.qualifiedName().name(), null );
+ if( entityReferences == null )
+ {
+ // NamedAssociation not found, default to empty one
+ namedAssociations.put( namedAssociationType.qualifiedName(), references );
+ }
+ else
+ {
+ String[] namedRefs = entityReferences.split( "\n" );
+ if( namedRefs.length % 2 != 0 )
+ {
+ throw new EntityStoreException( "Invalid NamedAssociation storage format" );
+ }
+ for( int idx = 0; idx < namedRefs.length; idx += 2 )
+ {
+ String name = namedRefs[ idx ];
+ String ref = namedRefs[ idx + 1 ];
+ references.put( name, EntityReference.parseEntityReference( ref ) );
+ }
+ namedAssociations.put( namedAssociationType.qualifiedName(), references );
+ }
+ } );
+
+ return new DefaultEntityState( entityPrefs.get( "version", "" ),
+ Instant.ofEpochMilli(entityPrefs.getLong( "modified", unitOfWork.currentTime().toEpochMilli() )),
+ reference,
+ status,
+ entityDescriptor,
+ properties,
+ associations,
+ manyAssociations,
+ namedAssociations
+ );
+ }
+ catch( ValueSerializationException | BackingStoreException e )
+ {
+ throw new EntityStoreException( e );
+ }
+ }
+
+ @Override
+ public String versionOf( EntityStoreUnitOfWork unitOfWork, EntityReference reference )
+ {
+ try
+ {
+ if( !root.nodeExists( reference.identity().toString() ) )
+ {
+ throw new NoSuchEntityException( reference, UnknownType.class, unitOfWork.usecase() );
+ }
+
+ Preferences entityPrefs = root.node( reference.identity().toString() );
+ return entityPrefs.get( "version", "" );
+ }
+ catch( BackingStoreException e )
+ {
+ throw new EntityStoreException( e );
+ }
+ }
+
+ @Override
+ public StateCommitter applyChanges( final EntityStoreUnitOfWork unitofwork, final Iterable<EntityState> state )
+ {
+ return new StateCommitter()
+ {
+ @SuppressWarnings( "SynchronizeOnNonFinalField" )
+ @Override
+ public void commit()
+ {
+ try
+ {
+ synchronized( root )
+ {
+ for( EntityState entityState : state )
+ {
+ DefaultEntityState state = (DefaultEntityState) entityState;
+ if( state.status().equals( EntityStatus.NEW ) )
+ {
+ Preferences entityPrefs = root.node( state.entityReference().identity().toString() );
+ writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() );
+ }
+ else if( state.status().equals( EntityStatus.UPDATED ) )
+ {
+ Preferences entityPrefs = root.node( state.entityReference().identity().toString() );
+ writeEntityState( state, entityPrefs, unitofwork.identity(), unitofwork.currentTime() );
+ }
+ else if( state.status().equals( EntityStatus.REMOVED ) )
+ {
+ root.node( state.entityReference().identity().toString() ).removeNode();
+ }
+ }
+ root.flush();
+ }
+ }
+ catch( BackingStoreException e )
+ {
+ throw new EntityStoreException( e );
+ }
+ }
+
+ @Override
+ public void cancel()
+ {
+ }
+ };
+ }
+
+ protected void writeEntityState( DefaultEntityState state,
+ Preferences entityPrefs,
+ Identity identity,
+ Instant lastModified
+ )
+ throws EntityStoreException
+ {
+ try
+ {
+ // Store into Preferences API
+ entityPrefs.put( "type", state.entityDescriptor().types().findFirst().get().getName() );
+ entityPrefs.put( "version", identity.toString() );
+ entityPrefs.putLong( "modified", lastModified.toEpochMilli() );
+
+ // Properties
+ Preferences propsPrefs = entityPrefs.node( "properties" );
+ state.entityDescriptor().state().properties()
+ .filter( property -> !property.qualifiedName().name().equals( "reference" ) )
+ .forEach( persistentProperty ->
+ {
+ Object value = state.properties().get( persistentProperty.qualifiedName() );
+
+ if( value == null )
+ {
+ propsPrefs.remove( persistentProperty.qualifiedName().name() );
+ }
+ else
+ {
+ ValueType valueType = persistentProperty.valueType();
+ Class<?> primaryType = valueType.primaryType();
+ if( Number.class.isAssignableFrom( primaryType ) )
+ {
+ if( primaryType.equals( Long.class ) )
+ {
+ propsPrefs.putLong( persistentProperty.qualifiedName().name(), (Long) value );
+ }
+ else if( primaryType.equals( Integer.class ) )
+ {
+ propsPrefs.putInt( persistentProperty.qualifiedName()
+ .name(), (Integer) value );
+ }
+ else if( primaryType.equals( Double.class ) )
+ {
+ propsPrefs.putDouble( persistentProperty.qualifiedName()
+ .name(), (Double) value );
+ }
+ else if( primaryType.equals( Float.class ) )
+ {
+ propsPrefs.putFloat( persistentProperty.qualifiedName()
+ .name(), (Float) value );
+ }
+ else
+ {
+ // Store as string even though it's a number
+ String jsonString = valueSerialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ }
+ }
+ else if( primaryType.equals( Boolean.class ) )
+ {
+ propsPrefs.putBoolean( persistentProperty.qualifiedName()
+ .name(), (Boolean) value );
+ }
+ else if( valueType instanceof ValueCompositeType
+ || valueType instanceof MapType
+ || valueType instanceof CollectionType
+ || valueType instanceof EnumType )
+ {
+ String jsonString = valueSerialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ }
+ else
+ {
+ String jsonString = valueSerialization.serialize( value );
+ propsPrefs.put( persistentProperty.qualifiedName().name(), jsonString );
+ }
+ }
+ } );
+
+ // Associations
+ if( !state.associations().isEmpty() )
+ {
+ Preferences assocsPrefs = entityPrefs.node( "associations" );
+ for( Map.Entry<QualifiedName, EntityReference> association : state.associations().entrySet() )
+ {
+ if( association.getValue() == null )
+ {
+ assocsPrefs.remove( association.getKey().name() );
+ }
+ else
+ {
+ assocsPrefs.put( association.getKey().name(), association.getValue().identity().toString() );
+ }
+ }
+ }
+
+ // ManyAssociations
+ if( !state.manyAssociations().isEmpty() )
+ {
+ Preferences manyAssocsPrefs = entityPrefs.node( "manyassociations" );
+ for( Map.Entry<QualifiedName, List<EntityReference>> manyAssociation : state.manyAssociations()
+ .entrySet() )
+ {
+ StringBuilder manyAssocs = new StringBuilder();
+ for( EntityReference entityReference : manyAssociation.getValue() )
+ {
+ if( manyAssocs.length() > 0 )
+ {
+ manyAssocs.append( "\n" );
+ }
+ manyAssocs.append( entityReference.identity().toString() );
+ }
+ if( manyAssocs.length() > 0 )
+ {
+ manyAssocsPrefs.put( manyAssociation.getKey().name(), manyAssocs.toString() );
+ }
+ }
+ }
+
+ // NamedAssociations
+ if( !state.namedAssociations().isEmpty() )
+ {
+ Preferences namedAssocsPrefs = entityPrefs.node( "namedassociations" );
+ for( Map.Entry<QualifiedName, Map<String, EntityReference>> namedAssociation : state.namedAssociations()
+ .entrySet() )
+ {
+ StringBuilder namedAssocs = new StringBuilder();
+ for( Map.Entry<String, EntityReference> namedRef : namedAssociation.getValue().entrySet() )
+ {
+ if( namedAssocs.length() > 0 )
+ {
+ namedAssocs.append( "\n" );
+ }
+ namedAssocs.append( namedRef.getKey() ).append( "\n" ).append( namedRef.getValue().identity().toString() );
+ }
+ if( namedAssocs.length() > 0 )
+ {
+ namedAssocsPrefs.put( namedAssociation.getKey().name(), namedAssocs.toString() );
+ }
+ }
+ }
+ }
+ catch( ValueSerializationException e )
+ {
+ throw new EntityStoreException( "Could not store EntityState", e );
+ }
+ }
+
+ protected Identity newUnitOfWorkId()
+ {
+ return identityGenerator.generate(EntityStore.class);
+ }
+
+ private interface NumberParser<T>
+ {
+ T parse( String str );
+ }
+
+ private static final NumberParser<Long> LONG_PARSER = Long::parseLong;
+
+ private static final NumberParser<Integer> INT_PARSER = Integer::parseInt;
+
+ private static final NumberParser<Double> DOUBLE_PARSER = Double::parseDouble;
+
+ private static final NumberParser<Float> FLOAT_PARSER = Float::parseFloat;
+
+ private <T> T getNumber( Preferences prefs, ModuleDescriptor module, PropertyDescriptor pDesc, NumberParser<T> parser )
+ {
+ Object initialValue = pDesc.resolveInitialValue( module );
+ String str = prefs.get( pDesc.qualifiedName().name(), initialValue == null ? null : initialValue.toString() );
+ T result = null;
+ if( str != null )
+ {
+ result = parser.parse( str );
+ }
+ return result;
+ }
+
+ private static class UnknownType
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreService.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreService.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreService.java
new file mode 100644
index 0000000..b66e2c7
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/PreferencesEntityStoreService.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+
+package org.apache.polygene.entitystore.preferences;
+
+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;
+
+/**
+ * EntityStore backed by Preferences API.
+ * <p>
+ * A root node is created in the System preferences, whose name
+ * is the same as the Application name (default:"Application").
+ * </p>
+ * <p>
+ * Each entity is stored under its identity name.
+ * </p>
+ * <p>
+ * Property types are converted to native Preferences API types
+ * as much as possible. All others will be serialized to a string using JSON.
+ * </p>
+ * <p>
+ * Associations are stored as the identity of the referenced Entity, ManyAssociations are stored as multi-line strings
+ * (one reference per line), and NamedAssociations are stored as multi-line strings (one name on a line, reference on the
+ * next line).
+ * </p>
+ * <p>
+ * The main use of the EntityStore is for storage of ConfigurationComposites for ServiceComposites.
+ * </p>
+ * @see org.apache.polygene.api.service.ServiceComposite
+ * @see org.apache.polygene.api.configuration.Configuration
+ */
+@Concerns( ConcurrentModificationCheckConcern.class )
+@Mixins( PreferencesEntityStoreMixin.class )
+public interface PreferencesEntityStoreService
+ extends EntityStore, ServiceComposite, EntityStateVersions, ServiceActivation
+{
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/PreferencesEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/PreferencesEntityStoreAssembler.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/PreferencesEntityStoreAssembler.java
new file mode 100644
index 0000000..53ea9de
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/PreferencesEntityStoreAssembler.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.preferences.assembly;
+
+import java.util.prefs.Preferences;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.bootstrap.ServiceDeclaration;
+import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreInfo;
+import org.apache.polygene.entitystore.preferences.PreferencesEntityStoreService;
+
+public class PreferencesEntityStoreAssembler
+ extends Assemblers.VisibilityIdentityConfig<PreferencesEntityStoreAssembler>
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ String applicationName = module.layer().application().name();
+
+ Preferences root = Preferences.userRoot();
+ Preferences node = root.node( applicationName );
+ PreferencesEntityStoreInfo info = new PreferencesEntityStoreInfo( node );
+ ServiceDeclaration service = module.services( PreferencesEntityStoreService.class )
+ .setMetaInfo( info )
+ .visibleIn( visibility() )
+ .instantiateOnStartup();
+ if( hasIdentity() )
+ {
+ service.identifiedBy( identity() );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/package.html
new file mode 100644
index 0000000..564de79
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/assembly/package.html
@@ -0,0 +1,24 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ ~
+ -->
+<html>
+ <body>
+ <h2>Preferences EntityStore Assembly.</h2>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/package.html
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/package.html b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/package.html
new file mode 100644
index 0000000..8e39337
--- /dev/null
+++ b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/preferences/package.html
@@ -0,0 +1,24 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ ~
+ ~
+ -->
+<html>
+ <body>
+ <h2>Preferences EntityStore.</h2>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/ListPreferencesNodes.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/ListPreferencesNodes.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/ListPreferencesNodes.java
deleted file mode 100644
index 35c3418..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/ListPreferencesNodes.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.prefs;
-
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
-
-public class ListPreferencesNodes
-{
- public static void main( String[] args )
- throws Exception
- {
- Preferences preferences = Preferences.userRoot();
- printNode( preferences, "" );
- }
-
- private static void printNode( Preferences node, String indent )
- throws BackingStoreException
- {
- System.out.print( indent );
- String name = node.name();
- if( "".equals( name ) )
- {
- name = "/";
- }
-
- System.out.print( name );
- String[] nodes = node.keys();
- if( nodes.length > 0 )
- {
- System.out.print( " { " );
- boolean first = true;
- for( String key : nodes )
- {
- if( !first )
- {
- System.out.print( ", " );
- }
- first = false;
- System.out.print( key );
- }
- System.out.print( " }" );
- }
- System.out.println();
- for( String childName : node.childrenNames() )
- {
- Preferences child = node.node( childName );
- printNode( child, indent + " " );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b8aea70a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreInfo.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreInfo.java b/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreInfo.java
deleted file mode 100644
index 9574844..0000000
--- a/extensions/entitystore-preferences/src/main/java/org/apache/polygene/entitystore/prefs/PreferencesEntityStoreInfo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.prefs;
-
-import java.io.Serializable;
-import java.util.prefs.Preferences;
-
-/**
- * @author edward.yakop@gmail.com
- */
-public final class PreferencesEntityStoreInfo
- implements Serializable
-{
- private Preferences rootNode;
-
- public PreferencesEntityStoreInfo( Preferences aRootNode )
- {
- rootNode = aRootNode;
- }
-
- /**
- * @return root preference node to use.
- */
- public Preferences rootNode()
- {
- return rootNode;
- }
-}
\ No newline at end of file