Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit b675c1a

Browse files
committed
Remove ValueSerialization “type finder” concept as there’s no implementation behind it
No use of the meta info Function at all. ValueDeserializer API takes the module to use as a parameter.
1 parent b61d025 commit b675c1a

17 files changed

Lines changed: 18 additions & 173 deletions

File tree

core/api/src/test/java/org/apache/polygene/api/value/DocumentationSupport.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,7 @@ public void assembledWithValuesModuleSerialization()
229229
{
230230
servicesModule -> {
231231
servicesModule.setName( "SERVICES-Module" );
232-
233-
Function<Application, Module> valuesModuleFinder = new Function<Application, Module>()
234-
{
235-
@Override
236-
public Module apply( Application app1 )
237-
{
238-
return app1.findModule( "SINGLE-Layer", "VALUES-Module" );
239-
}
240-
};
241232
new OrgJsonValueSerializationAssembler().
242-
withValuesModuleFinder( valuesModuleFinder ).
243233
assemble( servicesModule );
244234
}
245235
}

extensions/valueserialization-jackson/src/main/java/org/apache/polygene/valueserialization/jackson/JacksonValueSerializationAssembler.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*/
2020
package org.apache.polygene.valueserialization.jackson;
2121

22-
import java.util.function.Function;
23-
import org.apache.polygene.api.structure.Application;
24-
import org.apache.polygene.api.structure.Module;
2522
import org.apache.polygene.api.value.ValueSerialization;
2623
import org.apache.polygene.bootstrap.Assemblers;
2724
import org.apache.polygene.bootstrap.AssemblyException;
@@ -33,30 +30,12 @@
3330
public class JacksonValueSerializationAssembler
3431
extends Assemblers.Visibility<JacksonValueSerializationAssembler>
3532
{
36-
private Function<Application, Module> valuesModuleFinder;
37-
38-
public JacksonValueSerializationAssembler withValuesModuleFinder( Function<Application, Module> valuesModuleFinder )
39-
{
40-
this.valuesModuleFinder = valuesModuleFinder;
41-
return this;
42-
}
43-
4433
@Override
4534
public void assemble( ModuleAssembly module )
4635
throws AssemblyException
4736
{
48-
if( valuesModuleFinder == null )
49-
{
50-
module.services( JacksonValueSerializationService.class ).
51-
visibleIn( visibility() ).
52-
taggedWith( ValueSerialization.Formats.JSON );
53-
}
54-
else
55-
{
56-
module.services( JacksonValueSerializationService.class ).
57-
visibleIn( visibility() ).
58-
taggedWith( ValueSerialization.Formats.JSON ).
59-
setMetaInfo( valuesModuleFinder );
60-
}
37+
module.services( JacksonValueSerializationService.class ).
38+
visibleIn( visibility() ).
39+
taggedWith( ValueSerialization.Formats.JSON );
6140
}
6241
}

extensions/valueserialization-orgjson/src/main/java/org/apache/polygene/valueserialization/orgjson/OrgJsonValueSerializationAssembler.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*/
2020
package org.apache.polygene.valueserialization.orgjson;
2121

22-
import java.util.function.Function;
23-
import org.apache.polygene.api.structure.Application;
24-
import org.apache.polygene.api.structure.Module;
2522
import org.apache.polygene.api.value.ValueSerialization;
2623
import org.apache.polygene.bootstrap.Assemblers;
2724
import org.apache.polygene.bootstrap.AssemblyException;
@@ -33,30 +30,12 @@
3330
public class OrgJsonValueSerializationAssembler
3431
extends Assemblers.Visibility<OrgJsonValueSerializationAssembler>
3532
{
36-
private Function<Application, Module> valuesModuleFinder;
37-
38-
public OrgJsonValueSerializationAssembler withValuesModuleFinder( Function<Application, Module> valuesModuleFinder )
39-
{
40-
this.valuesModuleFinder = valuesModuleFinder;
41-
return this;
42-
}
43-
4433
@Override
4534
public void assemble( ModuleAssembly module )
4635
throws AssemblyException
4736
{
48-
if( valuesModuleFinder == null )
49-
{
50-
module.services( OrgJsonValueSerializationService.class ).
51-
visibleIn( visibility() ).
52-
taggedWith( ValueSerialization.Formats.JSON );
53-
}
54-
else
55-
{
56-
module.services( OrgJsonValueSerializationService.class ).
57-
visibleIn( visibility() ).
58-
taggedWith( ValueSerialization.Formats.JSON ).
59-
setMetaInfo( valuesModuleFinder );
60-
}
37+
module.services( OrgJsonValueSerializationService.class ).
38+
visibleIn( visibility() ).
39+
taggedWith( ValueSerialization.Formats.JSON );
6140
}
6241
}

