public void remove(GatewayEntry ge) throws GatewayException { String id = ge.getId().toLowerCase().trim(); GatewayEntry existing = (GatewayEntry) entries.remove(id); Gateway g = null; // does not exist if (existing != null) { g = existing.getGateway(); if (g.getState() == Gateway.RUNNING) g.doStop(); } }
public void addEntry(Config config, GatewayEntry ge) throws ClassException, PageException, GatewayException { String id = ge.getId().toLowerCase().trim(); GatewayEntry existing = (GatewayEntry) entries.get(id); Gateway g = null; // does not exist if (existing == null) { entries.put(id, load(config, ge)); } // exist but changed else if (!existing.equals(ge)) { g = existing.getGateway(); if (g.getState() == Gateway.RUNNING) g.doStop(); entries.put(id, load(config, ge)); } // not changed // else print.out("untouched:"+id); }
/** * send the message to the gateway * * @param gatewayId * @param data * @return * @throws PageException */ public String sendMessage(String gatewayId, Struct data) throws PageException, GatewayException { Gateway g = getGateway(gatewayId); if (g.getState() != Gateway.RUNNING) throw new GatewayException("Gateway [" + gatewayId + "] is not running"); return g.sendMessage(data); }