*
*/
public synchronized void loadBridge(String name) throws Exception {
_bc.logInfo("Loading bridge "+name, null);
Bridge b = _bridges.get(name);
if (b != null) {
_bc.logInfo("Bridge "+name+" is already loaded.", null);
throw new BridgeException(_bmr.getString(_bmr.I_BRIDGE_ALREADY_LOADED, name), Status.NOT_MODIFIED);
}
Properties props = _bc.getBridgeConfig();
/*
String activekey = props.getProperty(
BridgeBaseContext.PROP_PREFIX)+".activelist";
List<String> alist = BridgeUtil.getListProperty(activekey, props);
String tmpn = null;
boolean found = false;
Iterator<String> itr = alist.iterator();
while (itr.hasNext()) {
tmpn = itr.next();
if (tmpn.equals(name)) {
found = true;
break;
}
}
if (!found) {
String oldactives = props.getProperty(activekey);
String newactives = oldactives+","+name;
Properties p = new Properties();
p.setProperty(activekey, newactives);
_bc.updateBridgeConfig(p);
}
*/
props = _bc.getBridgeConfig();
String type = props.getProperty(
props.getProperty(
BridgeBaseContext.PROP_PREFIX)+"."+name+".type");
if (type == null) {
String emsg = _bmr.getKString(_bmr.E_LOAD_BRIDGE_NO_TYPE, name);
_bc.logError(emsg, null);
throw new BridgeException(emsg);
}
type = type.toLowerCase();
String classn = props.getProperty(
props.getProperty(
BridgeBaseContext.PROP_PREFIX)+"."+type+".class");
if (classn == null) {
String emsg = _bmr.getKString(_bmr.E_LOAD_BRIDGE_NO_CLASS, name);
_bc.logError(emsg, null);
throw new BridgeException(emsg);
}
b = (Bridge)Class.forName(classn).newInstance();
if (!b.isMultipliable() && !b.getType().toLowerCase().equals(name.toLowerCase())) {
String emsg = _bmr.getKString(_bmr.E_BRIDGE_NAME_TYPE_NOT_SAME, name, b.getType());
_bc.logError(emsg, null);
throw new BridgeException(emsg);
}
if (DEBUG) {
_bc.logInfo("Loaded brigde "+name+" by classloader "+
b.getClass().getClassLoader()+
"(parent:"+this.getClass().getClassLoader()+")", null);
}
b.setName(name);
_bridges.put(name, b);
_bc.logInfo("Loaded bridge "+name, null);
}