/protocols/ss7/map/map-impl/src/main/java/org/mobicents/protocols/ss7/map/MAPParameterFactoryImpl.java
Java | 397 lines | 309 code | 56 blank | 32 comment | 0 complexity | 05fe4a6e046440d5098983980e0dabf3 MD5 | raw file
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 23package org.mobicents.protocols.ss7.map; 24 25import java.nio.charset.Charset; 26import java.util.ArrayList; 27 28import org.mobicents.protocols.ss7.isup.message.parameter.LocationNumber; 29import org.mobicents.protocols.ss7.map.api.MAPException; 30import org.mobicents.protocols.ss7.map.api.MAPParameterFactory; 31import org.mobicents.protocols.ss7.map.api.dialog.MAPUserAbortChoice; 32import org.mobicents.protocols.ss7.map.api.primitives.AdditionalNumberType; 33import org.mobicents.protocols.ss7.map.api.primitives.AddressNature; 34import org.mobicents.protocols.ss7.map.api.primitives.AddressString; 35import org.mobicents.protocols.ss7.map.api.primitives.AlertingPattern; 36import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdFixedLength; 37import org.mobicents.protocols.ss7.map.api.primitives.CellGlobalIdOrServiceAreaIdOrLAI; 38import org.mobicents.protocols.ss7.map.api.primitives.FTNAddressString; 39import org.mobicents.protocols.ss7.map.api.primitives.IMEI; 40import org.mobicents.protocols.ss7.map.api.primitives.IMSI; 41import org.mobicents.protocols.ss7.map.api.primitives.ISDNAddressString; 42import org.mobicents.protocols.ss7.map.api.primitives.LAIFixedLength; 43import org.mobicents.protocols.ss7.map.api.primitives.LMSI; 44import org.mobicents.protocols.ss7.map.api.primitives.MAPExtensionContainer; 45import org.mobicents.protocols.ss7.map.api.primitives.MAPPrivateExtension; 46import org.mobicents.protocols.ss7.map.api.primitives.NumberingPlan; 47import org.mobicents.protocols.ss7.map.api.primitives.USSDString; 48import org.mobicents.protocols.ss7.map.api.service.callhandling.CallReferenceNumber; 49import org.mobicents.protocols.ss7.map.api.service.sms.LocationInfoWithLMSI; 50import org.mobicents.protocols.ss7.map.api.service.sms.MWStatus; 51import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_DA; 52import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_OA; 53import org.mobicents.protocols.ss7.map.api.service.sms.SM_RP_SMEA; 54import org.mobicents.protocols.ss7.map.api.service.sms.SmsSignalInfo; 55import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.GeodeticInformation; 56import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.GeographicalInformation; 57import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LSAIdentity; 58import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationInformation; 59import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationInformationEPS; 60import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.LocationNumberMap; 61import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.NotReachableReason; 62import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.SubscriberState; 63import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.SubscriberStateChoice; 64import org.mobicents.protocols.ss7.map.api.service.subscriberInformation.UserCSGInformation; 65import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtBasicServiceCode; 66import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtBearerServiceCode; 67import org.mobicents.protocols.ss7.map.api.service.subscriberManagement.ExtTeleserviceCode; 68import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSRequestIndication; 69import org.mobicents.protocols.ss7.map.api.service.supplementary.ProcessUnstructuredSSResponseIndication; 70import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyRequestIndication; 71import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSNotifyResponseIndication; 72import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSRequestIndication; 73import org.mobicents.protocols.ss7.map.api.service.supplementary.UnstructuredSSResponseIndication; 74import org.mobicents.protocols.ss7.map.api.smstpdu.SmsTpdu; 75import org.mobicents.protocols.ss7.map.dialog.MAPUserAbortChoiceImpl; 76import org.mobicents.protocols.ss7.map.primitives.AddressStringImpl; 77import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdFixedLengthImpl; 78import org.mobicents.protocols.ss7.map.primitives.CellGlobalIdOrServiceAreaIdOrLAIImpl; 79import org.mobicents.protocols.ss7.map.primitives.FTNAddressStringImpl; 80import org.mobicents.protocols.ss7.map.primitives.IMEIImpl; 81import org.mobicents.protocols.ss7.map.primitives.IMSIImpl; 82import org.mobicents.protocols.ss7.map.primitives.ISDNAddressStringImpl; 83import org.mobicents.protocols.ss7.map.primitives.LAIFixedLengthImpl; 84import org.mobicents.protocols.ss7.map.primitives.LMSIImpl; 85import org.mobicents.protocols.ss7.map.primitives.MAPExtensionContainerImpl; 86import org.mobicents.protocols.ss7.map.primitives.MAPPrivateExtensionImpl; 87import org.mobicents.protocols.ss7.map.primitives.USSDStringImpl; 88import org.mobicents.protocols.ss7.map.service.callhandling.CallReferenceNumberImpl; 89import org.mobicents.protocols.ss7.map.service.sms.LocationInfoWithLMSIImpl; 90import org.mobicents.protocols.ss7.map.service.sms.MWStatusImpl; 91import org.mobicents.protocols.ss7.map.service.sms.SM_RP_DAImpl; 92import org.mobicents.protocols.ss7.map.service.sms.SM_RP_OAImpl; 93import org.mobicents.protocols.ss7.map.service.sms.SM_RP_SMEAImpl; 94import org.mobicents.protocols.ss7.map.service.sms.SmsSignalInfoImpl; 95import org.mobicents.protocols.ss7.map.service.subscriberInformation.LocationInformationImpl; 96import org.mobicents.protocols.ss7.map.service.subscriberInformation.LocationNumberMapImpl; 97import org.mobicents.protocols.ss7.map.service.subscriberInformation.SubscriberStateImpl; 98import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtBasicServiceCodeImpl; 99import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtBearerServiceCodeImpl; 100import org.mobicents.protocols.ss7.map.service.subscriberManagement.ExtTeleserviceCodeImpl; 101import org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSRequestIndicationImpl; 102import org.mobicents.protocols.ss7.map.service.supplementary.ProcessUnstructuredSSResponseIndicationImpl; 103import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSNotifyRequestIndicationImpl; 104import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSNotifyResponseIndicationImpl; 105import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSRequestIndicationImpl; 106import org.mobicents.protocols.ss7.map.service.supplementary.UnstructuredSSResponseIndicationImpl; 107import org.mobicents.protocols.ss7.tcap.asn.TcapFactory; 108import org.mobicents.protocols.ss7.tcap.asn.comp.GeneralProblemType; 109import org.mobicents.protocols.ss7.tcap.asn.comp.InvokeProblemType; 110import org.mobicents.protocols.ss7.tcap.asn.comp.Problem; 111import org.mobicents.protocols.ss7.tcap.asn.comp.ProblemType; 112import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnErrorProblemType; 113import org.mobicents.protocols.ss7.tcap.asn.comp.ReturnResultProblemType; 114 115/** 116 * 117 * @author amit bhayani 118 * 119 */ 120public class MAPParameterFactoryImpl implements MAPParameterFactory { 121 122 public ProcessUnstructuredSSRequestIndication createProcessUnstructuredSSRequestIndication(byte ussdDataCodingSch, USSDString ussdString, 123 AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) { 124 125 ProcessUnstructuredSSRequestIndication request = new ProcessUnstructuredSSRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern, 126 msisdnAddressString); 127 return request; 128 } 129 130 public ProcessUnstructuredSSResponseIndication createProcessUnstructuredSSResponseIndication(byte ussdDataCodingScheme, USSDString ussdString) { 131 ProcessUnstructuredSSResponseIndication response = new ProcessUnstructuredSSResponseIndicationImpl(ussdDataCodingScheme, ussdString); 132 return response; 133 } 134 135 public UnstructuredSSRequestIndication createUnstructuredSSRequestIndication(byte ussdDataCodingSch, USSDString ussdString, 136 AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) { 137 UnstructuredSSRequestIndication request = new UnstructuredSSRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern, msisdnAddressString); 138 return request; 139 } 140 141 public UnstructuredSSResponseIndication createUnstructuredSSRequestIndication(byte ussdDataCodingScheme, USSDString ussdString) { 142 UnstructuredSSResponseIndication response = new UnstructuredSSResponseIndicationImpl(ussdDataCodingScheme, ussdString); 143 return response; 144 } 145 146 /* (non-Javadoc) 147 * @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) 148 */ 149 @Override 150 public UnstructuredSSNotifyRequestIndication createUnstructuredSSNotifyRequestIndication(byte ussdDataCodingSch, USSDString ussdString, 151 AlertingPattern alertingPattern, ISDNAddressString msisdnAddressString) { 152 UnstructuredSSNotifyRequestIndication request = new UnstructuredSSNotifyRequestIndicationImpl(ussdDataCodingSch, ussdString, alertingPattern, msisdnAddressString); 153 return request; 154 } 155 156 /* (non-Javadoc) 157 * @see org.mobicents.protocols.ss7.map.api.MAPParameterFactory#createUnstructuredSSNotifyResponseIndication() 158 */ 159 @Override 160 public UnstructuredSSNotifyResponseIndication createUnstructuredSSNotifyResponseIndication() { 161 UnstructuredSSNotifyResponseIndication response = new UnstructuredSSNotifyResponseIndicationImpl(); 162 return response; 163 } 164 165 public USSDString createUSSDString(String ussdString, Charset charset) { 166 return new USSDStringImpl(ussdString, charset); 167 } 168 169 public USSDString createUSSDString(String ussdString) { 170 return new USSDStringImpl(ussdString, null); 171 } 172 173 public USSDString createUSSDString(byte[] ussdString, Charset charset) { 174 return new USSDStringImpl(ussdString, charset); 175 } 176 177 public USSDString createUSSDString(byte[] ussdString) { 178 return new USSDStringImpl(ussdString, null); 179 } 180 181 public AddressString createAddressString(AddressNature addNature, NumberingPlan numPlan, String address) { 182 return new AddressStringImpl(addNature, numPlan, address); 183 } 184 185 public ISDNAddressString createISDNAddressString(AddressNature addNature, NumberingPlan numPlan, String address) { 186 return new ISDNAddressStringImpl(addNature, numPlan, address); 187 } 188 189 public FTNAddressString createFTNAddressString(AddressNature addNature, NumberingPlan numPlan, String address) { 190 return new FTNAddressStringImpl(addNature, numPlan, address); 191 } 192 193 public MAPUserAbortChoice createMAPUserAbortChoice() { 194 MAPUserAbortChoiceImpl mapUserAbortChoice = new MAPUserAbortChoiceImpl(); 195 return mapUserAbortChoice; 196 } 197 198 @Override 199 public MAPPrivateExtension createMAPPrivateExtension(long[] oId, byte[] data) { 200 return new MAPPrivateExtensionImpl(oId, data); 201 } 202 203 @Override 204 public MAPExtensionContainer createMAPExtensionContainer(ArrayList<MAPPrivateExtension> privateExtensionList, 205 byte[] pcsExtensions) { 206 return new MAPExtensionContainerImpl(privateExtensionList, pcsExtensions); 207 } 208 209 @Override 210 public IMSI createIMSI(String data) { 211 return new IMSIImpl(data); 212 } 213 214 @Override 215 public IMEI createIMEI(String imei) { 216 return new IMEIImpl(imei); 217 } 218 219 @Override 220 public LMSI createLMSI(byte[] data) { 221 return new LMSIImpl(data); 222 } 223 224 @Override 225 public SM_RP_DA createSM_RP_DA(IMSI imsi) { 226 return new SM_RP_DAImpl(imsi); 227 } 228 229 @Override 230 public SM_RP_DA createSM_RP_DA(LMSI lmsi) { 231 return new SM_RP_DAImpl(lmsi); 232 } 233 234 @Override 235 public SM_RP_DA createSM_RP_DA(AddressString serviceCentreAddressDA) { 236 return new SM_RP_DAImpl(serviceCentreAddressDA); 237 } 238 239 @Override 240 public SM_RP_DA createSM_RP_DA() { 241 return new SM_RP_DAImpl(); 242 } 243 244 @Override 245 public SM_RP_OA createSM_RP_OA_Msisdn(ISDNAddressString msisdn) { 246 SM_RP_OAImpl res = new SM_RP_OAImpl(); 247 res.setMsisdn(msisdn); 248 return res; 249 } 250 251 @Override 252 public SM_RP_OA createSM_RP_OA_ServiceCentreAddressOA(AddressString serviceCentreAddressOA) { 253 SM_RP_OAImpl res = new SM_RP_OAImpl(); 254 res.setServiceCentreAddressOA(serviceCentreAddressOA); 255 return res; 256 } 257 258 @Override 259 public SM_RP_OA createSM_RP_OA() { 260 return new SM_RP_OAImpl(); 261 } 262 263 @Override 264 public SmsSignalInfo createSmsSignalInfo(byte[] data, Charset gsm8Charset) { 265 return new SmsSignalInfoImpl(data, gsm8Charset); 266 } 267 268 @Override 269 public SmsSignalInfo createSmsSignalInfo(SmsTpdu data, Charset gsm8Charset) throws MAPException { 270 return new SmsSignalInfoImpl(data, gsm8Charset); 271 } 272 273 @Override 274 public SM_RP_SMEA createSM_RP_SMEA(byte[] data) { 275 return new SM_RP_SMEAImpl(data); 276 } 277 278 @Override 279 public MWStatus createMWStatus(boolean scAddressNotIncluded, boolean mnrfSet, boolean mcefSet, boolean mnrgSet) { 280 return new MWStatusImpl(scAddressNotIncluded, mnrfSet, mcefSet, mnrgSet); 281 } 282 283 @Override 284 public LocationInfoWithLMSI createLocationInfoWithLMSI(ISDNAddressString networkNodeNumber, LMSI lmsi, MAPExtensionContainer extensionContainer, 285 AdditionalNumberType additionalNumberType, ISDNAddressString additionalNumber) { 286 return new LocationInfoWithLMSIImpl(networkNodeNumber, lmsi, extensionContainer, additionalNumberType, additionalNumber); 287 } 288 289 290 @Override 291 public Problem createProblemGeneral(GeneralProblemType prob) { 292 Problem pb = TcapFactory.createProblem(ProblemType.General); 293 pb.setGeneralProblemType(prob); 294 return pb; 295 } 296 297 @Override 298 public Problem createProblemInvoke(InvokeProblemType prob) { 299 Problem pb = TcapFactory.createProblem(ProblemType.Invoke); 300 pb.setInvokeProblemType(prob); 301 return pb; 302 } 303 304 @Override 305 public Problem createProblemResult(ReturnResultProblemType prob) { 306 Problem pb = TcapFactory.createProblem(ProblemType.ReturnResult); 307 pb.setReturnResultProblemType(prob); 308 return pb; 309 } 310 311 @Override 312 public Problem createProblemError(ReturnErrorProblemType prob) { 313 Problem pb = TcapFactory.createProblem(ProblemType.ReturnError); 314 pb.setReturnErrorProblemType(prob); 315 return pb; 316 } 317 318 @Override 319 public CellGlobalIdOrServiceAreaIdOrLAI createCellGlobalIdOrServiceAreaIdOrLAI(CellGlobalIdOrServiceAreaIdFixedLength cellGlobalIdOrServiceAreaIdFixedLength) { 320 return new CellGlobalIdOrServiceAreaIdOrLAIImpl(cellGlobalIdOrServiceAreaIdFixedLength); 321 } 322 323 @Override 324 public CellGlobalIdOrServiceAreaIdOrLAI createCellGlobalIdOrServiceAreaIdOrLAI(LAIFixedLength laiFixedLength) { 325 return new CellGlobalIdOrServiceAreaIdOrLAIImpl(laiFixedLength); 326 } 327 328 @Override 329 public CellGlobalIdOrServiceAreaIdFixedLength createCellGlobalIdOrServiceAreaIdFixedLength(byte[] data) { 330 return new CellGlobalIdOrServiceAreaIdFixedLengthImpl(data); 331 } 332 333 @Override 334 public CellGlobalIdOrServiceAreaIdFixedLength createCellGlobalIdOrServiceAreaIdFixedLength(int mcc, int mnc, int lac, int cellId) throws MAPException { 335 return new CellGlobalIdOrServiceAreaIdFixedLengthImpl(mcc, mnc, lac, cellId); 336 } 337 338 @Override 339 public LAIFixedLength createLAIFixedLength(byte[] data) { 340 return new LAIFixedLengthImpl(data); 341 } 342 343 @Override 344 public LAIFixedLength createLAIFixedLength(int mcc, int mnc, int lac) throws MAPException { 345 return new LAIFixedLengthImpl(mcc, mnc, lac); 346 } 347 348 @Override 349 public CallReferenceNumber createCallReferenceNumber(byte[] data) { 350 return new CallReferenceNumberImpl(data); 351 } 352 353 @Override 354 public LocationInformation createLocationInformation(Integer ageOfLocationInformation, GeographicalInformation geographicalInformation, 355 ISDNAddressString vlrNumber, LocationNumberMap locationNumber, CellGlobalIdOrServiceAreaIdOrLAI cellGlobalIdOrServiceAreaIdOrLAI, 356 MAPExtensionContainer extensionContainer, LSAIdentity selectedLSAId, ISDNAddressString mscNumber, GeodeticInformation geodeticInformation, 357 boolean currentLocationRetrieved, boolean saiPresent, LocationInformationEPS locationInformationEPS, UserCSGInformation userCSGInformation) { 358 return new LocationInformationImpl(ageOfLocationInformation, geographicalInformation, vlrNumber, locationNumber, cellGlobalIdOrServiceAreaIdOrLAI, 359 extensionContainer, selectedLSAId, mscNumber, geodeticInformation, currentLocationRetrieved, saiPresent, locationInformationEPS, 360 userCSGInformation); 361 } 362 363 @Override 364 public LocationNumberMap createLocationNumberMap(byte[] data) { 365 return new LocationNumberMapImpl(data); 366 } 367 368 @Override 369 public LocationNumberMap createLocationNumberMap(LocationNumber locationNumber) throws MAPException { 370 return new LocationNumberMapImpl(locationNumber); 371 } 372 373 @Override 374 public SubscriberState createSubscriberState(SubscriberStateChoice subscriberStateChoice, NotReachableReason notReachableReason) { 375 return new SubscriberStateImpl(subscriberStateChoice, notReachableReason); 376 } 377 378 @Override 379 public ExtBasicServiceCode createExtBasicServiceCode(ExtBearerServiceCode extBearerServiceCode) { 380 return new ExtBasicServiceCodeImpl(extBearerServiceCode); 381 } 382 383 @Override 384 public ExtBasicServiceCode createExtBasicServiceCode(ExtTeleserviceCode extTeleserviceCode) { 385 return new ExtBasicServiceCodeImpl(extTeleserviceCode); 386 } 387 388 @Override 389 public ExtBearerServiceCode createExtBearerServiceCode(byte[] data) { 390 return new ExtBearerServiceCodeImpl(data); 391 } 392 393 @Override 394 public ExtTeleserviceCode createExtTeleserviceCode(byte[] data) { 395 return new ExtTeleserviceCodeImpl(data); 396 } 397}