package com.sealbird.util;
import com.sealbird.exception.ScutnetException;
import java.util.Hashtable;
import java.util.Vector;
import java.util.Enumeration;
/**
* Created by IntelliJ IDEA.
* User: seal
* Date: 2005-11-24
* Time: 16:22:27
*/
public final class DataPool {
private Hashtable InfoPools = new Hashtable();
public static final int TYPE_INTERFACE = 100;
public void setInof(int dataType, String vaultId, String id, Hashtable data)
throws ScutnetException {
Hashtable pool = getPool(dataType, vaultId);
if (pool != null) {
if (data == null)
pool.remove(id);
else
pool.put(id, data);
}
}
private Hashtable getPool(int type, String vaultId) {
Hashtable pools = null;
Hashtable pool = null;
pools = this.InfoPools;
pool = (Hashtable) pools.get(vaultId + "_" + type);
if (pool == null) {
pool = new Hashtable();
pools.put(vaultId + "_" + type, pool);
}
return pool;
}
public Vector getPoolData(int type, String vaultId) {
Vector result = new Vector();
Hashtable ht = getPool(type, vaultId);
if (ht != null) {
Enumeration e = ht.elements();
while (e.hasMoreElements()) {
result.add(e.nextElement());
}
}
return result;
}
public static void main(String[] args) throws ScutnetException {
}
}