Producer.IntLinkName=intlink.gif
Producer.MailLinkName=maillink.gif
+#objectstore
+StoreContainer.EntityDefaultSize=45
+StoreContainer.EntityListDefaultSize=15
+StorableObjectEntity.Entity.DefaultSize=5000
+StorableObjectEntity.EntityList.DefaultSize=400
* @version 1.0
*/
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
-import mir.config.MirPropertiesConfiguration;
import mir.log.LoggerWrapper;
public class ObjectStore {
private final static ObjectStore INSTANCE = new ObjectStore();
private final static Map containerMap = new HashMap(); // StoreContainerType/StoreContainer
private static long storeHit = 0, storeMiss = 0;
- private Properties ostoreConf;
private LoggerWrapper logger;
private ObjectStore() {
- String confName = null;
-
- logger = new LoggerWrapper("Database.ObjectStore");
- Properties conf = new Properties();
-
- try {
- confName =
- MirPropertiesConfiguration.instance().getString("Home") +
- "etc/objectstore.properties";
- conf.load(new BufferedInputStream(new FileInputStream(confName)));
- }
- catch (java.io.FileNotFoundException fnfe) {
- logger.error("could not read config file. not found: " + confName);
- }
- catch (Throwable t) {
- logger.error("could not get config: " + t.getMessage());
- }
- ostoreConf = conf;
+ logger = new LoggerWrapper("Database");
}
public static ObjectStore getInstance() {
return (stoc != null && stoc.has(sid)) ? true : false;
}
- public String getConfProperty(String name) {
- if (name != null) {
- String returnValue = "";
- try {
- return ostoreConf.getProperty(name);
- }
- catch (MissingResourceException e) {
- logger.error("getConfProperty: " + e.toString());
- }
- }
- return null;
- }
-
/**
* Method: toString()
* Description: Displays statistical information about the ObjectStore.
import javax.servlet.http.HttpServletRequest;
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
private int hitCount = 0, missCount = 0;
private static ObjectStore o_store = ObjectStore.getInstance();
- protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");
+ protected LoggerWrapper logger = new LoggerWrapper("Database");
+ private MirPropertiesConfiguration configuration;
// avoid construction without parameters
private StoreContainer() {};
this.uniqueId = ++uniqueCounter;
this.stocType = stoc_type;
this.container = new LinkedList();
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ } catch (PropertiesConfigExc e) {
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.ERROR_MESSAGE));
+ }
int defaultSize = stoc_type.getDefaultSize();
String confProperty = stoc_type.getConfPrefix() + ".DefaultSize";
- String confedSize = o_store.getConfProperty(confProperty);
+ String confedSize = configuration.getString(confProperty);
if (confedSize != null) {
this.maxSize = StringUtil.parseInt(confedSize, defaultSize);
}
import java.util.HashMap;
import java.util.Map;
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.log.LoggerWrapper;
import mir.misc.StringUtil;
public class StoreContainerType {
private static ObjectStore o_store = ObjectStore.getInstance();
private Class stocClass = null;
private int stocType = STOC_TYPE_UNKNOWN;
+ private MirPropertiesConfiguration configuration;
+ private LoggerWrapper logger;
static {
uniqueTypes[STOC_TYPE_ENTITY] = new HashMap();
private StoreContainerType(Class stocClass, int stocType) {
this.stocClass = stocClass;
this.stocType = stocType;
+ logger = new LoggerWrapper("Database");
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ } catch (PropertiesConfigExc e) {
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.ERROR_MESSAGE));
+ }
}
public static StoreContainerType valueOf(Class stoc_class, int stoc_type) {
String confProperty = "StoreContainer." + stringForStoreType(stocType) +
".DefaultSize";
return
- StringUtil.parseInt(o_store.getConfProperty(confProperty), 10);
+ StringUtil.parseInt(configuration.getString(confProperty), 10);
}
public String toString() {