private String showEsme() { List<Esme> esmes = this.smppManagement.getEsmeManagement().getEsmes(); if (esmes.size() == 0) { return SmppOamMessages.NO_ESME_DEFINED_YET; } StringBuffer sb = new StringBuffer(); for (Esme esme : esmes) { sb.append(SmppOamMessages.NEW_LINE); esme.show(sb); } return sb.toString(); }
/** * Command is smpp esme modify <name> password <password> esme-ton <esme address ton> esme-npi * <esme address npi> esme-range <esme address range> window-size <windowSize> connect-timeout * <connectTimeout> request-expiry-timeout <requestExpiryTimeout> window-monitor-interval * <windowMonitorInterval> window-wait-timeout <windowWaitTimeout> enquire-link-delay <30000> * source-ton <source address ton> source-npi <source address npi> source-range <source address * range> routing-ton <routing address ton> routing-npi <routing address npi> routing-range * <routing address range> * * @param args * @return */ private String modifyEsme(String[] args) throws Exception { if (args.length < 6 || args.length > 48) { return SmppOamMessages.INVALID_COMMAND; } // Create new Rem ESME String name = args[3]; if (name == null) { return SmppOamMessages.INVALID_COMMAND; } Esme esme = this.smppManagement.getEsmeManagement().getEsmeByName(name); if (esme == null) { throw new Exception(String.format(SmppOamMessages.DELETE_ESME_FAILED_NO_ESME_FOUND, name)); } int count = 4; while (count < args.length) { // These are all optional parameters for a Tx/Rx/Trx binds String key = args[count++]; if (key == null) { return SmppOamMessages.INVALID_COMMAND; } if (key.equals("password")) { esme.setPassword(args[count++]); } else if (key.equals("esme-ton")) { byte esmeTonType = Byte.parseByte(args[count++]); esme.setEsmeTon(esmeTonType); } else if (key.equals("esme-npi")) { byte esmeNpiType = Byte.parseByte(args[count++]); esme.setEsmeNpi(esmeNpiType); } else if (key.equals("esme-range")) { String esmeAddrRange = /* Regex */ args[count++]; esme.setEsmeAddressRange(esmeAddrRange); } else if (key.equals("window-size")) { int windowSize = Integer.parseInt(args[count++]); esme.setWindowSize(windowSize); } else if (key.equals("connect-timeout")) { long connectTimeout = Long.parseLong(args[count++]); esme.setConnectTimeout(connectTimeout); } else if (key.equals("request-expiry-timeout")) { long requestExpiryTimeout = Long.parseLong(args[count++]); esme.setRequestExpiryTimeout(requestExpiryTimeout); } else if (key.equals("window-monitor-interval")) { long windowMonitorInterval = Long.parseLong(args[count++]); esme.setWindowMonitorInterval(windowMonitorInterval); } else if (key.equals("window-wait-timeout")) { long windowWaitTimeout = Long.parseLong(args[count++]); esme.setWindowWaitTimeout(windowWaitTimeout); } else if (key.equals("enquire-link-delay")) { int enquireLinkDelay = Integer.parseInt(args[count++]); esme.setEnquireLinkDelay(enquireLinkDelay); } else if (key.equals("source-ton")) { int sourceTon = Integer.parseInt(args[count++]); esme.setSourceTon(sourceTon); } else if (key.equals("source-npi")) { int sourceNpi = Integer.parseInt(args[count++]); esme.setSourceNpi(sourceNpi); } else if (key.equals("source-range")) { String sourceAddressRange = args[count++]; esme.setSourceAddressRange(sourceAddressRange); } else if (key.equals("routing-ton")) { int routingTon = Integer.parseInt(args[count++]); esme.setRoutingTon(routingTon); } else if (key.equals("routing-npi")) { int routingNpi = Integer.parseInt(args[count++]); esme.setRoutingNpi(routingNpi); } else if (key.equals("routing-range")) { String routingAddressRange = args[count++]; esme.setRoutingAddressRange(routingAddressRange); } else { return SmppOamMessages.INVALID_COMMAND; } } return String.format(SmppOamMessages.MODIFY_ESME_SUCCESSFULL, esme.getSystemId()); }
/** * Command is smpp esme create name <systemId> <host-ip> <port> <SmppBindType> <SmppSession.Type> * password <password> system-type <sms | vms | ota > interface-version <3.3 | 3.4 | 5.0> esme-ton * <esme address ton> esme-npi <esme address npi> esme-range <esme address range> cluster-name * <clusterName> window-size <windowSize> connect-timeout <connectTimeout> request-expiry-timeout * <requestExpiryTimeout> window-monitor-interval <windowMonitorInterval> window-wait-timeout * <windowWaitTimeout> enquire-link-delay <30000> source-ton <source address ton> source-npi * <source address npi> source-range <source address range> routing-ton <routing address ton> * routing-npi <routing address npi>, routing-range <routing address range> ratelimit-day * <ratelimitday> * * @param args * @return */ private String createEsme(String[] args) throws Exception { if (args.length < 9 || args.length > 61) { return SmppOamMessages.INVALID_COMMAND; } // Create new Rem ESME String name = args[3]; if (name == null) { return SmppOamMessages.INVALID_COMMAND; } String systemId = args[4]; if (systemId == null) { return SmppOamMessages.INVALID_COMMAND; } // Password can be null String host = args[5]; if (host == null) { return SmppOamMessages.INVALID_COMMAND; } String strPort = args[6]; int intPort = -1; if (strPort == null) { return SmppOamMessages.INVALID_COMMAND; } else { try { intPort = Integer.parseInt(strPort); } catch (Exception e) { return SmppOamMessages.INVALID_COMMAND; } } String smppBindTypeStr = args[7]; if (smppBindTypeStr == null) { return SmppOamMessages.INVALID_COMMAND; } String smppSessionTypeStr = args[8]; if (smppSessionTypeStr == null) { return SmppOamMessages.INVALID_COMMAND; } String systemType = null; String smppVersionType = SmppInterfaceVersionType.SMPP34.getType(); byte esmeTonType = -1; byte esmeNpiType = -1; String esmeAddrRange = null; String clusterName = name; String password = null; int count = 9; int windowSize = SmppConstants.DEFAULT_WINDOW_SIZE; long connectTimeout = SmppConstants.DEFAULT_CONNECT_TIMEOUT; long requestExpiryTimeout = SmppConstants.DEFAULT_REQUEST_EXPIRY_TIMEOUT; long windowMonitorInterval = SmppConstants.DEFAULT_WINDOW_MONITOR_INTERVAL; long windowWaitTimeout = SmppConstants.DEFAULT_WINDOW_WAIT_TIMEOUT; int enquireLinkDelay = 30000; int sourceTon = -1; int sourceNpi = -1; String sourceAddressRange = "^[0-9a-zA-Z]*"; int routinigTon = -1; int routingNpi = -1; String routingAddressRange = "^[0-9a-zA-Z]*"; while (count < args.length) { // These are all optional parameters for a Tx/Rx/Trx binds String key = args[count++]; if (key == null) { return SmppOamMessages.INVALID_COMMAND; } if (key.equals("password")) { password = args[count++]; } else if (key.equals("system-type")) { systemType = args[count++]; } else if (key.equals("interface-version")) { smppVersionType = args[count++]; } else if (key.equals("esme-ton")) { esmeTonType = Byte.parseByte(args[count++]); } else if (key.equals("esme-npi")) { esmeNpiType = Byte.parseByte(args[count++]); } else if (key.equals("esme-range")) { esmeAddrRange = /* Regex */ args[count++]; } else if (key.equals("window-size")) { windowSize = Integer.parseInt(args[count++]); } else if (key.equals("connect-timeout")) { connectTimeout = Long.parseLong(args[count++]); } else if (key.equals("request-expiry-timeout")) { requestExpiryTimeout = Long.parseLong(args[count++]); } else if (key.equals("window-monitor-interval")) { windowMonitorInterval = Long.parseLong(args[count++]); } else if (key.equals("window-wait-timeout")) { windowWaitTimeout = Long.parseLong(args[count++]); } else if (key.equals("cluster-name")) { clusterName = args[count++]; // } else if (key.equals("counters-enabled")) { // countersEnabled = Boolean.parseBoolean(args[count++]); } else if (key.equals("enquire-link-delay")) { enquireLinkDelay = Integer.parseInt(args[count++]); // } else if (key.equals("charging-enabled")) { // chargingEnabled = Boolean.parseBoolean(args[count++]); } else if (key.equals("source-ton")) { sourceTon = Integer.parseInt(args[count++]); } else if (key.equals("source-npi")) { sourceNpi = Integer.parseInt(args[count++]); } else if (key.equals("source-range")) { sourceAddressRange = args[count++]; } else if (key.equals("routing-ton")) { routinigTon = Integer.parseInt(args[count++]); } else if (key.equals("routing-npi")) { routingNpi = Integer.parseInt(args[count++]); } else if (key.equals("routing-range")) { routingAddressRange = args[count++]; } else { return SmppOamMessages.INVALID_COMMAND; } } Esme esme = this.smppManagement .getEsmeManagement() .createEsme( name, systemId, password, host, intPort, smppBindTypeStr, systemType, smppVersionType, esmeTonType, esmeNpiType, esmeAddrRange, smppSessionTypeStr, windowSize, connectTimeout, requestExpiryTimeout, windowMonitorInterval, windowWaitTimeout, clusterName, enquireLinkDelay, sourceTon, sourceNpi, sourceAddressRange, routinigTon, routingNpi, routingAddressRange); return String.format(SmppOamMessages.CREATE_ESME_SUCCESSFULL, esme.getSystemId()); }