use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterCxDxResourceAdaptor 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 // UAR/UAA
UserAuthorizationRequest.COMMAND_CODE:
return isRequest ? new UserAuthorizationRequestImpl(message) : new UserAuthorizationAnswerImpl(message);
case // SAR/SAA
ServerAssignmentRequest.COMMAND_CODE:
return isRequest ? new ServerAssignmentRequestImpl(message) : new ServerAssignmentAnswerImpl(message);
case // LIR/LIA
LocationInfoRequest.COMMAND_CODE:
return isRequest ? new LocationInfoRequestImpl(message) : new LocationInfoAnswerImpl(message);
case // MAR/MAA
MultimediaAuthenticationRequest.COMMAND_CODE:
return isRequest ? new MultimediaAuthenticationRequestImpl(message) : new MultimediaAuthenticationAnswerImpl(message);
case // RTR/RTA
RegistrationTerminationRequest.COMMAND_CODE:
return isRequest ? new RegistrationTerminationRequestImpl(message) : new RegistrationTerminationAnswerImpl(message);
case // MAR/MAA
PushProfileRequest.COMMAND_CODE:
return isRequest ? new PushProfileRequestImpl(message) : new PushProfileAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class GxSessionActivityImpl method sendSyncMessage.
@Override
public DiameterMessage sendSyncMessage(DiameterMessage message) {
DiameterMessage answer = null;
Message receivedMessage = doSendMessage(message);
if (receivedMessage != null) {
if (!receivedMessage.isRequest()) {
if (receivedMessage.isError()) {
answer = new ErrorAnswerImpl(receivedMessage);
} else {
switch(receivedMessage.getCommandCode()) {
case GxCreditControlRequest.commandCode:
answer = new GxCreditControlRequestImpl(receivedMessage);
break;
case GxReAuthRequest.commandCode:
answer = new GxReAuthRequestImpl(receivedMessage);
break;
default:
logger.error("Received an unknown type of Message for Gx Activity: " + receivedMessage);
break;
}
}
} else {
logger.error("Received a REQUEST message when expecting an ANSWER.");
}
} else {
logger.debug("No answer received. Returning null.");
}
return answer;
}
use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterGqResourceAdaptor 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 // AAR/AAA
GqAARequest.COMMAND_CODE:
return isRequest ? new GqAARequestImpl(message) : new GqAAAnswerImpl(message);
case // ASR/ASA
GqAbortSessionRequest.COMMAND_CODE:
return isRequest ? new GqAbortSessionRequestImpl(message) : new GqAbortSessionAnswerImpl(message);
case // STR/STA
GqSessionTerminationRequest.COMMAND_CODE:
return isRequest ? new GqSessionTerminationRequestImpl(message) : new GqSessionTerminationAnswerImpl(message);
case // RAR/RAA
GqReAuthRequest.COMMAND_CODE:
return isRequest ? new GqReAuthRequestImpl(message) : new GqReAuthAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterS13ResourceAdaptor 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 MEIdentityCheckRequest.COMMAND_CODE:
return isRequest ? new MEIdentityCheckRequestImpl(message) : new MEIdentityCheckAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.base.events.ErrorAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterS6aResourceAdaptor 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 UpdateLocationRequest.COMMAND_CODE:
return isRequest ? new UpdateLocationRequestImpl(message) : new UpdateLocationAnswerImpl(message);
case AuthenticationInformationRequest.COMMAND_CODE:
return isRequest ? new AuthenticationInformationRequestImpl(message) : new AuthenticationInformationAnswerImpl(message);
case CancelLocationRequest.COMMAND_CODE:
return isRequest ? new CancelLocationRequestImpl(message) : new CancelLocationAnswerImpl(message);
case InsertSubscriberDataRequest.COMMAND_CODE:
return isRequest ? new InsertSubscriberDataRequestImpl(message) : new InsertSubscriberDataAnswerImpl(message);
case DeleteSubscriberDataRequest.COMMAND_CODE:
return isRequest ? new DeleteSubscriberDataRequestImpl(message) : new DeleteSubscriberDataAnswerImpl(message);
case PurgeUERequest.COMMAND_CODE:
return isRequest ? new PurgeUERequestImpl(message) : new PurgeUEAnswerImpl(message);
case ResetRequest.COMMAND_CODE:
return isRequest ? new ResetRequestImpl(message) : new ResetAnswerImpl(message);
case NotifyRequest.COMMAND_CODE:
return isRequest ? new NotifyRequestImpl(message) : new NotifyAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
Aggregations