Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.Energy4Java


     * @throws ActivationException if the activation failed
     */
    public Application newApplication()
        throws AssemblyException, ActivationException
    {
        Energy4Java qi4j = new Energy4Java();
        ApplicationDescriptor model = qi4j.newApplicationModel( new ApplicationAssembler()
        {
            @Override
            public ApplicationAssembly assemble( ApplicationAssemblyFactory factory )
                throws AssemblyException
            {
                ApplicationAssembly assembly = factory.newApplicationAssembly();
                assembly.setName( applicationName );
                HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
                for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() )
                {
                    LayerAssembly layer = entry.getValue().createLayer( assembly );
                    createdLayers.put( entry.getKey(), layer );
                }
                for( LayerDeclaration layer : layers.values() )
                {
                    layer.initialize( createdLayers );
                }
                return assembly;
            }
        } );
        Application application = model.newInstance( qi4j.api() );
        for( ActivationEventListener activationListener : activationListeners )
        {
            application.registerActivationEventListener( activationListener );
        }
        beforeActivation();
View Full Code Here


    @Before
    public void setup()
        throws Exception
    {
        qi4j = new Energy4Java();

        Assembler[][][] assemblers = new Assembler[][][]
            {
                { // Layer Above
                  {
View Full Code Here

    }

    private void createQi4jRuntime( Assembler testSetup )
        throws Exception
    {
        Energy4Java qi4j = new Energy4Java();
        Assembler[][][] assemblers = new Assembler[][][]
        {
            {
                {
                    infrastructure, testSetup
                }
            }
        };
        application = qi4j.newApplication( new ApplicationAssemblerAdapter( assemblers )
        {
        } );
        application.activate();

        Module moduleInstance = application.findModule( "Layer 1", "Module 1" );
View Full Code Here

     */
    protected abstract Module qi4jStrutsModule( Application application );

    private Application createNewApplication( ServletContext context )
    {
        Energy4Java qi4j = new Energy4Java();

        // Try create assembler
        final ApplicationAssembler assembler = createAssembler();
        if( assembler != null )
        {
            try
            {
                return qi4j.newApplication( assembler );
            }
            catch( AssemblyException e )
            {
                throw new IllegalStateException( e );
            }
View Full Code Here

public class VisualizeApplicationStructure
{
    public static void main( String[] args )
        throws Exception
    {
        Energy4Java qi4j = new Energy4Java();
        Assembler assembler = new Assembler();
        ApplicationDescriptor applicationModel = qi4j.newApplicationModel( assembler );
        applicationModel.newInstance( qi4j.spi() );

        /*
       * The Envisage Swing app visualizes the application assemblage structure.
       *
       * Tree view:
View Full Code Here

{
    // START SNIPPET: envisage
    public static void main( String[] args )
        throws Exception
    {
        Energy4Java energy4Java = new Energy4Java();

        ApplicationDescriptor applicationModel
                              = energy4Java.newApplicationModel( new SchoolAssembler() );

        new Envisage().run( applicationModel );
    }
View Full Code Here

public class Main
{
    public static void main( String[] args )
        throws Exception
    {
        Energy4Java is = new Energy4Java(  );

        Server server = new Server( Protocol.HTTP, 8888 );

        Application app = is.newApplication( new ForumAssembler(), new MetadataService() );

        app.activate();

        ContextRestlet restlet = app.findModule( "REST", "Restlet" ).newObject( ContextRestlet.class, new org.restlet.Context() );
View Full Code Here

    @Before
    public void setup()
        throws Exception
    {
        qi4j = new Energy4Java();

        Assembler[][][] assemblers = new Assembler[][][]
            {
                { // Layer Above
                  {
View Full Code Here

    }

    public Main()
        throws Exception
    {
        Energy4Java qi4j = new Energy4Java();
        application = qi4j.newApplication( new MainAssembler() );
        application.activate();
    }
View Full Code Here

        String applicationAssemblerName = args[0];
        System.out.println( "Assembler:" + applicationAssemblerName );
        Class applicationAssemblerClass = Class.forName( applicationAssemblerName );
        ApplicationAssembler assembler = (ApplicationAssembler) applicationAssemblerClass.newInstance();

        Energy4Java energy4Java = new Energy4Java();

        ApplicationDescriptor application = energy4Java.newApplicationModel( assembler );

        new Envisage().run( application );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.bootstrap.Energy4Java

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.