use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.
the class DiameterCCAResourceAdaptor method processRequest.
// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(Request request) {
// FIXME: baranowb: check if ACR is vald here also
if (request.getCommandCode() == CreditControlRequest.commandCode) {
DiameterActivity activity;
try {
activity = raProvider.createActivity(request);
if (activity == null) {
tracer.severe("Diameter CCA RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
} else {
// We can only have server session?, but for sake error catching
if (activity instanceof CreditControlServerSession) {
CreditControlServerSessionImpl session = (CreditControlServerSessionImpl) activity;
((ServerCCASessionImpl) session.getSession()).processRequest(request);
}
}
} catch (CreateActivityException e) {
tracer.severe("Failure trying to create CCA Activity.", e);
}
} else {
tracer.severe("Diameter CCA RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
}
// Returning null so we can answer later
return null;
}
use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.
the class DiameterRxResourceAdaptor method processRequest.
// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(final Request request) {
if (tracer.isInfoEnabled()) {
tracer.info("Diameter Rx RA :: Got Request. Command-Code[" + request.getCommandCode() + "]");
}
// FIXME: baranowb: check if ACR is vald here also
if (request.getCommandCode() == AARequest.commandCode) {
DiameterActivity activity;
try {
activity = raProvider.createActivity(request);
if (activity == null) {
tracer.severe("Diameter Rx RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
} else {
if (activity instanceof RxServerSessionActivity) {
final RxServerSessionActivityImpl session = (RxServerSessionActivityImpl) activity;
((ServerRxSessionImpl) session.getSession()).processRequest(request);
}
}
} catch (CreateActivityException e) {
tracer.severe("Failure trying to create Rx Activity.", e);
}
// Returning null so we can answer later
return null;
} else {
if (tracer.isInfoEnabled()) {
tracer.info("Diameter Rx RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
}
}
return null;
}
use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.
the class DiameterRoResourceAdaptor method processRequest.
// NetworkReqListener Implementation -----------------------------------
public Answer processRequest(Request request) {
if (tracer.isInfoEnabled()) {
tracer.info("Diameter Ro RA :: Got Request. Command-Code[" + request.getCommandCode() + "]");
}
// FIXME: baranowb: check if ACR is vald here also
if (request.getCommandCode() == RoCreditControlRequest.commandCode) {
DiameterActivity activity;
try {
activity = raProvider.createActivity(request);
if (activity == null) {
tracer.severe("Diameter Ro RA :: Failed to create session, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
} else {
// We can only have server session?, but for sake error catching
if (activity instanceof RoServerSessionActivity) {
RoServerSessionActivityImpl session = (RoServerSessionActivityImpl) activity;
((ServerRoSessionImpl) session.getSession()).processRequest(request);
}
}
} catch (CreateActivityException e) {
tracer.severe("Failure trying to create Ro Activity.", e);
}
// Returning null so we can answer later
return null;
} else {
if (tracer.isInfoEnabled()) {
tracer.info("Diameter Ro RA :: Received unexpected Request. Either its not CCR or session should exist to handle this, Command-Code: " + request.getCommandCode() + ", Session-Id: " + request.getSessionId());
}
}
return null;
}
use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.
the class DiameterShServerResourceAdaptor method fireEvent.
// Event and Activities management -------------------------------------
public boolean fireEvent(Object event, ActivityHandle handle, FireableEventType eventID, Address address, boolean useFiltering, boolean transacted) {
if (useFiltering && eventIDFilter.filterEvent(eventID)) {
if (tracer.isFineEnabled()) {
tracer.fine("Event " + eventID + " filtered");
}
} else if (eventID == null) {
tracer.severe("Event ID for " + eventID + " is unknown, unable to fire.");
} else {
if (tracer.isFineEnabled()) {
tracer.fine("Firing event " + event + " on handle " + handle);
}
try {
/* TODO: Support transacted fire of events when in cluster
if (transacted){
this.raContext.getSleeEndpoint().fireEventTransacted(handle, eventID, event, address, null, EVENT_FLAGS);
}
else */
{
DiameterActivity activity = (DiameterActivity) getActivity(handle);
if (activity instanceof ShServerActivityImpl) {
((ShServerActivityImpl) activity).fetchSessionData((DiameterMessage) event, true);
} else if (activity instanceof ShServerSubscriptionActivityImpl) {
((ShServerSubscriptionActivityImpl) activity).fetchSessionData((DiameterMessage) event, true);
}
this.raContext.getSleeEndpoint().fireEvent(handle, eventID, event, address, null, EVENT_FLAGS);
}
return true;
} catch (Exception e) {
tracer.severe("Error firing event.", e);
}
}
return false;
}
use of net.java.slee.resource.diameter.base.DiameterActivity in project jain-slee.diameter by RestComm.
the class DiameterShServerResourceAdaptor method sessionCreated.
// Session Management --------------------------------------------------
public void sessionCreated(ServerShSession session, boolean isSubscription) {
// Make sure it's a new session and there's no activity created yet.
if (this.getActivity(getActivityHandle(session.getSessions().get(0).getSessionId())) != null) {
tracer.warning("Activity found for created Credit-Control Server Session. Shouldn't exist. Aborting.");
return;
}
// Get Message Factories (for Base and ShServer)
DiameterMessageFactoryImpl baseMsgFactory = new DiameterMessageFactoryImpl(session.getSessions().get(0), this.stack);
ShServerMessageFactoryImpl shServerMsgFactory = new ShServerMessageFactoryImpl(baseMsgFactory, session.getSessions().get(0), this.stack, this.shAvpFactory);
// Create Server Activity
DiameterActivity activity = null;
if (isSubscription) {
ShServerSubscriptionActivityImpl _activity = new ShServerSubscriptionActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
_activity.setSessionListener(this);
activity = _activity;
activityCreated(activity, false);
} else {
ShServerActivityImpl _activity = new ShServerActivityImpl(shServerMsgFactory, this.shAvpFactory, session, null, null);
_activity.setSessionListener(this);
activity = _activity;
activityCreated(activity, false);
}
}
Aggregations