public MAPApplicationContextVersion getCurVersion() { if (curVersion == null) return MAPApplicationContextVersion.version3; else { switch (curVersion.getVersion()) { case 1: if (++upVersionTested > mapV1RetestUpCount) { upVersionTested = 0; return MAPApplicationContextVersion.version3; } else return curVersion; case 2: if (++upVersionTested > mapV2RetestUpCount) { upVersionTested = 0; return MAPApplicationContextVersion.version3; } else return curVersion; } return curVersion; } }
/** * smsc mapcache set <msisdn> <version> * * msisdn is optional * * @param args * @return */ private String setMapVersionCache(String[] args) throws Exception { if (args.length != 5) { return SMSCOAMMessages.INVALID_COMMAND; } String msisdn = args[3]; String version = args[4]; MAPApplicationContextVersion mapApplicationContextVersion = MAPApplicationContextVersion .getInstance(Long.parseLong(version)); if (mapApplicationContextVersion == null || mapApplicationContextVersion == MAPApplicationContextVersion.version4) { return SMSCOAMMessages.MAP_VERSION_CACHE_INVALID_VERSION; } mapVersionCache.forceMAPApplicationContextVersion(msisdn, mapApplicationContextVersion); return SMSCOAMMessages.MAP_VERSION_CACHE_SUCCESSFULLY_SET; }
@Override public String toString() { StringBuffer s = new StringBuffer(); s.append("MAPApplicationContext [Name="); s.append(this.contextName.toString()); s.append(", Version="); s.append(this.contextVersion.toString()); s.append(", Oid="); for (long l : this.getOID()) { s.append(l).append(", "); } s.append("]"); return s.toString(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((contextName == null) ? 0 : contextName.hashCode()); result = prime * result + ((contextVersion == null) ? 0 : contextVersion.hashCode()); result = prime * result + Arrays.hashCode(res); return result; }
private MAPApplicationContext(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { this.contextName = contextName; this.contextVersion = contextVersion; this.res[6] = this.contextName.getApplicationContextCode(); this.res[7] = this.contextVersion.getVersion(); }
/** * SBB Local Object Methods * */ @Override public void setSbbContext(SbbContext sbbContext) { super.setSbbContext(sbbContext); this.maxMAPApplicationContextVersion = MAPApplicationContextVersion.getInstance(smscPropertiesManagement .getMaxMapVersion()); }
return mapApplicationContextVersion.toString(); } else { return SMSCOAMMessages.MAP_VERSION_CACHE_NOT_FOUND;
public static MAPApplicationContext getInstance(MAPApplicationContextName contextName, MAPApplicationContextVersion contextVersion) { if (MAPApplicationContext.availableApplicationContextVersion(contextName, contextVersion.getVersion())) return getMAPApplicationContext(contextName, contextVersion); else return null; }
public static MAPApplicationContext getInstance(long[] oid) { if (oid == null || oid.length != oidTemplate.length) return null; for (int i1 = 0; i1 < oidTemplate.length - 2; i1++) { if (oid[i1] != oidTemplate[i1]) return null; } MAPApplicationContextName contextName = MAPApplicationContextName.getInstance(oid[6]); MAPApplicationContextVersion contextVersion = MAPApplicationContextVersion.getInstance(oid[7]); if (contextName == null || contextVersion == null) return null; if (!MAPApplicationContext.availableApplicationContextVersion(contextName, (int) oid[7])) return null; return getMAPApplicationContext(contextName, contextVersion); }
private MAPApplicationContext getSRIMAPApplicationContext(MAPApplicationContextVersion applicationContextVersion) { MAPApplicationContext mapApplicationContext = MAPApplicationContext.getInstance( MAPApplicationContextName.shortMsgGatewayContext, applicationContextVersion); this.setSriMapVersion(applicationContextVersion.getVersion()); return mapApplicationContext; }
.getVersion(), NetworkResource.hlr, null, null); } else {
@Override public void onDialogRequestEricsson(MAPDialog mapDialog, AddressString destReference, AddressString origReference, AddressString eriImsi, AddressString eriVlrNo) { DialogImplWrapper di = (DialogImplWrapper) ((MAPDialogImpl) mapDialog).getTcapDialog(); if (mapDialog.getApplicationContext() != null) { di.setAcnValue(mapDialog.getApplicationContext().getApplicationContextName().getApplicationContextCode()); di.setAcnVersion(mapDialog.getApplicationContext().getApplicationContextVersion().getVersion()); } }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { MAPApplicationContextName ctx = dialogApplicationContext.getApplicationContextName(); int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (ctx) { case gprsLocationInfoRetrievalContext: if (vers >= 3 && vers <= 4) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 4) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 2; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
public ServingCheckData isServingService(MAPApplicationContext dialogApplicationContext) { int vers = dialogApplicationContext.getApplicationContextVersion().getVersion(); switch (dialogApplicationContext.getApplicationContextName()) { case locationSvcEnquiryContext: case locationSvcGatewayContext: if (vers == 3) { return new ServingCheckDataImpl(ServingCheckResult.AC_Serving); } else if (vers > 3) { long[] altOid = dialogApplicationContext.getOID(); altOid[7] = 3; ApplicationContextName alt = TcapFactory.createApplicationContextName(altOid); return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect, alt); } else { return new ServingCheckDataImpl(ServingCheckResult.AC_VersionIncorrect); } } return new ServingCheckDataImpl(ServingCheckResult.AC_NotServing); }
@Override public void onDialogRequest(MAPDialog mapDialog, AddressString destReference, AddressString origReference, MAPExtensionContainer extensionContainer) { if (((MAPDialogImpl) mapDialog).getTcapDialog() instanceof DialogImplWrapper) { DialogImplWrapper di = (DialogImplWrapper) ((MAPDialogImpl) mapDialog).getTcapDialog(); if (mapDialog.getApplicationContext() != null) { di.setAcnValue(mapDialog.getApplicationContext().getApplicationContextName().getApplicationContextCode()); di.setAcnVersion(mapDialog.getApplicationContext().getApplicationContextVersion().getVersion()); } } }
private void resetRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException("Error while decoding resetRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException("Error while decoding resetRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); ResetRequestImpl ind = new ResetRequestImpl(version); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onResetRequest(ind); } catch (Exception e) { loger.error("Error processing resetRequest: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); InsertSubscriberDataResponseImpl ind = new InsertSubscriberDataResponseImpl(version); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataResponse: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataResponse(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataResponse: " + e.getMessage(), e); } } }
private void processInsertSubscriberDataRequest(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding InsertSubscriberDataRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); InsertSubscriberDataRequestImpl ind = new InsertSubscriberDataRequestImpl(version); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onInsertSubscriberDataRequest(ind); } catch (Exception e) { loger.error("Error processing processInsertSubscriberDataRequest: " + e.getMessage(), e); } } }
private void reportSMDeliveryStatusRequest(Parameter parameter, MAPDialogSmsImpl mapDialogImpl, Long invokeId) throws MAPParsingComponentException { if (parameter == null) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Parameter is mandatory but not found", MAPParsingComponentExceptionReason.MistypedParameter); if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding sendRoutingInfoForSMRequest: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ReportSMDeliveryStatusRequestImpl ind = new ReportSMDeliveryStatusRequestImpl(mapDialogImpl.getApplicationContext() .getApplicationContextVersion().getVersion()); ind.decodeData(ais, buf.length); ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceSmsListener) serLis).onReportSMDeliveryStatusRequest(ind); } catch (Exception e) { loger.error("Error processing onReportSMDeliveryStatusIndication: " + e.getMessage(), e); } } }
private void cancelLocationResponse(Parameter parameter, MAPDialogMobilityImpl mapDialogImpl, Long invokeId, boolean returnResultNotLast) throws MAPParsingComponentException { long version = mapDialogImpl.getApplicationContext().getApplicationContextVersion().getVersion(); CancelLocationResponseImpl ind = new CancelLocationResponseImpl(); if (parameter != null) { if (parameter.getTag() != Tag.SEQUENCE || parameter.getTagClass() != Tag.CLASS_UNIVERSAL || parameter.isPrimitive()) throw new MAPParsingComponentException( "Error while decoding cancelLocationResponse V2_3: Bad tag or tagClass or parameter is primitive, received tag=" + parameter.getTag(), MAPParsingComponentExceptionReason.MistypedParameter); byte[] buf = parameter.getData(); AsnInputStream ais = new AsnInputStream(buf); ind.decodeData(ais, buf.length); } ind.setInvokeId(invokeId); ind.setMAPDialog(mapDialogImpl); ind.setReturnResultNotLast(returnResultNotLast); for (MAPServiceListener serLis : this.serviceListeners) { try { serLis.onMAPMessage(ind); ((MAPServiceMobilityListener) serLis).onCancelLocationResponse(ind); } catch (Exception e) { loger.error("Error processing cancelLocationResponse: " + e.getMessage(), e); } } }