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" }, 1
    // ...
)
1 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, 1
                                           // ...
{
    // ...

    @Override
    public void injectResourceAdaptorProvider(Object provider) {
        this.tcapLegManager = (TcapLegManager)provider; 2
    }

    // ...

    private TcapLegManager tcapLegManager; 3

    // ...
}
1 The feature must implement the InjectResourceAdaptorProvider interface …​
2 …​ by implementing the injectResourceAdaptorProvider(Object) operation
3 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)) { 1
        getCaller().featureFailedToExecute(
            new FeatureError(FeatureError.Cause.unclassified,
                             "Feature not triggered on a DialogTcapMessage. Trigger = " + trigger));
        getCaller().featureHasFinished();
        return;
    }

    final SentinelActivityContextInterface triggerAci
                             = tcapLegManager.asSentinelActivityContextInterface(aci); 2
    final TcapLeg triggerLeg = tcapLegManager.getLeg(triggerAci); 3
    final DialogTcapMessage message = (DialogTcapMessage) trigger;

    final TcapLeg proxyLeg;
    switch (message.getType()) { 4

        case DialogOpenRequest: 5
            final DialogOpenRequestTcapMessage dialogOpen = message.asDialogOpenRequest();

            // ...

            // create the new outgoing leg
            try {
                proxyLeg = tcapLegManager.createLeg(dialogOpen.getApplicationContext(),
                                                    proxyLegName); 6
            }
            catch (DuplicateLegException dle) {
                // ...
                return;
            }
            catch(ProtocolException pe) {
                // ...
                return;
            }

            // ...
            break;

        case DialogOpenAccept: 7
            proxyLeg = triggerLeg.getLinkedLeg(); 8

            // ...
            break;
1 MAP features expect trigger objects that implement DialogTcapMessage
2 A useful utility method on the TCAP Leg Manager to get a SentinelActivityContext for the trigering ACI
3 Use the TCAP Leg Manager to get the TCAP Leg for the triggering ACI
4 The MAP proxy takes actions that depend on the type of the trigger
5 On a DialogOpenRequest the MAP Proxy feature creates a new outgoing leg to proxy to
6 Use the TCAP Leg Manager to create the new proxy leg
7 The MAP proxy will process an OpenAccept to the proxy leg
8 Get the proxy leg by following the link from the triggering leg
Previous page Next page