use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class ValidatorImpl method validate.
// NOTE: this class possibly should be Singleton, however some impl may use something more to perform validation
// hence, its not static, each RA provides instance through RA Sbb Interface.
/*
* (non-Javadoc)
*
* @see
* net.java.slee.resource.diameter.Validator#validate(net.java.slee.resource
* .diameter.base.events.DiameterMessage)
*/
@Override
public void validate(DiameterMessage msg) throws AvpNotAllowedException {
Dictionary dictionary = DictionarySingleton.getDictionary();
if (dictionary.isConfigured() && dictionary.isEnabled()) {
DiameterCommand com = msg.getCommand();
MessageRepresentation rep = dictionary.getMessage(com.getCode(), com.getApplicationId(), com.isRequest());
if (rep != null) {
DiameterMessageImpl impl = (DiameterMessageImpl) msg;
try {
rep.validate(impl.getGenericData(), ValidatorLevel.ALL);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Failed to validate message.", e, e.getAvpCode(), e.getVendorId());
}
}
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class AuthClientSessionActivityImpl method sendReAuthAnswer.
public void sendReAuthAnswer(ReAuthAnswer answer) throws IOException {
try {
// super.sendMessage(answer);
DiameterMessageImpl msg = (DiameterMessageImpl) answer;
this.clientSession.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.getMessage());
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class AuthClientSessionActivityImpl method sendAbortSessionAnswer.
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());
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method sendRegistrationTerminationRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendRegistrationTerminationRequest(net.java.slee.resource.diameter.cxdx.events.RegistrationTerminationRequest)
*/
public void sendRegistrationTerminationRequest(RegistrationTerminationRequest registrationTerminationRequest) throws IOException {
DiameterMessageImpl msg = (DiameterMessageImpl) registrationTerminationRequest;
JRegistrationTerminationRequestImpl request = new JRegistrationTerminationRequestImpl(msg.getGenericData());
try {
appSession.sendRegistrationTerminationRequest(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());
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class GxClientSessionActivityImpl method sendUpdateGxCreditControlRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diametergx.GxClientSessionActivity#sendUpdateRoCreditControlRequest(net.java.slee.resource.diameter.gx.events.GxCreditControlRequest)
*/
public void sendUpdateGxCreditControlRequest(final GxCreditControlRequest ccr) throws IOException {
// FIXME: Should this come already in the CCR?
validateState(ccr);
final DiameterMessageImpl msg = (DiameterMessageImpl) ccr;
try {
session.sendCreditControlRequest(new GxCreditControlRequestImpl((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);
}
}
Aggregations