本文整理了Java中org.jdiameter.api.Message
类的一些代码示例,展示了Message
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message
类的具体详情如下:
包路径:org.jdiameter.api.Message
类名称:Message
[英]A Diameter message is either a request from a client to a server, or a response from a server to a client. Both Request and Answer messages use the basic format of RFC 3588 Wrapper interface allows adapt message to any driver vendor specific interface The message must support adaptable operation to Answer and Request interfaces Serializable interface allows use this class in SLEE Event objects
[中]Diameter消息是从客户端到服务器的请求,或从服务器到客户端的响应。请求和应答消息都使用RFC 3588包装器的基本格式接口允许将消息适配到任何驱动程序供应商特定的接口消息必须支持应答和请求接口的适配操作可序列化接口允许在SLEE事件对象中使用此类
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-base-common-events
public DiameterAvp[] getAvps() {
DiameterAvp[] avps = new DiameterAvp[0];
try {
avps = getAvpsInternal(message.getAvps());
}
catch (Exception e) {
log.error("Failed to obtain/decode AVP/data.", e);
}
return avps;
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-rf-ra
/**
*
* @param eventLookupFacility
* @param message
* @return
*/
public FireableEventType getEventId(EventLookupFacility eventLookupFacility, Message message) {
FireableEventType eventID = null;
// Error is always the same.
if (message.isError()) {
//eventID = getEventId(eventLookupFacility, ERROR_ANSWER);
//TODO: x?
}
else {
final int commandCode = message.getCommandCode();
final boolean isRequest = message.isRequest();
String eventName = eventNames.get(commandCode);
if(eventName != null) {
eventID = getEventId(eventLookupFacility, eventName + (isRequest ? "Request" : "Answer"));
}
}
return eventID;
}
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-sh-client-ra
private Message createShMessage(DiameterHeader diameterHeader, DiameterAvp[] avps, int _commandCode) throws IllegalArgumentException {
// List<DiameterAvp> list = (List<DiameterAvp>) this.avpList.clone();
boolean isRequest = diameterHeader == null;
Message msg = null;
if (!isRequest) {
Message raw = createMessage(diameterHeader, avps,0);
raw.setProxiable(diameterHeader.isProxiable());
raw.setRequest(false);
raw.setReTransmitted(false); // just in case. answers never have T flag set
msg = raw;
}
else {
Message raw = createMessage(null, avps,_commandCode);
raw.setProxiable(true);
raw.setRequest(true);
msg = raw;
}
return msg;
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-sh-common-events
/**
*
* @param msg
*/
public PushNotificationAnswerImpl(Message msg) {
super(msg);
msg.setRequest(false);
msg.setReTransmitted(false); // just in case. answers never have T flag set
super.longMessageName = "Push-Notificaton-Answer";
super.shortMessageName = "PNA";
}
代码示例来源:origin: org.mobicents.diameter/jdiameter-impl
private String makeRoutingKey(Message message) {
String sessionId = message.getSessionId();
return new StringBuilder(sessionId != null ? sessionId : "null").append(message.getEndToEndIdentifier())
.append(message.getHopByHopIdentifier()).toString();
}
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-gq-ra
public Message createRequest(int code, DiameterAvp[] avps) {
Message raw = createMessage(code, new DiameterAvp[] {});
raw.setProxiable(true);
raw.setRequest(true);
return raw;
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-ro-ra
private DiameterActivity createActivity(Message message) throws CreateActivityException {
DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId()));
if (message.isRequest()) {
return createRoServerSessionActivity((Request) message);
AvpSet avps = message.getAvps();
Avp avp = null;
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-gq-ra
@Override
public GqSessionTerminationAnswer createGqSessionTerminationAnswer(GqSessionTerminationRequest str) {
Message raw = createMessage(str.getHeader(), new DiameterAvp[] {});
raw.setRequest(false); // this should be different ...
raw.setReTransmitted(false); // just in case. answers never have T flag set
GqSessionTerminationAnswerImpl sta = new GqSessionTerminationAnswerImpl(raw);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
sta.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
sta.setSessionId(str.getSessionId());
addOrigin(sta);
return sta;
}
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-gq-ra
msg.setRequest(isRequest);
msg.setProxiable(isProxiable);
msg.setError(isError);
msg.setReTransmitted(isRequest && isPotentiallyRetransmitted);
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-gx-ra
raw.setProxiable(ccr.getHeader().isProxiable());
raw.setRequest(false);
raw.setReTransmitted(false); // just in case. answers never have T flag set
final GxCreditControlAnswerImpl msg = new GxCreditControlAnswerImpl(raw);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_HOST);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.DESTINATION_REALM);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_HOST);
msg.getGenericData().getAvps().removeAvp(DiameterAvpCodes.ORIGIN_REALM);
msg.setSessionId(request.getSessionId());
代码示例来源:origin: org.mobicents.diameter/jdiameter-impl
public void setData(Object data) {
try {
if (((AppEvent) data).getMessage().isRequest()) {
request = (AppEvent) data;
} else {
answer = (AppEvent) data;
}
} catch (InternalException e) {
throw new IllegalArgumentException(e);
}
}
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-cx-dx-ra
private DiameterActivity createActivity(Message message) throws CreateActivityException {
DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId()));
if(activity == null) {
if (message.isRequest()) {
if(message.getCommandCode() == PushProfileRequest.COMMAND_CODE || message.getCommandCode() == RegistrationTerminationRequest.COMMAND_CODE) {
return createCxDxClientSessionActivity((Request) message, false);
}
else {
return createCxDxServerSessionActivity((Request) message);
}
}
else {
throw new IllegalStateException("Got answer, there should already be activity.");
}
}
return activity;
}
代码示例来源:origin: org.mobicents.servers.diameter.resources/base-common-events
public DiameterCommand getCommand() {
return new DiameterCommandImpl(this.message.getCommandCode(), this.message.getApplicationId(), this.getShortName(), this.getLongName(), this.message.isRequest(), this.message.isProxiable());
}
代码示例来源:origin: org.mobicents.diameter/jdiameter-impl
@Override
public void validate(Message msg, boolean incoming) throws AvpNotAllowedException {
if (!enabled || !configured) {
return;
}
MessageRepresentationImpl rep = new MessageRepresentationImpl(msg.getCommandCode(), msg.getApplicationId(), msg.isRequest());
rep = (MessageRepresentationImpl) this.commandMap.get(rep);
if (rep == null) {
// no notion, lets leave it.
logger.warn("Validation could not be performed, command not defined!. Code={}, Application-Id={}, Req={}",
new Object[] { msg.getCommandCode(), msg.getApplicationId(), msg.isRequest() });
return;
}
rep.validate(msg, (incoming ? receiveValidationLevel : sendValidationLevel));
}
代码示例来源:origin: org.mobicents.diameter/jdiameter-impl
/**
*
* @param message
*/
public JDeleteSubscriberDataRequestImpl(Message message) {
super(message);
message.setRequest(true);
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-base-ra
DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId()));
DiameterIdentity destinationRealm = null;
AvpSet avps = message.getAvps();
return this.createActivity(destinationHost, destinationRealm, message.getSessionId());
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-sh-client-ra
/**
* This method is for internal use only, it creates activities for requests that
* do not fall in certain app range or no activities were found <br>
* It should distinguish between initial requests, requests with different domains etc.
* Answer for creating XXXServerSession or basic diameter activity lies in this method
*
* @param message
* @return
*/
DiameterActivity createActivity(Message message) throws CreateActivityException {
DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId()));
if (activity == null) {
//FIXME: baranowb: here we can receive only (valid) PNR, other message are errors?
if(message.getCommandCode() != PushNotificationRequestImpl.commandCode) {
throw new CreateActivityException("Cant create activity for unexpected message:\r\n" + message);
}
return (ShClientSubscriptionActivityImpl) this.createShClientSubscriptionActivity(new PushNotificationRequestImpl( message));
}
return activity;
}
代码示例来源:origin: org.mobicents.diameter/jdiameter-impl
@Override
public int getCommandCode() {
return message.getCommandCode();
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-diameter-base-common-events
public boolean isError() {
return this.msg.isError();
}
代码示例来源:origin: org.mobicents.resources/restcomm-slee-ra-diameter-gx-ra
private DiameterActivity createActivity(final Message message) throws CreateActivityException {
DiameterActivity activity = activities.get(getActivityHandle(message.getSessionId()));
if (activity == null) {
if (message.isRequest()) {
return createGxServerSessionActivity((Request) message);
} else {
final AvpSet avps = message.getAvps();
Avp avp = null;
DiameterIdentity destinationHost = null;
DiameterIdentity destinationRealm = null;
if ((avp = avps.getAvp(Avp.DESTINATION_HOST)) != null) {
try {
destinationHost = new DiameterIdentity(avp.getDiameterIdentity());
} catch (AvpDataException e) {
tracer.severe("Failed to extract Destination-Host from Message.", e);
}
}
if ((avp = avps.getAvp(Avp.DESTINATION_REALM)) != null) {
try {
destinationRealm = new DiameterIdentity(avp.getDiameterIdentity());
} catch (AvpDataException e) {
tracer.severe("Failed to extract Destination-Realm from Message.", e);
}
}
return (DiameterActivity) createGxClientSessionActivity(destinationHost, destinationRealm);
}
}
return activity;
}
内容来源于网络,如有侵权,请联系作者删除!