Hi Chris, Do I have to create another account to log in ASF JIRA? My user id here cannot log in ASF JIRA.
After looking into the source code, I found that we can add support to Vendor Specific Optional Parameter by adding some codes in the AbstractSmppCommand class like below. Please correct me if I am wrong. @SuppressWarnings("rawtypes") protected List<OptionalParameter> createOptionalParameters(Map<String, String> optinalParamaters) { List<OptionalParameter> optParams = new ArrayList<OptionalParameter>(); for (Entry<String, String> entry : optinalParamaters.entrySet()) { OptionalParameter optParam = null; try { //add a checking to distinguish Vendor Specfic Optional Parameter //from other static defined optional parameters if (((String)entry.getKey()).equals.("VENDOR_SPECFIC_OPTIONAL_PARAMETER"){ optParam = generateVenderSpecificOptParam(entry) ; } else { Tag tag = Tag.valueOf(entry.getKey()); Class type = determineTypeClass(tag); if (OctetString.class.equals(type)) { optParam = new OptionalParameter.OctetString(tag.code(), entry.getValue()); } else if (COctetString.class.equals(type)) { optParam = new OptionalParameter.COctetString(tag.code(), entry.getValue()); } else if (org.jsmpp.bean.OptionalParameter.Byte.class.equals(type)) { optParam = new OptionalParameter.Byte(tag.code(), Byte.valueOf(entry.getValue())); } else if (org.jsmpp.bean.OptionalParameter.Int.class.equals(type)) { optParam = new OptionalParameter.Int(tag.code(), Integer.valueOf(entry.getValue())); } else if (org.jsmpp.bean.OptionalParameter.Short.class.equals(type)) { optParam = new OptionalParameter.Short(tag.code(), Short.valueOf(entry.getValue())); } else if (org.jsmpp.bean.OptionalParameter.Null.class.equals(type)) { optParam = new OptionalParameter.Null(tag); } } optParams.add(optParam); } catch (Exception e) { log.info("Couldn't determine optional parameter for key {} and value {}. Skip this one.", entry.getKey(), entry.getValue()); } } return optParams; } /* <p>Since it is vendor specified, so users must have the code and type, therefore users should concatenate these information as a string using a separator(":") and pass this in as the Entry's value </p> <p>Usage: Entry<String, String> String key must equal "VENDOR_SPECIFIC_OPTIONAL_PARAMETER" String value should be "code:type:param_value" */ protected OptionalParameter generateVendorSpecificOptParam(Entry<String, String> entry) throws SecurityException, IllegalArgumentException, IllegalAccessException{ OptionalParameter optParam = null ; //code must be in 4 character and can be parsed into a hex String code = entry.getValue().substring(0,4) ; //code must fall inside the ranges specified in SMPP 3.4 specification //0x1400 - 0x3FFF if ( !(code >= 0x1400 or code <= 0x3FFF) throw new IllegalArgumentException() ; //type must be one of the defined Class and must be in uppercase int pos2 = entry.getValue().indexOf(':', 5) ; String type = entry.getValue().substring(5,pos2-1) ; if ( type.equals("OCTETSTRING") ){ optParam = new OptionalParameter.OctetString(hexcode, entry.getValue().substring(pos2+1) ; }else if (type.equals("COCTETSTRING") ) { optParam = new OptionalParameter.COctetString(hexcode, entry.getValue().substring(pos2+1 ); }else if(type.equals("BYTE") ){ optParam = new OptionalParameter.Byte(hexcode, Byte.valueOf(entry.getValue().substring(pos2+1))); }else if (type.equals("INT") ){ optParam = new OptionalParameter.Int(hexcode, Integer.valueOf(entry.getValue().substring(pos2+1))); }else if (type.equals("SHORT") ) { optParam = new OptionalParameter.Short(hexcode, Short.valueOf(entry.getValue().substring(pos2+1))); }else if (type.equals("NULL") ) optParam = new OptionalParameter.Null(tag); }else throw new IllegualArgumentException() ; } return optParam ; } -- View this message in context: http://camel.465427.n5.nabble.com/How-to-add-Vendor-Specific-Optional-Parameter-in-CamelSmppOptionalParameters-tp5737268p5737427.html Sent from the Camel - Users mailing list archive at Nabble.com.