Search in sources :

Example 1 with PreferencesEntityStoreInfo

use of org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo 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);
    module.services(PreferencesEntityStoreService.class).setMetaInfo(info).visibleIn(visibility).instantiateOnStartup();
    module.services(UuidIdentityGeneratorService.class).visibleIn(visibility);
}
Also used : UuidIdentityGeneratorService(org.qi4j.spi.uuid.UuidIdentityGeneratorService) PreferencesEntityStoreInfo(org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo) Preferences(java.util.prefs.Preferences) PreferencesEntityStoreService(org.qi4j.entitystore.prefs.PreferencesEntityStoreService)

Example 2 with PreferencesEntityStoreInfo

use of org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo in project qi4j-sdk by Qi4j.

the class PreferencesEntityStoreTest method assemble.

@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
    module.layer().application().setName("PreferencesTest");
    super.assemble(module);
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    Thread.currentThread().setContextClassLoader(null);
    PreferencesEntityStoreInfo metaInfo = new PreferencesEntityStoreInfo(Preferences.userNodeForPackage(getClass()));
    Thread.currentThread().setContextClassLoader(cl);
    module.services(PreferencesEntityStoreService.class).setMetaInfo(metaInfo).instantiateOnStartup();
    new OrgJsonValueSerializationAssembler().assemble(module);
}
Also used : PreferencesEntityStoreInfo(org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo) OrgJsonValueSerializationAssembler(org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler)

Aggregations

PreferencesEntityStoreInfo (org.qi4j.entitystore.prefs.PreferencesEntityStoreInfo)2 Preferences (java.util.prefs.Preferences)1 PreferencesEntityStoreService (org.qi4j.entitystore.prefs.PreferencesEntityStoreService)1 UuidIdentityGeneratorService (org.qi4j.spi.uuid.UuidIdentityGeneratorService)1 OrgJsonValueSerializationAssembler (org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler)1