extensions/valueserialization-stax/src/main/java/org/apache/polygene/valueserialization/stax/StaxValueSerializationAssembler.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*/
2020
package org.apache.polygene.valueserialization.stax;
2121

22-
import java.util.function.Function;
23-
import org.apache.polygene.api.structure.Application;
24-
import org.apache.polygene.api.structure.Module;
2522
import org.apache.polygene.api.value.ValueSerialization;
2623
import org.apache.polygene.bootstrap.Assemblers;
2724
import org.apache.polygene.bootstrap.AssemblyException;
@@ -33,30 +30,12 @@
3330
public class StaxValueSerializationAssembler
3431
extends Assemblers.Visibility<StaxValueSerializationAssembler>
3532
{
36-
private Function<Application, Module> valuesModuleFinder;
37-
38-
public StaxValueSerializationAssembler withValuesModuleFinder( Function<Application, Module> valuesModuleFinder )
39-
{
40-
this.valuesModuleFinder = valuesModuleFinder;
41-
return this;
42-
}
43-
4433
@Override
4534
public void assemble( ModuleAssembly module )
4635
throws AssemblyException
4736
{
48-
if( valuesModuleFinder == null )
49-
{
50-
module.services( StaxValueSerializationService.class ).
51-
visibleIn( visibility() ).
52-
taggedWith( ValueSerialization.Formats.XML );
53-
}
54-
else
55-
{
56-
module.services( StaxValueSerializationService.class ).
57-
visibleIn( visibility() ).
58-
taggedWith( ValueSerialization.Formats.XML ).
59-
setMetaInfo( valuesModuleFinder );
60-
}
37+
module.services( StaxValueSerializationService.class ).
38+
visibleIn( visibility() ).
39+
taggedWith( ValueSerialization.Formats.XML );
6140
}
6241
}

libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/domain/DomainLayer.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
*/
2020
package org.apache.polygene.library.restlet.assembly.domain;
2121

22-
import java.util.function.Function;
23-
import org.apache.polygene.api.structure.Application;
24-
import org.apache.polygene.api.structure.Module;
2522
import org.apache.polygene.bootstrap.AssemblyException;
2623
import org.apache.polygene.bootstrap.LayerAssembly;
2724
import org.apache.polygene.bootstrap.layered.LayerAssembler;
@@ -39,9 +36,4 @@ public LayerAssembly assemble( LayerAssembly layer )
3936
createModule( layer, CrudModule.class );
4037
return layer;
4138
}
42-
43-
public static Function<Application, Module> typeFinder()
44-
{
45-
return application -> application.findModule( "Domain Layer", "TypeFinder Module" );
46-
}
4739
}

libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/InfrastructureLayer.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,37 @@
2020

2121
package org.apache.polygene.library.restlet.assembly.infrastructue;
2222

23-
import java.util.function.Function;
24-
import org.apache.polygene.api.structure.Application;
25-
import org.apache.polygene.api.structure.Module;
2623
import org.apache.polygene.bootstrap.AssemblyException;
2724
import org.apache.polygene.bootstrap.LayerAssembly;
2825
import org.apache.polygene.bootstrap.ModuleAssembly;
2926
import org.apache.polygene.bootstrap.layered.LayerAssembler;
3027
import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler;
3128
import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationLayer;
3229
import org.apache.polygene.library.restlet.assembly.configuration.ConfigurationModule;
33-
import org.apache.polygene.library.restlet.assembly.domain.DomainLayer;
3430

