Search in sources :

Example 6 with ServiceDeclaration

use of org.qi4j.bootstrap.ServiceDeclaration in project qi4j-sdk by Qi4j.

the class MemoryEntityStoreAssembler method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    module.services(UuidIdentityGeneratorService.class).visibleIn(visibility());
    ServiceDeclaration service = module.services(MemoryEntityStoreService.class).visibleIn(visibility());
    if (hasIdentity()) {
        service.identifiedBy(identity());
    }
}
Also used : UuidIdentityGeneratorService(org.qi4j.spi.uuid.UuidIdentityGeneratorService) ServiceDeclaration(org.qi4j.bootstrap.ServiceDeclaration)

Example 7 with ServiceDeclaration

use of org.qi4j.bootstrap.ServiceDeclaration in project qi4j-sdk by Qi4j.

the class VoldemortAssembler method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    module.services(UuidIdentityGeneratorService.class).visibleIn(visibility());
    ServiceDeclaration service = module.services(VoldemortEntityStoreService.class).visibleIn(visibility()).instantiateOnStartup();
    if (hasIdentity()) {
        service.identifiedBy(identity());
    }
    if (hasConfig()) {
        configModule().entities(VoldemortConfiguration.class).visibleIn(configVisibility());
    }
}
Also used : UuidIdentityGeneratorService(org.qi4j.spi.uuid.UuidIdentityGeneratorService) VoldemortConfiguration(org.qi4j.entitystore.voldemort.VoldemortConfiguration) ServiceDeclaration(org.qi4j.bootstrap.ServiceDeclaration)

Example 8 with ServiceDeclaration

use of org.qi4j.bootstrap.ServiceDeclaration in project qi4j-sdk by Qi4j.

the class PreferenceEntityStoreAssembler method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    String applicationName = module.layer().application().name();
    Preferences root = Preferences.userRoot();
    Preferences node = root.node(applicationName);
    PreferencesEntityStoreInfo info = new PreferencesEntityStoreInfo(node);
    ServiceDeclaration service = module.services(PreferencesEntityStoreService.class).setMetaInfo(info).visibleIn(visibility()).instantiateOnStartup();
    if (hasIdentity()) {
        service.identifiedBy(identity());
    }
    module.services(UuidIdentityGeneratorService.class).visibleIn(visibility());
}
Also used : UuidIdentityGeneratorService(org.qi4j.spi.uuid.UuidIdentityGeneratorService) ServiceDeclaration(org.qi4j.bootstrap.ServiceDeclaration) PreferencesEntityStoreInfo(org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo) Preferences(java.util.prefs.Preferences) PreferencesEntityStoreService(org.qi4j.entitystore.prefs.PreferencesEntityStoreService)

Example 9 with ServiceDeclaration

use of org.qi4j.bootstrap.ServiceDeclaration in project qi4j-sdk by Qi4j.

the class RedisMapEntityStoreAssembler method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    module.services(UuidIdentityGeneratorService.class).visibleIn(visibility());
    ServiceDeclaration service = module.services(RedisMapEntityStoreService.class).visibleIn(visibility());
    if (hasIdentity()) {
        service.identifiedBy(identity());
    }
    if (hasConfig()) {
        configModule().entities(RedisEntityStoreConfiguration.class).visibleIn(configVisibility());
    }
}
Also used : UuidIdentityGeneratorService(org.qi4j.spi.uuid.UuidIdentityGeneratorService) ServiceDeclaration(org.qi4j.bootstrap.ServiceDeclaration)

Example 10 with ServiceDeclaration

use of org.qi4j.bootstrap.ServiceDeclaration in project qi4j-sdk by Qi4j.

the class AlarmSystemAssembler method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    ServiceDeclaration alarmSystem = module.services(AlarmSystemService.class).visibleIn(visibility());
    if (hasIdentity()) {
        alarmSystem.identifiedBy(identity());
    }
    module.services(SimpleAlarmModelService.class).setMetaInfo(new AlarmModelDescriptor("Simple", false));
    module.services(StandardAlarmModelService.class).setMetaInfo(new AlarmModelDescriptor("Standard", true));
    module.services(ExtendedAlarmModelService.class).setMetaInfo(new AlarmModelDescriptor("Extended", false));
    module.services(AlarmPointFactory.class);
    module.entities(AlarmPointEntity.class);
    module.values(AlarmEvent.class);
    module.values(AlarmStatus.class);
    module.values(AlarmCategory.class);
    module.values(SimpleAlarmCategory.class);
    module.transients(AlarmProxy.class);
    module.services(AlarmProxy.Factory.class);
    module.forMixin(AlarmPoint.class).declareDefaults().alarmClass().set(AlarmClass.B);
}
Also used : ServiceDeclaration(org.qi4j.bootstrap.ServiceDeclaration)

Aggregations

ServiceDeclaration (org.qi4j.bootstrap.ServiceDeclaration)20 UuidIdentityGeneratorService (org.qi4j.spi.uuid.UuidIdentityGeneratorService)11 Test (org.junit.Test)2 ModuleAssembly (org.qi4j.bootstrap.ModuleAssembly)2 SingletonAssembler (org.qi4j.bootstrap.SingletonAssembler)2 Preferences (java.util.prefs.Preferences)1 ApplicationAssembly (org.qi4j.bootstrap.ApplicationAssembly)1 EntityDeclaration (org.qi4j.bootstrap.EntityDeclaration)1 ImportedServiceDeclaration (org.qi4j.bootstrap.ImportedServiceDeclaration)1 LayerAssembly (org.qi4j.bootstrap.LayerAssembly)1 ValueDeclaration (org.qi4j.bootstrap.ValueDeclaration)1 FileEntityStoreConfiguration (org.qi4j.entitystore.file.FileEntityStoreConfiguration)1 FileEntityStoreService (org.qi4j.entitystore.file.FileEntityStoreService)1 HazelcastConfiguration (org.qi4j.entitystore.hazelcast.HazelcastConfiguration)1 JdbmConfiguration (org.qi4j.entitystore.jdbm.JdbmConfiguration)1 JdbmEntityStoreService (org.qi4j.entitystore.jdbm.JdbmEntityStoreService)1 MemoryEntityStoreService (org.qi4j.entitystore.memory.MemoryEntityStoreService)1 PreferencesEntityStoreInfo (org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo)1 PreferencesEntityStoreService (org.qi4j.entitystore.prefs.PreferencesEntityStoreService)1 VoldemortConfiguration (org.qi4j.entitystore.voldemort.VoldemortConfiguration)1