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/07 08:23:54 UTC
[1/7] polygene-java git commit: Better reporting on bad Composition
during model creation.
Repository: polygene-java
Updated Branches:
refs/heads/develop d235b6385 -> 0cf199bc0
Better reporting on bad Composition during model creation.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/96de0124
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/96de0124
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/96de0124
Branch: refs/heads/develop
Commit: 96de01240b1eabe0a22348623dbcca58b96567b2
Parents: c48230e
Author: niclas <ni...@spicter.com>
Authored: Thu Mar 30 09:01:37 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Thu Mar 30 09:01:37 2017 +0800
----------------------------------------------------------------------
.../org/apache/polygene/api/PolygeneAPI.java | 33 +-
.../composite/InvalidCompositeException.java | 102 +++++-
.../bootstrap/AssemblyResportException.java | 60 ++++
.../bootstrap/ConfigurationAssembly.java | 30 --
.../apache/polygene/bootstrap/Energy4Java.java | 18 +-
.../polygene/bootstrap/ModuleAssembly.java | 4 +-
.../bootstrap/CompositeAssemblyImpl.java | 338 ++++++++++---------
.../bootstrap/ConfigurationAssemblyImpl.java | 45 ---
.../runtime/composite/CompositeModel.java | 66 ++--
.../runtime/composite/ConstructorsModel.java | 4 +-
.../TypedModifierInvocationHandler.java | 6 +-
.../polygene/bootstrap/ErrorReportingTest.java | 84 +++++
.../polygene/test/AbstractPolygeneBaseTest.java | 20 +-
.../polygene/library/rest/admin/RestTest.java | 2 +-
14 files changed, 495 insertions(+), 317 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java b/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
index ae03999..3b2f46d 100644
--- a/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
+++ b/core/api/src/main/java/org/apache/polygene/api/PolygeneAPI.java
@@ -140,30 +140,6 @@ public interface PolygeneAPI
AssociationDescriptor associationDescriptorFor( AbstractAssociation association );
/**
- * Function that returns the CompositeDescriptor of a Composite.
- */
- Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = composite -> {
- if( composite instanceof Proxy )
- {
- InvocationHandler invocationHandler = Proxy.getInvocationHandler( composite );
- return ( (CompositeInstance) invocationHandler ).descriptor();
- }
- try
- {
- Class<? extends Composite> compositeClass = composite.getClass();
- Field instanceField = compositeClass.getField( "_instance" );
- Object instance = instanceField.get( composite );
- return ( (CompositeInstance) instance ).descriptor();
- }
- catch( Exception e )
- {
- InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
- exception.initCause( e );
- throw exception;
- }
- };
-
- /**
* Function that returns the CompositeInstance of a Composite.
*/
Function<Composite, CompositeInstance> FUNCTION_COMPOSITE_INSTANCE_OF = composite -> {
@@ -180,9 +156,12 @@ public interface PolygeneAPI
}
catch( Exception e )
{
- InvalidCompositeException exception = new InvalidCompositeException( "Could not get _instance field" );
- exception.initCause( e );
- throw exception;
+ throw new InternalError( "Could not get _instance field. This field should have been automatically generated by the Polygene runtime.", e );
}
};
+
+ /**
+ * Function that returns the CompositeDescriptor of a Composite.
+ */
+ Function<Composite, CompositeDescriptor> FUNCTION_DESCRIPTOR_FOR = FUNCTION_COMPOSITE_INSTANCE_OF.andThen( CompositeInstance::descriptor );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
index d9de0c7..4f8b3e3 100644
--- a/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
+++ b/core/api/src/main/java/org/apache/polygene/api/composite/InvalidCompositeException.java
@@ -19,14 +19,110 @@
*/
package org.apache.polygene.api.composite;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.structure.ModuleDescriptor;
+
/**
* This exception is thrown if a Composite is invalid.
*/
-public class InvalidCompositeException
- extends RuntimeException
+public class InvalidCompositeException extends RuntimeException
{
- public InvalidCompositeException( String message )
+ private static boolean aggregateProblems = true;
+ private static ThreadLocal<ArrayList<InvalidCompositeException>> report = ThreadLocal.withInitial( ArrayList::new );
+ private ModuleDescriptor module;
+ private Class<?> primaryType;
+ private Class<?> fragmentClass;
+ private Type valueType;
+ private Member member;
+ private List<Class<?>> types;
+
+ public static void handleInvalidCompsiteType( String message, ModuleDescriptor module, Class<?> primaryType, Class<?> fragmentClass, Type valueType, Member member, List<Class<?>> types )
+ {
+ InvalidCompositeException exception = new InvalidCompositeException( message, module, primaryType, fragmentClass, valueType, member, types );
+ if( aggregateProblems )
+ {
+ report.get().add( exception );
+ return;
+ }
+ throw exception;
+ }
+
+ private InvalidCompositeException( String message, ModuleDescriptor module, Class<?> primaryType, Class<?> fragmentClass, Type valueType, Member member, List<Class<?>> types )
{
super( message );
+ this.module = module;
+ this.primaryType = primaryType;
+ this.fragmentClass = fragmentClass;
+ this.valueType = valueType;
+ this.member = member;
+ this.types = types;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String typeNames = typesString();
+ String primary = primaryType == null ? "" : " primary: " + primaryType.toGenericString() + "\n";
+ String methodName = memberString();
+ String message = super.getMessage() == null ? "" : " message: " + super.getMessage() + "\n";
+ String fragment = fragmentClass == null ? "" : " fragmentClass: " + fragmentClass.getName() + "\n";
+ String valueType = this.valueType == null ? "" : " valueType: " + this.valueType.getTypeName() + "\n";
+ String module = this.module == null ? "" : " layer: " + this.module.layer().name() + "\n module: " + this.module.name() + "\n";
+ return message + module + primary + fragment + methodName + valueType + typeNames;
+ }
+
+ private String typesString()
+ {
+ if( types == null || types.size() == 0 )
+ {
+ return "";
+ }
+ return " types: "
+ + types.stream()
+ .map( Class::getSimpleName )
+ .collect( Collectors.joining( ",", "[", "]" ) )
+ + "\n";
+ }
+
+ private String memberString()
+ {
+ if( member == null )
+ {
+ return "";
+ }
+ if( member instanceof Method )
+ {
+ Method method = (Method) member;
+ String parameters = Arrays.stream( method.getParameters() ).map( p -> p.getType().getSimpleName() + " " + p.getName() ).collect( Collectors.joining( ", ", "(", ")" ) );
+ return " method: " + method.getReturnType().getSimpleName() + " " + method.getName() + parameters + "\n";
+ }
+ if( member instanceof Field )
+ {
+ Field field = (Field) member;
+ return " field: " + field.getType().getSimpleName() + " " + field.getName() + "\n";
+ }
+ return member.toString();
+ }
+
+ public static String modelReport()
+ {
+ if( report.get().size() > 0 )
+ {
+ return "\nComposition Problems Report:\n"
+ + report.get().stream()
+ .map( Throwable::getMessage )
+ .map( m -> m + "\n--\n" )
+ .collect( Collectors.joining( "" ) );
+ }
+ aggregateProblems = false;
+ return null;
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
new file mode 100644
index 0000000..0129233
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.bootstrap;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Thrown when one or more assembly problems has occurred.
+ */
+public class AssemblyResportException extends AssemblyException
+{
+ private List<Throwable> problems;
+ private String modelReport;
+
+ public AssemblyResportException( List<Throwable> problems )
+ {
+ this.problems = problems;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String message;
+ if( modelReport == null )
+ {
+ message = "\nComposition Problems Report:\n";
+ }
+ else
+ {
+ message = modelReport;
+ }
+ return message + problems.stream()
+ .map( Throwable::getMessage )
+ .map( m -> m + "\n--\n" )
+ .collect( Collectors.joining( "" ) );
+ }
+
+ public void attacheModelReport( String modelReport )
+ {
+ this.modelReport = modelReport;
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
deleted file mode 100644
index c827e04..0000000
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ConfigurationAssembly.java
+++ /dev/null
@@ -1,30 +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.bootstrap;
-
-import org.apache.polygene.api.type.HasTypes;
-
-/**
- * This represents the assembly information of a single ConfigurationComposite in a Module.
- */
-public interface ConfigurationAssembly
- extends HasTypes
-{
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
index 88c84f1..67b6da4 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
@@ -21,6 +21,7 @@
package org.apache.polygene.bootstrap;
import org.apache.polygene.api.PolygeneAPI;
+import org.apache.polygene.api.composite.InvalidCompositeException;
import org.apache.polygene.api.structure.Application;
import org.apache.polygene.api.structure.ApplicationDescriptor;
import org.apache.polygene.spi.PolygeneSPI;
@@ -71,7 +72,22 @@ public final class Energy4Java
try
{
ApplicationModelFactory modelFactory = runtime.applicationModelFactory();
- return modelFactory.newApplicationModel( assembly );
+ ApplicationDescriptor model = modelFactory.newApplicationModel( assembly );
+ String modelReport = InvalidCompositeException.modelReport();
+ if( modelReport != null )
+ {
+ throw new AssemblyException( "Composition problems\n\n" + modelReport );
+ }
+ return model;
+ }
+ catch( AssemblyResportException e )
+ {
+ e.attacheModelReport( InvalidCompositeException.modelReport() );
+ throw e;
+ }
+ catch( AssemblyException e )
+ {
+ throw e;
}
catch( RuntimeException e )
{
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
index 47c3729..d57b5d8 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ModuleAssembly.java
@@ -152,8 +152,8 @@ public interface ModuleAssembly
ConfigurationDeclaration configurations( Class<?>... configurationTypes );
/**
- * Given a Specification for ConfigurationAssembly's, returns a ConfigurationDeclaration that can
- * be used to work with all of the assemblies matched by the specification.
+ * Given a Specification for Configuration, returns a ConfigurationDeclaration that can be used to work with all
+ * of the assemblies matched by the specification.
*
* @param specification The Specification that specifies the ConfigurationComposite types of interest.
*
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/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 709f614..bb4254d 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
@@ -48,7 +48,6 @@ import org.apache.polygene.api.common.Optional;
import org.apache.polygene.api.common.QualifiedName;
import org.apache.polygene.api.common.UseDefaults;
import org.apache.polygene.api.common.Visibility;
-import org.apache.polygene.api.composite.InvalidCompositeException;
import org.apache.polygene.api.concern.Concerns;
import org.apache.polygene.api.constraint.Constraint;
import org.apache.polygene.api.constraint.ConstraintDeclaration;
@@ -69,6 +68,7 @@ import org.apache.polygene.api.util.Annotations;
import org.apache.polygene.api.util.Classes;
import org.apache.polygene.api.util.Fields;
import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
+import org.apache.polygene.bootstrap.AssemblyResportException;
import org.apache.polygene.bootstrap.StateDeclarations;
import org.apache.polygene.runtime.association.AssociationModel;
import org.apache.polygene.runtime.association.AssociationsModel;
@@ -98,6 +98,7 @@ import org.apache.polygene.runtime.property.PropertiesModel;
import org.apache.polygene.runtime.property.PropertyModel;
import static java.util.stream.Stream.concat;
+import static org.apache.polygene.api.composite.InvalidCompositeException.handleInvalidCompsiteType;
import static org.apache.polygene.api.util.Annotations.isType;
import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
import static org.apache.polygene.api.util.Classes.classHierarchy;
@@ -126,11 +127,11 @@ public abstract class CompositeAssemblyImpl
protected MixinsModel mixinsModel;
protected CompositeMethodsModel compositeMethodsModel;
private AssemblyHelper helper;
- protected StateDeclarations stateDeclarations;
+ private StateDeclarations stateDeclarations;
- protected Set<String> registeredStateNames = new HashSet<>();
+ private Set<String> registeredStateNames = new HashSet<>();
- public CompositeAssemblyImpl( Class<?> mainType )
+ CompositeAssemblyImpl( Class<?> mainType )
{
types.add( mainType );
}
@@ -151,9 +152,9 @@ public abstract class CompositeAssemblyImpl
return new MixinsModel();
}
- protected void buildComposite( AssemblyHelper helper,
- StateDeclarations stateDeclarations
- )
+ void buildComposite( AssemblyHelper helper,
+ StateDeclarations stateDeclarations
+ )
{
this.stateDeclarations = stateDeclarations;
this.helper = helper;
@@ -167,7 +168,6 @@ public abstract class CompositeAssemblyImpl
propertiesModel = new PropertiesModel();
stateModel = createStateModel();
mixinsModel = createMixinsModel();
-// compositeMethodsModel = new CompositeMethodsModel();
compositeMethodsModel = new CompositeMethodsModel( mixinsModel );
// Implement composite methods
@@ -181,7 +181,7 @@ public abstract class CompositeAssemblyImpl
concernClasses,
sideEffectClasses,
mixinClasses
- );
+ );
// Add state from methods and fields
//noinspection unchecked
@@ -208,86 +208,103 @@ public abstract class CompositeAssemblyImpl
List<Class<?>> concernClasses,
List<Class<?>> sideEffectClasses,
List<Class<?>> mixinClasses
- )
+ )
{
+ List<Throwable> exceptions = new ArrayList<>();
Set<Class<?>> thisDependencies = new HashSet<>();
- types.forEach( mixinType -> {
- for( Method method : mixinType.getMethods() )
- {
- if( !compositeMethodsModel.isImplemented( method )
- && !Proxy.class.equals( method.getDeclaringClass().getSuperclass() )
- && !Proxy.class.equals( method.getDeclaringClass() )
- && !Modifier.isStatic( method.getModifiers() ) )
- {
- MixinModel mixinModel = implementMethod( method, mixinClasses );
- ConcernsModel concernsModel = concernsFor(
- method,
- mixinModel.mixinClass(),
- concat( concernDeclarations( mixinModel.mixinClass() ),
- concernClasses.stream() )
- );
- SideEffectsModel sideEffectsModel = sideEffectsFor(
- method,
- mixinModel.mixinClass(),
- concat( sideEffectDeclarations( mixinModel.mixinClass() ),
- sideEffectClasses.stream() )
- );
- method.setAccessible( true );
- ConstraintsModel constraints = constraintsFor(
- method,
- toList( concat( constraintDeclarations( mixinModel.mixinClass() ),
- constraintClasses.stream() ) )
- );
- CompositeMethodModel methodComposite = new CompositeMethodModel(
- method,
- constraints,
- concernsModel,
- sideEffectsModel,
- mixinsModel
- );
-
- Stream<? extends Dependencies> source = Stream.of( methodComposite, mixinModel );
- source.flatMap( Dependencies::dependencies )
- .filter( new DependencyModel.ScopeSpecification( This.class ) )
- .map( DependencyModel::rawInjectionType )
- .forEach( thisDependencies::add );
-
- interfacesOf( mixinModel.mixinClass() )
- .map( Classes.RAW_CLASS )
- .filter( clazz -> Stream.of( Initializable.class, Lifecycle.class, InvocationHandler.class )
- .noneMatch( c -> c.equals( clazz ) ) )
- .forEach( thisDependencies::add );
-
- compositeMethodsModel.addMethod( methodComposite );
- }
- }
- // Add type to set of mixin types
- mixinsModel.addMixinType( mixinType );
- } );
+ types.forEach( mixinType ->
+ {
+ for( Method method : mixinType.getMethods() )
+ {
+ try
+ {
+ if( !compositeMethodsModel.isImplemented( method )
+ && !Proxy.class.equals( method.getDeclaringClass().getSuperclass() )
+ && !Proxy.class.equals( method.getDeclaringClass() )
+ && !Modifier.isStatic( method.getModifiers() ) )
+ {
+ MixinModel mixinModel = implementMethod( method, mixinClasses );
+ if( mixinModel != null )
+ {
+ ConcernsModel concernsModel = concernsFor(
+ method,
+ mixinModel.mixinClass(),
+ concat( concernDeclarations( mixinModel.mixinClass() ),
+ concernClasses.stream() )
+ );
+ SideEffectsModel sideEffectsModel = sideEffectsFor(
+ method,
+ mixinModel.mixinClass(),
+ concat( sideEffectDeclarations( mixinModel.mixinClass() ),
+ sideEffectClasses.stream() )
+ );
+ method.setAccessible( true );
+ ConstraintsModel constraints = constraintsFor(
+ method,
+ toList( concat( constraintDeclarations( mixinModel.mixinClass() ),
+ constraintClasses.stream() ) )
+ );
+ CompositeMethodModel methodComposite = new CompositeMethodModel(
+ method,
+ constraints,
+ concernsModel,
+ sideEffectsModel,
+ mixinsModel
+ );
+
+ Stream<? extends Dependencies> source = Stream.of( methodComposite, mixinModel );
+ source.flatMap( Dependencies::dependencies )
+ .filter( new DependencyModel.ScopeSpecification( This.class ) )
+ .map( DependencyModel::rawInjectionType )
+ .forEach( thisDependencies::add );
+
+ interfacesOf( mixinModel.mixinClass() )
+ .map( Classes.RAW_CLASS )
+ .filter( clazz -> Stream.of( Initializable.class, Lifecycle.class, InvocationHandler.class )
+ .noneMatch( c -> c.equals( clazz ) ) )
+ .forEach( thisDependencies::add );
+
+ compositeMethodsModel.addMethod( methodComposite );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ }
+ }
+ // Add type to set of mixin types
+ mixinsModel.addMixinType( mixinType );
+ } );
// Implement all @This dependencies that were found
- thisDependencies.forEach( thisDependency -> {
- // Add additional declarations from the @This type
- Stream<Class<?>> typeConstraintClasses = concat(
- constraintClasses.stream(),
- constraintDeclarations( thisDependency ) );
- Stream<Class<?>> typeConcernClasses = concat(
- concernClasses.stream(),
- concernDeclarations( thisDependency ) );
- Stream<Class<?>> typeSideEffectClasses = concat(
- sideEffectClasses.stream(),
- sideEffectDeclarations( thisDependency ) );
- Stream<Class<?>> typeMixinClasses = concat(
- mixinClasses.stream(),
- mixinDeclarations( thisDependency ) );
- List<? extends Class<?>> singleton = Collections.singletonList( thisDependency );
- implementMixinType( singleton,
- toList( typeConstraintClasses ),
- toList( typeConcernClasses ),
- toList( typeSideEffectClasses ),
- toList( typeMixinClasses )
- );
- } );
+ thisDependencies.forEach( thisDependency ->
+ {
+ // Add additional declarations from the @This type
+ Stream<Class<?>> typeConstraintClasses = concat(
+ constraintClasses.stream(),
+ constraintDeclarations( thisDependency ) );
+ Stream<Class<?>> typeConcernClasses = concat(
+ concernClasses.stream(),
+ concernDeclarations( thisDependency ) );
+ Stream<Class<?>> typeSideEffectClasses = concat(
+ sideEffectClasses.stream(),
+ sideEffectDeclarations( thisDependency ) );
+ Stream<Class<?>> typeMixinClasses = concat(
+ mixinClasses.stream(),
+ mixinDeclarations( thisDependency ) );
+ List<? extends Class<?>> singleton = Collections.singletonList( thisDependency );
+ implementMixinType( singleton,
+ toList( typeConstraintClasses ),
+ toList( typeConcernClasses ),
+ toList( typeSideEffectClasses ),
+ toList( typeMixinClasses )
+ );
+ } );
+ if( exceptions.size() > 0 )
+ {
+ throw new AssemblyResportException( exceptions );
+ }
}
@SuppressWarnings( "raw" )
@@ -311,8 +328,8 @@ public abstract class CompositeAssemblyImpl
return implementMethodWithClass( method, mixinClass );
}
- throw new InvalidCompositeException( "No implementation found for method \n " + method.toGenericString()
- + "\nin\n " + types );
+ handleInvalidCompsiteType( "No implementation found for method ", null, null, null, null, method, types );
+ return null;
}
private Class<?> findTypedImplementation( final Method method, Stream<Class<?>> mixins )
@@ -383,8 +400,8 @@ public abstract class CompositeAssemblyImpl
MixinModel model = (MixinModel) visited;
Consumer<Field> addState = field -> addStateFor( field, constraintClasses );
Fields.FIELDS_OF.apply( model.mixinClass() )
- .filter( Annotations.hasAnnotation( State.class ) )
- .forEach( addState );
+ .filter( Annotations.hasAnnotation( State.class ) )
+ .forEach( addState );
return false;
}
return super.visitEnter( visited );
@@ -441,7 +458,7 @@ public abstract class CompositeAssemblyImpl
protected PropertyModel newPropertyModel( AccessibleObject accessor,
List<Class<?>> constraintClasses
- )
+ )
{
List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
@@ -466,7 +483,7 @@ 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);
+ InitialValueProvider initialValueProvider = metaInfo.get( InitialValueProvider.class );
return new PropertyModel(
accessor,
immutable,
@@ -481,7 +498,7 @@ public abstract class CompositeAssemblyImpl
// Model
private ConstraintsModel constraintsFor( Method method,
List<Class<?>> constraintClasses
- )
+ )
{
List<ValueConstraintsModel> parameterConstraintModels = Collections.emptyList();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
@@ -496,8 +513,8 @@ public abstract class CompositeAssemblyImpl
String name = nameAnnotation == null ? "param" + ( i + 1 ) : nameAnnotation.value();
boolean optional = Stream.of( parameterAnnotation )
- .filter( isType( Optional.class ) )
- .findFirst().isPresent();
+ .filter( isType( Optional.class ) )
+ .findFirst().isPresent();
ValueConstraintsModel parameterConstraintsModel = constraintsFor(
Arrays.stream( parameterAnnotation ),
parameterTypes[ i ],
@@ -534,7 +551,7 @@ public abstract class CompositeAssemblyImpl
boolean optional,
Iterable<Class<?>> constraintClasses,
AccessibleObject accessor
- )
+ )
{
valueType = wrapperClass( valueType );
@@ -576,7 +593,7 @@ public abstract class CompositeAssemblyImpl
// No implementation found!
// Check if if it's a composite constraints
if( Arrays.stream( annotationType.getAnnotations() )
- .anyMatch( typeHasAnnotation( ConstraintDeclaration.class ) ) )
+ .anyMatch( typeHasAnnotation( ConstraintDeclaration.class ) ) )
{
ValueConstraintsModel valueConstraintsModel = constraintsFor(
Arrays.stream( annotationType.getAnnotations() ),
@@ -592,14 +609,7 @@ public abstract class CompositeAssemblyImpl
}
else
{
- throw new InvalidCompositeException(
- "Cannot find implementation of constraint @"
- + annotationType.getSimpleName()
- + " for "
- + valueType
- + " in method "
- + ( (Member) accessor ).getName()
- + " of composite " + types );
+ handleInvalidCompsiteType( "Cannot find implementation of constraint @", null, annotationType, null, valueType, (Member) accessor, types );
}
}
return new ValueConstraintsModel( constraintModels, name, optional );
@@ -608,34 +618,35 @@ public abstract class CompositeAssemblyImpl
private ConcernsModel concernsFor( Method method,
Class<?> mixinClass,
Stream<Class<?>> concernClasses
- )
+ )
{
List<ConcernModel> concernsFor = new ArrayList<>();
- concernClasses.forEach( concern -> {
- if( helper.appliesTo( concern, method, types, mixinClass ) )
- {
- addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
- }
- else
- {
- // Lookup method in mixin
- if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
- {
- try
- {
- Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
- if( helper.appliesTo( concern, mixinMethod, types, mixinClass ) )
- {
- addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
- }
- }
- catch( NoSuchMethodException e )
- {
- // Ignore
- }
- }
- }
- } );
+ concernClasses.forEach( concern ->
+ {
+ if( helper.appliesTo( concern, method, types, mixinClass ) )
+ {
+ addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
+ }
+ else
+ {
+ // Lookup method in mixin
+ if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
+ {
+ try
+ {
+ Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
+ if( helper.appliesTo( concern, mixinMethod, types, mixinClass ) )
+ {
+ addConcernOrRepositionIfExists( concernsFor, helper.getConcernModel( concern ) );
+ }
+ }
+ catch( NoSuchMethodException e )
+ {
+ // Ignore
+ }
+ }
+ }
+ } );
// Check annotations on method that have @Concerns annotations themselves
for( Annotation annotation : method.getAnnotations() )
@@ -675,35 +686,36 @@ public abstract class CompositeAssemblyImpl
private SideEffectsModel sideEffectsFor( Method method,
Class<?> mixinClass,
Stream<Class<?>> sideEffectClasses
- )
+ )
{
List<SideEffectModel> sideEffectsFor = new ArrayList<>();
- sideEffectClasses.forEach( sideEffect -> {
- SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
- if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
- {
- addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
- }
- else
- {
- // Lookup method in mixin
- if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
- {
- try
- {
- Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
- if( helper.appliesTo( sideEffect, mixinMethod, types, mixinClass ) )
- {
- addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
- }
- }
- catch( NoSuchMethodException e )
- {
- // Ignore
- }
- }
- }
- } );
+ sideEffectClasses.forEach( sideEffect ->
+ {
+ SideEffectModel sideEffectModel = helper.getSideEffectModel( sideEffect );
+ if( helper.appliesTo( sideEffect, method, types, mixinClass ) )
+ {
+ addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
+ }
+ else
+ {
+ // Lookup method in mixin
+ if( !InvocationHandler.class.isAssignableFrom( mixinClass ) )
+ {
+ try
+ {
+ Method mixinMethod = mixinClass.getMethod( method.getName(), method.getParameterTypes() );
+ if( helper.appliesTo( sideEffect, mixinMethod, types, mixinClass ) )
+ {
+ addSideEffectOrRepositionIfExists( sideEffectsFor, sideEffectModel );
+ }
+ }
+ catch( NoSuchMethodException e )
+ {
+ // Ignore
+ }
+ }
+ }
+ } );
// Check annotations on method that have @Concerns annotations themselves
for( Annotation annotation : method.getAnnotations() )
@@ -735,7 +747,7 @@ public abstract class CompositeAssemblyImpl
private void addSideEffectOrRepositionIfExists( List<SideEffectModel> sideEffectsFor,
SideEffectModel sideEffectModel
- )
+ )
{
// This add/remove is to allow reording of SideEffects.
sideEffectsFor.remove( sideEffectModel );
@@ -800,8 +812,8 @@ public abstract class CompositeAssemblyImpl
private Stream<Class<?>> mixinDeclarations( Stream<? extends Class> types )
{
return types.flatMap( this::getTypes ).flatMap( Classes::typesOf )
- .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
- .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
+ .filter( mixinType -> Annotations.annotationOn( mixinType, Mixins.class ) != null )
+ .flatMap( mixinType -> Arrays.stream( Annotations.annotationOn( mixinType, Mixins.class ).value() ) );
}
private Stream<Class> getAllTypes()
@@ -823,7 +835,7 @@ public abstract class CompositeAssemblyImpl
public AssociationModel newAssociationModel( AccessibleObject accessor,
List<Class<?>> constraintClasses
- )
+ )
{
List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
@@ -859,7 +871,7 @@ public abstract class CompositeAssemblyImpl
public ManyAssociationModel newManyAssociationModel( AccessibleObject accessor,
List<Class<?>> constraintClasses
- )
+ )
{
List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
@@ -886,7 +898,7 @@ public abstract class CompositeAssemblyImpl
public NamedAssociationModel newNamedAssociationModel( AccessibleObject accessor,
List<Class<?>> constraintClasses
- )
+ )
{
List<Annotation> annotations = Annotations.findAccessorAndTypeAnnotationsIn( accessor );
boolean optional = annotations.stream().anyMatch( isType( Optional.class ) );
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
deleted file mode 100644
index 8bbee50..0000000
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ConfigurationAssemblyImpl.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.runtime.bootstrap;
-
-import java.util.stream.Stream;
-import org.apache.polygene.bootstrap.ConfigurationAssembly;
-
-/**
- * Declaration of a EntityComposite.
- */
-public final class ConfigurationAssemblyImpl
- implements ConfigurationAssembly
-{
- private ValueAssemblyImpl value;
- private EntityAssemblyImpl entity;
-
- public ConfigurationAssemblyImpl( Class<?> mainType )
- {
- value = new ValueAssemblyImpl( mainType );
- entity = new EntityAssemblyImpl( mainType );
- }
-
- @Override
- public Stream<Class<?>> types()
- {
- return value.types();
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
index 2f1e81d..5c2c91f 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/CompositeModel.java
@@ -40,6 +40,7 @@ import org.apache.polygene.runtime.injection.Dependencies;
import org.apache.polygene.runtime.injection.DependencyModel;
import static java.lang.reflect.Proxy.newProxyInstance;
+import static org.apache.polygene.api.composite.InvalidCompositeException.handleInvalidCompsiteType;
/**
* JAVADOC
@@ -47,16 +48,18 @@ import static java.lang.reflect.Proxy.newProxyInstance;
public abstract class CompositeModel
implements VisitableHierarchy<Object, Object>, Dependencies, CompositeDescriptor
{
+ protected final ModuleDescriptor module;
protected final MixinsModel mixinsModel;
protected final CompositeMethodsModel compositeMethodsModel;
+ protected final StateModel stateModel;
+
+ private final Class<?> primaryType;
private final Set<Class<?>> types;
private final Visibility visibility;
private final MetaInfo metaInfo;
- protected final StateModel stateModel;
- private volatile Class<?> primaryType;
- protected Class<? extends Composite> proxyClass;
- protected Constructor<? extends Composite> proxyConstructor;
- protected ModuleDescriptor module;
+
+ private Class<? extends Composite> proxyClass;
+ private Constructor<? extends Composite> proxyConstructor;
protected CompositeModel( final ModuleDescriptor module,
final List<Class<?>> types,
@@ -76,7 +79,17 @@ public abstract class CompositeModel
this.mixinsModel = mixinsModel;
// Create proxy class
- createProxyClass();
+ @SuppressWarnings( "OptionalGetWithoutIsPresent" )
+ Class<?> mainType = types.stream().findFirst().get();
+ try
+ {
+ proxyClass = createProxyClass( mainType );
+ proxyConstructor = createProxyConstructor( mainType );
+ }
+ catch( ClassNotFoundException | NoSuchMethodException e )
+ {
+ handleInvalidCompsiteType( e.getMessage(), module, mainType, null, null, null, types );
+ }
primaryType = mixinTypes()
.reduce( null, ( primary, type ) ->
{
@@ -172,38 +185,39 @@ public abstract class CompositeModel
}
@SuppressWarnings( { "raw", "unchecked" } )
- private void createProxyClass()
+ private Class<? extends Composite> createProxyClass( Class<?> mainType )
+ throws ClassNotFoundException, NoSuchMethodException
{
- Class<?> mainType = types.stream().findFirst().get();
+ Class<? extends Composite> proxyClass;
if( mainType.isInterface() )
{
ClassLoader proxyClassloader = mainType.getClassLoader();
Class<?>[] interfaces = types.stream().map( Class.class::cast ).toArray( Class[]::new );
proxyClass = (Class<? extends Composite>) ProxyGenerator.createProxyClass( proxyClassloader, interfaces );
+ }
+ else
+ {
+ proxyClass = new TransientClassLoader( getClass().getClassLoader() ).loadFragmentClass( mainType );
+ }
+ return proxyClass;
+ }
- try
- {
- proxyConstructor = proxyClass.getConstructor( InvocationHandler.class );
- }
- catch( NoSuchMethodException e )
- {
- throw (InvalidCompositeException) new InvalidCompositeException( "Could not get proxy constructor" ).initCause( e );
- }
- proxyConstructor.setAccessible( true );
+ @SuppressWarnings( { "raw", "unchecked" } )
+ private Constructor<? extends Composite> createProxyConstructor( Class<?> mainType )
+ throws ClassNotFoundException, NoSuchMethodException
+ {
+ Constructor<? extends Composite> constructor;
+ if( mainType.isInterface() )
+ {
+ constructor = proxyClass.getConstructor( InvocationHandler.class );
}
else
{
- try
- {
- proxyClass = new TransientClassLoader( getClass().getClassLoader() ).loadFragmentClass( mainType );
- proxyConstructor = (Constructor<? extends Composite>) proxyClass.getConstructors()[ 0 ];
- }
- catch( ClassNotFoundException e )
- {
- throw (InvalidCompositeException) new InvalidCompositeException( "Could not get proxy constructor" ).initCause( e );
- }
+ constructor = (Constructor<? extends Composite>) proxyClass.getConstructors()[ 0 ];
}
+ constructor.setAccessible( true );
+ return constructor;
}
// Context
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
index bc4be4a..750a019 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/ConstructorsModel.java
@@ -33,7 +33,6 @@ import java.util.List;
import java.util.stream.Stream;
import org.apache.polygene.api.common.ConstructionException;
import org.apache.polygene.api.composite.CompositeDescriptor;
-import org.apache.polygene.api.composite.InvalidCompositeException;
import org.apache.polygene.api.injection.InjectionScope;
import org.apache.polygene.api.injection.scope.Uses;
import org.apache.polygene.api.util.Classes;
@@ -49,6 +48,7 @@ import org.apache.polygene.runtime.injection.ParameterizedTypeInstance;
import org.apache.polygene.runtime.model.Binder;
import org.apache.polygene.runtime.model.Resolution;
+import static org.apache.polygene.api.composite.InvalidCompositeException.handleInvalidCompsiteType;
import static org.apache.polygene.api.util.Annotations.typeHasAnnotation;
/**
@@ -104,7 +104,7 @@ public final class ConstructorsModel
{
return;
}
- throw new InvalidCompositeException( "Inner classes can not be used. Use static nested classes instead: " + fragmentClass );
+ handleInvalidCompsiteType( "Inner classes can not be used. Use static nested classes instead.", null, null, fragmentClass, null, null, null );
}
@Override
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
index 399e3f2..d147134 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/composite/TypedModifierInvocationHandler.java
@@ -23,6 +23,8 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.apache.polygene.api.composite.InvalidCompositeException;
+import static org.apache.polygene.api.composite.InvalidCompositeException.handleInvalidCompsiteType;
+
/**
* JAVADOC
*/
@@ -43,10 +45,6 @@ public final class TypedModifierInvocationHandler
}
catch( Throwable e )
{
- if( fragment == null )
- {
- throw new InvalidCompositeException( "No fragment available for method " + method.getName() );
- }
throw cleanStackTrace( e, proxy, method );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
new file mode 100644
index 0000000..7d1606d
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.bootstrap;
+
+import java.util.Map;
+import org.apache.polygene.api.association.Association;
+import org.apache.polygene.api.association.ManyAssociation;
+import org.apache.polygene.api.property.Property;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.Test;
+
+import static org.hamcrest.core.StringContains.containsString;
+import static org.junit.Assert.assertThat;
+
+public class ErrorReportingTest extends AbstractPolygeneTest
+{
+ @Override
+ public void assemble( ModuleAssembly module )
+ throws AssemblyException
+ {
+ module.values( Person.class );
+ module.values( Pet.class );
+ }
+
+ @Override
+ protected void assemblyException( AssemblyException exception )
+ throws AssemblyException
+ {
+ assertThat( exception.getMessage(), containsString( "Composition problems\n" ) );
+ assertThat( exception.getMessage(), containsString( "Composition Problems Report:\n" ) );
+ assertThat( exception.getMessage(), containsString( " message: No implementation found for method \n"
+ + " method: Map doAnotherThing(String name, int value)\n"
+ + " types: [Person,ValueComposite]\n" ) );
+
+ assertThat( exception.getMessage(), containsString( " message: No implementation found for method \n"
+ + " method: void doOneThing()\n"
+ + " types: [Person,ValueComposite]\n" ) );
+
+ assertThat( exception.getMessage(), containsString( " message: No implementation found for method \n"
+ + " method: void goForWalk(int minutes)\n"
+ + " types: [Pet,ValueComposite]\n" ) );
+ }
+
+ @Test
+ public void dummy()
+ {
+
+ }
+
+ public interface Person
+ {
+ void doOneThing();
+
+ Map<String, Integer> doAnotherThing( String name, int value );
+
+ Property<String> name();
+
+ Association<Person> spouse();
+
+ ManyAssociation<Pet> pets();
+ }
+
+ public interface Pet
+ {
+ void goForWalk( int minutes );
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
----------------------------------------------------------------------
diff --git a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
index 18e1c24..6d7d6ba 100644
--- a/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
+++ b/core/testsupport/src/main/java/org/apache/polygene/test/AbstractPolygeneBaseTest.java
@@ -27,7 +27,6 @@ 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.ApplicationAssemblyFactory;
import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.Energy4Java;
import org.apache.polygene.spi.PolygeneSPI;
@@ -49,7 +48,7 @@ public abstract class AbstractPolygeneBaseTest
throws Exception
{
polygene = new Energy4Java();
- applicationModel = newApplication();
+ applicationModel = newApplicationModel();
if( applicationModel == null )
{
// An AssemblyException has occurred that the Test wants to check for.
@@ -76,20 +75,15 @@ public abstract class AbstractPolygeneBaseTest
return applicationModel.newInstance( polygene.api() );
}
- protected ApplicationDescriptor newApplication()
+ protected ApplicationDescriptor newApplicationModel()
throws AssemblyException
{
- ApplicationAssembler assembler = new ApplicationAssembler()
+ ApplicationAssembler assembler = applicationFactory ->
{
- @Override
- public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
- throws AssemblyException
- {
- ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
- applicationAssembly.setMode( Application.Mode.test );
- defineApplication( applicationAssembly );
- return applicationAssembly;
- }
+ ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly();
+ applicationAssembly.setMode( Application.Mode.test );
+ defineApplication( applicationAssembly );
+ return applicationAssembly;
};
try
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/96de0124/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
----------------------------------------------------------------------
diff --git a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
index e320c99..f09e785 100644
--- a/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
+++ b/libraries/rest/src/test/java/org/apache/polygene/library/rest/admin/RestTest.java
@@ -70,7 +70,7 @@ public class RestTest extends AbstractPolygeneTest
private static final int ADMIN_PORT = FreePortFinder.findFreePortOnLoopback();
@Override
- protected ApplicationDescriptor newApplication()
+ protected ApplicationDescriptor newApplicationModel()
throws AssemblyException
{
return polygene.newApplicationModel( new ApplicationAssemblerAdapter(
[5/7] polygene-java git commit: POLYGENE-222 - Fixed a Identity
conversion problem.
Posted by ni...@apache.org.
POLYGENE-222 - Fixed a Identity conversion problem.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/8931fb27
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/8931fb27
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/8931fb27
Branch: refs/heads/develop
Commit: 8931fb27b5c38ce09fe374da260207dd8aadd0ba
Parents: 47d2ad6
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 4 10:02:48 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 4 10:02:48 2017 +0800
----------------------------------------------------------------------
.../index/sql/support/skeletons/AbstractSQLQuerying.java | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/8931fb27/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLQuerying.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLQuerying.java b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLQuerying.java
index 4b2cc22..331e034 100644
--- a/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLQuerying.java
+++ b/extensions/indexing-sql/src/main/java/org/apache/polygene/index/sql/support/skeletons/AbstractSQLQuerying.java
@@ -36,6 +36,7 @@ import org.apache.polygene.api.common.QualifiedName;
import org.apache.polygene.api.composite.Composite;
import org.apache.polygene.api.entity.EntityComposite;
import org.apache.polygene.api.identity.HasIdentity;
+import org.apache.polygene.api.identity.Identity;
import org.apache.polygene.api.injection.scope.Structure;
import org.apache.polygene.api.injection.scope.This;
import org.apache.polygene.api.injection.scope.Uses;
@@ -988,15 +989,17 @@ public abstract class AbstractSQLQuerying
QualifiedName qName
= QualifiedName.fromAccessor( predicate.property().accessor() );
String columnName;
+ Object value;
if( qName.type().equals( HasIdentity.class.getName() ) )
{
columnName = DBNames.ENTITY_TABLE_IDENTITY_COLUMN_NAME;
+ value = predicate.value().toString();
}
else
{
columnName = DBNames.QNAME_TABLE_VALUE_COLUMN_NAME;
+ value = predicate.value();
}
- Object value = predicate.value();
modifyFromClauseAndWhereClauseToGetValue(
qName, value, predicate,
negationActive, lastTableIndex,
@@ -1393,8 +1396,7 @@ public abstract class AbstractSQLQuerying
return this.findFromLookupTables( SQL_OPERATORS, null, predicate, false );
}
- protected JoinType
- getTableJoinStyle( Predicate<Composite> predicate, Boolean negationActive )
+ protected JoinType getTableJoinStyle( Predicate<Composite> predicate, Boolean negationActive )
{
return this.findFromLookupTables( JOIN_STYLES, NEGATED_JOIN_STYLES, predicate,
negationActive );
@@ -1428,8 +1430,7 @@ public abstract class AbstractSQLQuerying
return result;
}
- protected QuerySpecificationBuilder
- getBuilderForPredicate( SQLVendor vendor, String tableAlias )
+ protected QuerySpecificationBuilder getBuilderForPredicate( SQLVendor vendor, String tableAlias )
{
QueryFactory q = vendor.getQueryFactory();
ColumnsFactory c = vendor.getColumnsFactory();
[7/7] polygene-java git commit: Improving the assembly problem
reporting, by aggregating problems and reporting more in one single report.
Posted by ni...@apache.org.
Improving the assembly problem reporting, by aggregating problems and reporting more in one single report.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/0cf199bc
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0cf199bc
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0cf199bc
Branch: refs/heads/develop
Commit: 0cf199bc006da898d9b70c2d987875b0b4a86c22
Parents: 0321a7f
Author: niclas <ni...@spicter.com>
Authored: Fri Apr 7 16:22:02 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Fri Apr 7 16:22:02 2017 +0800
----------------------------------------------------------------------
.../bootstrap/AssemblyReportException.java | 83 +++++++++++++
.../bootstrap/AssemblyResportException.java | 60 ---------
.../apache/polygene/bootstrap/Energy4Java.java | 2 +-
.../polygene/runtime/PolygeneRuntimeImpl.java | 2 +-
.../bootstrap/CompositeAssemblyImpl.java | 6 +-
.../runtime/bootstrap/ModuleAssemblyImpl.java | 122 +++++++++++++++----
.../concerns/PropertyInheritanceTest.java | 16 +--
.../polygene/library/scripting/ScriptUtil.java | 32 -----
.../library/scripting/ScriptUtilImpl.java | 35 ------
.../library/scripting/ScriptUtilImplTest.java | 41 -------
10 files changed, 191 insertions(+), 208 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyReportException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyReportException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyReportException.java
new file mode 100644
index 0000000..e4139bd
--- /dev/null
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyReportException.java
@@ -0,0 +1,83 @@
+/*
+ * 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.bootstrap;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Thrown when one or more assembly problems has occurred.
+ */
+public class AssemblyReportException extends AssemblyException
+{
+ private List<Throwable> problems;
+ private String modelReport;
+
+ public AssemblyReportException( List<Throwable> problems )
+ {
+ this.problems = problems;
+ }
+
+ @Override
+ public String getMessage()
+ {
+ String message;
+ if( modelReport == null )
+ {
+ message = "\nComposition Problems Report:\n";
+ }
+ else
+ {
+ message = modelReport;
+ }
+ return message + problems.stream()
+ .map( this::composeMessage )
+ .map( m -> m + "\n--\n" )
+ .collect( Collectors.joining( "" ) );
+ }
+
+ public void attacheModelReport( String modelReport )
+ {
+ this.modelReport = modelReport;
+ }
+
+ private String composeMessage( Throwable exception )
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream( baos );
+ if( Boolean.getBoolean( "polygene.report.exceptions" ) )
+ {
+ exception.printStackTrace( ps );
+ }
+ else
+ {
+ StringBuilder indent = new StringBuilder( );
+ while( exception != null ){
+ indent = indent.append( " " );
+ ps.println(indent.toString() + exception.getMessage());
+ ps.println("---");
+ exception = exception.getCause();
+ }
+ }
+ return baos.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
deleted file mode 100644
index 0129233..0000000
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/AssemblyResportException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.bootstrap;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * Thrown when one or more assembly problems has occurred.
- */
-public class AssemblyResportException extends AssemblyException
-{
- private List<Throwable> problems;
- private String modelReport;
-
- public AssemblyResportException( List<Throwable> problems )
- {
- this.problems = problems;
- }
-
- @Override
- public String getMessage()
- {
- String message;
- if( modelReport == null )
- {
- message = "\nComposition Problems Report:\n";
- }
- else
- {
- message = modelReport;
- }
- return message + problems.stream()
- .map( Throwable::getMessage )
- .map( m -> m + "\n--\n" )
- .collect( Collectors.joining( "" ) );
- }
-
- public void attacheModelReport( String modelReport )
- {
- this.modelReport = modelReport;
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
index 67b6da4..a4cf0c3 100644
--- a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
+++ b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/Energy4Java.java
@@ -80,7 +80,7 @@ public final class Energy4Java
}
return model;
}
- catch( AssemblyResportException e )
+ catch( AssemblyReportException e )
{
e.attacheModelReport( InvalidCompositeException.modelReport() );
throw e;
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
index 2a0be69..372fb18 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/PolygeneRuntimeImpl.java
@@ -275,7 +275,7 @@ public final class PolygeneRuntimeImpl
ValueInstance valueInstance = ValueInstance.valueInstanceOf( (ValueComposite) value );
return valueInstance.descriptor();
}
- throw new IllegalArgumentException( "Wrong type. Must be subtype of " + ValueComposite.class );
+ throw new IllegalArgumentException( "Wrong type. {" + value + "} must be subtype of " + ValueComposite.class );
}
@Override
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/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 bb4254d..33b16b9 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
@@ -68,7 +68,7 @@ import org.apache.polygene.api.util.Annotations;
import org.apache.polygene.api.util.Classes;
import org.apache.polygene.api.util.Fields;
import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
-import org.apache.polygene.bootstrap.AssemblyResportException;
+import org.apache.polygene.bootstrap.AssemblyReportException;
import org.apache.polygene.bootstrap.StateDeclarations;
import org.apache.polygene.runtime.association.AssociationModel;
import org.apache.polygene.runtime.association.AssociationsModel;
@@ -214,6 +214,7 @@ public abstract class CompositeAssemblyImpl
Set<Class<?>> thisDependencies = new HashSet<>();
types.forEach( mixinType ->
{
+
for( Method method : mixinType.getMethods() )
{
try
@@ -270,6 +271,7 @@ public abstract class CompositeAssemblyImpl
}
catch( Exception e )
{
+ System.out.println("NICLAS 2: " + e.getClass() + " - " + e.getMessage());
exceptions.add( e );
}
}
@@ -303,7 +305,7 @@ public abstract class CompositeAssemblyImpl
} );
if( exceptions.size() > 0 )
{
- throw new AssemblyResportException( exceptions );
+ throw new AssemblyReportException( exceptions );
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
index 43478bf..011da1b 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ModuleAssemblyImpl.java
@@ -27,6 +27,7 @@ import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -49,6 +50,7 @@ import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
import org.apache.polygene.api.value.ValueComposite;
import org.apache.polygene.bootstrap.Assembler;
import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.AssemblyReportException;
import org.apache.polygene.bootstrap.AssemblySpecifications;
import org.apache.polygene.bootstrap.AssemblyVisitor;
import org.apache.polygene.bootstrap.ConfigurationDeclaration;
@@ -497,6 +499,7 @@ final class ModuleAssemblyImpl
throws AssemblyException
{
addDefaultAssemblers();
+ List<Throwable> exceptions = new ArrayList<>();
List<TransientModel> transientModels = new ArrayList<>();
List<ObjectModel> objectModels = new ArrayList<>();
List<ValueModel> valueModels = new ArrayList<>();
@@ -520,20 +523,56 @@ final class ModuleAssemblyImpl
}
transientModels.addAll(transientAssemblies.values().stream()
- .map(composite -> composite.newTransientModel(moduleModel, metaInfoDeclaration, helper))
+ .map( composite ->
+ {
+ try
+ {
+ return composite.newTransientModel( moduleModel, metaInfoDeclaration, helper );
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ return null;
+ }
+ } )
+ .filter( Objects::nonNull )
.collect(toList()));
valueModels.addAll(valueAssemblies.values().stream()
- .map(value -> value.newValueModel(moduleModel, metaInfoDeclaration, helper))
+ .map( value ->
+ {
+ try
+ {
+ return value.newValueModel( moduleModel, metaInfoDeclaration, helper );
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ return null;
+ }
+ } )
+ .filter( Objects::nonNull )
.collect(toList()));
entityModels.addAll(entityAssemblies.values().stream()
- .map(entityDeclaration -> entityDeclaration.newEntityModel(moduleModel,
- metaInfoDeclaration,
- metaInfoDeclaration,
- metaInfoDeclaration,
- metaInfoDeclaration,
- helper))
+ .map( entityDeclaration ->
+ {
+ try
+ {
+ return entityDeclaration.newEntityModel( moduleModel,
+ metaInfoDeclaration,
+ metaInfoDeclaration,
+ metaInfoDeclaration,
+ metaInfoDeclaration,
+ helper );
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ return null;
+ }
+ } )
+ .filter( Objects::nonNull )
.collect(Collectors.toList()));
for (ObjectAssemblyImpl objectDeclaration : objectAssemblies.values())
@@ -541,15 +580,27 @@ final class ModuleAssemblyImpl
objectDeclaration.addObjectModel(moduleModel, objectModels);
}
- for (ServiceAssemblyImpl serviceDeclaration : serviceAssemblies)
- {
- if (serviceDeclaration.identity == null)
- {
- serviceDeclaration.identity = generateId(serviceDeclaration.types());
- }
-
- serviceModels.add(serviceDeclaration.newServiceModel(moduleModel, metaInfoDeclaration, helper));
- }
+ serviceModels.addAll(
+ serviceAssemblies
+ .stream()
+ .map( serviceDeclaration ->
+ {
+ try
+ {
+ if( serviceDeclaration.identity == null )
+ {
+ serviceDeclaration.identity = generateId( serviceDeclaration.types() );
+ }
+ return ( serviceDeclaration.newServiceModel( moduleModel, metaInfoDeclaration, helper ) );
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ return null;
+ }
+ } )
+ .filter( Objects::nonNull )
+ .collect( Collectors.toList() ) );
for (ImportedServiceAssemblyImpl importedServiceDeclaration : importedServiceAssemblies.values())
{
@@ -563,22 +614,29 @@ final class ModuleAssemblyImpl
String identity = serviceModel.identity().toString();
if (identities.contains(identity))
{
- throw new DuplicateServiceIdentityException(
- "Duplicated service reference: " + identity + " in module " + moduleModel.name()
+ DuplicateServiceIdentityException exception = new DuplicateServiceIdentityException(
+ "Duplicated service reference: " + identity + " in module " + moduleModel.name()
);
+ exceptions.add( exception.fillInStackTrace() );
+ } else
+ {
+ identities.add( identity );
}
- identities.add(identity);
}
for (ImportedServiceModel serviceModel : importedServiceModels)
{
String identity = serviceModel.identity().toString();
if (identities.contains(identity))
{
- throw new DuplicateServiceIdentityException(
+ DuplicateServiceIdentityException exception = new DuplicateServiceIdentityException(
"Duplicated service reference: " + identity + " in module " + moduleModel.name()
);
+ exceptions.add( exception.fillInStackTrace() );
+ }
+ else
+ {
+ identities.add( identity );
}
- identities.add(identity);
}
importedServiceModels
@@ -589,10 +647,22 @@ final class ModuleAssemblyImpl
.equals( importedServiceModel.serviceImporter() ) ) )
.forEach(
importedServiceModel ->
- objectModels.add( new ObjectModel( moduleModel, importedServiceModel.serviceImporter(),
- Visibility.module, new MetaInfo() ) ) );
-
- return moduleModel;
+ {
+ try
+ {
+ objectModels.add( new ObjectModel( moduleModel, importedServiceModel.serviceImporter(),
+ Visibility.module, new MetaInfo() ) );
+ }
+ catch( Exception e )
+ {
+ exceptions.add( e );
+ }
+ } );
+ if( exceptions.size() == 0 )
+ {
+ return moduleModel;
+ }
+ throw new AssemblyReportException( exceptions );
}
private void addDefaultAssemblers()
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
index 12550f2..1982f2d 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/concerns/PropertyInheritanceTest.java
@@ -21,16 +21,15 @@ package org.apache.polygene.runtime.concerns;
import java.util.ArrayList;
import java.util.List;
-import org.apache.polygene.test.AbstractPolygeneTest;
-import org.junit.Test;
-import org.apache.polygene.api.common.InvalidApplicationException;
import org.apache.polygene.api.common.UseDefaults;
import org.apache.polygene.api.concern.ConcernOf;
import org.apache.polygene.api.concern.Concerns;
-import org.apache.polygene.api.property.InvalidPropertyTypeException;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.AssemblyReportException;
import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.test.AbstractPolygeneTest;
+import org.junit.Test;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
@@ -53,13 +52,10 @@ public class PropertyInheritanceTest extends AbstractPolygeneTest
protected void assemblyException( AssemblyException exception )
throws AssemblyException
{
- if( exception.getCause() instanceof InvalidApplicationException )
+ if( exception instanceof AssemblyReportException )
{
- if( exception.getCause().getCause() instanceof InvalidPropertyTypeException )
- {
- failed = true;
- return;
- }
+ failed = true;
+ return;
}
super.assemblyException( exception );
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtil.java
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtil.java b/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtil.java
deleted file mode 100644
index c03d783..0000000
--- a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtil.java
+++ /dev/null
@@ -1,32 +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.library.scripting;
-
-import java.io.PrintStream;
-import org.apache.polygene.api.mixin.Mixins;
-
-/**
- * JAVADOC
- */
-@Mixins( ScriptUtilImpl.class )
-public interface ScriptUtil
-{
- PrintStream getOut();
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtilImpl.java
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtilImpl.java b/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtilImpl.java
deleted file mode 100644
index e8a191c..0000000
--- a/libraries/scripting/src/main/java/org/apache/polygene/library/scripting/ScriptUtilImpl.java
+++ /dev/null
@@ -1,35 +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.library.scripting;
-
-import java.io.PrintStream;
-
-/**
- * JAVADOC
- */
-public class ScriptUtilImpl
- implements ScriptUtil
-{
- @Override
- public PrintStream getOut()
- {
- return System.out;
- }
-}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0cf199bc/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptUtilImplTest.java
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptUtilImplTest.java b/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptUtilImplTest.java
deleted file mode 100644
index 92937ac..0000000
--- a/libraries/scripting/src/test/java/org/apache/polygene/library/scripting/ScriptUtilImplTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.polygene.library.scripting;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
-
-public class ScriptUtilImplTest
-{
- @Test
- public void testDefaultStream()
- {
- ScriptUtil underTest = new ScriptUtilImpl();
- assertThat( underTest.getOut(), equalTo(System.out));
- }
-
- @Test( expected = ScriptException.class )
- public void testException()
- {
- throw new ScriptException( "This is a test exception." );
- }
-}
[6/7] polygene-java git commit: Merge remote-tracking branch
'origin/develop' into develop
Posted by ni...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/0321a7f8
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0321a7f8
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0321a7f8
Branch: refs/heads/develop
Commit: 0321a7f855335f7fa4a362d6138247d62d88a481
Parents: 8931fb2 d235b63
Author: niclas <ni...@spicter.com>
Authored: Fri Apr 7 09:29:49 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Fri Apr 7 09:29:49 2017 +0800
----------------------------------------------------------------------
.../testsupport-internal/src/main/docker/s3server/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[3/7] polygene-java git commit: Merge remote-tracking branch
'origin/develop' into develop
Posted by ni...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/912f39f2
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/912f39f2
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/912f39f2
Branch: refs/heads/develop
Commit: 912f39f2fdfcb741726c6b97a2434e2a86dc8218
Parents: 4034e41 ab7491c
Author: niclas <ni...@spicter.com>
Authored: Mon Apr 3 09:45:24 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Mon Apr 3 09:45:24 2017 +0800
----------------------------------------------------------------------
.../structure/reports/ReportsPlugin.groovy | 2 +-
core/api/build.gradle | 1 -
core/api/src/docs/api.txt | 4 +
core/api/src/docs/configuration.txt | 7 +-
core/api/src/docs/objects.txt | 4 +-
core/api/src/docs/serialization.txt | 102 ++
core/api/src/docs/valuecomposite.txt | 107 +-
.../apache/polygene/api/common/UseDefaults.java | 2 +-
.../StatefulAssociationCompositeDescriptor.java | 31 +
.../api/configuration/Configuration.java | 117 +-
.../polygene/api/entity/EntityDescriptor.java | 8 +-
.../polygene/api/property/DefaultValues.java | 5 +
.../polygene/api/serialization/Converter.java | 49 +
.../polygene/api/serialization/Converters.java | 131 +++
.../api/serialization/Deserializer.java | 73 ++
.../api/serialization/Serialization.java | 46 +
.../serialization/SerializationException.java | 34 +
.../polygene/api/serialization/Serializer.java | 252 +++++
.../polygene/api/serialization/package.html | 47 +
.../org/apache/polygene/api/type/ArrayType.java | 97 ++
.../polygene/api/type/CollectionType.java | 62 +-
.../org/apache/polygene/api/type/EnumType.java | 5 +-
.../api/type/HasAssignableFromType.java | 52 +
.../polygene/api/type/HasAssignableToType.java | 48 +
.../api/type/HasEqualOrAssignableFromType.java | 44 +
.../api/type/HasEqualOrAssignableToType.java | 44 +
.../apache/polygene/api/type/HasEqualType.java | 45 +
.../polygene/api/type/HasTypesCollectors.java | 427 ++++++++
.../polygene/api/type/HasTypesPredicate.java | 79 ++
.../org/apache/polygene/api/type/MapType.java | 45 +-
.../api/type/MatchTypeSpecification.java | 51 -
.../apache/polygene/api/type/Serialization.java | 62 --
.../polygene/api/type/ValueCompositeType.java | 38 +-
.../org/apache/polygene/api/type/ValueType.java | 187 ++--
.../apache/polygene/api/util/ArrayIterable.java | 75 ++
.../apache/polygene/api/util/Collectors.java | 149 ++-
.../MissingValueSerializationException.java | 43 -
.../polygene/api/value/ValueDescriptor.java | 8 +-
.../polygene/api/value/ValueDeserializer.java | 172 ---
.../polygene/api/value/ValueSerialization.java | 56 -
.../api/value/ValueSerializationException.java | 50 -
.../polygene/api/value/ValueSerializer.java | 293 -----
.../api/type/HasTypesCollectorsTest.java | 150 +++
.../api/type/HasTypesPredicatesTest.java | 73 ++
.../polygene/api/type/ValueTypeFactoryTest.java | 124 +++
.../polygene/api/util/CollectorsTest.java | 106 +-
.../api/value/DocumentationSupport.java | 136 +--
.../api/configuration/MyService.properties | 2 +-
.../bootstrap/builder/ApplicationBuilder.java | 71 +-
.../DefaultSerializationAssembler.java | 42 +
.../builder/ApplicationBuilderTest.java | 5 +-
.../runtime/bootstrap/ModuleAssemblyImpl.java | 31 +-
.../runtime/property/PropertyInstance.java | 45 +
.../runtime/property/PropertyModel.java | 46 +-
.../runtime/structure/ModuleInstance.java | 50 +-
.../runtime/structure/TypeLookupImpl.java | 289 +----
.../runtime/type/ValueTypeFactoryInstance.java | 152 +++
.../runtime/types/ValueTypeFactory.java | 233 ----
.../polygene/runtime/value/ValueInstance.java | 2 +-
.../polygene/runtime/value/ValueModel.java | 2 +-
.../bootstrap/ApplicationAssemblerTest.java | 5 +-
.../polygene/regression/qi382/Qi382Test.java | 3 -
.../polygene/regression/qi383/Qi383Test.java | 9 +-
.../association/AssociationAssignmentTest.java | 4 -
.../runtime/defaults/UseDefaultsTest.java | 54 +-
.../polygene/runtime/mixin/JDKMixinTest.java | 88 +-
.../property/ValueNestedBuilderTest.java | 3 -
.../runtime/value/AssociationToValueTest.java | 3 -
.../runtime/value/NestedValueBuilderTest.java | 16 +-
.../runtime/value/ValueCompositeBasicsTest.java | 6 +-
.../value/ValueSerializationRegressionTest.java | 9 +-
.../runtime/value/ValueWithAssociationTest.java | 11 +-
.../visibility/VisibilityInUnitOfWorkTest.java | 5 -
.../memory/MemoryEntityStoreTest.java | 3 -
core/spi/build.gradle | 4 +-
core/spi/src/docs/serialization.txt | 115 ++
core/spi/src/docs/spi.txt | 4 +-
core/spi/src/docs/valueserialization.txt | 83 --
.../memory/MemoryMapEntityStoreMixin.java | 49 +-
.../serialization/javaxjson/JavaxJson.java | 141 +++
.../javaxjson/JavaxJsonAdapter.java | 56 +
.../javaxjson/JavaxJsonAdapters.java | 366 +++++++
.../javaxjson/JavaxJsonDeserializer.java | 384 +++++++
.../javaxjson/JavaxJsonFactories.java | 127 +++
.../javaxjson/JavaxJsonSerialization.java | 26 +
.../javaxjson/JavaxJsonSerializer.java | 261 +++++
.../javaxjson/JavaxJsonSettings.java | 85 ++
.../serialization/javaxjson/package.html | 24 +
.../entitystore/helpers/JSONEntityState.java | 397 ++++---
.../helpers/JSONManyAssociationState.java | 94 +-
.../helpers/JSONMapEntityStoreMixin.java | 327 +++---
.../helpers/JSONNamedAssociationState.java | 77 +-
.../spi/entitystore/helpers/MapEntityStore.java | 78 +-
.../helpers/MapEntityStoreMixin.java | 560 +++++-----
.../spi/entitystore/helpers/Migration.java | 8 +-
.../spi/entitystore/helpers/StateStore.java | 7 +-
.../apache/polygene/spi/module/ModuleSpi.java | 10 +-
.../AbstractBinaryDeserializer.java | 57 +
.../serialization/AbstractBinarySerializer.java | 55 +
.../spi/serialization/AbstractDeserializer.java | 177 ++++
.../spi/serialization/AbstractSerializer.java | 172 +++
.../serialization/AbstractTextDeserializer.java | 43 +
.../serialization/AbstractTextSerializer.java | 52 +
.../spi/serialization/BuiltInConverters.java | 256 +++++
.../spi/serialization/JsonDeserializer.java | 82 ++
.../spi/serialization/JsonSerialization.java | 27 +
.../spi/serialization/JsonSerializer.java | 78 ++
.../serialization/SerializationSettings.java | 60 ++
.../spi/serialization/XmlDeserializer.java | 82 ++
.../spi/serialization/XmlSerialization.java | 27 +
.../spi/serialization/XmlSerializer.java | 78 ++
.../polygene/spi/serialization/package.html | 68 ++
.../polygene/spi/type/ValueTypeFactory.java | 30 +
.../spi/value/ValueDeserializerAdapter.java | 1001 ------------------
.../spi/value/ValueSerializerAdapter.java | 570 ----------
.../org/apache/polygene/spi/value/package.html | 24 -
.../orgjson/OrgJsonValueDeserializer.java | 485 ---------
.../OrgJsonValueSerializationService.java | 32 -
.../orgjson/OrgJsonValueSerializer.java | 114 --
.../valueserialization/orgjson/package.html | 24 -
.../spi/entitystore/Polygene142Test.java | 15 +-
.../helpers/JSONManyAssociationStateTest.java | 34 +-
.../helpers/JsonNamedAssociationStateTest.java | 104 ++
.../polygene/test/EntityTestAssembler.java | 5 +-
...bstractConfigurationDeserializationTest.java | 9 +-
.../test/model/assembly/PersistenceModule.java | 3 -
.../AbstractCollectionSerializationTest.java | 481 +++++++++
.../AbstractPlainValueSerializationTest.java | 420 ++++++++
...AbstractValueCompositeSerializationTest.java | 626 +++++++++++
.../polygene/test/serialization/package.html | 24 +
.../apache/polygene/test/util/JSONAssert.java | 130 ---
.../AbstractCollectionSerializationTest.java | 433 --------
.../test/value/AbstractJsonDateFormatTest.java | 151 ---
.../AbstractPlainValueSerializationTest.java | 211 ----
...AbstractValueCompositeSerializationTest.java | 431 --------
.../org/apache/polygene/test/value/package.html | 24 -
dependencies.gradle | 14 +-
extensions/cache-ehcache/build.gradle | 1 -
extensions/cache-memcache/build.gradle | 1 -
extensions/entitystore-cassandra/build.gradle | 1 -
.../cassandra/CassandraEntityStoreMixin.java | 10 +-
.../cassandra/CassandraMapEntityStoreTest.java | 2 -
extensions/entitystore-file/build.gradle | 2 -
.../entitystore/file/FileEntityStoreMixin.java | 6 +-
.../entitystore/file/FileEntityStoreTest.java | 2 -
.../file/FileEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-geode/build.gradle | 1 -
.../geode/GeodeEntityStoreMixin.java | 6 +-
.../entitystore/geode/GeodeEntityStoreTest.java | 2 -
.../geode/GeodeEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-hazelcast/build.gradle | 1 -
.../hazelcast/HazelcastEntityStoreMixin.java | 6 +-
.../hazelcast/HazelcastEntityStoreTest.java | 6 +-
.../HazelcastEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-jclouds/build.gradle | 1 -
.../jclouds/JCloudsMapEntityStoreMixin.java | 11 +-
.../jclouds/JCloudsFilesystemTest.java | 4 -
.../entitystore/jclouds/JCloudsS3Test.java | 2 -
.../jclouds/JCloudsTransientTest.java | 6 -
.../jclouds/JCloudsWithCacheTest.java | 2 -
extensions/entitystore-jdbm/build.gradle | 1 -
.../entitystore/jdbm/JdbmEntityStoreMixin.java | 6 +-
.../entitystore/jdbm/JdbmEntityStoreTest.java | 2 -
.../jdbm/JdbmEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-leveldb/build.gradle | 1 -
.../leveldb/LevelDBEntityStoreMixin.java | 9 +-
.../leveldb/JavaLevelDBEntityStoreTest.java | 2 -
.../leveldb/JniLevelDBEntityStoreTest.java | 2 -
.../LevelDBEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-memory/build.gradle | 1 -
.../memory/MemoryEntityStoreTest.java | 5 -
.../memory/MemoryEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-mongodb/build.gradle | 1 -
.../mongodb/MongoMapEntityStoreMixin.java | 10 +-
.../mongodb/EmbedMongoMapEntityStoreTest.java | 3 -
.../mongodb/MongoMapEntityStoreTest.java | 7 +-
.../MongoMapEntityStoreWithCacheTest.java | 7 +-
extensions/entitystore-preferences/build.gradle | 1 -
.../PreferencesEntityStoreMixin.java | 48 +-
.../preferences/PreferencesEntityStoreTest.java | 2 -
extensions/entitystore-redis/build.gradle | 1 -
.../redis/RedisMapEntityStoreMixin.java | 12 +-
.../redis/RedisMapEntityStoreTest.java | 4 +-
.../redis/RedisMapEntityStoreWithCacheTest.java | 4 +-
extensions/entitystore-riak/build.gradle | 1 -
.../riak/RiakMapEntityStoreMixin.java | 12 +-
.../riak/RiakMapEntityStoreTest.java | 2 -
.../riak/RiakMapEntityStoreWithCacheTest.java | 2 -
extensions/entitystore-sql/build.gradle | 9 +-
extensions/entitystore-sql/src/docs/es-sql.txt | 14 +-
.../entitystore/sql/SQLEntityStoreMixin.java | 624 -----------
.../entitystore/sql/SQLEntityStoreService.java | 39 -
.../sql/SQLMapEntityStoreConfiguration.java | 47 +
.../entitystore/sql/SQLMapEntityStoreMixin.java | 240 +++++
.../sql/SQLMapEntityStoreService.java | 45 +
.../AbstractSQLEntityStoreAssembler.java | 93 --
.../AbstractSQLMapEntityStoreAssembler.java | 97 ++
.../assembly/DerbySQLEntityStoreAssembler.java | 21 +-
.../sql/assembly/H2SQLEntityStoreAssembler.java | 21 +-
.../sql/assembly/MySQLEntityStoreAssembler.java | 21 +-
.../PostgreSQLEntityStoreAssembler.java | 28 +-
.../assembly/SQLiteEntityStoreAssembler.java | 21 +-
.../sql/internal/DatabaseSQLService.java | 124 ---
.../internal/DatabaseSQLServiceCoreMixin.java | 159 ---
.../sql/internal/DatabaseSQLServiceSpi.java | 81 --
.../sql/internal/DatabaseSQLServiceState.java | 35 -
.../DatabaseSQLServiceStatementsMixin.java | 118 ---
.../sql/internal/DatabaseSQLStringsBuilder.java | 389 -------
.../DerbySQLDatabaseSQLServiceMixin.java | 72 --
.../internal/H2SQLDatabaseSQLServiceMixin.java | 63 --
.../internal/MySQLDatabaseSQLServiceMixin.java | 72 --
.../PostgreSQLDatabaseSQLServiceMixin.java | 68 --
.../internal/PostgreSQLStringBuilderMixin.java | 45 -
.../sql/internal/SQLEntityState.java | 189 ----
.../internal/SQLiteDatabaseSQLServiceMixin.java | 65 --
.../polygene/entitystore/sql/internal/SQLs.java | 39 -
.../entitystore/sql/internal/package.html | 24 -
.../polygene/entitystore/sql/changelog.xml | 37 +
.../sql/DerbySQLEntityStoreTest.java | 52 +-
.../entitystore/sql/H2SQLEntityStoreTest.java | 49 +-
.../entitystore/sql/MySQLEntityStoreTest.java | 46 +-
.../sql/PostgreSQLEntityStoreTest.java | 46 +-
.../entitystore/sql/SQLiteEntityStoreTest.java | 54 +-
.../test/resources/mysql-datasource.properties | 2 +-
extensions/indexing-elasticsearch/build.gradle | 1 -
.../elasticsearch/ElasticSearchIndexer.java | 246 ++---
.../assembly/ESClientIndexQueryAssembler.java | 5 -
.../assembly/ESClusterIndexQueryAssembler.java | 5 -
.../ESFilesystemIndexQueryAssembler.java | 2 -
.../elasticsearch/ElasticSearchQueryTest.java | 4 -
extensions/indexing-rdf/build.gradle | 1 -
.../index/rdf/query/RdfQueryParserFactory.java | 11 +-
.../rdf/query/internal/RdfQueryParserImpl.java | 18 +-
.../polygene/index/rdf/ContainsAllTest.java | 118 +--
.../apache/polygene/index/rdf/ContainsTest.java | 52 +-
.../polygene/index/rdf/RdfComplexQueryTest.java | 5 +-
.../polygene/index/rdf/RdfEntityFinderTest.java | 3 -
.../index/rdf/RdfNamedQueryMultimoduleTest.java | 2 -
.../polygene/index/rdf/RdfNamedQueryTest.java | 2 -
.../index/rdf/RdfQueryMultimoduleTest.java | 2 -
.../polygene/index/rdf/qi66/Qi66IssueTest.java | 7 +-
.../polygene/index/rdf/qi95/Qi95IssueTest.java | 22 +-
extensions/indexing-solr/build.gradle | 1 -
.../solr/assembly/SolrIndexingAssembler.java | 25 +-
.../solr/internal/SolrEntityIndexerMixin.java | 95 +-
extensions/indexing-sql/build.gradle | 1 -
.../sql/SQLIndexingEngineConfiguration.java | 31 +
.../AbstractSQLIndexQueryAssembler.java | 4 +-
.../support/skeletons/AbstractSQLStartup.java | 13 +-
.../skeletons/SQLCompatEntityStateWrapper.java | 1 +
.../postgresql/PostgreSQLDBIntegrityTest.java | 6 +-
.../polygene/migration/MigrationService.java | 549 +++++++---
.../org/apache/polygene/migration/Migrator.java | 56 +-
.../assembly/AbstractMigrationRule.java | 6 +
.../assembly/EntityMigrationOperation.java | 12 +-
.../migration/assembly/EntityMigrationRule.java | 27 +-
.../migration/assembly/MigrationContext.java | 60 ++
.../migration/operation/AddAssociation.java | 14 +-
.../migration/operation/AddManyAssociation.java | 14 +-
.../operation/AddNamedAssociation.java | 14 +-
.../migration/operation/AddProperty.java | 14 +-
.../migration/operation/RemoveAssociation.java | 14 +-
.../operation/RemoveManyAssociation.java | 14 +-
.../operation/RemoveNamedAssociation.java | 14 +-
.../migration/operation/RemoveProperty.java | 14 +-
.../migration/operation/RenameAssociation.java | 14 +-
.../migration/operation/RenameEntity.java | 35 +-
.../operation/RenameManyAssociation.java | 14 +-
.../operation/RenameNamedAssociation.java | 14 +-
.../migration/operation/RenameProperty.java | 14 +-
.../polygene/migration/MigrationTest.java | 37 +-
extensions/reindexer/build.gradle | 1 -
.../polygene/index/reindexer/ReindexerTest.java | 2 -
extensions/serialization-javaxjson/build.gradle | 34 +
.../serialization-javaxjson/dev-status.xml | 38 +
.../src/docs/serialization-javaxjson.txt | 49 +
.../JavaxJsonSerializationAssembler.java | 61 ++
.../javaxjson/assembly/package.html | 24 +
.../serialization/javaxjson/package.html | 24 +
.../javaxjson/CustomJsonAdapterTest.java | 184 ++++
.../javaxjson/HandCraftedJsonTest.java | 72 ++
.../JavaxJsonCollectionSerializationTest.java | 24 +
...vaxJsonConfigurationDeserializationTest.java | 24 +
.../JavaxJsonPlainValueSerializationTest.java | 41 +
...avaxJsonValueCompositeSerializationTest.java | 77 ++
.../src/test/resources/configtest.json | 8 +
extensions/serialization-javaxxml/build.gradle | 34 +
.../serialization-javaxxml/dev-status.xml | 38 +
.../src/docs/serialization-javaxxml.txt | 46 +
.../serialization/javaxxml/JavaxXml.java | 161 +++
.../serialization/javaxxml/JavaxXmlAdapter.java | 56 +
.../javaxxml/JavaxXmlAdapters.java | 227 ++++
.../javaxxml/JavaxXmlDeserializer.java | 380 +++++++
.../javaxxml/JavaxXmlFactories.java | 74 ++
.../javaxxml/JavaxXmlSerialization.java | 88 ++
.../javaxxml/JavaxXmlSerializer.java | 334 ++++++
.../javaxxml/JavaxXmlSettings.java | 159 +++
.../JavaxXmlSerializationAssembler.java | 61 ++
.../javaxxml/assembly/package.html | 24 +
.../serialization/javaxxml/package.html | 24 +
.../javaxxml/deserializer-normalization.xsl | 9 +
.../javaxxml/HandCraftedXmlTest.java | 146 +++
.../javaxxml/JavaxXmlAdaptersTest.java | 40 +
.../javaxxml/JavaxXmlCollectionTest.java | 32 +
...avaxXmlConfigurationDeserializationTest.java | 22 +
.../JavaxXmlPlainValueSerializationTest.java | 59 ++
...JavaxXmlValueCompositeSerializationTest.java | 77 ++
.../src/test/resources/configtest.xml | 1 +
.../serialization-messagepack/build.gradle | 36 +
.../serialization-messagepack/dev-status.xml | 38 +
.../src/docs/serialization-messagepack.txt | 43 +
.../messagepack/MessagePackAdapter.java | 57 +
.../messagepack/MessagePackAdapters.java | 269 +++++
.../messagepack/MessagePackDeserializer.java | 315 ++++++
.../messagepack/MessagePackSerialization.java | 22 +
.../messagepack/MessagePackSerializer.java | 202 ++++
.../messagepack/MessagePackSettings.java | 45 +
.../MessagePackSerializationAssembler.java | 54 +
.../messagepack/assembly/package.html | 24 +
.../serialization/messagepack/package.html | 24 +
.../MessagePackCollectionSerializationTest.java | 32 +
.../MessagePackPlainValueSerializationTest.java | 43 +
...sagePackValueCompositeSerializationTest.java | 36 +
.../valueserialization-jackson/build.gradle | 37 -
.../valueserialization-jackson/dev-status.xml | 36 -
.../src/docs/vs-jackson.txt | 43 -
.../jackson/JacksonValueDeserializer.java | 379 -------
.../JacksonValueSerializationService.java | 32 -
.../jackson/JacksonValueSerializer.java | 92 --
.../JacksonValueSerializationAssembler.java | 42 -
.../valueserialization/jackson/package.html | 24 -
.../JacksonCollectionSerializationTest.java | 38 -
...JacksonConfigurationDeserializationTest.java | 39 -
.../jackson/JacksonJsonDateFormatTest.java | 38 -
.../JacksonPlainValueSerializationTest.java | 36 -
.../JacksonValueCompositeSerializationTest.java | 38 -
.../src/test/resources/configtest.json | 8 -
.../valueserialization-orgjson/build.gradle | 35 -
.../valueserialization-orgjson/dev-status.xml | 36 -
.../src/docs/vs-orgjson.txt | 43 -
.../OrgJsonValueSerializationAssembler.java | 41 -
.../valueserialization/orgjson/package.html | 24 -
.../OrgJsonCollectionSerializationTest.java | 37 -
...OrgJsonConfigurationDeserializationTest.java | 38 -
.../orgjson/OrgJsonDateFormatTest.java | 37 -
.../OrgJsonPlainValueSerializationTest.java | 35 -
.../OrgJsonValueCompositeSerializationTest.java | 37 -
.../src/test/resources/configtest.json | 8 -
extensions/valueserialization-stax/build.gradle | 37 -
.../valueserialization-stax/dev-status.xml | 36 -
.../src/docs/vs-stax.txt | 43 -
.../stax/StaxValueDeserializer.java | 522 ---------
.../stax/StaxValueSerializationService.java | 32 -
.../stax/StaxValueSerializer.java | 134 ---
.../StaxValueSerializationAssembler.java | 42 -
.../valueserialization/stax/package.html | 24 -
.../stax/StaxCollectionSerializationTest.java | 47 -
.../StaxConfigurationDeserializationTest.java | 69 --
.../stax/StaxPlainValueSerializationTest.java | 45 -
.../StaxValueCompositeSerializationTest.java | 47 -
.../src/test/resources/configtest.xml | 50 -
internals/testsupport-internal/build.gradle | 4 +
.../library/appbrowser/AppBrowserTest.java | 2 -
.../library/constraints/ConstraintTest.java | 10 +-
libraries/rdf/build.gradle | 1 -
.../rdf/entity/EntityStateSerializer.java | 176 +--
.../rdf/entity/EntitySerializerTest.java | 16 +-
libraries/rest-client/build.gradle | 1 -
.../ValueCompositeRequestWriter.java | 17 +-
.../responsereader/DefaultResponseReader.java | 56 +-
.../responsereader/JSONResponseReader.java | 88 +-
.../responsereader/TableResponseReader.java | 137 +--
.../ContextResourceClientFactoryTest.java | 16 +-
.../rest/client/ContinuousIntegrationTest.java | 20 +-
.../library/rest/client/RssReaderTest.java | 6 +-
.../polygene/library/rest/common/Resource.java | 2 +-
.../rest/server/api/ContextResource.java | 2 +-
.../requestreader/DefaultRequestReader.java | 14 +-
.../responsewriter/AbstractResponseWriter.java | 3 +-
.../responsewriter/DefaultResponseWriter.java | 4 +-
.../responsewriter/FormResponseWriter.java | 21 +-
.../responsewriter/JSONResponseWriter.java | 22 +-
.../responsewriter/LinksResponseWriter.java | 3 +-
.../responsewriter/TableResponseWriter.java | 92 +-
.../ValueCompositeResponseWriter.java | 10 +-
.../ValueDescriptorResponseWriter.java | 51 +-
libraries/rest/build.gradle | 4 +-
.../library/rest/admin/EntitiesResource.java | 7 +-
.../library/rest/admin/EntityResource.java | 13 +-
.../library/rest/admin/RDFAssembler.java | 2 -
libraries/restlet/build.gradle | 3 +-
.../RestletCrudConnectivityAssembler.java | 2 -
.../configuration/ConfigurationModule.java | 2 -
.../infrastructue/SerializationModule.java | 5 -
.../serialization/JsonRepresentation.java | 15 +-
libraries/sql-liquibase/build.gradle | 5 +-
.../sql/liquibase/LiquibaseAssembler.java | 16 +-
.../sql/liquibase/LiquibaseConfiguration.java | 12 +-
.../library/sql/liquibase/LiquibaseService.java | 133 +--
.../sql/liquibase/LiquibaseServiceTest.java | 131 +--
.../polygene/library/sql/common/Databases.java | 1 +
.../library/sql/common/SQLConfiguration.java | 4 -
...taSourceConfigurationManagerServiceTest.java | 21 +-
.../ConcurrentUoWFileModificationException.java | 2 +-
manual/src/docs/userguide/extensions.txt | 25 +-
samples/forum/build.gradle | 1 -
.../sample/forum/assembler/ForumAssembler.java | 17 +-
samples/rental/build.gradle | 1 -
.../rental/web/assembly/StorageModule.java | 5 -
.../sample/sqlsupport/AppAssembler.java | 7 -
.../apache/polygene/sample/sqlsupport/Main.java | 8 -
settings.gradle | 6 +-
tests/performance/build.gradle | 1 -
.../jdbm/JdbmEntityStorePerformanceTest.java | 2 -
.../MemoryEntityStorePerformanceTest.java | 4 +-
.../sql/DerbySQLEntityStorePerformanceTest.java | 38 +-
.../PostgreSQLEntityStorePerformanceTest.java | 34 +-
.../indexing/rdf/QueryPerformanceTest.java | 14 +-
tools/generator-polygene/app/index.js | 10 +-
.../ConfigModule/bootstrap.tmpl | 2 -
.../SerializationModule/bootstrap.tmpl | 6 +-
.../SerializationModule/module.js | 2 +-
.../InfrastructureLayer/bootstrap.tmpl | 2 +-
.../templates/buildtool/gradle-bootstrap.tmpl | 2 +-
tools/generator-polygene/test/generator_test.js | 18 +-
425 files changed, 14832 insertions(+), 12838 deletions(-)
----------------------------------------------------------------------
[2/7] polygene-java git commit: For some reason the
ErrorReportingTest in IDEA takes a different execution route than when
running from IDEA. And I can't figure out why, and really hard to debug.
Posted by ni...@apache.org.
For some reason the ErrorReportingTest in IDEA takes a different execution route than when running from IDEA. And I can't figure out why, and really hard to debug.
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/4034e417
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/4034e417
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/4034e417
Branch: refs/heads/develop
Commit: 4034e4179c0ff0782f38665ce00c15b09a29a6a3
Parents: 96de012
Author: niclas <ni...@spicter.com>
Authored: Thu Mar 30 09:42:58 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Thu Mar 30 09:42:58 2017 +0800
----------------------------------------------------------------------
core/runtime/build.gradle | 5 +++++
.../runtime/bootstrap/ValueAssemblyImpl.java | 19 ++++++-------------
.../polygene/bootstrap/ErrorReportingTest.java | 1 -
3 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/4034e417/core/runtime/build.gradle
----------------------------------------------------------------------
diff --git a/core/runtime/build.gradle b/core/runtime/build.gradle
index e2c52ad..756b3f2 100644
--- a/core/runtime/build.gradle
+++ b/core/runtime/build.gradle
@@ -35,3 +35,8 @@ dependencies {
testImplementation polygene.core.testsupport
testImplementation polygene.library( 'constraints' )
}
+
+compileTestJava {
+ options.fork = true
+ options.compilerArgs += ["-parameters"]
+}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/4034e417/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
index 408da07..aa26857 100644
--- a/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
+++ b/core/runtime/src/main/java/org/apache/polygene/runtime/bootstrap/ValueAssemblyImpl.java
@@ -63,19 +63,12 @@ public final class ValueAssemblyImpl
AssemblyHelper helper
)
{
- try
- {
- associationsModel = new AssociationsModel();
- manyAssociationsModel = new ManyAssociationsModel();
- namedAssociationsModel = new NamedAssociationsModel();
- buildComposite( helper, stateDeclarations );
- return new ValueModel(
- module, types, visibility, metaInfo, mixinsModel, (ValueStateModel) stateModel, compositeMethodsModel );
- }
- catch( Exception e )
- {
- throw new InvalidApplicationException( "Could not register " + types, e );
- }
+ associationsModel = new AssociationsModel();
+ manyAssociationsModel = new ManyAssociationsModel();
+ namedAssociationsModel = new NamedAssociationsModel();
+ buildComposite( helper, stateDeclarations );
+ return new ValueModel(
+ module, types, visibility, metaInfo, mixinsModel, (ValueStateModel) stateModel, compositeMethodsModel );
}
protected AssociationsModel associationsModel()
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/4034e417/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
index 7d1606d..bcd8e2a 100644
--- a/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ErrorReportingTest.java
@@ -43,7 +43,6 @@ public class ErrorReportingTest extends AbstractPolygeneTest
protected void assemblyException( AssemblyException exception )
throws AssemblyException
{
- assertThat( exception.getMessage(), containsString( "Composition problems\n" ) );
assertThat( exception.getMessage(), containsString( "Composition Problems Report:\n" ) );
assertThat( exception.getMessage(), containsString( " message: No implementation found for method \n"
+ " method: Map doAnotherThing(String name, int value)\n"
[4/7] polygene-java git commit: Merge remote-tracking branch
'origin/develop' into develop
Posted by ni...@apache.org.
Merge remote-tracking branch 'origin/develop' into develop
Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/47d2ad64
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/47d2ad64
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/47d2ad64
Branch: refs/heads/develop
Commit: 47d2ad64f02b8ea22b6b4e5c6624ad02f694883d
Parents: 912f39f 55ea6c5
Author: niclas <ni...@spicter.com>
Authored: Tue Apr 4 08:01:14 2017 +0800
Committer: niclas <ni...@spicter.com>
Committed: Tue Apr 4 08:01:14 2017 +0800
----------------------------------------------------------------------
.../gradle/code/PublishingPlugin.groovy | 4 +-
.../DependenciesDownloadTask.groovy | 2 +-
.../dependencies/DependenciesPlugin.groovy | 2 +-
.../distributions/DistributionsPlugin.groovy | 10 +-
.../structure/manual/DocumentationTask.groovy | 2 +-
core/api/src/docs/metrics.txt | 4 +-
.../polygene/api/serialization/ConvertedBy.java | 37 ++++
.../javaxjson/JavaxJsonDeserializer.java | 30 +++-
.../javaxjson/JavaxJsonFactories.java | 15 +-
.../javaxjson/JavaxJsonSerializer.java | 25 ++-
.../javaxjson/JavaxJsonSettings.java | 28 +++
.../AbstractConvertersSerializationTest.java | 159 +++++++++++++++++
dependencies.gradle | 28 +--
.../JavaxJsonSerializationAssembler.java | 4 +-
.../javaxjson/HandCraftedJsonTest.java | 1 -
.../JavaxJsonCollectionSerializationTest.java | 172 +++++++++++++++++++
.../JavaxJsonConvertersSerializationTest.java | 45 +++++
.../javaxxml/JavaxXmlDeserializer.java | 45 +++--
.../javaxxml/JavaxXmlFactories.java | 119 +++++++++++--
.../javaxxml/JavaxXmlSerializer.java | 52 +++---
.../javaxxml/JavaxXmlSettings.java | 65 ++++++-
.../JavaxXmlSerializationAssembler.java | 4 +-
.../javaxxml/deserializer-normalization.xsl | 17 ++
.../javaxxml/JavaxXmlAdaptersTest.java | 17 ++
...avaxXmlConfigurationDeserializationTest.java | 24 ++-
.../JavaxXmlConvertersSerializationTest.java | 67 ++++++++
.../JavaxXmlPlainValueSerializationTest.java | 7 +-
.../src/test/resources/configtest.xml | 31 +++-
.../src/docs/serialization-messagepack.txt | 4 +-
.../messagepack/MessagePackDeserializer.java | 49 ++++--
.../messagepack/MessagePackSerializer.java | 27 ++-
.../MessagePackConvertersSerializationTest.java | 44 +++++
32 files changed, 1012 insertions(+), 128 deletions(-)
----------------------------------------------------------------------