package com.round.aside.server.module;

import java.util.HashMap;
import java.util.Map;

import com.round.aside.server.module.accountmanager.AccountManagerModuleFactoryImpl;
import com.round.aside.server.module.accountmanager.IAccountManager;
import com.round.aside.server.module.netsecurity.INetSecurity;
import com.round.aside.server.module.netsecurity.NetSecurityModuleFactoryImpl;

/**
 * 模块对象池，用于对外暴露接口供第三方使用获取模块对象，隐藏了模块实现和工厂实现。
 * 
 * @author A Shuai
 *
 */
public final class ModuleObjectPool {

    private static final Map<String, IModuleFactory<? extends IModule>> mModuleFactoryMap = 
            new HashMap<String, IModuleFactory<? extends IModule>>();

    static {
        mModuleFactoryMap.put(IAccountManager.class.getSimpleName(), new AccountManagerModuleFactoryImpl());
        mModuleFactoryMap.put(INetSecurity.class.getSimpleName(), new NetSecurityModuleFactoryImpl());
    }

    private ModuleObjectPool() {
    }

    public static <T extends IModule> T getModuleObject(Class<?> mModuleName, Object o1, Object... objects) {
        @SuppressWarnings("unchecked")
        IModuleFactory<T> mModuleFactory = (IModuleFactory<T>) mModuleFactoryMap.get(mModuleName.getSimpleName());
        return mModuleFactory.createModule(o1, objects);
    }

}

@@ -452,16 +452,17 @@
 Shuai%0A *
+ 
 %0A */%0Apub
@@ -929,24 +929,360 @@
 () %7B%0A    %7D%0A%0A
+    /**%0A     * %E8%8E%B7%E5%8F%96%E6%A8%A1%E5%9D%97%E7%9A%84%E9%9D%99%E6%80%81%E6%96%B9%E6%B3%95%0A     * %0A     * @param mModuleName%0A     *            %E5%BE%85%E8%8E%B7%E5%8F%96%E6%A8%A1%E5%9D%97%E7%9A%84%E7%B1%BB%EF%BC%8C%E5%8F%AA%E5%8F%AF%E4%BB%A5%E6%98%AF%7B@link IAccountManager%7D%EF%BC%8C%7B@link INetSecurity%7D%0A     *            %EF%BC%8C%E9%99%A4%E6%AD%A4%E4%B9%8B%E5%A4%96%E5%85%B6%E4%BB%96%E7%9A%84%E8%BE%93%E5%85%A5%E5%9D%87%E4%B8%BA%E9%9D%9E%E6%B3%95%E8%BE%93%E5%85%A5%0A     * @param o1%0A     *            %E5%BE%85%E8%8E%B7%E5%8F%96%E6%A8%A1%E5%9D%97%E7%9A%84%E7%AC%AC%E4%B8%80%E4%B8%AA%E6%9E%84%E9%80%A0%E5%8F%82%E6%95%B0%EF%BC%8C%E5%8F%AF%E4%B8%BAnull%0A     * @param objects%0A     *            %E5%BE%85%E8%8E%B7%E5%8F%96%E6%A8%A1%E5%9D%97%E7%9A%84%E9%99%A4%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%8F%82%E6%95%B0%E4%BB%A5%E5%A4%96%E7%9A%84%E5%85%B6%E4%BB%96%E6%9E%84%E9%80%A0%E5%8F%82%E6%95%B0%EF%BC%8C%E6%98%AF%E4%B8%80%E4%B8%AA%E5%8F%98%E9%95%BF%E5%8F%82%E6%95%B0%EF%BC%8C%E5%8F%AF%E4%B8%BA0%E4%B8%AA%E8%87%B3%E6%97%A0%E9%99%90%E4%B8%AA%0A     * @return %E5%BE%85%E6%9E%84%E9%80%A0%E7%9A%84%E6%A8%A1%E5%9D%97%E5%AF%B9%E8%B1%A1%0A     */%0A
     public s
@@ -1529,24 +1529,159 @@
 pleName());%0A
+        if (mModuleFactory == null) %7B%0A            throw new IllegalArgumentException(%22the module class isn't legal class.%22);%0A        %7D%0A
         retu

add comments.