public void sendProfileUpdateRequest(ProfileUpdateRequest message) throws IOException { try { DiameterMessageImpl msg = (DiameterMessageImpl) message; clientSession.sendProfileUpdateRequest(new ProfileUpdateRequestImpl((Request) msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e.getLocalizedMessage()); } }
public void sendRegistrationTerminationAnswer(RegistrationTerminationAnswer registrationTerminationAnswer) throws IOException { try{ DiameterMessageImpl msg = (DiameterMessageImpl) registrationTerminationAnswer; appSession.sendRegistrationTerminationAnswer(new JRegistrationTerminationAnswerImpl((Answer) msg.getGenericData())); } catch(org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(),anae.getAvpCode(),anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
@Override public void validate(Avp avp) throws AvpNotAllowedException { if (isGrouped()) { try { AvpSet avpAsGrouped = avp.getGrouped(); validate(avpAsGrouped); } catch (AvpDataException e) { throw new AvpNotAllowedException("Failed to parse AVP to grouped!", e, code, vendor); } } else { // dont care } }
@Override public void validate(Message msg, ValidatorLevel validatorLevel) throws AvpNotAllowedException { if (validatorLevel == ValidatorLevel.OFF) { return; } // if its !OFF, we will go down, at least to this section for (AvpRepresentation ap : this.unmuttableMessageAvps.values()) { AvpSet innerSet = msg.getAvps().getAvps(ap.getCode(), ap.getVendorId()); int count = 0; if (innerSet != null) { count = innerSet.size(); } if (!ap.isCountValidForMultiplicity(count)) { throw new AvpNotAllowedException("AVP: \n" + ap + "\n, has wrong count in message - " + (count), ap.getCode(), ap.getVendorId()); } // if its ALL, we need to go down deeper in AVPs if (validatorLevel != ValidatorLevel.ALL) { continue; } if (count != 0 && ap.isGrouped()) { // we are grouped validateGrouped(ap, innerSet); } } }
public void sendReAuthAnswer(ReAuthAnswer rar) throws IOException { DiameterMessageImpl msg = (DiameterMessageImpl) rar; try { session.sendReAuthAnswer(new ReAuthAnswerImpl((Answer) msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e); } }
public void sendLocationInfoRequest(LocationInfoRequest locationInfoRequest) throws IOException { try{ DiameterMessageImpl msg = (DiameterMessageImpl) locationInfoRequest; appSession.sendLocationInformationRequest(new JLocationInfoRequestImpl(msg.getGenericData())); } catch(org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(),anae.getAvpCode(),anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
@Override public void validate(AvpSet avpSet) throws AvpNotAllowedException { //this is used in RAs, cause ... AvpSet is asexual AVP, no code, no vendor // let it rip for (AvpRepresentation childrenVAvp : getChildren()) { AvpSet childSset = avpSet.getAvps(childrenVAvp.getCode(), childrenVAvp.getVendorId()); int count = childSset.size(); if (!childrenVAvp.isCountValidForMultiplicity(count)) { throw new AvpNotAllowedException("AVP: " + childrenVAvp + " has wrong count, in grouped parent avp - " + (count) + ", allowed: " + childrenVAvp.getMultiplicityIndicator(), getCode(), getVendorId()); } if (childrenVAvp.isGrouped()) { for (int index = 0; index < childSset.size(); index++) { Avp presumablyGrouped = childSset.getAvpByIndex(index); childrenVAvp.validate(presumablyGrouped); } } // else we are good ? } }
public void sendUserDataRequest(UserDataRequest message) throws IOException { try { DiameterMessageImpl msg = (DiameterMessageImpl) message; this.clientSession.sendUserDataRequest(new UserDataRequestImpl((Request) msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e); } }
public void sendPushProfileAnswer(PushProfileAnswer pushProfileAnswer) throws IOException { try{ DiameterMessageImpl msg = (DiameterMessageImpl) pushProfileAnswer; appSession.sendPushProfileAnswer(new JPushProfileAnswerImpl((Answer) msg.getGenericData())); } catch(org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(),anae.getAvpCode(),anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
public void sendGxReAuthAnswer(final GxReAuthAnswer rar) throws IOException { final DiameterMessageImpl msg = (DiameterMessageImpl) rar; try { session.sendGxReAuthAnswer(new GxReAuthAnswerImpl((Answer) msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e); } }
public void sendServerAssignmentRequest(ServerAssignmentRequest serverAssignmentRequest) throws IOException { try{ DiameterMessageImpl msg = (DiameterMessageImpl) serverAssignmentRequest; appSession.sendServerAssignmentRequest(new JServerAssignmentRequestImpl(msg.getGenericData())); } catch(org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(),anae.getAvpCode(),anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
protected Message doSendMessage(DiameterMessage message) { Message receivedMessage = null; try { if(message instanceof DiameterMessageImpl) { Future<Message> future = session.send(((DiameterMessageImpl)message).getGenericData()); receivedMessage = future.get(); } else { throw new OperationNotSupportedException((new StringBuilder()).append("Trying to send wrong type of message? [").append(message.getClass()).append("] \n").append(message).toString()); } } catch(AvpNotAllowedException e) { throw new net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch(Exception e) { logger.error("Failure sending sync request.", e); } return receivedMessage; }
public void sendMultimediaAuthenticationRequest(MultimediaAuthenticationRequest multimediaAuthenticationRequest) throws IOException { try{ DiameterMessageImpl msg = (DiameterMessageImpl) multimediaAuthenticationRequest; appSession.sendMultimediaAuthRequest(new JMultimediaAuthRequestImpl(msg.getGenericData())); } catch(org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(),anae.getAvpCode(),anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
public void sendAbortSessionRequest(AbortSessionRequest request) throws IOException { try { //super.sendMessage(request); DiameterMessageImpl msg = (DiameterMessageImpl) request; this.serverSession.sendAbortSessionRequest(new AbortSessionRequestImpl(msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e.getMessage()); } }
public void sendUserAuthorizationRequest(UserAuthorizationRequest userAuthorizationRequest) throws IOException { try { DiameterMessageImpl msg = (DiameterMessageImpl) userAuthorizationRequest; appSession.sendUserAuthorizationRequest(new JUserAuthorizationRequestImpl(msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId()); } catch (Exception e) { throw new IOException(e.getMessage()); } }
public void sendAbortSessionAnswer(AbortSessionAnswer answer) throws IOException { try { // super.sendMessage(answer); DiameterMessageImpl asa = (DiameterMessageImpl) answer; this.clientSession.sendAbortSessionAnswer(new AbortSessionAnswerImpl((Answer) asa.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e.getMessage()); } }
public void sendResetRequest(ResetRequest rsr) throws IOException { DiameterMessageImpl msg = (DiameterMessageImpl) rsr; JResetRequestImpl request = new JResetRequestImpl((Answer) msg.getGenericData()); try { appSession.sendResetRequest(request); } catch (org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId()); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to send message.", e); } throw new IOException(e.getMessage()); } }
public void sendSessionTerminationRequest(SessionTerminationRequest request) throws IOException { try { //super.sendMessage(request); DiameterMessageImpl msg = (DiameterMessageImpl) request; this.clientSession.sendSessionTerminationRequest(new SessionTermRequestImpl(msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e.getMessage()); } }
public void sendMultimediaAuthenticationAnswer(MultimediaAuthenticationAnswer multimediaAuthenticationAnswer) throws IOException { DiameterMessageImpl msg = (DiameterMessageImpl) multimediaAuthenticationAnswer; JMultimediaAuthAnswerImpl answer = new JMultimediaAuthAnswerImpl((Answer) msg.getGenericData()); try { appSession.sendMultimediaAuthAnswer(answer); } catch (org.jdiameter.api.validation.AvpNotAllowedException anae) { throw new AvpNotAllowedException(anae.getMessage(), anae.getAvpCode(), anae.getVendorId()); } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to send message.", e); } throw new IOException(e.getMessage()); } }
public void sendReAuthAnswer(ReAuthAnswer rar) throws IOException { DiameterMessageImpl msg = (DiameterMessageImpl) rar; try { session.sendReAuthAnswer(new ReAuthAnswerImpl((Answer) msg.getGenericData())); } catch (org.jdiameter.api.validation.AvpNotAllowedException e) { throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId()); } catch (Exception e) { throw new IOException("Failed to send message, due to: " + e); } }