public LayeredApplicationAssembler( String name, String version, Application.Mode mode ) throws AssemblyException { this.name = name; this.version = version; this.mode = mode; polygene = new Energy4Java(); }
public LayeredApplicationAssembler( String name, String version, Application.Mode mode ) throws AssemblyException { this.name = name; this.version = version; this.mode = mode; polygene = new Energy4Java(); }
public static void main(String[] args) throws Exception { Energy4Java polygene = new Energy4Java(); // Instantiate the Application Model. Application application = polygene.newApplication( factory -> factory.newApplicationAssembly( new MyAssembler()) ); application.activate(); } }
private Application createApplication() { Energy4Java polygene = new Energy4Java(); try { return polygene.newApplication( factory -> { ApplicationAssembly applicationAssembly = factory.newApplicationAssembly(); applicationBootstrap.assemble( applicationAssembly ); return applicationAssembly; } ); } catch ( AssemblyException e ) { throw new BeanInitializationException( "Fail to bootstrap Polygene application.", e ); } }
/** * Creates a Polygene Runtime instance containing one Layer with one Module. * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add * additional layers and modules via the Assembler interface that must be implemented in the subclass of this * class. * * @throws AssemblyException Either if the model can not be created from the disk, or some inconsistency in * the programming model makes it impossible to create it. * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception.. */ public SingletonAssembler() throws AssemblyException, ActivationException { // START SNIPPET: actual polygene = new Energy4Java(); applicationInstance = createApplicationInstance(); activateApplication(); // END SNIPPET: actual moduleInstance = applicationInstance.findModule( layerName(), moduleName() ); }
/** * Creates a Polygene Runtime instance containing one Layer with one Module. * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add * additional layers and modules via the Assembler interface that must be implemented in the subclass of this * class. * * @throws AssemblyException Either if the model can not be created from the disk, or some inconsistency in * the programming model makes it impossible to create it. * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception.. */ public SingletonAssembler() throws AssemblyException, ActivationException { // START SNIPPET: actual polygene = new Energy4Java(); applicationInstance = createApplicationInstance(); activateApplication(); // END SNIPPET: actual moduleInstance = applicationInstance.findModule( layerName(), moduleName() ); }
/** * Creates a Polygene Runtime instance containing one Layer with one Module. * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add * additional layers and modules via the Assembler interface that must be implemented in the subclass of this * class. * * @param assemble An Assembler lambda containing the module assembly. * @throws AssemblyException Either if the model can not be created from the disk, or some inconsistency in * the programming model makes it impossible to create it. * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception.. */ public SingletonAssembler( Assembler assemble ) throws ActivationException { this.assemble = assemble; polygene = new Energy4Java(); applicationInstance = createApplicationInstance(); activateApplication(); moduleInstance = applicationInstance.findModule( layerName(), moduleName() ); }
@Before public void setUp() throws Exception { polygene = new Energy4Java(); applicationModel = newApplicationModel(); if( applicationModel == null ) { // An AssemblyException has occurred that the Test wants to check for. return; } application = newApplicationInstance( applicationModel ); initApplication( application ); api = spi = polygene.spi(); application.activate(); }
/** * Creates a Polygene Runtime instance containing one Layer with one Module. * The Layer will be named "Layer 1" and the Module will be named "Module 1". It is possible to add * additional layers and modules via the Assembler interface that must be implemented in the subclass of this * class. * * @param assemble An Assembler lambda containing the module assembly. * @throws AssemblyException Either if the model can not be created from the disk, or some inconsistency in * the programming model makes it impossible to create it. * @throws ActivationException If the automatic {@code activate()} method is throwing this Exception.. */ public SingletonAssembler( Assembler assemble ) throws ActivationException { this.assemble = assemble; polygene = new Energy4Java(); applicationInstance = createApplicationInstance(); activateApplication(); moduleInstance = applicationInstance.findModule( layerName(), moduleName() ); }
public Main() throws Exception { Energy4Java polygene = new Energy4Java(); application = polygene.newApplication( new MainAssembler() ); application.activate(); }
@Before public void setUp() throws Exception { polygene = new Energy4Java(); applicationModel = newApplicationModel(); if( applicationModel == null ) { // An AssemblyException has occurred that the Test wants to check for. return; } application = newApplicationInstance( applicationModel ); initApplication( application ); api = spi = polygene.spi(); application.activate(); }
public static void main( String[] args ) throws Exception { // Create a Polygene Runtime polygene = new Energy4Java(); // Create the application application = polygene.newApplication( factory -> buildAssembly( factory.newApplicationAssembly() ) ); // Activate the application application.activate(); }
public static void main( String[] args ) throws Exception { polygene = new Energy4Java(); ApplicationDescriptor model = polygene.newApplicationModel( factory -> createAssembly( factory ) ); Application application = model.newInstance( polygene.spi() ); }
@BeforeClass public static void setUp() throws Exception { polygene = new Energy4Java(); applicationModel = newApplication(); if( applicationModel == null ) { // An AssemblyException has occurred that the Test wants to check for. return; } application = applicationModel.newInstance( polygene.spi() ); initApplication( application ); api = spi = polygene.spi(); application.activate(); // Assume only one module module = application.findModule( "Layer 1", "Module 1" ); uowf = module.unitOfWorkFactory(); }
@BeforeClass public static void setUp() throws Exception { polygene = new Energy4Java(); applicationModel = newApplication(); if( applicationModel == null ) { // An AssemblyException has occurred that the Test wants to check for. return; } application = applicationModel.newInstance( polygene.spi() ); initApplication( application ); api = spi = polygene.spi(); application.activate(); // Assume only one module module = application.findModule( "Layer 1", "Module 1" ); uowf = module.unitOfWorkFactory(); }
public static void main( String[] args ) throws Exception { // Create a Polygene Runtime polygene = new Energy4Java(); // Create the application application = polygene.newApplication( factory -> { ApplicationAssembly assembly = factory.newApplicationAssembly(); assembly.setMetaInfo( new DalvikAssemblyHelper() ); // END SNIPPET: customAssemblyHelper // START SNIPPET: customAssemblyHelper return assembly; } ); // Activate the application application.activate(); }
public Application givenFixture1() throws AssemblyException { Energy4Java polygene = new Energy4Java(); return polygene.newApplication( factory -> factory.newApplicationAssembly( new Assembler[][][] { { { module -> module.transients( TestComposite1.class ) }, { module -> module.transients( TestComposite2.class ).visibleIn( Visibility.layer ) } } } ) ); }
public static void main( String[] args ) throws Exception { Energy4Java polygene = new Energy4Java( ); Server server = new Server( Protocol.HTTP, 8888 ); Application app = polygene.newApplication( new ForumAssembler(), new MetadataService() ); app.activate(); ContextRestlet restlet = app.findModule( "REST", "Restlet" ).newObject( ContextRestlet.class, new org.restlet.Context() ); ChallengeAuthenticator guard = new ChallengeAuthenticator(null, ChallengeScheme.HTTP_BASIC, "testRealm"); MapVerifier mapVerifier = new MapVerifier(); mapVerifier.getLocalSecrets().put("rickard", "secret".toCharArray()); guard.setVerifier(mapVerifier); guard.setNext(restlet); server.setNext( restlet ); server.start(); } }
@Test public void createApplicationUsingApplicationAssembly() throws AssemblyException { Energy4Java polygene = new Energy4Java(); polygene.newApplication( factory -> { ApplicationAssembly applicationAssembly = factory.newApplicationAssembly(); // Application Layer LayerAssembly applicationLayer = applicationAssembly.layer( "Application" ); ModuleAssembly applicationModule = applicationLayer.module( "Application" ); new DomainApplicationAssembler().assemble( applicationModule ); // View Layer LayerAssembly viewLayer = applicationAssembly.layer( "View" ); ModuleAssembly viewModule = viewLayer.module( "View" ); new ViewAssembler().assemble( viewModule ); viewLayer.uses( applicationLayer ); return applicationAssembly; } ); }
private Application createApplication() throws AssemblyException { Energy4Java polygene = new Energy4Java(); return polygene.newApplication( appFactory -> { ApplicationAssembly appAssembly = appFactory.newApplicationAssembly(); LayerAssembly layer1 = appAssembly.layer( "layer1" ); ModuleAssembly myModule = layer1.module( "My Module" ); ModuleAssembly yourModule = layer1.module( "Your Module" ); ModuleAssembly infraModule = layer1.module( "Infra Module" ); myModule.services( MyService.class ); myModule.entities( MyEntity.class ); yourModule.entities( YourEntity.class ); yourModule.services( YourService.class ).visibleIn( Visibility.layer ); new EntityTestAssembler().visibleIn( Visibility.layer ).assemble( infraModule ); return appAssembly; } ); } }