/* ==================================================================
* Created [2009-4-27 下午11:32:55] by Jon.King
* ==================================================================
* TSS
* ==================================================================
* mailTo:jinpujun@hotmail.com
* Copyright (c) Jon.King, 2009-2012
* ==================================================================
*/
package com.jinhe.tss.core.sso.appserver;
import com.jinhe.tss.core.Config;
import com.jinhe.tss.core.sso.SSOConstants;
import com.jinhe.tss.core.util.BeanUtil;
/**
* <p> AppServerStorerFactory.java </p>
* <p>
* 应用服务器存储器对象工厂类
* </p>
*/
public class AppServerStorerFactory {
private static AppServerStorerFactory factory = null;
private static IAppServerStorer appServerStorer = null;
private AppServerStorerFactory() {}
/**
* <p>
* 获取应用服务器存储器对象
* </p>
* @return
*/
public IAppServerStorer getAppServerStorer() {
if (appServerStorer == null) {
String className = Config.getAttribute(SSOConstants.APPSERVER_STORER);
if (className != null) {
appServerStorer = (IAppServerStorer) BeanUtil.newInstanceByName(className);
}
if(appServerStorer == null) {
appServerStorer = new FileAppServerStorer();
}
}
return appServerStorer;
}
/**
* <p>
* 工厂类实例化
* </p>
* @return
*/
public static AppServerStorerFactory newInstance() {
if (factory == null) {
factory = new AppServerStorerFactory();
}
return factory;
}
}