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/04/11 12:11:02 UTC
[1/5] polygene-java git commit: Updating devstatus in many
subprojects.
Repository: polygene-java
Updated Branches:
refs/heads/develop 8e2a2da3e -> 118bb06de
Updating devstatus in many subprojects.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/e8ba5cb4
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/e8ba5cb4
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/e8ba5cb4
Branch: refs/heads/develop
Commit: e8ba5cb48542f2c8e72556add277640e5621e4ca
Parents: 8e2a2da
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 11 19:21:31 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 11 19:21:31 2017 +0800
----------------------------------------------------------------------
extensions/entitystore-geode/dev-status.xml | 2 +-
extensions/entitystore-leveldb/dev-status.xml | 2 +-
extensions/entitystore-redis/dev-status.xml | 2 +-
extensions/entitystore-riak/dev-status.xml | 2 +-
extensions/indexing-solr/dev-status.xml | 2 +-
extensions/serialization-javaxjson/dev-status.xml | 2 +-
extensions/serialization-javaxxml/dev-status.xml | 4 ++--
extensions/serialization-messagepack/dev-status.xml | 6 +++---
libraries/restlet/dev-status.xml | 2 +-
9 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/entitystore-geode/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-geode/dev-status.xml b/extensions/entitystore-geode/dev-status.xml
index c79727f..762e250 100644
--- a/extensions/entitystore-geode/dev-status.xml
+++ b/extensions/entitystore-geode/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
+ <codebase>stable</codebase>
<!-- none, brief, good, complete -->
<documentation>brief</documentation>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/entitystore-leveldb/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/dev-status.xml b/extensions/entitystore-leveldb/dev-status.xml
index c79727f..762e250 100644
--- a/extensions/entitystore-leveldb/dev-status.xml
+++ b/extensions/entitystore-leveldb/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
+ <codebase>stable</codebase>
<!-- none, brief, good, complete -->
<documentation>brief</documentation>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/entitystore-redis/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/dev-status.xml b/extensions/entitystore-redis/dev-status.xml
index 273df00..8d582e2 100644
--- a/extensions/entitystore-redis/dev-status.xml
+++ b/extensions/entitystore-redis/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
+ <codebase>stable</codebase>
<!-- none, brief, good, complete -->
<documentation>good</documentation>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/entitystore-riak/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/dev-status.xml b/extensions/entitystore-riak/dev-status.xml
index 273df00..8d582e2 100644
--- a/extensions/entitystore-riak/dev-status.xml
+++ b/extensions/entitystore-riak/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
+ <codebase>stable</codebase>
<!-- none, brief, good, complete -->
<documentation>good</documentation>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/indexing-solr/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/dev-status.xml b/extensions/indexing-solr/dev-status.xml
index 7299a21..e6cf5af 100644
--- a/extensions/indexing-solr/dev-status.xml
+++ b/extensions/indexing-solr/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>stable</codebase>
+ <codebase>beta</codebase>
<!-- none, brief, good, complete -->
<documentation>brief</documentation>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/serialization-javaxjson/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/serialization-javaxjson/dev-status.xml b/extensions/serialization-javaxjson/dev-status.xml
index 0d777be..a36ce79 100644
--- a/extensions/serialization-javaxjson/dev-status.xml
+++ b/extensions/serialization-javaxjson/dev-status.xml
@@ -27,7 +27,7 @@
<codebase>beta</codebase>
<!-- none, brief, good, complete -->
- <documentation>none</documentation>
+ <documentation>brief</documentation>
<!-- none, some, good, complete -->
<unittests>good</unittests>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/serialization-javaxxml/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/serialization-javaxxml/dev-status.xml b/extensions/serialization-javaxxml/dev-status.xml
index 81841be..a36ce79 100644
--- a/extensions/serialization-javaxxml/dev-status.xml
+++ b/extensions/serialization-javaxxml/dev-status.xml
@@ -24,10 +24,10 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>early</codebase>
+ <codebase>beta</codebase>
<!-- none, brief, good, complete -->
- <documentation>none</documentation>
+ <documentation>brief</documentation>
<!-- none, some, good, complete -->
<unittests>good</unittests>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/extensions/serialization-messagepack/dev-status.xml
----------------------------------------------------------------------
diff --git a/extensions/serialization-messagepack/dev-status.xml b/extensions/serialization-messagepack/dev-status.xml
index 8086fb0..a36ce79 100644
--- a/extensions/serialization-messagepack/dev-status.xml
+++ b/extensions/serialization-messagepack/dev-status.xml
@@ -24,13 +24,13 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>early</codebase>
+ <codebase>beta</codebase>
<!-- none, brief, good, complete -->
- <documentation>none</documentation>
+ <documentation>brief</documentation>
<!-- none, some, good, complete -->
- <unittests>some</unittests>
+ <unittests>good</unittests>
</status>
<licenses>
<license>ALv2</license>
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/e8ba5cb4/libraries/restlet/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/restlet/dev-status.xml b/libraries/restlet/dev-status.xml
index c581dfc..66babc6 100644
--- a/libraries/restlet/dev-status.xml
+++ b/libraries/restlet/dev-status.xml
@@ -24,7 +24,7 @@
http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
<status>
<!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
+ <codebase>stable</codebase>
<!-- none, brief, good, complete -->
<documentation>brief</documentation>
[5/5] polygene-java git commit: POLYGENE-45 : Clean up
Posted by ni...@apache.org.
POLYGENE-45 : Clean up
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/118bb06d
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/118bb06d
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/118bb06d
Branch: refs/heads/develop
Commit: 118bb06de92128c2d7f281de7d210f17f61c73c7
Parents: d7fc306
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 11 20:07:28 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 11 20:07:28 2017 +0800
----------------------------------------------------------------------
.../runtime/composite/MapOverrideTest.java | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/118bb06d/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
index 06fc1e4..bfd908a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/composite/MapOverrideTest.java
@@ -44,7 +44,7 @@ import static org.junit.Assert.assertThat;
* Note that keySet(), values() and entrySet() would ALSO require overloading, but this has been left out for
* clarity reasons.
*/
-@Ignore( "Awaiting QI-298" )
+@Ignore( "Awaiting QI-298 - Allow Transients to be declared by classes" )
public class MapOverrideTest
extends AbstractPolygeneTest
{
@@ -118,9 +118,9 @@ public class MapOverrideTest
}
@Test
- @Ignore
public void givenReadOnlyAnnotatedHashMapWhenCallingEntrySetExpectSuccess()
{
+ // TODO
}
@Test
@@ -136,35 +136,30 @@ public class MapOverrideTest
}
@Test( expected = ReadOnlyException.class )
- @Ignore
public void givenReadOnlyAnnotatedHashMapWhenCallingPutExpectReadOnlyException()
{
-
+ // TODO
}
@Test( expected = ReadOnlyException.class )
- @Ignore
public void givenReadOnlyAnnotatedHashMapWhenCallingRemoveExpectReadOnlyException()
{
-
+ // TODO
}
@Test( expected = ReadOnlyException.class )
- @Ignore
public void givenReadOnlyAnnotatedHashMapWhenCallingPutAllExpectReadOnlyException()
{
-
+ // TODO
}
@Test( expected = ReadOnlyException.class )
- @Ignore
public void givenReadOnlyAnnotatedHashMapWhenCallingClearExpectReadOnlyException()
{
-
+ // TODO
}
- public static abstract class ReadOnlyMapConcern
- extends ConcernOf<Map>
+ public static abstract class ReadOnlyMapConcern extends ConcernOf<Map>
implements Map
{
@Invocation
[3/5] polygene-java git commit: POLYGENE-222 : Re-instate some
requirement for "extends ValueComposite" which is required to do the right
thing in indexing-sql. For some reason that is not needed in indexing-rdf and
indexing-elasticsearch, so it should p
Posted by ni...@apache.org.
POLYGENE-222 : Re-instate some requirement for "extends ValueComposite" which is required to do the right thing in indexing-sql. For some reason that is not needed in indexing-rdf and indexing-elasticsearch, so it should probably be investigated further. I should probably also try to fail the query that tries to use non-ValueComposites in query expressions. So, I will keep the issue open and just change the target for 3.1
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/a6fb0cd6
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/a6fb0cd6
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/a6fb0cd6
Branch: refs/heads/develop
Commit: a6fb0cd6c395beb999412a5ad3316e50fff98007
Parents: e8ba5cb
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 11 20:02:56 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 11 20:02:56 2017 +0800
----------------------------------------------------------------------
.../runtime/entity/EntityMixinsModel.java | 9 +-
.../runtime/injection/InjectedMethodsModel.java | 2 +
.../test/indexing/AbstractQueryTest.java | 2 +-
.../org/apache/polygene/test/model/Domain.java | 1 +
.../org/apache/polygene/test/model/Host.java | 3 +-
.../apache/polygene/test/model/Protocol.java | 3 +-
.../org/apache/polygene/test/model/URL.java | 3 +-
.../sql/PostgreSQLEntityStoreTest.java | 4 +-
.../support/skeletons/AbstractSQLStartup.java | 887 +++++++++----------
.../skeletons/SQLCompatEntityStateWrapper.java | 3 +-
.../sql/postgresql/PostgreSQLQueryTest.java | 4 +-
.../library/scripting/SimpleSpeaker.groovy | 26 +
12 files changed, 490 insertions(+), 457 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
index 6993b6f..566557b 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/entity/EntityMixinsModel.java
@@ -40,7 +40,7 @@ import org.apache.polygene.runtime.model.Resolution;
public final class EntityMixinsModel
extends MixinsModel
{
- List<Integer> lifecycleMixins;
+ private List<Integer> lifecycleMixins;
@Override
public void bind( Resolution resolution )
@@ -52,11 +52,12 @@ public final class EntityMixinsModel
for( int i = 0; i < mixinModels.size(); i++ )
{
MixinModel mixinModel = mixinModels.get( i );
+
if( Lifecycle.class.isAssignableFrom( mixinModel.mixinClass() ) )
{
if( lifecycleMixins == null )
{
- lifecycleMixins = new ArrayList<Integer>();
+ lifecycleMixins = new ArrayList<>();
}
lifecycleMixins.add( i );
@@ -64,7 +65,7 @@ public final class EntityMixinsModel
}
}
- public Object newMixin( EntityInstance entityInstance, StateHolder state, Object[] mixins, Method method )
+ Object newMixin( EntityInstance entityInstance, StateHolder state, Object[] mixins, Method method )
{
MixinModel model = methodImplementation.get( method );
InjectionContext injectionContext = new InjectionContext( entityInstance, UsesInstance.EMPTY_USES, state );
@@ -73,7 +74,7 @@ public final class EntityMixinsModel
return mixin;
}
- public void invokeLifecycle( boolean create, Object[] mixins, CompositeInstance instance, StateHolder state )
+ void invokeLifecycle( boolean create, Object[] mixins, CompositeInstance instance, StateHolder state )
{
if( lifecycleMixins != null )
{
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
index 388a17b..b2d4c89 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/injection/InjectedMethodsModel.java
@@ -29,6 +29,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
+import javax.annotation.PostConstruct;
import org.apache.polygene.api.injection.InjectionScope;
import org.apache.polygene.api.util.Classes;
import org.apache.polygene.api.util.Methods;
@@ -96,6 +97,7 @@ public final class InjectedMethodsModel
} );
}
+ @PostConstruct
private Type createParameterizedTypeInstance( ParameterizedType genericType )
{
return new ParameterizedTypeInstance(
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java
index 24fb780..f005398 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/indexing/AbstractQueryTest.java
@@ -432,7 +432,7 @@ public abstract class AbstractQueryTest
{
QueryBuilder<Person> qb = this.moduleInstance.newQueryBuilder( Person.class );
Person person = templateFor( Person.class );
- QueryParam queryParam = null; // oneOf( person.personalWebsite().get().queryParams() );
+ QueryParam queryParam = null; //oneOf( person.personalWebsite().get().queryParams() );
Query<Person> query = unitOfWork.newQuery( qb.where( and( eq( queryParam.name(), "foo" ), eq( queryParam.value(), "bar" ) ) ) );
System.out.println( "*** script30: " + query );
verifyUnorderedResults( query, "Jack Doe" );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/testsupport/src/main/java/org/apache/polygene/test/model/Domain.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/model/Domain.java b/core/testsupport/src/main/java/org/apache/polygene/test/model/Domain.java
index 09536d5..d157f56 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/model/Domain.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/model/Domain.java
@@ -20,6 +20,7 @@
package org.apache.polygene.test.model;
import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueComposite;
/**
* JAVADOC Add JavaDoc
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/testsupport/src/main/java/org/apache/polygene/test/model/Host.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/model/Host.java b/core/testsupport/src/main/java/org/apache/polygene/test/model/Host.java
index cf9b428..1da358d 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/model/Host.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/model/Host.java
@@ -20,11 +20,12 @@
package org.apache.polygene.test.model;
import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueComposite;
/**
* JAVADOC Add JavaDoc.
*/
-public interface Host
+public interface Host extends ValueComposite
{
Property<String> value();
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/testsupport/src/main/java/org/apache/polygene/test/model/Protocol.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/model/Protocol.java b/core/testsupport/src/main/java/org/apache/polygene/test/model/Protocol.java
index 3466c9c..d05c6db 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/model/Protocol.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/model/Protocol.java
@@ -20,11 +20,12 @@
package org.apache.polygene.test.model;
import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueComposite;
/**
* JAVADOC Add JavaDoc.
*/
-public interface Protocol
+public interface Protocol extends ValueComposite
{
Property<String> value();
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/core/testsupport/src/main/java/org/apache/polygene/test/model/URL.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/model/URL.java b/core/testsupport/src/main/java/org/apache/polygene/test/model/URL.java
index dfc5e10..e30e565 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/model/URL.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/model/URL.java
@@ -23,11 +23,12 @@ import java.util.Collection;
import org.apache.polygene.api.common.Optional;
import org.apache.polygene.api.entity.Queryable;
import org.apache.polygene.api.property.Property;
+import org.apache.polygene.api.value.ValueComposite;
/**
* JAVADOC Add JavaDoc.
*/
-public interface URL
+public interface URL extends ValueComposite
{
Property<Protocol> protocol();
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
index 18b347c..1da7b58 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
@@ -77,7 +77,9 @@ public class PostgreSQLEntityStoreTest
extends AbstractEntityStoreTest
{
@ClassRule
- public static final DockerRule DOCKER = new DockerRule( "postgres", 3000L, "PostgreSQL init process complete; ready for start up." );
+ public static final DockerRule DOCKER = new DockerRule( "postgres",
+ 3000L,
+ "PostgreSQL init process complete; ready for start up." );
@Override
// START SNIPPET: assembly
[4/5] polygene-java git commit: POLYGENE-45 : The plugin proposal
that this test is trying to verify disappeared years ago,
and we might re-visit "plugin patterns" later.
Posted by ni...@apache.org.
POLYGENE-45 : The plugin proposal that this test is trying to verify disappeared years ago, and we might re-visit "plugin patterns" later.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/d7fc3065
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/d7fc3065
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/d7fc3065
Branch: refs/heads/develop
Commit: d7fc306584c1e42311c6ff09f6174942e89afb39
Parents: a6fb0cd
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 11 20:04:14 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 11 20:04:14 2017 +0800
----------------------------------------------------------------------
.../apache/polygene/api/common/PluginTest.java | 368 -------------------
1 file changed, 368 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d7fc3065/core/runtime/src/test/java/org/apache/polygene/api/common/PluginTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/api/common/PluginTest.java b/core/runtime/src/test/java/org/apache/polygene/api/common/PluginTest.java
deleted file mode 100644
index dcab32f..0000000
--- a/core/runtime/src/test/java/org/apache/polygene/api/common/PluginTest.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-
-package org.apache.polygene.api.common;
-
-import java.lang.reflect.Proxy;
-import java.time.Instant;
-import java.util.Collections;
-import java.util.List;
-import org.apache.polygene.api.injection.scope.Service;
-import org.apache.polygene.api.injection.scope.Structure;
-import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.service.ImportedServiceDescriptor;
-import org.apache.polygene.api.service.ServiceActivation;
-import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.api.service.ServiceFinder;
-import org.apache.polygene.api.service.ServiceImporter;
-import org.apache.polygene.api.service.ServiceImporterException;
-import org.apache.polygene.api.service.ServiceReference;
-import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.api.time.SystemTime;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.bootstrap.LayerAssembly;
-import org.apache.polygene.bootstrap.LayerName;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.ModuleName;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Sample of how a plugin architecture could work.
- * The plugins can use services in the main application and the main
- * application can use services from the plugins
- */
-public class PluginTest
-{
- @Test
- @Ignore( "Must fix the TODOs below. This example relied on ability to set Service MetaInfo at runtime, it seems it's not possible anymore." )
- public void testPlugins()
- throws Exception
- {
- Energy4Java runtime = new Energy4Java();
- Application app = runtime.newApplication( new MainApplicationAssembler() );
- app.activate();
- }
-
- // Main application
-
- class MainApplicationAssembler
- implements ApplicationAssembler
- {
- public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
- throws AssemblyException
- {
- return applicationFactory.newApplicationAssembly( new Assembler[][][]
- {
- {
- {
- new PluginAssembler(),
- new UIAssembler(),
- }
- },
- {
- {
- new ServiceAssembler()
- }
- }
- } );
- }
- }
-
- // The UI uses the plugins
-
- class UIAssembler
- implements Assembler
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( PluginTesterService.class ).instantiateOnStartup();
- module.importedServices( Plugin.class )
- .importedBy( ServiceFinderImporter.class )
- .visibleIn( Visibility.layer );
- }
- }
-
- // Get a reference to a plugin and use it
-
- @Mixins( PluginTesterService.PluginTesterMixin.class )
- interface PluginTesterService
- extends ServiceActivation, ServiceComposite
- {
- class PluginTesterMixin
- implements ServiceActivation
- {
- @Service
- Plugin plugin;
-
- @Service
- PluginsService plugins;
-
- public void activateService()
- throws Exception
- {
- // Use plugin
- System.out.println( plugin.say( "Hello", "World" ) );
-
- // Restart plugin
- plugins.passivateService();
-
- // Plugin is now unavailable
- try
- {
- System.out.println( plugin.say( "Hello", "World" ) );
- }
- catch( ServiceImporterException e )
- {
- // Ignore
- }
-
- plugins.activateService();
-
- // Use plugin
- System.out.println( plugin.say( "Hello", "World" ) );
- }
-
- public void passivateService()
- throws Exception
- {
- }
- }
- }
-
- // Assemble the base service that the plugin can use
-
- class ServiceAssembler
- implements Assembler
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( HelloWorldService.class ).visibleIn( Visibility.application );
- }
- }
-
- // Plugins can access service instances with this interface
-
- interface HelloWorld
- {
- String say( String phrase, String name );
- }
-
- // Implementation of service that the plugin can use
-
- @Mixins( HelloWorldService.HelloWorldMixin.class )
- interface HelloWorldService
- extends HelloWorld, ServiceComposite
- {
- class HelloWorldMixin
- implements HelloWorld
- {
- public String say( String phrase, String name )
- {
- return phrase + " " + name;
- }
- }
- }
-
- // Assemble the plugins module
-
- class PluginAssembler
- implements Assembler
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( PluginsService.class ).instantiateOnStartup();
- }
- }
-
-// Plugin service
-// This assembles and activates a separate application for the plugins
-// The plugins can look up services in the host application and the
-
- // plugins can be looked up by the host application
-
- @Mixins( PluginsService.PluginsMixin.class )
- interface PluginsService
- extends ServiceComposite, ServiceActivation
- {
- class PluginsMixin
- implements ServiceActivation
- {
- @Structure
- ServiceFinder finder;
- @Service
- ServiceReference<Plugin> plugin;
- private Application app;
-
- public void activateService()
- throws Exception
- {
- Energy4Java runtime = new Energy4Java();
- app = runtime.newApplication( new PluginApplicationAssembler( finder ) );
-
- app.activate();
- ServiceFinder pluginFinder = app.findModule( "Plugin layer", "Plugin module" );
-
- // TODO: Niclas wrote: No clue how all this Test is supposed to work, and can't figure out to create a workaround for this.
-// finder.findService(Plugin.class).metaInfo().add(ServiceFinder.class, pluginFinder);
- }
-
- public void passivateService()
- throws Exception
- {
- // TODO: Niclas wrote: No clue how all this Test is supposed to work, and can't figure out to create a workaround for this.
-// plugin.metaInfo().remove(ServiceFinder.class);
-
- app.passivate();
- }
- }
- }
-
- // Assemble the plugin application
-
- public static class PluginApplicationAssembler
- implements ApplicationAssembler
- {
- private ServiceFinder finder;
-
- public PluginApplicationAssembler( ServiceFinder finder )
- {
- this.finder = finder;
- }
-
- public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
- throws AssemblyException
- {
- return applicationFactory.newApplicationAssembly( new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- new LayerName( "Plugin layer" ).assemble( module );
- new ModuleName( "Plugin module" ).assemble( module );
-
- LayerAssembly layer = module.layer();
-
- // In a real case you would "detect" the plugins somehow. Here the plugin assembler is hardcoded
- List<Assembler> pluginAssemblers = Collections.singletonList( new SimonAssembler() );
-
- for( int i = 0; i < pluginAssemblers.size(); i++ )
- {
- ModuleAssembly pluginModule = layer.module( "Plugin " + ( i + 1 ) );
- Assembler assembler = pluginAssemblers.get( i );
- assembler.assemble( pluginModule );
- }
-
- // Import host services
- module.importedServices( HelloWorld.class )
- .importedBy( ServiceFinderImporter.class )
- .setMetaInfo( finder )
- .visibleIn( Visibility.layer );
- }
- } );
- }
- }
-
- // Service importer that uses a ServiceFinder
-
- public static class ServiceFinderImporter
- implements ServiceImporter
- {
- public Object importService( final ImportedServiceDescriptor serviceDescriptor )
- throws ServiceImporterException
- {
- final Class<?> mainType = serviceDescriptor.types().findFirst().orElse(null);
-
- Class[] interfaces = serviceDescriptor.types().toArray( Class[]::new );
- return Proxy.newProxyInstance(
- mainType.getClassLoader(),
- interfaces,
- ( proxy, method, args ) -> {
- ServiceFinder finder = serviceDescriptor.metaInfo( ServiceFinder.class );
- if( finder == null )
- {
- throw new ServiceImporterException( "No ServiceFinder specified for imported service " + serviceDescriptor
- .identity() );
- }
- Object service = finder.findService( mainType ).get();
- return method.invoke( service, args );
- } );
- }
-
- public boolean isAvailable( Object instance )
- {
- return true;
- }
- }
-
-// The plugin interface. Plugins should implement this, and they can then
-
- // be looked up by the host application
-
- interface Plugin
- {
- String say( String phrase, String name );
- }
-
- // Assemble a sample plugin
-
- public static class SimonAssembler
- implements Assembler
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( SimonSaysPlugin.class ).visibleIn( Visibility.layer );
- }
- }
-
- // Test implementation of the plugin interface
-
- @Mixins( SimonSaysPlugin.SimonSaysMixin.class )
- interface SimonSaysPlugin
- extends Plugin, ServiceComposite
- {
- class SimonSaysMixin
- implements Plugin
- {
- @Service
- HelloWorld helloWorld;
- private Instant time;
-
- public SimonSaysMixin()
- {
- time = SystemTime.now();
- }
-
- public String say( String phrase, String name )
- {
- return "Simon says:" + helloWorld.say( phrase, name ) + " (plugin started at:" + time + ")";
- }
- }
- }
-}
[2/5] polygene-java git commit: POLYGENE-222 : Re-instate some
requirement for "extends ValueComposite" which is required to do the right
thing in indexing-sql. For some reason that is not needed in indexing-rdf and
indexing-elasticsearch, so it should p
Posted by ni...@apache.org.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLStartup.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLStartup.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLStartup.java
index b41c41a..1df5642 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLStartup.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLStartup.java
@@ -48,6 +48,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import org.apache.polygene.api.common.Optional;
import org.apache.polygene.api.common.QualifiedName;
@@ -230,45 +231,45 @@ public abstract class AbstractSQLStartup
for( Map.Entry<QualifiedName, QNameInfo> entry : _state.qNameInfos().get().entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
report.append( "entityUsedQNames:" ).append( newline );
for( Map.Entry<EntityDescriptor, Set<QualifiedName>> entry : _state.entityUsedQNames()
- .get()
- .entrySet() )
+ .get()
+ .entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
report.append( "usedClassesPKs:" ).append( newline );
for( Map.Entry<CompositeDescriptor, Integer> entry : _state.usedClassesPKs().get()
- .entrySet() )
+ .entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
report.append( "javaTypes2SQLTypes:" ).append( newline );
for( Map.Entry<Class<?>, Integer> entry : _state.javaTypes2SQLTypes().get().entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
report.append( "entityTypePKs:" ).append( newline );
for( Map.Entry<String, Integer> entry : _state.entityTypePKs().get().entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
report.append( "enumPKs:" ).append( newline );
for( Map.Entry<String, Integer> entry : _state.enumPKs().get().entrySet() )
{
report.append( tab ).append( entry.getKey() ).append( colonspace )
- .append( entry.getValue() ).append( newline );
+ .append( entry.getValue() ).append( newline );
}
LOGGER.debug( "SQLDBState after initConnection:\n{}", report.toString() );
@@ -312,8 +313,8 @@ public abstract class AbstractSQLStartup
jdbcTypes.put( LocalTime.class, Types.TIME );
jdbcTypes.put( ZonedDateTime.class, Types.TIMESTAMP_WITH_TIMEZONE );
jdbcTypes.put( OffsetDateTime.class, Types.TIMESTAMP_WITH_TIMEZONE );
- jdbcTypes.put( Duration.class, Types.VARCHAR);
- jdbcTypes.put( Period.class, Types.VARCHAR);
+ jdbcTypes.put( Duration.class, Types.VARCHAR );
+ jdbcTypes.put( Period.class, Types.VARCHAR );
jdbcTypes.put( Character.class, Types.INTEGER );
jdbcTypes.put( String.class, Types.VARCHAR );
jdbcTypes.put( BigInteger.class, Types.NUMERIC );
@@ -324,15 +325,15 @@ public abstract class AbstractSQLStartup
this._customizableTypes.put(
String.class,
( propertyType, sqlTypeInfo ) -> _vendor.getDataTypeFactory().sqlVarChar( sqlTypeInfo.maxLength() )
- );
+ );
this._customizableTypes.put(
BigInteger.class,
( propertyType, sqlTypeInfo ) -> _vendor.getDataTypeFactory().decimal( sqlTypeInfo.maxLength() )
- );
+ );
this._customizableTypes.put(
BigDecimal.class,
( propertyType, sqlTypeInfo ) -> _vendor.getDataTypeFactory().decimal( sqlTypeInfo.maxLength() )
- );
+ );
}
protected void checkSchemaName( String schemaName )
@@ -352,7 +353,6 @@ public abstract class AbstractSQLStartup
private final Set<CompositeDescriptorInfo> usedValueComposites = new HashSet<>();
private final Set<String> enumValues = new HashSet<>();
-
}
private static class CompositeDescriptorInfo
@@ -374,7 +374,7 @@ public abstract class AbstractSQLStartup
{
return this == obj
|| ( obj instanceof CompositeDescriptorInfo && this.composite
- .equals( ( (CompositeDescriptorInfo) obj ).composite ) );
+ .equals( ( (CompositeDescriptorInfo) obj ).composite ) );
}
@Override
@@ -463,11 +463,11 @@ public abstract class AbstractSQLStartup
stmt.execute(
vendor.toString(
d
- .createSchemaDefinitionBuilder()
- .setSchemaName( schemaName )
- .createExpression()
- )
- );
+ .createSchemaDefinitionBuilder()
+ .setSchemaName( schemaName )
+ .createExpression()
+ )
+ );
LOGGER.debug( "Database schema created" );
}
@@ -477,236 +477,236 @@ public abstract class AbstractSQLStartup
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( USED_CLASSES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( Integer.class ), false ) )
- .addTableElement( d.createColumnDefinition( USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( USED_CLASSES_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.UNIQUE )
- .addColumns( USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( USED_CLASSES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( Integer.class ), false ) )
+ .addTableElement( d.createColumnDefinition( USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( USED_CLASSES_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.UNIQUE )
+ .addColumns( USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
tablePKs.put( USED_CLASSES_TABLE_NAME, 0L );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_TYPE_PK_TYPE ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.UNIQUE )
- .addColumns( ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( ENTITY_TYPE_PK_TYPE ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.UNIQUE )
+ .addColumns( ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
tablePKs.put( ENTITY_TYPES_TABLE_NAME, 0L );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false, AutoGenerationPolicy.BY_DEFAULT ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_IDENTITY_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_MODIFIED_COLUMN_NAME, this._primitiveTypes
- .get( Instant.class ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_VERSION_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_APPLICATION_VERSION_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.UNIQUE )
- .addColumns( ENTITY_TABLE_IDENTITY_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( ENTITY_PK_TYPE ), false, AutoGenerationPolicy.BY_DEFAULT ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_IDENTITY_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_MODIFIED_COLUMN_NAME, this._primitiveTypes
+ .get( Instant.class ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_VERSION_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_APPLICATION_VERSION_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.UNIQUE )
+ .addColumns( ENTITY_TABLE_IDENTITY_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
tablePKs.put( ENTITY_TABLE_NAME, 0L );
stmt.execute(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, ENTITY_TYPES_JOIN_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_TYPE_PK_TYPE ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ENTITY_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
- .addSourceColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
- .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .setOnDelete( ReferentialAction.CASCADE )
- .setOnUpdate( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
- ) )
- .addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
- .addSourceColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
- .addTargetColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
- .setOnDelete( ReferentialAction.RESTRICT )
- .setOnDelete( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.NOT_DEFERRABLE ) )
- .createExpression()
- ).createExpression()
- .toString()
- );
+ .setTableName( t.tableName( schemaName, ENTITY_TYPES_JOIN_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( ENTITY_PK_TYPE ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( ENTITY_TYPE_PK_TYPE ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ENTITY_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
+ .addSourceColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
+ .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+ ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
+ .addSourceColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
+ .addTargetColumns( ENTITY_TYPES_TABLE_PK_COLUMN_NAME )
+ .setOnDelete( ReferentialAction.RESTRICT )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.NOT_DEFERRABLE ) )
+ .createExpression()
+ ).createExpression()
+ .toString()
+ );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( Integer.class ), false ) )
- .addTableElement( d.createColumnDefinition( ENUM_LOOKUP_TABLE_ENUM_VALUE_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( Integer.class ), false ) )
+ .addTableElement( d.createColumnDefinition( ENUM_LOOKUP_TABLE_ENUM_VALUE_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
tablePKs.put( ENUM_LOOKUP_TABLE_NAME, 0L );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createColumnDefinition( USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createColumnDefinition( USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( ALL_QNAMES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( Integer.class ), false ) )
- .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false ) )
- .addTableElement( d.createTableConstraintDefinition(
- d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .addTableElement( d.createTableConstraintDefinition(
- d.createForeignKeyConstraintBuilder()
- .addSourceColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
- .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .setOnUpdate( ReferentialAction.CASCADE )
- .setOnDelete( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( ALL_QNAMES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( Integer.class ), false ) )
+ .addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
+ .get( ENTITY_PK_TYPE ), false ) )
+ .addTableElement( d.createTableConstraintDefinition(
+ d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .addTableElement( d.createTableConstraintDefinition(
+ d.createForeignKeyConstraintBuilder()
+ .addSourceColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
+ .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
tablePKs.put( ALL_QNAMES_TABLE_NAME, 0L );
stmt.execute(
vendor.toString(
d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, APP_VERSION_TABLE_NAME ) )
- .setTableContentsSource(
- d.createTableElementListBuilder()
- .addTableElement( d.createColumnDefinition( APP_VERSION_PK_COLUMN_NAME, this._primitiveTypes
- .get( String.class ), false ) )
- .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( APP_VERSION_PK_COLUMN_NAME )
- .createExpression()
- ) )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, APP_VERSION_TABLE_NAME ) )
+ .setTableContentsSource(
+ d.createTableElementListBuilder()
+ .addTableElement( d.createColumnDefinition( APP_VERSION_PK_COLUMN_NAME, this._primitiveTypes
+ .get( String.class ), false ) )
+ .addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( APP_VERSION_PK_COLUMN_NAME )
+ .createExpression()
+ ) )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
ModificationFactory m = vendor.getModificationFactory();
PreparedStatement ps = connection.prepareStatement(
vendor.toString(
m.insert()
- .setTableName( t.tableName( schemaName, APP_VERSION_TABLE_NAME ) )
- .setColumnSource(
- m.columnSourceByValues()
- .addValues( vendor.getLiteralFactory().param() )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, APP_VERSION_TABLE_NAME ) )
+ .setColumnSource(
+ m.columnSourceByValues()
+ .addValues( vendor.getLiteralFactory().param() )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
ps.setString( 1, this._app.version() );
ps.execute();
@@ -728,14 +728,14 @@ public abstract class AbstractSQLStartup
// @formatter:off
// First delete all entity data
DeleteBySearch clearEntityData = this._vendor.getModificationFactory().deleteBySearch()
- .setTargetTable(
- this._vendor.getModificationFactory().createTargetTable(
- this._vendor.getTableReferenceFactory().tableName(
- this._state.schemaName().get(),
- ENTITY_TABLE_NAME
- )
- )
- ).createExpression();
+ .setTargetTable(
+ this._vendor.getModificationFactory().createTargetTable(
+ this._vendor.getTableReferenceFactory().tableName(
+ this._state.schemaName().get(),
+ ENTITY_TABLE_NAME
+ )
+ )
+ ).createExpression();
connection.prepareStatement( this._vendor.toString( clearEntityData ) ).execute();
// @formatter:on
@@ -768,18 +768,18 @@ public abstract class AbstractSQLStartup
// @formatter:off
q.simpleQueryBuilder()
- .select( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
- .from( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
- .createExpression();
+ .select( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
+ .from( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
+ .createExpression();
ResultSet rs = stmt.executeQuery(
vendor.toString(
q.simpleQueryBuilder()
- .select( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
- .from( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
- .createExpression()
- )
- );
+ .select( ENTITY_TYPES_TABLE_PK_COLUMN_NAME, ENTITY_TYPES_TABLE_TYPE_NAME_COLUMN_NAME )
+ .from( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
+ .createExpression()
+ )
+ );
long pk;
try
@@ -800,11 +800,11 @@ public abstract class AbstractSQLStartup
rs = stmt.executeQuery(
vendor.toString(
q.simpleQueryBuilder()
- .select( USED_CLASSES_TABLE_PK_COLUMN_NAME, USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME )
- .from( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
- .createExpression()
- )
- );
+ .select( USED_CLASSES_TABLE_PK_COLUMN_NAME, USED_CLASSES_TABLE_CLASS_NAME_COLUMN_NAME )
+ .from( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
+ .createExpression()
+ )
+ );
try
{
@@ -827,11 +827,11 @@ public abstract class AbstractSQLStartup
rs = stmt.executeQuery(
vendor.toString(
q.simpleQueryBuilder()
- .select( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME, ENUM_LOOKUP_TABLE_ENUM_VALUE_NAME )
- .from( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
- .createExpression()
- )
- );
+ .select( ENUM_LOOKUP_TABLE_PK_COLUMN_NAME, ENUM_LOOKUP_TABLE_ENUM_VALUE_NAME )
+ .from( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
+ .createExpression()
+ )
+ );
try
{
@@ -849,11 +849,11 @@ public abstract class AbstractSQLStartup
rs = stmt.executeQuery(
q.simpleQueryBuilder()
- .select( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME )
- .from( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
- .createExpression()
- .toString()
- );
+ .select( USED_QNAMES_TABLE_QNAME_COLUMN_NAME, USED_QNAMES_TABLE_TABLE_NAME_COLUMN_NAME )
+ .from( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
+ .createExpression()
+ .toString()
+ );
try
{
while( rs.next() )
@@ -891,14 +891,14 @@ public abstract class AbstractSQLStartup
final PreparedStatement st = connection.prepareStatement(
vendor.toString(
m.insert()
- .setTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
- .setColumnSource( m.columnSourceByValues()
- .addValues( l.param(), l.param() )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ENTITY_TYPES_TABLE_NAME ) )
+ .setColumnSource( m.columnSourceByValues()
+ .addValues( l.param(), l.param() )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
try
{
@@ -906,28 +906,28 @@ public abstract class AbstractSQLStartup
for( EntityDescriptor descriptor : appInfo.entityDescriptors.values() )
{
descriptor.types().forEach( entityType ->
- {
- String entityTypeName = entityType.getName();
- if( !insertedTypeNames.contains( entityTypeName ) )
- {
- long pk = tablePKs.get( ENTITY_TYPES_TABLE_NAME );
- try
- {
- st.setInt( 1, (int) pk );
- st.setString( 2, entityTypeName );
- st.executeUpdate();
- }
- catch( SQLException e )
- {
- throw new EntityStoreException( "Underlying exception when setting " + pk,
- SQLUtil.withAllSQLExceptions( e ) );
- }
- this._state.entityTypePKs().get().put( entityTypeName, (int) pk );
+ {
+ String entityTypeName = entityType.getName();
+ if( !insertedTypeNames.contains( entityTypeName ) )
+ {
+ long pk = tablePKs.get( ENTITY_TYPES_TABLE_NAME );
+ try
+ {
+ st.setInt( 1, (int) pk );
+ st.setString( 2, entityTypeName );
+ st.executeUpdate();
+ }
+ catch( SQLException e )
+ {
+ throw new EntityStoreException( "Underlying exception when setting " + pk,
+ SQLUtil.withAllSQLExceptions( e ) );
+ }
+ this._state.entityTypePKs().get().put( entityTypeName, (int) pk );
// this._state.entityTypeInfos().get().put( entityTypeName, new EntityTypeInfo( descriptor, (int) pk ) );
- tablePKs.put( ENTITY_TYPES_TABLE_NAME, pk + 1 );
- insertedTypeNames.add( entityTypeName );
- }
- } );
+ tablePKs.put( ENTITY_TYPES_TABLE_NAME, pk + 1 );
+ insertedTypeNames.add( entityTypeName );
+ }
+ } );
}
}
finally
@@ -938,15 +938,15 @@ public abstract class AbstractSQLStartup
PreparedStatement ps = connection.prepareStatement(
vendor.toString(
m.insert()
- .setTableName( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
- .setColumnSource(
- m.columnSourceByValues()
- .addValues( l.param(), l.param() )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, USED_CLASSES_TABLE_NAME ) )
+ .setColumnSource(
+ m.columnSourceByValues()
+ .addValues( l.param(), l.param() )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
try
{
@@ -969,14 +969,14 @@ public abstract class AbstractSQLStartup
ps = connection.prepareStatement(
vendor.toString(
m.insert()
- .setTableName( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
- .setColumnSource( m.columnSourceByValues()
- .addValues( l.param(), l.param() )
- .createExpression()
- )
- .createExpression()
- )
- );
+ .setTableName( t.tableName( schemaName, ENUM_LOOKUP_TABLE_NAME ) )
+ .setColumnSource( m.columnSourceByValues()
+ .addValues( l.param(), l.param() )
+ .createExpression()
+ )
+ .createExpression()
+ )
+ );
try
{
@@ -998,7 +998,7 @@ public abstract class AbstractSQLStartup
Statement stmt = connection.createStatement();
ps = connection.prepareStatement(
this.createInsertStatementForQNameInfo( schemaName, vendor ).toString()
- );
+ );
try
{
@@ -1011,9 +1011,9 @@ public abstract class AbstractSQLStartup
TableElementListBuilder builder = d.createTableElementListBuilder();
builder
.addTableElement( d.createColumnDefinition( ALL_QNAMES_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( Integer.class ), false ) )
+ .get( Integer.class ), false ) )
.addTableElement( d.createColumnDefinition( ENTITY_TABLE_PK_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false ) );
+ .get( ENTITY_PK_TYPE ), false ) );
if( type.equals( QNameType.PROPERTY ) )
{
@@ -1029,13 +1029,13 @@ public abstract class AbstractSQLStartup
this.appendColumnDefinitionsForProperty( builder, qNameInfo );
builder.addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
- .addSourceColumns( QNAME_TABLE_PARENT_QNAME_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
- .addTargetColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .setOnUpdate( ReferentialAction.CASCADE )
- .setOnDelete( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
- ) );
+ .addSourceColumns( QNAME_TABLE_PARENT_QNAME_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
+ .addTargetColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+ ) );
}
else
{
@@ -1043,25 +1043,25 @@ public abstract class AbstractSQLStartup
{
builder
.addTableElement( d.createColumnDefinition( QNAME_TABLE_VALUE_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false ) )
+ .get( ENTITY_PK_TYPE ), false ) )
.addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) );
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) );
}
else if( type.equals( QNameType.MANY_ASSOCIATION ) )
{
builder
.addTableElement( d.createColumnDefinition( QNAME_TABLE_ASSOCIATION_INDEX_COLUMN_NAME, this._primitiveTypes
- .get( Integer.class ), false ) )
+ .get( Integer.class ), false ) )
.addTableElement( d.createColumnDefinition( QNAME_TABLE_VALUE_COLUMN_NAME, this._primitiveTypes
- .get( ENTITY_PK_TYPE ), false ) )
+ .get( ENTITY_PK_TYPE ), false ) )
.addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) );
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) );
}
else
{
@@ -1070,14 +1070,14 @@ public abstract class AbstractSQLStartup
builder
.addTableElement( d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
- .addSourceColumns( QNAME_TABLE_VALUE_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
- .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
- .setOnUpdate( ReferentialAction.CASCADE )
- .setOnDelete( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
- )
- );
+ .addSourceColumns( QNAME_TABLE_VALUE_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ENTITY_TABLE_NAME ) )
+ .addTargetColumns( ENTITY_TABLE_PK_COLUMN_NAME )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+ )
+ );
tablePKs.put( qNameInfo.getTableName(), 0L );
}
@@ -1085,20 +1085,20 @@ public abstract class AbstractSQLStartup
builder
.addTableElement(
d.createTableConstraintDefinition( d.createForeignKeyConstraintBuilder()
- .addSourceColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .setTargetTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
- .addTargetColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .setOnUpdate( ReferentialAction.CASCADE )
- .setOnDelete( ReferentialAction.CASCADE )
- .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
- )
- );
+ .addSourceColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .setTargetTableName( t.tableName( schemaName, ALL_QNAMES_TABLE_NAME ) )
+ .addTargetColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .setOnDelete( ReferentialAction.CASCADE )
+ .createExpression(), ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+ )
+ );
stmt.execute( this._vendor.toString( d.createTableDefinitionBuilder()
- .setTableName( t.tableName( schemaName, qNameInfo.getTableName() ) )
- .setTableContentsSource( builder.createExpression() )
- .createExpression()
- ) );
+ .setTableName( t.tableName( schemaName, qNameInfo.getTableName() ) )
+ .setTableContentsSource( builder.createExpression() )
+ .createExpression()
+ ) );
// stmt.execute( "COMMENT ON TABLE " + schemaName + "." + qNameInfo.getTableName() + " IS '"
// + qNameInfo.getQName() + "'" );
@@ -1123,11 +1123,11 @@ public abstract class AbstractSQLStartup
LiteralFactory l = vendor.getLiteralFactory();
return m.insert()
- .setTableName( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
- .setColumnSource( m.columnSourceByValues()
- .addValues( l.param(), l.param() )
- .createExpression()
- ).createExpression();
+ .setTableName( t.tableName( schemaName, USED_QNAMES_TABLE_NAME ) )
+ .setColumnSource( m.columnSourceByValues()
+ .addValues( l.param(), l.param() )
+ .createExpression()
+ ).createExpression();
}
private void appendColumnDefinitionsForProperty( TableElementListBuilder builder,
@@ -1147,12 +1147,12 @@ public abstract class AbstractSQLStartup
if( this._customizableTypes.keySet().contains( finalClass )
&& qNameInfo.getPropertyDescriptor().accessor()
- .isAnnotationPresent( SQLTypeInfo.class ) )
+ .isAnnotationPresent( SQLTypeInfo.class ) )
{
sqlType = this._customizableTypes.get( finalClass ).customizeType( finalClass,
qNameInfo.getPropertyDescriptor()
- .accessor()
- .getAnnotation( SQLTypeInfo.class ) );
+ .accessor()
+ .getAnnotation( SQLTypeInfo.class ) );
}
else if( Enum.class.isAssignableFrom( finalClass ) )
{
@@ -1189,25 +1189,25 @@ public abstract class AbstractSQLStartup
d.createColumnDefinition( QNAME_TABLE_VALUE_COLUMN_NAME, sqlType,
qNameInfo.getCollectionDepth() > 0 ) )
.addTableElement( d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
- .setUniqueness( UniqueSpecification.PRIMARY_KEY )
- .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
- .createExpression()
- ) );
+ .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+ .addColumns( ALL_QNAMES_TABLE_PK_COLUMN_NAME, ENTITY_TABLE_PK_COLUMN_NAME )
+ .createExpression()
+ ) );
if( valueRefTableName != null /* && valueRefTablePKColumnName != null is always true if valueRefTableName!=null */ )
{
builder
.addTableElement( d.createTableConstraintDefinition( d
- .createForeignKeyConstraintBuilder()
- .addSourceColumns( QNAME_TABLE_VALUE_COLUMN_NAME )
- .setTargetTableName( t.tableName( this._state
- .schemaName()
- .get(), valueRefTableName ) )
- .addTargetColumns( valueRefTablePKColumnName )
- .setOnUpdate( ReferentialAction.CASCADE )
- .setOnDelete( ReferentialAction.RESTRICT )
- .createExpression(), ConstraintCharacteristics.NOT_DEFERRABLE
- ) );
+ .createForeignKeyConstraintBuilder()
+ .addSourceColumns( QNAME_TABLE_VALUE_COLUMN_NAME )
+ .setTargetTableName( t.tableName( this._state
+ .schemaName()
+ .get(), valueRefTableName ) )
+ .addTargetColumns( valueRefTablePKColumnName )
+ .setOnUpdate( ReferentialAction.CASCADE )
+ .setOnDelete( ReferentialAction.RESTRICT )
+ .createExpression(), ConstraintCharacteristics.NOT_DEFERRABLE
+ ) );
}
}
@@ -1312,7 +1312,7 @@ public abstract class AbstractSQLStartup
try
{
QueryExpression getAppVersionQuery
- = this._vendor
+ = this._vendor
.getQueryFactory()
.simpleQueryBuilder()
.select( APP_VERSION_PK_COLUMN_NAME )
@@ -1347,7 +1347,7 @@ public abstract class AbstractSQLStartup
return result;
}
-// private static void clearSchema( Connection connection, String schemaName, SQLVendor vendor )
+ // private static void clearSchema( Connection connection, String schemaName, SQLVendor vendor )
// throws SQLException
// {
// ModificationFactory m = vendor.getModificationFactory();
@@ -1406,7 +1406,7 @@ public abstract class AbstractSQLStartup
{
@Override
public boolean visitEnter( Object visited )
- throws RuntimeException
+ throws RuntimeException
{
if( visited instanceof LayerDescriptor || visited instanceof ModuleDescriptor )
{
@@ -1474,27 +1474,22 @@ public abstract class AbstractSQLStartup
List<CompositeDescriptorInfo> vDescriptors,
Set<String> enumValues,
Boolean setQNameTableNameToNull
- )
+ )
{
QualifiedName qName = pType.qualifiedName();
if( !newQNames.contains( qName ) && !qName.name().equals( HasIdentity.class.getName() ) )
{
newQNames.add( qName );
- QNameInfo info = qNameInfos.get( qName );
- if( info == null )
+ QNameInfo info = qNameInfos.computeIfAbsent( qName, n ->
{
- info
- = QNameInfo.fromProperty(
- //
- qName, //
- setQNameTableNameToNull ? null : ( QNAME_TABLE_NAME_PREFIX + qNameInfos
- .size() ), //
- pType//
- );
- qNameInfos.put( qName, info );
- }
+ String tableName = null;
+ if( !setQNameTableNameToNull )
+ {
+ tableName = QNAME_TABLE_NAME_PREFIX + qNameInfos.size();
+ }
+ return QNameInfo.fromProperty( n, tableName, pType );
+ } );
Type vType = info.getFinalType();
-
while( vType instanceof ParameterizedType )
{
vType = ( (ParameterizedType) vType ).getRawType();
@@ -1511,20 +1506,20 @@ public abstract class AbstractSQLStartup
{
ValueDescriptor vDesc = (ValueDescriptor) desc;
// TODO this doesn't understand, say, Map<String, String>, or indeed,
- // any
- // other Serializable
+ // any other Serializable
if( vDesc.types().anyMatch( vTypeClass::isAssignableFrom ) )
{
- vDesc.state().properties().forEach( subPDesc -> {
- this.processPropertyTypeForQNames( //
- subPDesc, //
- qNameInfos, //
- newQNames, //
- vDescriptors, //
- enumValues, //
- setQNameTableNameToNull //
- );
- } );
+ vDesc.state().properties().forEach( subPDesc ->
+ {
+ this.processPropertyTypeForQNames(
+ subPDesc,
+ qNameInfos,
+ newQNames,
+ vDescriptors,
+ enumValues,
+ setQNameTableNameToNull
+ );
+ } );
}
}
}
@@ -1534,7 +1529,7 @@ public abstract class AbstractSQLStartup
for( Object value : ( (Class<?>) vType ).getEnumConstants() )
{
enumValues.add( QualifiedName
- .fromClass( (Class<?>) vType, value.toString() ).toString() );
+ .fromClass( (Class<?>) vType, value.toString() ).toString() );
}
}
}
@@ -1547,77 +1542,77 @@ public abstract class AbstractSQLStartup
List<CompositeDescriptorInfo> vDescriptors,
Set<String> enumValues,
Boolean setQNameTableNameToNull
- )
+ )
{
entityDesc.state().properties().forEach( pDesc ->
- {
- if( SQLSkeletonUtil.isQueryable( pDesc.accessor() ) )
- {
- this.processPropertyTypeForQNames( //
- pDesc, //
- qNameInfos, //
- newQNames, //
- vDescriptors, //
- enumValues, //
- setQNameTableNameToNull //
- );
- }
- });
+ {
+ if( SQLSkeletonUtil.isQueryable( pDesc.accessor() ) )
+ {
+ this.processPropertyTypeForQNames(
+ pDesc,
+ qNameInfos,
+ newQNames,
+ vDescriptors,
+ enumValues,
+ setQNameTableNameToNull //
+ );
+ }
+ } );
}
private void extractAssociationQNames( EntityDescriptor entityDesc,
Map<QualifiedName, QNameInfo> extractedQNames,
Set<QualifiedName> newQNames, Boolean setQNameTableNameToNull
- )
+ )
{
entityDesc.state().associations().forEach( assoDesc ->
- {
- if( SQLSkeletonUtil.isQueryable( assoDesc.accessor() ) )
- {
- QualifiedName qName = assoDesc.qualifiedName();
- if( !extractedQNames.containsKey( qName ) )
- {
- extractedQNames.put( qName,//
- QNameInfo.fromAssociation( //
- qName, //
- setQNameTableNameToNull ? null
- : ( QNAME_TABLE_NAME_PREFIX + extractedQNames
- .size() ), //
- assoDesc //
- ) //
- );
- newQNames.add( qName );
- }
- }
- });
+ {
+ if( SQLSkeletonUtil.isQueryable( assoDesc.accessor() ) )
+ {
+ QualifiedName qName = assoDesc.qualifiedName();
+ if( !extractedQNames.containsKey( qName ) )
+ {
+ extractedQNames.put( qName,//
+ QNameInfo.fromAssociation( //
+ qName, //
+ setQNameTableNameToNull ? null
+ : ( QNAME_TABLE_NAME_PREFIX + extractedQNames
+ .size() ), //
+ assoDesc //
+ ) //
+ );
+ newQNames.add( qName );
+ }
+ }
+ } );
}
private void extractManyAssociationQNames( EntityDescriptor entityDesc,
Map<QualifiedName, QNameInfo> extractedQNames,
Set<QualifiedName> newQNames,
Boolean setQNameTableNameToNull
- )
+ )
{
entityDesc.state().manyAssociations().forEach( mAssoDesc ->
- {
- QualifiedName qName = mAssoDesc.qualifiedName();
- if( SQLSkeletonUtil.isQueryable( mAssoDesc.accessor() ) )
- {
- if( !extractedQNames.containsKey( qName ) )
- {
- extractedQNames.put( //
- qName, //
- QNameInfo.fromManyAssociation( //
- qName, //
- setQNameTableNameToNull ? null
- : ( QNAME_TABLE_NAME_PREFIX + extractedQNames.size() ), //
- mAssoDesc //
- ) //
- );
- newQNames.add( qName );
- }
- }
- });
+ {
+ QualifiedName qName = mAssoDesc.qualifiedName();
+ if( SQLSkeletonUtil.isQueryable( mAssoDesc.accessor() ) )
+ {
+ if( !extractedQNames.containsKey( qName ) )
+ {
+ extractedQNames.put( //
+ qName, //
+ QNameInfo.fromManyAssociation( //
+ qName, //
+ setQNameTableNameToNull ? null
+ : ( QNAME_TABLE_NAME_PREFIX + extractedQNames.size() ), //
+ mAssoDesc //
+ ) //
+ );
+ newQNames.add( qName );
+ }
+ }
+ } );
}
protected abstract void testRequiredCapabilities( Connection connection )
@@ -1627,19 +1622,19 @@ public abstract class AbstractSQLStartup
String schemaName,
String tableName,
Statement stmt
- )
+ )
throws SQLException
{
boolean result = false;
try
{
stmt.execute( this._vendor.toString( this._vendor.getManipulationFactory()
- .createDropTableOrViewStatement(
- this._vendor
- .getTableReferenceFactory()
- .tableName( schemaName, tableName ), ObjectType.TABLE,
- DropBehaviour.CASCADE
- ) ) );
+ .createDropTableOrViewStatement(
+ this._vendor
+ .getTableReferenceFactory()
+ .tableName( schemaName, tableName ), ObjectType.TABLE,
+ DropBehaviour.CASCADE
+ ) ) );
result = true;
}
catch( SQLException sqle )
@@ -1676,8 +1671,8 @@ public abstract class AbstractSQLStartup
}
protected static <TCompositeDescriptor extends CompositeDescriptor> TCompositeDescriptor
- stringToCompositeDescriptor( final Class<TCompositeDescriptor> descriptorClass,
- ApplicationDescriptor appDesc, String str )
+ stringToCompositeDescriptor( final Class<TCompositeDescriptor> descriptorClass,
+ ApplicationDescriptor appDesc, String str )
{
Matcher matcher = DESCRIPTOR_TEXTUAL_REGEXP.matcher( str );
if( !matcher.matches() )
@@ -1716,7 +1711,7 @@ public abstract class AbstractSQLStartup
Set<String> names = desc.types().map( Class::getName ).collect( Collectors.toSet() );
if( classNames.equals( names ) )
{
- result[0] = desc;
+ result[ 0 ] = desc;
thisResult = false;
}
}
@@ -1726,17 +1721,17 @@ public abstract class AbstractSQLStartup
@Override
public boolean visitLeave( Object visited )
{
- return result[0] == null;
+ return result[ 0 ] == null;
}
} );
//noinspection unchecked
- return (TCompositeDescriptor) result[0];
+ return (TCompositeDescriptor) result[ 0 ];
}
protected abstract void modifyPrimitiveTypes( Map<Class<?>, SQLDataType> primitiveTypes,
Map<Class<?>, Integer> jdbcTypes
- );
+ );
protected abstract SQLDataType getCollectionPathDataType();
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
index ed1bc47..2584600 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/SQLCompatEntityStateWrapper.java
@@ -35,6 +35,7 @@ import org.apache.polygene.api.structure.ModuleDescriptor;
import org.apache.polygene.api.type.CollectionType;
import org.apache.polygene.api.type.ValueCompositeType;
import org.apache.polygene.api.type.ValueType;
+import org.apache.polygene.api.value.ValueComposite;
import org.apache.polygene.spi.entity.EntityState;
import org.apache.polygene.spi.entity.EntityStatus;
import org.apache.polygene.spi.entity.ManyAssociationState;
@@ -88,7 +89,7 @@ class SQLCompatEntityStateWrapper
// || DateTime.class.isAssignableFrom( primaryType )
// || LocalDateTime.class.isAssignableFrom( primaryType )
// || LocalDate.class.isAssignableFrom( primaryType )
- || valueType instanceof ValueCompositeType;
+ || valueType.hasType( ValueComposite.class );
}
};
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLQueryTest.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLQueryTest.java b/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLQueryTest.java
index ab8b923..2d4dde5 100644
--- a/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLQueryTest.java
+++ b/extensions/indexing-sql/src/test/java/org/apache/polygene/index/sql/postgresql/PostgreSQLQueryTest.java
@@ -36,7 +36,9 @@ public class PostgreSQLQueryTest
extends AbstractQueryTest
{
@ClassRule
- public static final DockerRule DOCKER = new DockerRule( "postgres", 3000L, "PostgreSQL init process complete; ready for start up." );
+ public static final DockerRule DOCKER = new DockerRule( "postgres",
+ 10000L,
+ "PostgreSQL init process complete; ready for start up." );
@Override
public void assemble( ModuleAssembly mainModule )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a6fb0cd6/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/SimpleSpeaker.groovy
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/SimpleSpeaker.groovy b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/SimpleSpeaker.groovy
new file mode 100644
index 0000000..69e5cfe
--- /dev/null
+++ b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/SimpleSpeaker.groovy
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.library.scripting
+
+// START SNIPPET: script
+def sayHello() {
+ "Hello, Groovy"
+}
+// END SNIPPET: script