📄 commonobject.java
字号:
/*
* FileName CommonObject.java
* Create Time 2005-8-1 9:33:25
* Author shiwei
* Descript 系统公用对象操作
* Version
*/
package com.snoics.reptile.system.common;
import java.util.ArrayList;
import com.snoics.base.pool.ObjectManager;
import com.snoics.reptile.system.conf.ConfigInfo;
import com.snoics.reptile.system.exception.ReptileSystemException;
import com.snoics.reptile.system.init.InitSystemImpl;
import com.snoics.system.interfaces.InitSystem;
public class CommonObject{
/**
* 对象池管理实例
*/
private ObjectManager objectManager=ObjectManager.getInstance() ;
private InitSystem initSystemImpl=new InitSystemImpl();
/**
* 从对象池中取得系统配置信息
* @return ConfigInfo
* @throws ReptileSystemException
*/
public ConfigInfo getConfigInfoObject() throws ReptileSystemException{
ConfigInfo configInfo=null;
configInfo=(ConfigInfo)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CONFIGINFO);
if(configInfo==null){
initSystemImpl.initialize();
configInfo=(ConfigInfo)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CONFIGINFO);
}
return configInfo;
}
/**
* 将系统配置信息放入对象池,如果对象已经存在则覆盖原有对象
* @param configInfo ConfigInfo
* @throws ReptileSystemException
*/
public void setConfigInfoObject(ConfigInfo configInfo) throws ReptileSystemException{
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CONFIGINFO,configInfo);
}
/**
* 取得文件类型对象
* @return ArrayList
* @throws ReptileSystemException
*/
public ArrayList getUnDownloadType() throws ReptileSystemException{
ArrayList arraylist=null;
arraylist=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_UNRELINKTYPE);
if(arraylist==null||arraylist.isEmpty()){
initSystemImpl.initialize();
arraylist=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_UNRELINKTYPE);
}
return arraylist;
}
/**
* 将文件类型放入对象池,如果对象已经存在则覆盖原有对象
* @param unrelinktypes ArrayList
* @throws ReptileSystemException
*/
public void setRelinkremotefiletype(ArrayList unrelinktypes) throws ReptileSystemException{
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_UNRELINKTYPE,unrelinktypes);
}
/**
* 取得需要下载到本地的文件类型对象
* @return ArrayList
* @throws ReptileSystemException
*/
public ArrayList getDownloadfiletype() throws ReptileSystemException{
ArrayList arraylist=null;
arraylist=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_DOWNLOADFILETYPE);
if(arraylist==null||arraylist.isEmpty()){
initSystemImpl.initialize();
arraylist=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_DOWNLOADFILETYPE);
}
return arraylist;
}
/**
* 将取得需要下载到本地的文件类型对象放入对象池,如果对象已经存在则覆盖原有对象
* @param downloadfiletype ArrayList
* @throws ReptileSystemException
*/
public void setDownloadfiletype(ArrayList downloadfiletype) throws ReptileSystemException{
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_DOWNLOADFILETYPE,downloadfiletype);
}
/**
* 将一个配置写入系统配置信息
* @param parameter
* @param value
* @throws ReptileSystemException
*/
public void setConfigInfo(String parameter,String value) throws ReptileSystemException{
ConfigInfo configInfo=getConfigInfoObject();
configInfo.setValue(parameter,value);
setConfigInfoObject(configInfo);
}
/**
* 取得一个配置信息
* @param parameter
* @return String
* @throws ReptileSystemException
*/
public String getConfigInfo(String parameter) throws ReptileSystemException{
ConfigInfo configInfo=getConfigInfoObject();
String value=configInfo.getValue(parameter);
return value;
}
/**
* 将系统缓存放到对象池中
* @param reptilecache
* @throws ReptileSystemException
*/
public void setReptileCache(ArrayList reptilecache) throws ReptileSystemException{
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CACHE,reptilecache);
}
/**
* 取得缓存
* @return ArrayList
* @throws ReptileSystemException
*/
public ArrayList getReptileCache() throws ReptileSystemException{
ArrayList reptilecache=null;
reptilecache=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CACHE);
if(reptilecache==null){
//destorySystemObject();
initSystemImpl.initialize();
reptilecache=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CACHE);
}
return reptilecache;
}
/**
* 将系统临时缓存放到对象池中
* @param tmepcache
* @throws ReptileSystemException
*/
public void setReptileTempCache(ArrayList tmepcache) throws ReptileSystemException{
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_TEMPCACHE,tmepcache);
}
/**
* 取得临时缓存
* @return ArrayList
* @throws ReptileSystemException
*/
public ArrayList getReptileTempCache() throws ReptileSystemException{
ArrayList tempcache=null;
tempcache=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_TEMPCACHE);
if(tempcache==null){
//destorySystemObject();
initSystemImpl.initialize();
tempcache=(ArrayList)objectManager.getObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_TEMPCACHE);
}
return tempcache;
}
/**
* 摧毁对象池中的对象
*
*/
public synchronized void destorySystemObject(){
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CACHE,null);
objectManager.checkOutObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CACHE);
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CONFIGINFO,null);
objectManager.checkOutObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_CONFIGINFO);
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_DOWNLOADFILETYPE,null);
objectManager.checkOutObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_DOWNLOADFILETYPE);
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_TEMPCACHE,null);
objectManager.checkOutObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_TEMPCACHE);
objectManager.checkInObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_UNRELINKTYPE,null);
objectManager.checkOutObject(Common.REPTILE_OBJECTPOOL_NAME,Common.COMMON_OBJECT_UNRELINKTYPE);
}
/**
* 彻底清除系统中的对象,停止线程执行
*
*/
public synchronized void clearSystem(){
destorySystemObject();
objectManager.destroy();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -