use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class JMXTest method main.
public static void main(String[] args) throws InterruptedException, ActivationException, AssemblyException {
/*
Logger logger = Logger.getLogger( "" );
logger.setLevel( Level.FINE );
Logger.getLogger("sun.rmi").setLevel( Level.WARNING );
ConsoleHandler consoleHandler = new ConsoleHandler();
consoleHandler.setLevel( Level.FINE );
logger.addHandler( consoleHandler );
*/
SingletonAssembler assembler = new SingletonAssembler() {
// START SNIPPET: assembly
public void assemble(ModuleAssembly module) throws AssemblyException {
// END SNIPPET: assembly
new EntityTestAssembler().assemble(module);
module.services(TestService.class, TestService2.class, TestService3.class).instantiateOnStartup();
module.entities(TestConfiguration.class);
module.values(TestValue.class);
module.objects(TestObject.class);
// START SNIPPET: assembly
new JMXAssembler().assemble(module);
module.services(JMXConnectorService.class).instantiateOnStartup();
module.entities(JMXConnectorConfiguration.class);
module.forMixin(JMXConnectorConfiguration.class).declareDefaults().port().set(1099);
}
};
// This allows user to connect using VisualVM/JConsole
while (true) {
Thread.sleep(10000);
}
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class PasswordDomainTest method assemble.
// END SNIPPET: domain
// START SNIPPET: assembly
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
// END SNIPPET: assembly
new EntityTestAssembler().assemble(module);
new RdfMemoryStoreAssembler().assemble(module);
ModuleAssembly configModule = module;
// START SNIPPET: assembly
new StandaloneShiroAssembler().withConfig(configModule, Visibility.layer).assemble(module);
new PasswordDomainAssembler().withConfig(configModule, Visibility.layer).assemble(module);
module.entities(User.class);
module.services(UserFactory.class);
// END SNIPPET: assembly
configModule.forMixin(ShiroIniConfiguration.class).declareDefaults().iniResourcePath().set("classpath:standalone-shiro.ini");
// START SNIPPET: assembly
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class StandaloneShiroTest method assemble.
@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");
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class WebRealmServiceTest method assemble.
@Override
public void assemble(ModuleAssembly module) throws AssemblyException {
try {
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);
module.services(MyRealmService.class);
// END SNIPPET: assembly
configModule.forMixin(ShiroIniConfiguration.class).declareDefaults().iniResourcePath().set("classpath:web-shiro.ini");
addServlets(serve("/*").with(MyServletService.class)).to(module);
} catch (IOException ex) {
throw new AssemblyException("Unable to find free port to bind to", ex);
}
}
use of org.qi4j.bootstrap.ModuleAssembly in project qi4j-sdk by Qi4j.
the class SchedulerTest method onAssembly.
@Override
protected void onAssembly(ModuleAssembly testAssembly) throws AssemblyException {
ModuleAssembly moduleAssembly = testAssembly;
ModuleAssembly configModuleAssembly = testAssembly;
// START SNIPPET: assembly
new SchedulerAssembler().visibleIn(Visibility.application).withConfig(configModuleAssembly, Visibility.layer).withTimeline().assemble(moduleAssembly);
// END SNIPPET: assembly
}
Aggregations