PageRenderTime 29ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/protocols/ss7/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java

http://mobicents.googlecode.com/
Java | 397 lines | 309 code | 56 blank | 32 comment | 0 complexity | 05fe4a6e046440d5098983980e0dabf3 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.ss7.map;
  23. import java.nio.charset.Charset;
  24. import java.util.ArrayList;
  25. import org.mobicents.protocols.ss7.isup.message.parameter.LocationNumber;
  26. import org.mobicents.protocols.ss7.map.api.MAPException;
  27. import org.mobicents.protocols.ss7.map.api.MAPParameterFactory;
  28. import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice;
  29. import org.mobicents.protocols.ss7.map.api.primitives.AdditionalNumberType;
  30. import org.mobicents.protocols.ss7.map.api.primitives.AddressNature;
  31. import org.mobicents.protocols.ss7.map.api.primitives.AddressString;
  32. import org.mobicents.protocols.ss7.map.api.primitives.AlertingPattern;
  33. import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdFixedLength;
  34. import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdOrLAI;
  35. import org.mobicents.protocols.ss7.map.api.primitives.FTNAddressString;
  36. import org.mobicents.protocols.ss7.map.api.primitives.IMEI;
  37. import org.mobicents.protocols.ss7.map.api.primitives.IMSI;
  38. import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString;
  39. import org.mobicents.protocols.ss7.map.api.primitives.LAIFixedLength;
  40. import org.mobicents.protocols.ss7.map.api.primitives.LMSI;
  41. import org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer;
  42. import org.mobicents.protocols.ss7.map.api.primitives.MAPPrivateExtension;
  43. import org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan;
  44. import org.mobicents.protocols.ss7.map.api.primitives.USSDString;
  45. import org.mobicents.protocols.ss7.map.api.service.callhandling.CallReferenceNumber;
  46. import org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI;
  47. import org.mobicents.protocols.ss7.map.api.service.sms.MWStatus;
  48. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA;
  49. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA;
  50. import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_SMEA;
  51. import org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo;
  52. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.GeodeticInformation;
  53. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.GeographicalInformation;
  54. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LSAIdentity;
  55. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationInformation;
  56. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationInformationEPS;
  57. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationNumberMap;
  58. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.NotReachableReason;
  59. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.SubscriberState;
  60. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.SubscriberStateChoice;
  61. import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.UserCSGInformation;
  62. import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtBasicServiceCode;
  63. import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtBearerServiceCode;
  64. import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtTeleserviceCode;
  65. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSRequestIndication;
  66. import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSResponseIndication;
  67. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyRequestIndication;
  68. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication;
  69. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSRequestIndication;
  70. import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSResponseIndication;
  71. import org.mobicents.protocols.ss7.map.api.smstpdu.SmsTpdu;
  72. import org.mobicents.protocols.ss7.map.dialog.MAPUserAbortChoiceImpl;
  73. import org.mobicents.protocols.ss7.map.primitives.AddressStringImpl;
  74. import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdFixedLengthImpl;
  75. import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdOrLAIImpl;
  76. import org.mobicents.protocols.ss7.map.primitives.FTNAddressStringImpl;
  77. import org.mobicents.protocols.ss7.map.primitives.IMEIImpl;
  78. import org.mobicents.protocols.ss7.map.primitives.IMSIImpl;
  79. import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl;
  80. import org.mobicents.protocols.ss7.map.primitives.LAIFixedLengthImpl;
  81. import org.mobicents.protocols.ss7.map.primitives.LMSIImpl;
  82. import org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerImpl;
  83. import org.mobicents.protocols.ss7.map.primitives.MAPPrivateExtensionImpl;
  84. import org.mobicents.protocols.ss7.map.primitives.USSDStringImpl;
  85. import org.mobicents.protocols.ss7.map.service.callhandling.CallReferenceNumberImpl;
  86. import org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl;
  87. import org.mobicents.protocols.ss7.map.service.sms.MWStatusImpl;
  88. import org.mobicents.protocols.ss7.map.service.sms.SM_RP_DAImpl;
  89. import org.mobicents.protocols.ss7.map.service.sms.SM_RP_OAImpl;
  90. import org.mobicents.protocols.ss7.map.service.sms.SM_RP_SMEAImpl;
  91. import org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl;
  92. import org.mobicents.protocols.ss7.map.service.subscriberInformation.LocationInformationImpl;
  93. import org.mobicents.protocols.ss7.map.service.subscriberInformation.LocationNumberMapImpl;
  94. import org.mobicents.protocols.ss7.map.service.subscriberInformation.SubscriberStateImpl;
  95. import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtBasicServiceCodeImpl;
  96. import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtBearerServiceCodeImpl;
  97. import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtTeleserviceCodeImpl;
  98. import org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSRequestIndicationImpl;
  99. import org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSResponseIndicationImpl;
  100. import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSNotifyRequestIndicationImpl;
  101. import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSNotifyResponseIndicationImpl;
  102. import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSRequestIndicationImpl;
  103. import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSResponseIndicationImpl;
  104. import org.mobicents.protocols.ss7.tcap.asn.TcapFactory;
  105. import org.mobicents.protocols.ss7.tcap.asn.comp.GeneralProblemType;
  106. import org.mobicents.protocols.ss7.tcap.asn.comp.InvokeProblemType;
  107. import org.mobicents.protocols.ss7.tcap.asn.comp.Problem;
  108. import org.mobicents.protocols.ss7.tcap.asn.comp.ProblemType;
  109. import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnErrorProblemType;
  110. import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnResultProblemType;
  111. /**
  112. *
  113. * @author amit bhayani
  114. *
  115. */
  116. public class MAPParameterFactoryImpl implements MAPParameterFactory {
  117. public ProcessUnstructuredSSRequestIndication createProcessUnstructuredSSRequestIndication(byte ussdDataCodingSch, USSDString ussdString,
  118. AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) {
  119. ProcessUnstructuredSSRequestIndication request = new ProcessUnstructuredSSRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern,
  120. msisdnAddressString);
  121. return request;
  122. }
  123. public ProcessUnstructuredSSResponseIndication createProcessUnstructuredSSResponseIndication(byte ussdDataCodingScheme, USSDString ussdString) {
  124. ProcessUnstructuredSSResponseIndication response = new ProcessUnstructuredSSResponseIndicationImpl(ussdDataCodingScheme, ussdString);
  125. return response;
  126. }
  127. public UnstructuredSSRequestIndication createUnstructuredSSRequestIndication(byte ussdDataCodingSch, USSDString ussdString,
  128. AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) {
  129. UnstructuredSSRequestIndication request = new UnstructuredSSRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern, msisdnAddressString);
  130. return request;
  131. }
  132. public UnstructuredSSResponseIndication createUnstructuredSSRequestIndication(byte ussdDataCodingScheme, USSDString ussdString) {
  133. UnstructuredSSResponseIndication response = new UnstructuredSSResponseIndicationImpl(ussdDataCodingScheme, ussdString);
  134. return response;
  135. }
  136. /* (non-Javadoc)
  137. * @see org.mobicents.protocols.ss7.map.api.MAPParameterFactory#createUnstructuredSSNotifyRequestIndication(byte, org.mobicents.protocols.ss7.map.api.primitives.USSDString, org.mobicents.protocols.ss7.map.api.primitives.AlertingPattern, org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString)
  138. */
  139. @Override
  140. public UnstructuredSSNotifyRequestIndication createUnstructuredSSNotifyRequestIndication(byte ussdDataCodingSch, USSDString ussdString,
  141. AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) {
  142. UnstructuredSSNotifyRequestIndication request = new UnstructuredSSNotifyRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern, msisdnAddressString);
  143. return request;
  144. }
  145. /* (non-Javadoc)
  146. * @see org.mobicents.protocols.ss7.map.api.MAPParameterFactory#createUnstructuredSSNotifyResponseIndication()
  147. */
  148. @Override
  149. public UnstructuredSSNotifyResponseIndication createUnstructuredSSNotifyResponseIndication() {
  150. UnstructuredSSNotifyResponseIndication response = new UnstructuredSSNotifyResponseIndicationImpl();
  151. return response;
  152. }
  153. public USSDString createUSSDString(String ussdString, Charset charset) {
  154. return new USSDStringImpl(ussdString, charset);
  155. }
  156. public USSDString createUSSDString(String ussdString) {
  157. return new USSDStringImpl(ussdString, null);
  158. }
  159. public USSDString createUSSDString(byte[] ussdString, Charset charset) {
  160. return new USSDStringImpl(ussdString, charset);
  161. }
  162. public USSDString createUSSDString(byte[] ussdString) {
  163. return new USSDStringImpl(ussdString, null);
  164. }
  165. public AddressString createAddressString(AddressNature addNature, NumberingPlan numPlan, String address) {
  166. return new AddressStringImpl(addNature, numPlan, address);
  167. }
  168. public ISDNAddressString createISDNAddressString(AddressNature addNature, NumberingPlan numPlan, String address) {
  169. return new ISDNAddressStringImpl(addNature, numPlan, address);
  170. }
  171. public FTNAddressString createFTNAddressString(AddressNature addNature, NumberingPlan numPlan, String address) {
  172. return new FTNAddressStringImpl(addNature, numPlan, address);
  173. }
  174. public MAPUserAbortChoice createMAPUserAbortChoice() {
  175. MAPUserAbortChoiceImpl mapUserAbortChoice = new MAPUserAbortChoiceImpl();
  176. return mapUserAbortChoice;
  177. }
  178. @Override
  179. public MAPPrivateExtension createMAPPrivateExtension(long[] oId, byte[] data) {
  180. return new MAPPrivateExtensionImpl(oId, data);
  181. }
  182. @Override
  183. public MAPExtensionContainer createMAPExtensionContainer(ArrayList<MAPPrivateExtension> privateExtensionList,
  184. byte[] pcsExtensions) {
  185. return new MAPExtensionContainerImpl(privateExtensionList, pcsExtensions);
  186. }
  187. @Override
  188. public IMSI createIMSI(String data) {
  189. return new IMSIImpl(data);
  190. }
  191. @Override
  192. public IMEI createIMEI(String imei) {
  193. return new IMEIImpl(imei);
  194. }
  195. @Override
  196. public LMSI createLMSI(byte[] data) {
  197. return new LMSIImpl(data);
  198. }
  199. @Override
  200. public SM_RP_DA createSM_RP_DA(IMSI imsi) {
  201. return new SM_RP_DAImpl(imsi);
  202. }
  203. @Override
  204. public SM_RP_DA createSM_RP_DA(LMSI lmsi) {
  205. return new SM_RP_DAImpl(lmsi);
  206. }
  207. @Override
  208. public SM_RP_DA createSM_RP_DA(AddressString serviceCentreAddressDA) {
  209. return new SM_RP_DAImpl(serviceCentreAddressDA);
  210. }
  211. @Override
  212. public SM_RP_DA createSM_RP_DA() {
  213. return new SM_RP_DAImpl();
  214. }
  215. @Override
  216. public SM_RP_OA createSM_RP_OA_Msisdn(ISDNAddressString msisdn) {
  217. SM_RP_OAImpl res = new SM_RP_OAImpl();
  218. res.setMsisdn(msisdn);
  219. return res;
  220. }
  221. @Override
  222. public SM_RP_OA createSM_RP_OA_ServiceCentreAddressOA(AddressString serviceCentreAddressOA) {
  223. SM_RP_OAImpl res = new SM_RP_OAImpl();
  224. res.setServiceCentreAddressOA(serviceCentreAddressOA);
  225. return res;
  226. }
  227. @Override
  228. public SM_RP_OA createSM_RP_OA() {
  229. return new SM_RP_OAImpl();
  230. }
  231. @Override
  232. public SmsSignalInfo createSmsSignalInfo(byte[] data, Charset gsm8Charset) {
  233. return new SmsSignalInfoImpl(data, gsm8Charset);
  234. }
  235. @Override
  236. public SmsSignalInfo createSmsSignalInfo(SmsTpdu data, Charset gsm8Charset) throws MAPException {
  237. return new SmsSignalInfoImpl(data, gsm8Charset);
  238. }
  239. @Override
  240. public SM_RP_SMEA createSM_RP_SMEA(byte[] data) {
  241. return new SM_RP_SMEAImpl(data);
  242. }
  243. @Override
  244. public MWStatus createMWStatus(boolean scAddressNotIncluded, boolean mnrfSet, boolean mcefSet, boolean mnrgSet) {
  245. return new MWStatusImpl(scAddressNotIncluded, mnrfSet, mcefSet, mnrgSet);
  246. }
  247. @Override
  248. public LocationInfoWithLMSI createLocationInfoWithLMSI(ISDNAddressString networkNodeNumber, LMSI lmsi, MAPExtensionContainer extensionContainer,
  249. AdditionalNumberType additionalNumberType, ISDNAddressString additionalNumber) {
  250. return new LocationInfoWithLMSIImpl(networkNodeNumber, lmsi, extensionContainer, additionalNumberType, additionalNumber);
  251. }
  252. @Override
  253. public Problem createProblemGeneral(GeneralProblemType prob) {
  254. Problem pb = TcapFactory.createProblem(ProblemType.General);
  255. pb.setGeneralProblemType(prob);
  256. return pb;
  257. }
  258. @Override
  259. public Problem createProblemInvoke(InvokeProblemType prob) {
  260. Problem pb = TcapFactory.createProblem(ProblemType.Invoke);
  261. pb.setInvokeProblemType(prob);
  262. return pb;
  263. }
  264. @Override
  265. public Problem createProblemResult(ReturnResultProblemType prob) {
  266. Problem pb = TcapFactory.createProblem(ProblemType.ReturnResult);
  267. pb.setReturnResultProblemType(prob);
  268. return pb;
  269. }
  270. @Override
  271. public Problem createProblemError(ReturnErrorProblemType prob) {
  272. Problem pb = TcapFactory.createProblem(ProblemType.ReturnError);
  273. pb.setReturnErrorProblemType(prob);
  274. return pb;
  275. }
  276. @Override
  277. public CellGlobalIdOrServiceAreaIdOrLAI createCellGlobalIdOrServiceAreaIdOrLAI(CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength) {
  278. return new CellGlobalIdOrServiceAreaIdOrLAIImpl(cellGlobalIdOrServiceAreaIdFixedLength);
  279. }
  280. @Override
  281. public CellGlobalIdOrServiceAreaIdOrLAI createCellGlobalIdOrServiceAreaIdOrLAI(LAIFixedLength laiFixedLength) {
  282. return new CellGlobalIdOrServiceAreaIdOrLAIImpl(laiFixedLength);
  283. }
  284. @Override
  285. public CellGlobalIdOrServiceAreaIdFixedLength createCellGlobalIdOrServiceAreaIdFixedLength(byte[] data) {
  286. return new CellGlobalIdOrServiceAreaIdFixedLengthImpl(data);
  287. }
  288. @Override
  289. public CellGlobalIdOrServiceAreaIdFixedLength createCellGlobalIdOrServiceAreaIdFixedLength(int mcc, int mnc, int lac, int cellId) throws MAPException {
  290. return new CellGlobalIdOrServiceAreaIdFixedLengthImpl(mcc, mnc, lac, cellId);
  291. }
  292. @Override
  293. public LAIFixedLength createLAIFixedLength(byte[] data) {
  294. return new LAIFixedLengthImpl(data);
  295. }
  296. @Override
  297. public LAIFixedLength createLAIFixedLength(int mcc, int mnc, int lac) throws MAPException {
  298. return new LAIFixedLengthImpl(mcc, mnc, lac);
  299. }
  300. @Override
  301. public CallReferenceNumber createCallReferenceNumber(byte[] data) {
  302. return new CallReferenceNumberImpl(data);
  303. }
  304. @Override
  305. public LocationInformation createLocationInformation(Integer ageOfLocationInformation, GeographicalInformation geographicalInformation,
  306. ISDNAddressString vlrNumber, LocationNumberMap locationNumber, CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI,
  307. MAPExtensionContainer extensionContainer, LSAIdentity selectedLSAId, ISDNAddressString mscNumber, GeodeticInformation geodeticInformation,
  308. boolean currentLocationRetrieved, boolean saiPresent, LocationInformationEPS locationInformationEPS, UserCSGInformation userCSGInformation) {
  309. return new LocationInformationImpl(ageOfLocationInformation, geographicalInformation, vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI,
  310. extensionContainer, selectedLSAId, mscNumber, geodeticInformation, currentLocationRetrieved, saiPresent, locationInformationEPS,
  311. userCSGInformation);
  312. }
  313. @Override
  314. public LocationNumberMap createLocationNumberMap(byte[] data) {
  315. return new LocationNumberMapImpl(data);
  316. }
  317. @Override
  318. public LocationNumberMap createLocationNumberMap(LocationNumber locationNumber) throws MAPException {
  319. return new LocationNumberMapImpl(locationNumber);
  320. }
  321. @Override
  322. public SubscriberState createSubscriberState(SubscriberStateChoice subscriberStateChoice, NotReachableReason notReachableReason) {
  323. return new SubscriberStateImpl(subscriberStateChoice, notReachableReason);
  324. }
  325. @Override
  326. public ExtBasicServiceCode createExtBasicServiceCode(ExtBearerServiceCode extBearerServiceCode) {
  327. return new ExtBasicServiceCodeImpl(extBearerServiceCode);
  328. }
  329. @Override
  330. public ExtBasicServiceCode createExtBasicServiceCode(ExtTeleserviceCode extTeleserviceCode) {
  331. return new ExtBasicServiceCodeImpl(extTeleserviceCode);
  332. }
  333. @Override
  334. public ExtBearerServiceCode createExtBearerServiceCode(byte[] data) {
  335. return new ExtBearerServiceCodeImpl(data);
  336. }
  337. @Override
  338. public ExtTeleserviceCode createExtTeleserviceCode(byte[] data) {
  339. return new ExtTeleserviceCodeImpl(data);
  340. }
  341. }