This section explains how a feature gets a reference to the TCAP Leg Manager and how IPSMGW MAP features are triggered.
Obtaining a Reference to the TCAP Leg Manager
Features access the TCAP Leg Manager as a provider object. The first step is to add the TCAP Leg Manager provider jndi name to the raProviderJndiNames
attribute of the SentinelFeature
annotation. For example, the MAP Proxy features does:
/**
* Sentinel feature that acts as a proxy between two MAP Dialogs.
*/
@SentinelFeature(
featureName = IPSMGWMapProxyFeature.NAME,
// ...
raProviderJndiNames = { "sentinel/tcaplegmanagerprovider" },
// ...
)
The TCAP Leg Manager is injected as a provider object using the name "sentinel/tcaplegmanagerprovider" |
The second step is to implement the InjectResourceAdaptorProvider
interface in your feature. The IPSMGW will call injectResourceAdaptorProvider()
when the feature is created. For example, the MAP Proxy feature does:
@BinderTargets(services = "ipsmgw")
public class IPSMGWMapProxyFeature extends BaseFeature<SentinelSessionState, FeatureEndpoint>
implements InjectResourceAdaptorProvider,
// ...
{
// ...
@Override
public void injectResourceAdaptorProvider(Object provider) {
this.tcapLegManager = (TcapLegManager)provider;
}
// ...
private TcapLegManager tcapLegManager;
// ...
}
The feature must implement the InjectResourceAdaptorProvider interface … |
|
… by implementing the injectResourceAdaptorProvider(Object) operation |
|
It is safe for a feature to hold a reference to the TcapLegManager in a java attribute |
Triggering IPSMGW MAP Features
IPSMGW MAP Features are triggered with a trigger event object that corresponds to a class in the TCAP Messages hierachy. The triggering ActivityContextInterface
is for the Dialog
activity that corresponds to the triggering event object. For example the MAP Proxy does:
@Override
public void startFeature(Object trigger, Object activity,
ActivityContextInterface aci,
Map<String, ParameterValue> featureParameters)
{
final Tracer tracer = getTracer();
if (! (trigger instanceof DialogTcapMessage)) {
getCaller().featureFailedToExecute(
new FeatureError(FeatureError.Cause.unclassified,
"Feature not triggered on a DialogTcapMessage. Trigger = " + trigger));
getCaller().featureHasFinished();
return;
}
final SentinelActivityContextInterface triggerAci
= tcapLegManager.asSentinelActivityContextInterface(aci);
final TcapLeg triggerLeg = tcapLegManager.getLeg(triggerAci);
final DialogTcapMessage message = (DialogTcapMessage) trigger;
final TcapLeg proxyLeg;
switch (message.getType()) {
case DialogOpenRequest:
final DialogOpenRequestTcapMessage dialogOpen = message.asDialogOpenRequest();
// ...
// create the new outgoing leg
try {
proxyLeg = tcapLegManager.createLeg(dialogOpen.getApplicationContext(),
proxyLegName);
}
catch (DuplicateLegException dle) {
// ...
return;
}
catch(ProtocolException pe) {
// ...
return;
}
// ...
break;
case DialogOpenAccept:
proxyLeg = triggerLeg.getLinkedLeg();
// ...
break;
MAP features expect trigger objects that implement DialogTcapMessage |
|
A useful utility method on the TCAP Leg Manager to get a SentinelActivityContext for the trigering ACI |
|
Use the TCAP Leg Manager to get the TCAP Leg for the triggering ACI | |
The MAP proxy takes actions that depend on the type of the trigger | |
On a DialogOpenRequest the MAP Proxy feature creates a new outgoing leg to proxy to |
|
Use the TCAP Leg Manager to create the new proxy leg | |
The MAP proxy will process an OpenAccept to the proxy leg |
|
Get the proxy leg by following the link from the triggering leg |