コード例 #1
0
ファイル: ApplicationDocs.java プロジェクト: ramtej/zest-java
  public static void someMethod(String[] args) throws Exception {
    {
      // START SNIPPET: application1
      SingletonAssembler qi4j =
          new SingletonAssembler() {
            public void assemble(ModuleAssembly assembly) throws AssemblyException {
              assembly.values(MyStuffValueComposite.class);
            }
          };
      // END SNIPPET: application1
    }
    {
      Assembler customerListEditAssembler = new DummyAssembler();
      Assembler customerEditAssembler = new DummyAssembler();
      Assembler customerSearchAssembler = new DummyAssembler();
      Assembler accountsListEditAssembler = new DummyAssembler();
      Assembler accountsEditAssembler = new DummyAssembler();
      Assembler accountsSearchAssembler = new DummyAssembler();
      Assembler customerDomainAssembler = new DummyAssembler();
      Assembler accountsDomainAssembler = new DummyAssembler();
      // START SNIPPET: application2
      final Assembler[][][] assemblers = {
        { // web layer
          { // Customer Module
            customerListEditAssembler, customerEditAssembler, customerSearchAssembler
          },
          { // Accounts Module
            accountsListEditAssembler, accountsEditAssembler, accountsSearchAssembler
          }
        },
        { // domain layer
          { // Customer Module
            customerDomainAssembler,
          },
          { // Accounts Module
            accountsDomainAssembler,
          }
        }
      };
      Energy4Java qi4j = new Energy4Java();
      Application app =
          qi4j.newApplication(
              new ApplicationAssembler() {

                @Override
                public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory)
                    throws AssemblyException {
                  return applicationFactory.newApplicationAssembly(assemblers);
                }
              });
      app.activate();
      // END SNIPPET: application2
    }
  }
コード例 #2
0
ファイル: Main.java プロジェクト: rahulgnayak/zest-java
  public static void main(String[] args)
      throws ClassNotFoundException, IllegalAccessException, InstantiationException,
          AssemblyException {
    String applicationAssemblerName = args[0];
    Class applicationAssemblerClass = Class.forName(applicationAssemblerName);
    ApplicationAssembler assembler = (ApplicationAssembler) applicationAssemblerClass.newInstance();

    Energy4Java energy4Java = new Energy4Java();

    ApplicationDescriptor application = energy4Java.newApplicationModel(assembler);

    new Envisage().run(application);
  }
コード例 #3
0
ファイル: ApplicationDocs.java プロジェクト: ramtej/zest-java
 public static void main(String[] args) throws Exception {
   qi4j = new Energy4Java();
   ApplicationDescriptor model =
       qi4j.newApplicationModel(
           new ApplicationAssembler() {
             @Override
             public ApplicationAssembly assemble(ApplicationAssemblyFactory applicationFactory)
                 throws AssemblyException {
               return createAssembly(applicationFactory);
             }
           });
   Application application = model.newInstance(qi4j.spi());
 }
コード例 #4
0
  private ApplicationSPI 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);
      }
    }

    return null;
  }
コード例 #5
0
ファイル: Main.java プロジェクト: rahulgnayak/zest-java
  public static void main(String[] args) throws Exception {
    // Bootstrap Zest Runtime
    // Create a Zest Runtime
    qi4j = new Energy4Java();

    // Instantiate the Application Model.
    application =
        qi4j.newApplication(
            new ApplicationAssembler() {
              public ApplicationAssembly assemble(ApplicationAssemblyFactory factory)
                  throws AssemblyException {
                ApplicationAssembly assembly = factory.newApplicationAssembly();
                LayerAssembly runtime = createRuntimeLayer(assembly);
                LayerAssembly designer = createDesignerLayer(assembly);
                LayerAssembly domain = createDomainLayer(assembly);
                LayerAssembly messaging = createMessagingLayer(assembly);
                LayerAssembly persistence = createPersistenceLayer(assembly);

                // declare structure between layers
                domain.uses(messaging);
                domain.uses(persistence);
                designer.uses(persistence);
                designer.uses(domain);
                runtime.uses(domain);

                return assembly;
              }
            });

    // We need to handle shutdown.
    installShutdownHook();

    // Activate the Application Runtime.
    application.activate();
  }