use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method sendLocationInfoAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendLocationInfoAnswer(net.java.slee.resource.diameter.cxdx.events.LocationInfoAnswer)
*/
public void sendLocationInfoAnswer(LocationInfoAnswer locationInfoAnswer) throws IOException {
DiameterMessageImpl msg = (DiameterMessageImpl) locationInfoAnswer;
JLocationInfoAnswerImpl answer = new JLocationInfoAnswerImpl((Answer) msg.getGenericData());
try {
appSession.sendLocationInformationAnswer(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());
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method sendServerAssignmentAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendServerAssignmentAnswer(net.java.slee.resource.diameter.cxdx.events.ServerAssignmentAnswer)
*/
public void sendServerAssignmentAnswer(ServerAssignmentAnswer serverAssignmentAnswer) throws IOException {
DiameterMessageImpl msg = (DiameterMessageImpl) serverAssignmentAnswer;
JServerAssignmentAnswerImpl answer = new JServerAssignmentAnswerImpl((Answer) msg.getGenericData());
try {
appSession.sendServerAssignmentAnswer(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());
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class CxDxServerSessionImpl method sendPushProfileRequest.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.cxdx.CxDxServerSession#sendPushProfileRequest(net.java.slee.resource.diameter.cxdx.events.PushProfileRequest)
*/
public void sendPushProfileRequest(PushProfileRequest pushProfileRequest) throws IOException {
DiameterMessageImpl msg = (DiameterMessageImpl) pushProfileRequest;
JPushProfileRequestImpl request = new JPushProfileRequestImpl(msg.getGenericData());
try {
appSession.sendPushProfileRequest(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 ValidatorImpl method validate.
/*
* (non-Javadoc)
*
* @see net.java.slee.resource.diameter.Validator#
* validate(net.java.slee.resource.diameter.base.events.avp.DiameterAvp)
*/
@Override
public void validate(DiameterAvp avp) throws AvpNotAllowedException {
Dictionary dictionary = DictionarySingleton.getDictionary();
if (dictionary.isConfigured() && dictionary.isEnabled()) {
AvpRepresentation rep = dictionary.getAvp(avp.getCode(), avp.getVendorId());
// check for grouped?
if (rep != null && rep.isGrouped()) {
try {
GroupedAvpImpl impl = (GroupedAvpImpl) avp;
rep.validate(impl.getGenericData());
} catch (ClassCastException cce) {
throw new AvpNotAllowedException("Failed to validate avp, its not grouped!", cce, avp.getCode(), avp.getVendorId());
}
}
}
}
use of net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException in project jain-slee.diameter by RestComm.
the class AccountingServerSessionActivityImpl method sendAccountingAnswer.
public void sendAccountingAnswer(AccountingAnswer answer) throws IOException {
try {
AccountingAnswerImpl aca = (AccountingAnswerImpl) answer;
this.serverSession.sendAccountAnswer(new AccountAnswerImpl((Answer) aca.getGenericData()));
// FIXME: check this?
if (this.serverSession.isStateless()) {
endActivity();
} else if (aca.getAccountingRecordType() == AccountingRecordType.STOP_RECORD) {
endActivity();
}
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message, due to: ", e);
}
throw new IOException("Failed to send message, due to: " + e.getMessage());
}
}
Aggregations