You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/06/05 09:54:40 UTC
[1/6] polygene-java git commit: Core API: remove InitialValueProvider
Repository: polygene-java
Updated Branches:
refs/heads/develop 6e5d9119c -> 767b36167
Core API: remove InitialValueProvider
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/615189bb
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/615189bb
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/615189bb
Branch: refs/heads/develop
Commit: 615189bb40a0300e2e2246cb2b21da9115754820
Parents: 6e5d911
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 07:44:50 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 07:44:50 2017 +0200
----------------------------------------------------------------------
.../api/property/InitialValueProvider.java | 27 --------------------
.../api/property/PropertyDescriptor.java | 2 --
.../polygene/bootstrap/MetaInfoDeclaration.java | 8 ------
.../polygene/bootstrap/MixinDeclaration.java | 4 ---
.../runtime/property/PropertyModel.java | 24 +++++------------
5 files changed, 7 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/615189bb/core/api/src/main/java/org/apache/polygene/api/property/InitialValueProvider.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/InitialValueProvider.java b/core/api/src/main/java/org/apache/polygene/api/property/InitialValueProvider.java
deleted file mode 100644
index cd32a3a..0000000
--- a/core/api/src/main/java/org/apache/polygene/api/property/InitialValueProvider.java
+++ /dev/null
@@ -1,27 +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.property;
-
-import java.util.function.BiFunction;
-import org.apache.polygene.api.structure.Module;
-
-public interface InitialValueProvider extends BiFunction<Module, PropertyDescriptor, Object>
-{
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/615189bb/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java b/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
index 47a8db1..6c7df05 100644
--- a/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
+++ b/core/api/src/main/java/org/apache/polygene/api/property/PropertyDescriptor.java
@@ -54,8 +54,6 @@ public interface PropertyDescriptor extends MetaInfoHolder
AccessibleObject accessor();
- InitialValueProvider initialValueProvider();
-
Object resolveInitialValue(ModuleDescriptor moduleDescriptor);
ValueType valueType();
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/615189bb/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
index 348ac10..2967fe5 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MetaInfoDeclaration.java
@@ -29,7 +29,6 @@ import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;
import org.apache.polygene.api.common.MetaInfo;
-import org.apache.polygene.api.property.InitialValueProvider;
import org.apache.polygene.api.property.Property;
/**
@@ -218,12 +217,5 @@ public final class MetaInfoDeclaration
metaInfo.set( info );
return this;
}
-
- @Override
- public MixinDeclaration<T> declareInitialValueProvider(InitialValueProvider provider)
- {
- metaInfo.add( InitialValueProvider.class, provider);
- return this;
- }
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/615189bb/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
index a50f305..90e22f4 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/MixinDeclaration.java
@@ -20,8 +20,6 @@
package org.apache.polygene.bootstrap;
-import org.apache.polygene.api.property.InitialValueProvider;
-
/**
* Fluent API for declaring information about properties
*
@@ -32,6 +30,4 @@ public interface MixinDeclaration<T>
T declareDefaults();
MixinDeclaration<T> setMetaInfo( Object info );
-
- MixinDeclaration<T> declareInitialValueProvider(InitialValueProvider provider);
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/615189bb/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
index 79f7ae9..984d8c4 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/property/PropertyModel.java
@@ -27,6 +27,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.List;
+import java.util.function.BiFunction;
import java.util.stream.Stream;
import org.apache.polygene.api.common.MetaInfo;
import org.apache.polygene.api.common.QualifiedName;
@@ -35,7 +36,6 @@ import org.apache.polygene.api.constraint.ConstraintViolationException;
import org.apache.polygene.api.entity.Queryable;
import org.apache.polygene.api.property.DefaultValues;
import org.apache.polygene.api.property.GenericPropertyInfo;
-import org.apache.polygene.api.property.InitialValueProvider;
import org.apache.polygene.api.property.InvalidPropertyTypeException;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.api.property.PropertyDescriptor;
@@ -87,8 +87,7 @@ public class PropertyModel
boolean useDefaults,
ValueConstraintsInstance constraints,
MetaInfo metaInfo,
- Object initialValue,
- InitialValueProvider initialValueProvider
+ Object initialValue
)
{
if( accessor instanceof Method )
@@ -105,14 +104,7 @@ public class PropertyModel
type = GenericPropertyInfo.propertyTypeOf( accessor );
checkTypeValidity( type );
qualifiedName = QualifiedName.fromAccessor( accessor );
- if( initialValueProvider != null )
- {
- this.initialValueProvider = initialValueProvider;
- }
- else
- {
- this.initialValueProvider = new DefaultInitialValueProvider( useDefaults, initialValue );
- }
+ initialValueProvider = new DefaultInitialValueProvider( useDefaults, initialValue );
this.constraints = constraints;
final Queryable queryable = accessor.getAnnotation( Queryable.class );
this.queryable = queryable == null || queryable.value();
@@ -195,12 +187,6 @@ public class PropertyModel
}
@Override
- public InitialValueProvider initialValueProvider()
- {
- return initialValueProvider;
- }
-
- @Override
public Object resolveInitialValue( ModuleDescriptor moduleDescriptor )
{
return initialValueProvider.apply( moduleDescriptor.instance(), this );
@@ -310,6 +296,10 @@ public class PropertyModel
}
}
+ private interface InitialValueProvider extends BiFunction<Module, PropertyDescriptor, Object>
+ {
+ }
+
private class DefaultInitialValueProvider
implements InitialValueProvider
{
[6/6] polygene-java git commit: :tools:generator fix storage module
compilation
Posted by pa...@apache.org.
:tools:generator fix storage module compilation
Memory & Preferences ES have no configuration
SQL ES have a common configuration
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/767b3616
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/767b3616
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/767b3616
Branch: refs/heads/develop
Commit: 767b36167eed5800c0f25a653d5e534fad621f07
Parents: a4e1318
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 11:18:48 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 11:54:16 2017 +0200
----------------------------------------------------------------------
.../InfrastructureLayer/StorageModule/bootstrap.tmpl | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/767b3616/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
index ce33d13..4220bd9 100644
--- a/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
+++ b/tools/generator-polygene/app/templates/InfrastructureLayer/StorageModule/bootstrap.tmpl
@@ -26,7 +26,18 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.layered.ModuleAssembler;
+<%
+if( polygene.entitystore !== 'Memory' && polygene.entitystore !== 'Preferences' && polygene.entitystore.indexOf('SQL') == -1 ) {
+%>
import org.apache.polygene.entitystore.<%- polygene.entitystoremodule %>.<%- polygene.entitystore %>EntityStoreConfiguration;
+<%
+}
+if( polygene.entitystore.indexOf('SQL') >= 0 ) {
+%>
+import org.apache.polygene.entitystore.sql.SQLEntityStoreConfiguration;
+<%
+}
+%>
import org.apache.polygene.entitystore.<%- polygene.entitystoremodule %>.assembly.<%- polygene.entitystore %>EntityStoreAssembler;
<%
if( polygene.entitystore.indexOf('SQL') >= 0 ) {
[5/6] polygene-java git commit: Use AccessibleObjects.accessible(T)
everywhere applicable
Posted by pa...@apache.org.
Use AccessibleObjects.accessible(T) everywhere applicable
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/a4e13185
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/a4e13185
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/a4e13185
Branch: refs/heads/develop
Commit: a4e13185803be0fc1d899d45187d5cbb1eb13052
Parents: b50f0ac
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 08:27:35 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 10:42:11 2017 +0200
----------------------------------------------------------------------
.../polygene/api/composite/PropertyMapperTest.java | 4 ++--
.../layered/LayeredApplicationAssembler.java | 17 +++++++----------
.../bootstrap/layered/LayeredLayerAssembler.java | 8 ++++----
.../polygene/runtime/bootstrap/AssemblyHelper.java | 5 +++--
.../composite/InterfaceDefaultMethodsMixin.java | 5 +++--
.../polygene/index/solr/EmbeddedSolrService.java | 5 +++--
.../apache/polygene/sample/rental/web/Page.java | 6 +++---
7 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java b/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
index d285102..c2b6ccb 100644
--- a/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/composite/PropertyMapperTest.java
@@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.junit.Test;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -41,8 +42,7 @@ public class PropertyMapperTest
{
try
{
- MAP_TO_TYPE = PropertyMapper.class.getDeclaredMethod( "mapToType", Composite.class, Type.class, Object.class );
- MAP_TO_TYPE.setAccessible( true );
+ MAP_TO_TYPE = accessible( PropertyMapper.class.getDeclaredMethod( "mapToType", Composite.class, Type.class, Object.class ) );
}
catch( NoSuchMethodException e )
{
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
index 7301907..3ed2e9f 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredApplicationAssembler.java
@@ -36,6 +36,8 @@ import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.Energy4Java;
import org.apache.polygene.bootstrap.LayerAssembly;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
public abstract class LayeredApplicationAssembler
implements ApplicationAssembler
{
@@ -200,8 +202,7 @@ public abstract class LayeredApplicationAssembler
{
try
{
- Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create", LayerAssembly.class );
- factoryMethod.setAccessible( true );
+ Method factoryMethod = accessible( layerAssemblerClass.getDeclaredMethod( "create", LayerAssembly.class ) );
int modifiers = factoryMethod.getModifiers();
if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
{
@@ -212,8 +213,7 @@ public abstract class LayeredApplicationAssembler
{
try
{
- Method factoryMethod = layerAssemblerClass.getDeclaredMethod( "create" );
- factoryMethod.setAccessible( true );
+ Method factoryMethod = accessible( layerAssemblerClass.getDeclaredMethod( "create" ) );
int modifiers = factoryMethod.getModifiers();
if( Modifier.isStatic( modifiers ) && LayerAssembler.class.isAssignableFrom( factoryMethod.getReturnType() ) )
{
@@ -237,8 +237,7 @@ public abstract class LayeredApplicationAssembler
Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getConstructor( LayerAssembly.class );
if( constructor != null )
{
- constructor.setAccessible( true );
- return constructor.newInstance( assembly );
+ return accessible( constructor ).newInstance( assembly );
}
}
catch( NoSuchMethodException e )
@@ -248,8 +247,7 @@ public abstract class LayeredApplicationAssembler
Constructor<? extends LayerAssembler> constructor = layerAssemblerClass.getDeclaredConstructor();
if( constructor != null )
{
- constructor.setAccessible( true );
- return constructor.newInstance();
+ return accessible( constructor ).newInstance();
}
}
catch( NoSuchMethodException e1 )
@@ -268,8 +266,7 @@ public abstract class LayeredApplicationAssembler
Field field = clazz.getDeclaredField( "NAME" );
if( Modifier.isStatic( field.getModifiers() ) )
{
- field.setAccessible( true );
- field.set( null, classname );
+ accessible( field ).set( null, classname );
}
}
catch( Exception e )
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
index 9866f89..0f0b624 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/layered/LayeredLayerAssembler.java
@@ -24,6 +24,8 @@ import java.util.HashMap;
import org.apache.polygene.bootstrap.LayerAssembly;
import org.apache.polygene.bootstrap.ModuleAssembly;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
public abstract class LayeredLayerAssembler
implements LayerAssembler
{
@@ -76,14 +78,12 @@ public abstract class LayeredLayerAssembler
try
{
Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor( ModuleAssembly.class );
- assemblyConstructor.setAccessible( true );
- moduleAssembler = assemblyConstructor.newInstance( constructorArgument );
+ moduleAssembler = accessible( assemblyConstructor ).newInstance( constructorArgument );
}
catch( NoSuchMethodException e )
{
Constructor<? extends ModuleAssembler> assemblyConstructor = modulerAssemblerClass.getDeclaredConstructor();
- assemblyConstructor.setAccessible( true );
- moduleAssembler = assemblyConstructor.newInstance();
+ moduleAssembler = accessible( assemblyConstructor ).newInstance();
}
return moduleAssembler;
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
index b456a1e..206289a 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/AssemblyHelper.java
@@ -38,6 +38,8 @@ import org.apache.polygene.runtime.composite.FragmentClassLoader;
import org.apache.polygene.runtime.composite.MixinModel;
import org.apache.polygene.runtime.composite.SideEffectModel;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
/**
* This helper is used when building the application model. It keeps track
* of already created classloaders and various models
@@ -147,8 +149,7 @@ public class AssemblyHelper
{
@SuppressWarnings("unchecked")
Constructor<AppliesToFilter> cons = (Constructor<AppliesToFilter>) appliesToClass.getDeclaredConstructor();
- cons.setAccessible(true);
- filter = cons.newInstance();
+ filter = accessible( cons ).newInstance();
}
catch( Exception e )
{
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsMixin.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsMixin.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsMixin.java
index cb2875f..938cde8 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsMixin.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/InterfaceDefaultMethodsMixin.java
@@ -30,6 +30,8 @@ import org.apache.polygene.api.composite.Composite;
import org.apache.polygene.api.composite.DefaultMethodsFilter;
import org.apache.polygene.api.injection.scope.This;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
@AppliesTo( { DefaultMethodsFilter.class } )
public class InterfaceDefaultMethodsMixin
implements InvocationHandler
@@ -65,8 +67,7 @@ public class InterfaceDefaultMethodsMixin
try
{
Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor( Class.class, int.class );
- constructor.setAccessible( true );
- MethodHandles.Lookup lookup = constructor.newInstance( declaringClass, MethodHandles.Lookup.PRIVATE );
+ MethodHandles.Lookup lookup = accessible( constructor ).newInstance( declaringClass, MethodHandles.Lookup.PRIVATE );
MethodHandle handle = lookup.unreflectSpecial( method, declaringClass );
return ( proxy, args ) -> handle.bindTo( proxy ).invokeWithArguments( args );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/EmbeddedSolrService.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/EmbeddedSolrService.java b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/EmbeddedSolrService.java
index 29653a3..1d2dbb3 100644
--- a/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/EmbeddedSolrService.java
+++ b/extensions/indexing-solr/src/main/java/org/apache/polygene/index/solr/EmbeddedSolrService.java
@@ -35,6 +35,8 @@ import org.apache.polygene.api.service.ServiceDescriptor;
import org.apache.polygene.api.service.ServiceReference;
import org.apache.polygene.library.fileconfig.FileConfiguration;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
@Mixins( EmbeddedSolrService.Mixin.class )
@Activators( EmbeddedSolrService.Activator.class )
public interface EmbeddedSolrService
@@ -112,8 +114,7 @@ public interface EmbeddedSolrService
// Clear instance fields for GC purposes
Field instanceField = SolrCore.class.getDeclaredField( "instance" );
- instanceField.setAccessible( true );
- instanceField.set( null, null );
+ accessible( instanceField ).set( null, null );
SolrConfig.config = null;
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a4e13185/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/Page.java
----------------------------------------------------------------------
diff --git a/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/Page.java b/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/Page.java
index 876e4ad..5f0f827 100644
--- a/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/Page.java
+++ b/samples/rental/src/main/java/org/apache/polygene/sample/rental/web/Page.java
@@ -35,6 +35,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import static org.apache.polygene.api.util.AccessibleObjects.accessible;
+
@Concerns( PageUowManagement.class )
@Mixins( { Page.MountPointMixin.class, Page.DefaultPageRenderMixin.class } )
public interface Page
@@ -160,9 +162,7 @@ public interface Page
throws NoSuchMethodException
{
// TODO: Add caching since locating the methods and the throwing of exceptions are expensive.
- Method method = compositeType.getMethod( methodName, QuikitContext.class );
- method.setAccessible( true );
- return method;
+ return accessible( compositeType.getMethod( methodName, QuikitContext.class ) );
}
}
[4/6] polygene-java git commit: Core API: remove InitialValueProvider
Posted by pa...@apache.org.
Core API: remove InitialValueProvider
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/b50f0ac7
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/b50f0ac7
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/b50f0ac7
Branch: refs/heads/develop
Commit: b50f0ac7a4abb4620af059506b2406e4b66cd61e
Parents: b3d5854
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 08:20:01 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 08:20:01 2017 +0200
----------------------------------------------------------------------
.../polygene/runtime/bootstrap/CompositeAssemblyImpl.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b50f0ac7/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
index 543e8cd..bc3993b 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/CompositeAssemblyImpl.java
@@ -59,7 +59,6 @@ import org.apache.polygene.api.mixin.Initializable;
import org.apache.polygene.api.mixin.Mixins;
import org.apache.polygene.api.property.GenericPropertyInfo;
import org.apache.polygene.api.property.Immutable;
-import org.apache.polygene.api.property.InitialValueProvider;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.api.sideeffect.SideEffects;
import org.apache.polygene.api.type.HasTypes;
@@ -491,15 +490,13 @@ public abstract class CompositeAssemblyImpl
}
boolean useDefaults = useDefaultsDeclaration != null || stateDeclarations.useDefaults( accessor );
boolean immutable = this.immutable || metaInfo.get( Immutable.class ) != null;
- InitialValueProvider initialValueProvider = metaInfo.get( InitialValueProvider.class );
return new PropertyModel(
accessor,
immutable,
useDefaults,
valueConstraintsInstance,
metaInfo,
- initialValue,
- initialValueProvider
+ initialValue
);
}
[2/6] polygene-java git commit: Build: minor,
better inputs/outputs in AsciidocBuildInfoPlugin task
Posted by pa...@apache.org.
Build: minor, better inputs/outputs in AsciidocBuildInfoPlugin task
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/43876cd5
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/43876cd5
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/43876cd5
Branch: refs/heads/develop
Commit: 43876cd5e8782fb1b596b976607f5aadb4d2265c
Parents: 615189b
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 07:45:24 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 07:45:24 2017 +0200
----------------------------------------------------------------------
.../structure/manual/AsciidocBuildInfoPlugin.groovy | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/43876cd5/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/manual/AsciidocBuildInfoPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/manual/AsciidocBuildInfoPlugin.groovy b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/manual/AsciidocBuildInfoPlugin.groovy
index 3a9216c..b73fbb6 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/manual/AsciidocBuildInfoPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/manual/AsciidocBuildInfoPlugin.groovy
@@ -35,7 +35,6 @@ class AsciidocBuildInfoPlugin implements Plugin<Project>
def task = project.tasks.create( TASK_NAME )
task.group = TaskGroups.DOCUMENTATION
task.description = 'Generates asciidoc artifact snippet'
- task.inputs.properties.put 'artifactId', PublishNaming.publishedNameFor( project.path )
task.doLast {
buildInfoDir.mkdirs()
@@ -53,10 +52,9 @@ class AsciidocBuildInfoPlugin implements Plugin<Project>
}
// Declare inputs/outputs
- if( project.getBuildFile() != null && project.getBuildFile().exists() )
- {
- task.getInputs().file( project.getBuildFile() )
- }
- task.getOutputs().file( buildInfoDir )
+ task.inputs.property( 'groupId', project.group )
+ task.inputs.property( 'artifactId', PublishNaming.publishedNameFor( project.path ) )
+ task.inputs.property( 'version', project.version )
+ task.outputs.file( buildInfoDir )
}
}
[3/6] polygene-java git commit: Documentation: tools/model-detail +
some edits in other tools docs
Posted by pa...@apache.org.
Documentation: tools/model-detail + some edits in other tools docs
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/b3d5854c
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/b3d5854c
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/b3d5854c
Branch: refs/heads/develop
Commit: b3d5854c044db8e9572a80447db71ebc21d44da5
Parents: 43876cd
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 08:17:47 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 08:17:47 2017 +0200
----------------------------------------------------------------------
manual/src/docs/userguide/tools.txt | 12 +-
tools/envisage/src/docs/envisage.txt | 10 +-
.../src/docs/yeoman_polygene.txt | 25 +++-
tools/model-detail/src/docs/model-detail.txt | 52 ++++++++
.../tools/model/DocumentationSupport.java | 118 +++++++++++++++++
.../src/test/resources/doc-support-report.json | 129 +++++++++++++++++++
6 files changed, 330 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/manual/src/docs/userguide/tools.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/tools.txt b/manual/src/docs/userguide/tools.txt
index 840115e..bd129c9 100644
--- a/manual/src/docs/userguide/tools.txt
+++ b/manual/src/docs/userguide/tools.txt
@@ -24,11 +24,9 @@
== Overview ==
-The Polygene™ SDK comes with useful development tools. Theses tools can come in
-handy when assembled into your <<def-application>> in development
-<<def-application-mode, Mode>>.
-
-The tools are available in the +tools/+ directory of the Polygene™ SDK.
+The Polygene™ SDK comes with useful development tools:
+ a `yeoman` project generator,
+ a detailed application model and its visualization gui.
:leveloffset: 2
@@ -39,3 +37,7 @@ include::../../../../tools/generator-polygene/src/docs/yeoman_polygene.txt[]
include::../../../../tools/envisage/src/docs/envisage.txt[]
:leveloffset: 2
+
+include::../../../../tools/model-detail/src/docs/model-detail.txt[]
+
+:leveloffset: 2
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/tools/envisage/src/docs/envisage.txt
----------------------------------------------------------------------
diff --git a/tools/envisage/src/docs/envisage.txt b/tools/envisage/src/docs/envisage.txt
index 9202133..dc411f2 100644
--- a/tools/envisage/src/docs/envisage.txt
+++ b/tools/envisage/src/docs/envisage.txt
@@ -23,6 +23,10 @@
Envisage is a Swing based visualization tool for the Polygene™ Application model.
Visualizations can be printed to PDFs.
+include::../../build/docs/buildinfo/artifact.txt[]
+
+It can be handy to run Envisage in development <<def-application-mode, Mode>> while working on assemblies.
+
== Usage ==
Envisage can be easily used directly and prior your Application activation:
@@ -48,9 +52,3 @@ image:tools-envisage-stacked-collapsed.png[width="800px"]
image:tools-envisage-stacked.png[width="800px"]
image:tools-envisage-type.png[width="800px"]
-
-== Embed into your Application ==
-
-include::../../build/docs/buildinfo/artifact.txt[]
-
-It can be handy to run Envisage in development <<def-application-mode, Mode>> while working on assemblies.
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/tools/generator-polygene/src/docs/yeoman_polygene.txt
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/src/docs/yeoman_polygene.txt b/tools/generator-polygene/src/docs/yeoman_polygene.txt
index 19cca52..388aea2 100644
--- a/tools/generator-polygene/src/docs/yeoman_polygene.txt
+++ b/tools/generator-polygene/src/docs/yeoman_polygene.txt
@@ -19,14 +19,29 @@
[[tools-shell,Command Line Shell]]
= Polygene Generator =
-Apache Polygene comes with a Yeoman code generator, to quickly set up a
-project for Polygene applications.
+Apache Polygene comes with a http://yeoman.io/[Yeoman] code generator, to
+quickly set up a project for Polygene applications.
+
+== Usage ==
+
+You will need `node` installed in your machine. In case you don't have it
+(you can check this typing `node --version` in your terminal) please visit
+this https://nodejs.org/en/download/[link].
+
+Then run the following command to install Yeoman and the Polygene generator:
+
+[source,shell]
+----
+$ npm install -g yo generator-polygene
+----
+
+Then run the following commands to get started:
[source,shell]
----
-mkdir projectdirname
-cd projectdirname
-yo polygene
+$ mkdir projectdirname
+$ cd projectdirname
+$ yo polygene
----
It will ask a lot of questions. For choice questions, you operate up and down, and with multi-choice, you
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/tools/model-detail/src/docs/model-detail.txt
----------------------------------------------------------------------
diff --git a/tools/model-detail/src/docs/model-detail.txt b/tools/model-detail/src/docs/model-detail.txt
new file mode 100644
index 0000000..333016c
--- /dev/null
+++ b/tools/model-detail/src/docs/model-detail.txt
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////
+ * 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.
+///////////////////////////////////////////////////////////////
+
+[[tools-model-detail,Detailed Application Model]]
+= Detailed Application Model =
+
+For troubleshooting it can be handy to log the application model, or write it to some file, when activating an application.
+
+This library is what <<tools-envisage>> uses under the hood.
+
+include::../../build/docs/buildinfo/artifact.txt[]
+
+== Usage ==
+
+On application bootstrap:
+
+[snippet,java]
+----
+source=tools/model-detail/src/test/java/org/apache/polygene/tools/model/DocumentationSupport.java
+tag=usage
+----
+
+ . Given an application assembler,
+ . and a Polygene runtime,
+ . create the `ApplicationModel`.
+ . Use the `createApplicationDetailDescriptor()` static method to create a detailed application model object.
+ . Use its `toJson()` method to get a detailed report of the application model.
+ . Continue with regular application activation.
+
+Here is what a sample JSON dump looks like:
+
+[snippet,javascript]
+----
+source=tools/model-detail/src/test/resources/doc-support-report.json
+tag=report
+----
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/tools/model-detail/src/test/java/org/apache/polygene/tools/model/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/tools/model-detail/src/test/java/org/apache/polygene/tools/model/DocumentationSupport.java b/tools/model-detail/src/test/java/org/apache/polygene/tools/model/DocumentationSupport.java
new file mode 100644
index 0000000..cb6bba9
--- /dev/null
+++ b/tools/model-detail/src/test/java/org/apache/polygene/tools/model/DocumentationSupport.java
@@ -0,0 +1,118 @@
+/*
+ * 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.tools.model;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.json.stream.JsonGenerator;
+import org.apache.polygene.api.activation.ActivationException;
+import org.apache.polygene.api.activation.PassivationException;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.structure.Application;
+import org.apache.polygene.api.structure.ApplicationDescriptor;
+import org.apache.polygene.bootstrap.ApplicationAssembler;
+import org.apache.polygene.bootstrap.ApplicationAssembly;
+import org.apache.polygene.bootstrap.Energy4Java;
+import org.apache.polygene.bootstrap.LayerAssembly;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.tools.model.descriptor.ApplicationDetailDescriptor;
+import org.junit.Test;
+
+import static java.util.Collections.singletonMap;
+import static java.util.stream.Collectors.joining;
+import static org.apache.polygene.tools.model.descriptor.ApplicationDetailDescriptorBuilder.createApplicationDetailDescriptor;
+import static org.hamcrest.Matchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+public class DocumentationSupport
+{
+ interface HttpService {}
+
+ interface MyDomain {}
+
+ @Test
+ public void usage() throws ActivationException, PassivationException, IOException
+ {
+ // START SNIPPET: usage
+ ApplicationAssembler assembler = // (1)
+ // END SNIPPET: usage
+ applicationFactory -> {
+ ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
+ assembly.setName( "my-app" );
+ assembly.setMode( Application.Mode.staging );
+
+ LayerAssembly network = assembly.layer( "network" );
+ ModuleAssembly http = network.module( "http" );
+ http.services( HttpService.class ).instantiateOnStartup();
+
+ LayerAssembly application = assembly.layer( "application" );
+ ModuleAssembly domain = application.module( "domain" );
+ domain.transients( MyDomain.class ).visibleIn( Visibility.application );
+
+ network.uses( application );
+
+ return assembly;
+ };
+ // START SNIPPET: usage
+ Energy4Java polygene = new Energy4Java(); // (2)
+ ApplicationDescriptor model = polygene.newApplicationModel( assembler ); // (3)
+ ApplicationDetailDescriptor detailedModel = createApplicationDetailDescriptor( model ); // (4)
+
+ System.out.println( detailedModel.toJson().toString() ); // (5)
+
+ Application application = model.newInstance( polygene.spi() ); // (6)
+ try
+ {
+ application.activate();
+ // END SNIPPET: usage
+ ClassLoader loader = getClass().getClassLoader();
+ try( InputStream input = loader.getResourceAsStream( "doc-support-report.json" ) )
+ {
+ String text = new BufferedReader( new InputStreamReader( input ) )
+ .lines()
+ .filter( line -> !line.startsWith( "//" ) )
+ .collect( joining( "\n" ) );
+ JsonObject reference = Json.createReader( new StringReader( text ) ).readObject();
+
+ JsonObject detailedModelReport = detailedModel.toJson();
+
+ StringWriter writer = new StringWriter();
+ Json.createWriterFactory( singletonMap( JsonGenerator.PRETTY_PRINTING, true ) )
+ .createWriter( writer )
+ .write( detailedModelReport );
+ System.out.println( "--------\n" + writer.toString() );
+
+ assertThat( reference, equalTo( detailedModelReport ) );
+ }
+ // START SNIPPET: usage
+ }
+ finally
+ {
+ application.passivate();
+ }
+ // END SNIPPET: usage
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/b3d5854c/tools/model-detail/src/test/resources/doc-support-report.json
----------------------------------------------------------------------
diff --git a/tools/model-detail/src/test/resources/doc-support-report.json b/tools/model-detail/src/test/resources/doc-support-report.json
new file mode 100644
index 0000000..a804f83
--- /dev/null
+++ b/tools/model-detail/src/test/resources/doc-support-report.json
@@ -0,0 +1,129 @@
+// START SNIPPET: report
+{
+ "name":"my-app",
+ "version":"1.0",
+ "mode":"staging",
+ "layers":[
+ {
+ "name":"network",
+ "modules":[
+ {
+ "name":"http",
+ "services":[
+ {
+ "type":"org.apache.polygene.tools.model.DocumentationSupport$HttpService",
+ "visibility":"module",
+ "types":[
+ "org.apache.polygene.tools.model.DocumentationSupport$HttpService",
+ "org.apache.polygene.api.service.ServiceComposite"
+ ],
+ "mixins":[
+ {
+ "mixin":"org.apache.polygene.api.identity.HasIdentity$HasIdentityMixin",
+ "constructors":[
+ {
+ "name":"org.apache.polygene.api.identity.HasIdentity_HasIdentityMixin_Stub"
+ }
+ ],
+ "injection":{
+
+ }
+ }
+ ]
+ },
+ {
+ "type":"org.apache.polygene.api.unitofwork.UnitOfWorkFactory",
+ "visibility":"module",
+ "types":[
+ "org.apache.polygene.api.unitofwork.UnitOfWorkFactory",
+ "org.apache.polygene.api.service.ServiceComposite"
+ ],
+ "mixins":[
+ {
+ "mixin":"org.apache.polygene.runtime.unitofwork.UnitOfWorkFactoryMixin",
+ "constructors":[
+ {
+ "name":"org.apache.polygene.runtime.unitofwork.UnitOfWorkFactoryMixin_Stub"
+ }
+ ],
+ "injection":{
+
+ }
+ },
+ {
+ "mixin":"org.apache.polygene.api.identity.HasIdentity$HasIdentityMixin",
+ "constructors":[
+ {
+ "name":"org.apache.polygene.api.identity.HasIdentity_HasIdentityMixin_Stub"
+ }
+ ],
+ "injection":{
+
+ }
+ }
+ ]
+ }
+ ],
+ "activators":[
+ ]
+ }
+ ],
+ "usedLayers":[
+ "application"
+ ],
+ "activators":[
+ ]
+ },
+ {
+ "name":"application",
+ "modules":[
+ {
+ "name":"domain",
+ "services":[
+ {
+ "type":"org.apache.polygene.api.unitofwork.UnitOfWorkFactory",
+ "visibility":"module",
+ "types":[
+ "org.apache.polygene.api.unitofwork.UnitOfWorkFactory",
+ "org.apache.polygene.api.service.ServiceComposite"
+ ],
+ "mixins":[
+ {
+ "mixin":"org.apache.polygene.runtime.unitofwork.UnitOfWorkFactoryMixin",
+ "constructors":[
+ {
+ "name":"org.apache.polygene.runtime.unitofwork.UnitOfWorkFactoryMixin_Stub"
+ }
+ ],
+ "injection":{
+
+ }
+ },
+ {
+ "mixin":"org.apache.polygene.api.identity.HasIdentity$HasIdentityMixin",
+ "constructors":[
+ {
+ "name":"org.apache.polygene.api.identity.HasIdentity_HasIdentityMixin_Stub"
+ }
+ ],
+ "injection":{
+
+ }
+ }
+ ]
+ }
+ ],
+ "activators":[
+ ]
+ }
+ ],
+ "usedLayers":[
+ ],
+ "activators":[
+ ]
+ }
+ ],
+ "activators":[
+ ]
+}
+// END SNIPPET: report