public void assemble( ModuleAssembly module ) throws AssemblyException { try { module.services( TestService.class ); module.forMixin( TestService.class ).declareDefaults().voidMethod(); fail( "It is not allowed to declareDefaults on methods not returning Property." ); } catch( IllegalArgumentException e ) { // expected } }
@Override public void assemble( ModuleAssembly module ) { module.values( SomeValue.class ); module.forMixin( SomeValue.class ) .setMetaInfo( new CustomPropertyConverter() ) .declareDefaults() .customAssemblyConvertedProperty(); }
void defaultPropertyValues() { Assembler assembler = // START SNIPPET: properties-defaults ( ModuleAssembly module ) -> { module.values( MyValue.class ); MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults(); myValueDefaults.foo().set( "bar" ); module.entities( MyEntity.class ); MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults(); myEntityDefaults.cathedral().set( "bazar" ); } // END SNIPPET: properties-defaults ; } }
@Override public void assemble( ModuleAssembly module ) { module.values( SomeValue.class ); module.forMixin( SomeValue.class ) .setMetaInfo( new CustomPropertyConverter() ) .declareDefaults() .customAssemblyConvertedProperty(); }
@Override public void assemble( ModuleAssembly module ) { module.transients( TestComposite.class ); module.forMixin( TestComposite.class ).declareDefaults().assemblyString().set( "habba" ); module.defaultServices(); }
public void assemble( ModuleAssembly module ) throws AssemblyException { module.transients( Company.class ).withConcerns( LogConcern.class ); module.forMixin( Nameable.class ) .setMetaInfo( new DisplayInfo( "Name", "Name of something", "The name" ) ) // Add UI info .setMetaInfo( new RdfInfo( "label", "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ) ) // Add persistence info .declareDefaults() .name() // Select accessor .set( "Hello World" ); // Set default value }
private Assembler entityStoreConfigAssembler() { return module -> { new EntityTestAssembler().assemble( module ); module.entities( NativeConfiguration.class ).visibleIn( Visibility.application ); module.forMixin( NativeConfiguration.class ) .declareDefaults() .dataDirectory() .set( rdfDirectory().getAbsolutePath() ); module.entities( JdbmEntityStoreConfiguration.class ).visibleIn( Visibility.application ); module.forMixin( JdbmEntityStoreConfiguration.class ) .declareDefaults() .file() .set( jdbmDirectory().getAbsolutePath() ); }; }
public void assemble( ModuleAssembly module ) throws AssemblyException { new EntityTestAssembler().assemble( module ); module.entities( AssociationTest.Person.class, AssociationTest.Company.class ); module.forMixin( Employer.class ) .setMetaInfo( new DisplayInfo( "Employees", "Employees in the company", "Employees", null ) ) .declareDefaults() .employees(); module.forMixin( Company.class ).declareDefaults().name().set( "A Company" ); }
@Override protected void defineStorageModule( ModuleAssembly module ) { module.defaultServices(); new JCloudsEntityStoreAssembler() .visibleIn( Visibility.application ) .withConfig( configModule, Visibility.application ) .assemble( module ); JCloudsEntityStoreConfiguration defaults = configModule.forMixin( JCloudsEntityStoreConfiguration.class ) .declareDefaults(); defaults.provider().set( "filesystem" ); defaults.properties().set( Collections.singletonMap( FilesystemConstants.PROPERTY_BASEDIR, tmpDir.getRoot().getAbsolutePath() ) ); } }
@Override protected void defineStorageModule( ModuleAssembly module ) { module.defaultServices(); new RiakEntityStoreAssembler() .visibleIn( Visibility.application ) .withConfig( configModule, Visibility.application ) .assemble( module ); RiakEntityStoreConfiguration riakConfig = configModule.forMixin( RiakEntityStoreConfiguration.class ) .declareDefaults(); String host = DOCKER.getDockerHost(); int port = DOCKER.getExposedContainerPort( "8087/tcp" ); riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) ); }
public void assemble( ModuleAssembly module ) throws AssemblyException { module.services( FooServiceComposite.class ).identifiedBy( "bazar" ); module.entities( FooConfigurationComposite.class ); new EntityTestAssembler().assemble( module ); FooConfigurationComposite config = module.forMixin( FooConfigurationComposite.class ).declareDefaults(); config.foo().set( "bar" ); }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { // JDBM EntityStore new JdbmEntityStoreAssembler().assemble( module ); // Native Sesame EntityFinder new RdfNativeSesameStoreAssembler().assemble( module ); // Reindexer // START SNIPPET: assembly module.services( ReindexerService.class ); // END SNIPPET: assembly // Configuration ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config ); config.entities( JdbmEntityStoreConfiguration.class, NativeConfiguration.class, ReindexerConfiguration.class ) .visibleIn( Visibility.layer ); config.forMixin( JdbmEntityStoreConfiguration.class ).declareDefaults() .file().set( new File( tmpDir.getRoot(), ENTITIES_DIR ).getAbsolutePath() ); config.forMixin( NativeConfiguration.class ).declareDefaults() .dataDirectory().set( new File( tmpDir.getRoot(), INDEX_DIR ).getAbsolutePath() ); // Test entity module.entities( MyEntity.class ); }
@Override public void assemble( ModuleAssembly module ) { super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config ); new JCloudsEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); JCloudsEntityStoreConfiguration defaults = config.forMixin( JCloudsEntityStoreConfiguration.class ) .declareDefaults(); defaults.provider().set( "filesystem" ); defaults.properties().set( Collections.singletonMap( FilesystemConstants.PROPERTY_BASEDIR, tmpDir.getRoot().getAbsolutePath() ) ); } }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { new EntityTestAssembler().assemble( module ); ModuleAssembly configModule = module; // START SNIPPET: assembly new StandaloneShiroAssembler(). withConfig( configModule, Visibility.layer ). assemble( module ); // END SNIPPET: assembly configModule.forMixin( ShiroIniConfiguration.class ). declareDefaults(). iniResourcePath().set( "classpath:standalone-shiro.ini" ); }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { super.assemble( module ); new RdfNativeSesameStoreAssembler( Visibility.module, Visibility.module ).assemble( module ); ModuleAssembly config = module.layer().module( "Config" ); config.entities( NativeConfiguration.class ).visibleIn( Visibility.layer ); config.forMixin( NativeConfiguration.class ).declareDefaults() .dataDirectory().set( tmpDir.getRoot().getAbsolutePath() ); new EntityTestAssembler().assemble( config ); }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { new FileConfigurationAssembler() .withOverride( new FileConfigurationOverride().withConventionalRoot( tmpDir.getRoot() ) ) .assemble( module ); ModuleAssembly prefModule = module.layer().module( "PrefModule" ); prefModule.entities( NativeConfiguration.class ).visibleIn( Visibility.application ); prefModule.forMixin( NativeConfiguration.class ).declareDefaults() .tripleIndexes().set( "spoc,cspo" ); prefModule.forMixin( NativeConfiguration.class ).declareDefaults() .dataDirectory().set( new File( tmpDir.getRoot(), "rdf-data" ).getAbsolutePath() ); new EntityTestAssembler().assemble( prefModule ); module.entities( ExampleEntity.class ); EntityTestAssembler testAss = new EntityTestAssembler(); testAss.assemble( module ); Assembler rdfAssembler = new RdfNativeSesameStoreAssembler(); rdfAssembler.assemble( module ); }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { super.assemble( module ); ModuleAssembly config = module.layer().module( "config" ); new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config ); new RiakEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module ); RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class ) .declareDefaults(); String host = DOCKER.getDockerHost(); int port = DOCKER.getExposedContainerPort( "8087/tcp" ); riakConfig.hosts().set( Collections.singletonList( host + ':' + port ) ); } }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { // END SNIPPET: realm-service new EntityTestAssembler().assemble( module ); ModuleAssembly configModule = module; // START SNIPPET: realm-service new StandaloneShiroAssembler(). withConfig( configModule, Visibility.layer ). assemble( module ); module.services( MyRealmService.class ); // END SNIPPET: realm-service configModule.forMixin( ShiroIniConfiguration.class ). declareDefaults(). iniResourcePath().set( "classpath:standalone-shiro.ini" ); // START SNIPPET: realm-service }
@Override public void assemble( ModuleAssembly module ) throws AssemblyException { ModuleAssembly configModule = module; new EntityTestAssembler().assemble( configModule ); // START SNIPPET: assembly new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); // END SNIPPET: assembly port = FreePortFinder.findFreePortOnLoopback(); JettyConfiguration config = module.forMixin( JettyConfiguration.class ).declareDefaults(); config.hostName().set( "127.0.0.1" ); config.port().set( port ); // START SNIPPET: assembly new HttpShiroAssembler() .withConfig( configModule, Visibility.layer ) .assemble( module ); // END SNIPPET: assembly configModule.forMixin( ShiroIniConfiguration.class ) .declareDefaults().iniResourcePath().set( "classpath:web-shiro.ini" ); }
@SuppressWarnings( { "unchecked" } ) @Override public void assemble( ModuleAssembly module ) throws AssemblyException { module.services( TestAlarmModel.class ); module.services( AlarmSystemService.class ); new EntityTestAssembler().assemble( module ); module.entities( AlarmPointEntity.class ); module.forMixin( AlarmHistory.class ).declareDefaults().maxSize().set( 10 ); module.values( AlarmEvent.class ); module.values( AlarmCategory.class ); module.values( AlarmStatus.class ); }