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:36 UTC
[3/3] polygene-java git commit: Fixed Serialization missing in
RdfIndexingAssembler,
causing failed tests. Fixed additional issues in Yeoman generator.
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