📄 containerdirector.java
字号:
/**
* Copyright 2003-2005 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jdon.container.builder;
import com.jdon.container.ContainerWrapper;
import com.jdon.container.config.app.AppConfigureCollection;
import com.jdon.util.Debug;
/**
* container director register order: 1. register all components in
* container.xml 2. register all components in aspect.xml 3. startup above all
* components 3. register user services in jdonframework.xml
*
*
* @author banq
*/
public class ContainerDirector {
public final static String module = ContainerDirector.class.getName();
private ContainerBuilder cb;
private static Object initLock = new Object();
public ContainerDirector(ContainerBuilder cb) {
this.cb = cb;
}
/**
* prepare the applicaition configure files
*
* @param appConfigureFiles
*/
public void prepare(AppConfigureCollection appConfigureFiles) throws Exception {
if (!cb.isStartup())
cb.addAppConfigureFiles(appConfigureFiles);
}
public void startup() throws StartupException {
Debug.logVerbose(" <======== JdonFramework beigin to startup =========>", module);
if (!cb.isStartup())
synchronized (initLock) {
if (!cb.isStartup()) {
try {
Debug.logVerbose(" <------ register the basic components in container.xml ------> ", module);
cb.registerComponents();
ContainerWrapper cw = cb.getContainerWrapper();
cw.start();
cb.setStartup(true);
Debug.logVerbose(" <------ started micro container ------> ", module);
Debug.logVerbose(" <------ register the pojo services in jdonframework.xml ------> ", module);
cb.registerUserService();
Debug.logVerbose(" <------ register the aspect components in container.xml ------> ", module);
cb.registerAspectComponents();
Debug.logInfo(" <======== Jdon Framework started successfully! =========>", module);
} catch (Exception ex) {
Debug.logError(" startup container error: " + ex, module);
throw new StartupException();
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -