1 15 16 package com.jdon.container.builder; 17 18 import com.jdon.container.ContainerWrapper; 19 import com.jdon.util.Debug; 20 21 29 public class ContainerDirector { 30 public final static String module = ContainerDirector.class.getName(); 31 32 private ContainerBuilder cb; 33 34 private static Object initLock = new Object (); 35 36 public ContainerDirector(ContainerBuilder cb) { 37 this.cb = cb; 38 } 39 40 45 public void prepareConfiguration(String configureFileName) throws Exception { 46 if (!cb.isStartup()) 47 cb.addAppConfigureFile(configureFileName); 48 } 49 50 public void startup() throws StartupException { 51 Debug.logVerbose("[JdonFramework] <======== JdonFramework beigin to startup =========>", module); 52 if (!cb.isStartup()) 53 synchronized (initLock) { 54 if (!cb.isStartup()) { 55 try { 56 Debug.logVerbose("[JdonFramework] <------ register the basic components in container.xml ------> ", module); 57 cb.registerComponents(); 58 59 ContainerWrapper cw = cb.getContainerWrapper(); 60 cw.start(); 61 cb.setStartup(true); 62 63 Debug.logVerbose("[JdonFramework] <------ started micro container ------> ", module); 64 65 Debug.logVerbose("[JdonFramework] <------ register the pojo services in jdonframework.xml ------> ", module); 66 cb.registerUserService(); 67 68 Debug.logVerbose("[JdonFramework] <------ register the aspect components in container.xml ------> ", module); 69 cb.registerAspectComponents(); 70 71 Debug.logInfo(" <======== Jdon Framework started successfully! =========>", module); 72 73 } catch (Exception ex) { 74 Debug.logError("[JdonFramework] startup container error: " + ex, module); 75 throw new StartupException(); 76 } 77 } 78 } 79 80 } 81 82 } 83 | Popular Tags |