3531
public class InfrastructureLayer extends LayeredLayerAssembler
3632
implements LayerAssembler
3733
{
3834
public static final String NAME = "Infrastructure Layer";
3935
private final ModuleAssembly configModule;
40-
private final Function<Application, Module> typeFinder;
4136

4237
public static InfrastructureLayer create( LayerAssembly layer )
4338
{
44-
Function<Application, Module> typeFinder = DomainLayer.typeFinder();
4539
ModuleAssembly config = layer.application().layer( ConfigurationLayer.NAME ).module( ConfigurationModule.NAME );
46-
return new InfrastructureLayer( config, typeFinder );
40+
return new InfrastructureLayer( config );
4741
}
4842

49-
public InfrastructureLayer( ModuleAssembly configModule, Function<Application, Module> typeFinder )
43+
public InfrastructureLayer( ModuleAssembly configModule )
5044
{
5145
this.configModule = configModule;
52-
this.typeFinder = typeFinder;
5346
}
5447

5548
@Override
5649
public LayerAssembly assemble( LayerAssembly layer )
5750
throws AssemblyException
5851
{
5952
new IndexingModule( configModule ).assemble( layer, layer.module( IndexingModule.NAME ) );
60-
new SerializationModule( typeFinder ).assemble( layer, layer.module( SerializationModule.NAME ) );
53+
new SerializationModule().assemble( layer, layer.module( SerializationModule.NAME ) );
6154
return layer;
6255
}
6356
}

libraries/restlet/src/main/java/org/apache/polygene/library/restlet/assembly/infrastructue/SerializationModule.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020

2121
package org.apache.polygene.library.restlet.assembly.infrastructue;
2222

23-
import java.util.function.Function;
2423
import org.apache.polygene.api.common.Visibility;
25-
import org.apache.polygene.api.structure.Application;
26-
import org.apache.polygene.api.structure.Module;
2724
import org.apache.polygene.bootstrap.AssemblyException;
2825
import org.apache.polygene.bootstrap.LayerAssembly;
2926
import org.apache.polygene.bootstrap.ModuleAssembly;
@@ -34,20 +31,13 @@ public class SerializationModule
3431
implements ModuleAssembler
3532
{
3633
public static final String NAME = "Serialization Module";
37-
private final Function<Application, Module> typeFinder;
38-
39-
public SerializationModule( Function<Application, Module> typeFinder )
40-
{
41-
this.typeFinder = typeFinder;
42-
}
4334

4435
@Override
4536
public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module )
4637
throws AssemblyException
4738
{
4839
new JacksonValueSerializationAssembler()
4940
.visibleIn( Visibility.layer )
50-
.withValuesModuleFinder( typeFinder )
5141
.assemble( module );
5242
return module;
5343
}

samples/forum/src/main/java/org/apache/polygene/sample/forum/assembler/ForumAssembler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFacto
8585
ModuleAssembly serialization = infrastructure.module( "Serialization" );
8686
new OrgJsonValueSerializationAssembler().
8787
visibleIn( Visibility.application ).
88-
withValuesModuleFinder( app -> app.findModule( "REST", "Values" ) ).
8988
assemble( serialization );
9089

9190
ModuleAssembly entityStore = infrastructure.module( "EntityStore" );

samples/rental/src/main/java/org/apache/polygene/sample/rental/web/assembly/StorageModule.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public void assemble( ModuleAssembly module )
3737
module.services( MemoryEntityStoreService.class ).visibleIn( Visibility.application );
3838
new OrgJsonValueSerializationAssembler().
3939
visibleIn( Visibility.application ).
40-
withValuesModuleFinder( app -> app.findModule( "DomainLayer", "RentalModule" ) ).
4140
assemble( module );
4241
}
4342
}

tools/generator-polygene/app/templates/DomainLayer/bootstrap.tmpl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
-%>
2020
package <%= packageName %>.bootstrap.domain;
2121

22-
import java.util.function.Function;
23-
import org.apache.polygene.api.structure.Application;
24-
import org.apache.polygene.api.structure.Module;
2522
import org.apache.polygene.bootstrap.AssemblyException;
2623
import org.apache.polygene.bootstrap.LayerAssembly;
2724
import org.apache.polygene.bootstrap.layered.LayerAssembler;
@@ -38,9 +35,4 @@ public class DomainLayer extends LayeredLayerAssembler
3835
createModule( layer, SecurityModule.class );
3936
return layer;
4037
}
41-
42-
public static Function<Application, Module> typeFinder()
43-
{
44-
return application -> application.findModule( "Domain Layer", "Assets Module" );
45-
}
4638
}

0 commit comments

Comments
 (0)