use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterMessageFactoryImpl method createMessage.
public ExtensionDiameterMessage createMessage(DiameterCommand command, DiameterAvp[] avps) throws AvpNotAllowedException {
ApplicationId aid = command.getCode() == AccountingRequest.commandCode ? ApplicationId.createByAccAppId(0, command.getApplicationId()) : ApplicationId.createByAuthAppId(0, command.getApplicationId());
ExtensionDiameterMessageImpl msg = (ExtensionDiameterMessageImpl) this.createDiameterMessage(null, avps, command.getCode(), aid);
msg.getGenericData().setRequest(command.isRequest());
((MessageImpl) msg.getGenericData()).setProxiable(command.isProxiable());
if (!command.isRequest()) {
// just in case. answers never have T flag set
((MessageImpl) msg.getGenericData()).setReTransmitted(false);
}
return msg;
}
use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterShServerResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // PNR/PNA
PushNotificationRequest.commandCode:
return isRequest ? new PushNotificationRequestImpl(message) : new PushNotificationAnswerImpl(message);
case // PUR/PUA
ProfileUpdateRequest.commandCode:
return isRequest ? new ProfileUpdateRequestImpl(message) : new ProfileUpdateAnswerImpl(message);
case // SNR/SNA
SubscribeNotificationsRequest.commandCode:
return isRequest ? new SubscribeNotificationsRequestImpl(message) : new SubscribeNotificationsAnswerImpl(message);
case // UDR/UDA
UserDataRequest.commandCode:
return isRequest ? new UserDataRequestImpl(message) : new UserDataAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterShClientResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // PNR/PNA
PushNotificationRequestImpl.commandCode:
return isRequest ? new PushNotificationRequestImpl(message) : new PushNotificationAnswerImpl(message);
case // PUR/PUA
ProfileUpdateRequestImpl.commandCode:
return isRequest ? new ProfileUpdateRequestImpl(message) : new ProfileUpdateAnswerImpl(message);
case // SNR/SNA
SubscribeNotificationsRequestImpl.commandCode:
return isRequest ? new SubscribeNotificationsRequestImpl(message) : new SubscribeNotificationsAnswerImpl(message);
case // UDR/UDA
net.java.slee.resource.diameter.sh.events.UserDataRequest.commandCode:
return isRequest ? new UserDataRequestImpl(message) : new UserDataAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterGxResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer).
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(final Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
final int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
final boolean isRequest = message.isRequest();
switch(commandCode) {
case // CCR/CCA
GxCreditControlRequest.commandCode:
return isRequest ? new GxCreditControlRequestImpl(message) : new GxCreditControlAnswerImpl(message);
case // ASR/ASA
AbortSessionAnswer.commandCode:
return isRequest ? new AbortSessionRequestImpl(message) : new AbortSessionAnswerImpl(message);
case // STR/STA
SessionTerminationAnswer.commandCode:
return isRequest ? new SessionTerminationRequestImpl(message) : new SessionTerminationAnswerImpl(message);
case // RAR/RAA
GxReAuthAnswer.commandCode:
return isRequest ? new GxReAuthRequestImpl(message) : new GxReAuthAnswerImpl(message);
case // ACR/ACA
AccountingAnswer.commandCode:
return isRequest ? new AccountingRequestImpl(message) : new AccountingAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ExtensionDiameterMessageImpl in project jain-slee.diameter by RestComm.
the class DiameterRfResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // ACR/ACA
RfAccountingAnswer.commandCode:
return isRequest ? new RfAccountingRequestImpl(message) : new RfAccountingAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
Aggregations