Package org.tamacat.di

Examples of org.tamacat.di.DIContainer


      }
      return null;
    }
   
    public synchronized DIContainer getInstance(String file) {
        DIContainer di = manager.get(file);
        if (di == null) {
          Object[] args = {file, loader};
          Class<?>[] types = {String.class, ClassLoader.class};
            di = (DIContainer) ClassUtils.newInstance(defaultDIContainerClass, types, args);
            manager.put(file, di);
View Full Code Here


  public static final String XML = "components.xml";
 
  public static void main(String[] args) throws Exception {
    String config = args.length > 0 ? args[0] : XML;
    DIContainer di = DI.configure(config);
    if (di == null) throw new IllegalArgumentException(config + " is not found.");
    HttpEngine server = di.getBean("server", HttpEngine.class);
    Thread t = new Thread(server);
    t.start();
   
    create();
   
View Full Code Here

        def2.setId("sub");
        def2.setType("org.tamacat.di.impl.DIContainer_test$Sub", loader);
        def2.setSingleton(false);
        defines.put(def2.getId(), def2);
       
    DIContainer di = new TamaCatDIContainer(defines, loader);
    Super get1 = di.getBean("sub", Super.class);
    System.out.println(get1);
   
    Super get2 = di.getBean("sub", Sub.class);
    System.out.println(get2);
  }
View Full Code Here

  public static final String XML = "httpd.xml";
 
  public static void main(String[] args) {
    String config = args.length > 0 ? args[0] : XML;
    DIContainer di = DI.configure(config);
    if (di == null) throw new IllegalArgumentException(config + " is not found.");
    HttpEngine server = di.getBean("server", HttpEngine.class);
    if (server == null) throw new IllegalArgumentException();
    Thread t = new Thread(server);
    t.start();
  }
View Full Code Here

  public static final String XML = "httpsd.xml";
 
  public static void main(String[] args) {
    String config = args.length > 0 ? args[0] : XML;
    DIContainer di = DI.configure(config);
    if (di == null) throw new IllegalArgumentException(config + " is not found.");
    HttpEngine server = di.getBean("server", HttpEngine.class);
    if (server == null) throw new IllegalArgumentException();
    Thread t = new Thread(server);
    t.start();
  }
View Full Code Here

   *   <li>args[1]: Name of HttpEngine. (default "server")
   */
  public static void main(String[] args) {
    String config = args.length > 0 ? args[0] : XML;
    String serverKey = args.length > 1 ? args[1] : DEFAULT_SERVER_KEY;
    DIContainer di = DI.configure(config);
    if (di == null) throw new IllegalArgumentException(config + " is not found.");
    HttpEngine server = di.getBean(serverKey, HttpEngine.class);
    if (server == null) throw new IllegalArgumentException();
    Thread t = new Thread(server);
    t.start();
  }
View Full Code Here

TOP

Related Classes of org.tamacat.di.DIContainer

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.