public Application newApplication( ApplicationAssembler assembler, Object... importedServiceInstances ) throws AssemblyException { ApplicationDescriptor model = newApplicationModel( assembler ); return model.newInstance( runtime.spi(), importedServiceInstances ); }
public Application newApplication( ApplicationAssembler assembler, Object... importedServiceInstances ) throws AssemblyException { ApplicationDescriptor model = newApplicationModel( assembler ); return model.newInstance( runtime.spi(), importedServiceInstances ); }
public void initialize() throws AssemblyException { model = polygene.newApplicationModel( this ); onModelCreated( model ); instantiateApplication( polygene, model ); }
public void initialize() throws AssemblyException { model = polygene.newApplicationModel( this ); onModelCreated( model ); instantiateApplication( polygene, model ); }
static protected ApplicationDescriptor newApplication() throws AssemblyException { final Assembler asm = assembler; ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm ); try { return polygene.newApplicationModel( assembler ); } catch( AssemblyException e ) { assemblyException( e ); return null; } }
static protected ApplicationDescriptor newApplication() throws AssemblyException { final Assembler asm = assembler; ApplicationAssembler assembler = applicationFactory -> applicationFactory.newApplicationAssembly( asm ); try { return polygene.newApplicationModel( assembler ); } catch( AssemblyException e ) { assemblyException( e ); return null; } }
private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers ) throws AssemblyException { return polygene.newApplicationModel( factory -> factory.newApplicationAssembly( assemblers ) ); } // END SNIPPET: pancake
protected ApplicationDescriptor newApplicationModel() throws AssemblyException { ApplicationAssembler assembler = applicationFactory -> { ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly(); applicationAssembly.setMode( Application.Mode.test ); defineApplication( applicationAssembly ); return applicationAssembly; }; try { return polygene.newApplicationModel( assembler ); } catch( AssemblyException e ) { assemblyException( e ); return null; } }
protected ApplicationDescriptor newApplicationModel() throws AssemblyException { ApplicationAssembler assembler = applicationFactory -> { ApplicationAssembly applicationAssembly = applicationFactory.newApplicationAssembly(); applicationAssembly.setMode( Application.Mode.test ); defineApplication( applicationAssembly ); return applicationAssembly; }; try { return polygene.newApplicationModel( assembler ); } catch( AssemblyException e ) { assemblyException( e ); return null; } }
@Override public final void contextInitialized( ServletContextEvent sce ) { try { ServletContext context = sce.getServletContext(); LOGGER.trace( "Assembling Application" ); polygene = new Energy4Java(); applicationModel = polygene.newApplicationModel( this ); LOGGER.trace( "Instanciating and activating Application" ); application = applicationModel.newInstance( polygene.api() ); api = polygene.api(); beforeApplicationActivation( application ); application.activate(); afterApplicationActivation( application ); LOGGER.trace( "Storing Application in ServletContext" ); context.setAttribute( PolygeneServletSupport.APP_IN_CTX, application ); } catch ( Exception ex ) { if ( application != null ) { try { beforeApplicationPassivation( application ); application.passivate(); afterApplicationPassivation( application ); } catch ( Exception ex1 ) { LOGGER.warn( "Application not null and could not passivate it.", ex1 ); } } throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex ); } }
@Override public final void contextInitialized( ServletContextEvent sce ) { try { ServletContext context = sce.getServletContext(); LOGGER.trace( "Assembling Application" ); polygene = new Energy4Java(); applicationModel = polygene.newApplicationModel( this ); LOGGER.trace( "Instanciating and activating Application" ); application = applicationModel.newInstance( polygene.api() ); api = polygene.api(); beforeApplicationActivation( application ); application.activate(); afterApplicationActivation( application ); LOGGER.trace( "Storing Application in ServletContext" ); context.setAttribute( PolygeneServletSupport.APP_IN_CTX, application ); } catch ( Exception ex ) { if ( application != null ) { try { beforeApplicationPassivation( application ); application.passivate(); afterApplicationPassivation( application ); } catch ( Exception ex1 ) { LOGGER.warn( "Application not null and could not passivate it.", ex1 ); } } throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex ); } }
ApplicationDescriptor model = polygene.newApplicationModel( factory -> { ApplicationAssembly assembly = factory.newApplicationAssembly(); assembly.setName( applicationName );
ApplicationDescriptor model = polygene.newApplicationModel( factory -> { ApplicationAssembly assembly = factory.newApplicationAssembly(); assembly.setName( applicationName );
public static void main( String[] args ) throws Exception { polygene = new Energy4Java(); ApplicationDescriptor model = polygene.newApplicationModel( factory -> createAssembly( factory ) ); Application application = model.newInstance( polygene.spi() ); }
@Override protected ApplicationDescriptor newApplicationModel() throws AssemblyException { return polygene.newApplicationModel( new ApplicationAssemblerAdapter( new Assembler[][][] { { { RestTest.this, new RestAssembler(), new RdfMemoryStoreAssembler() } } } ) {} // subclassing ApplicationAssemblerAdapter ); }
@Test public void testModel2XML() throws AssemblyException, TransformerException { Energy4Java polygene = new Energy4Java( ); ApplicationDescriptor model = polygene.newApplicationModel( factory -> { ApplicationAssembly assembly = factory.newApplicationAssembly(); assembly.setName( "Test application" ); LayerAssembly webLayer = assembly.layer( "Web" ); LayerAssembly domainLayer = assembly.layer( "Domain" ); LayerAssembly infrastructureLayer = assembly.layer( "Infrastructure" ); webLayer.uses( domainLayer, infrastructureLayer ); domainLayer.uses( infrastructureLayer ); ModuleAssembly rest = webLayer.module( "REST" ); rest.transients( TestTransient.class ).visibleIn( Visibility.layer ); domainLayer.module( "Domain" ); infrastructureLayer.module( "Database" ); return assembly; } ); Document document = new Model2XML().apply( model ); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty( "indent", "yes" ); transformer.setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "2" ); transformer.transform( new DOMSource( document ), new StreamResult( System.out ) ); }
ApplicationDescriptor model = polygene.newApplicationModel( factory -> { ApplicationAssembly assembly = factory.newApplicationAssembly();