Below are instructions for injecting resources into a SIP Servlet application.

Container-managed objects

Servlet classes can use the standard @Resource annotation to have certain container-managed objects be automatically injected into the application. For example, the SipFactory can be injected into an instance variable in a servlet class just by annotating the variable with @Resource:

@Resource
private SipFactory sipFactory;

Objects in the JNDI environment

Similarly, any object in the application’s JNDI environment can be injected by providing the JNDI object name in the @Resource annotation. For example, if the application defines an integer env-entry named "timeout", it can be injected using:

@Resource(name = "timeout")
private int timeout;

RA type interfaces

RA type interfaces are injected in the same way, using the JNDI object names specified in the @RATypeBinding. The RA interfaces from the example above would be injected like this:

import com.opencloud.slee.resources.http.*; // Import HTTP RA Type interfaces

@Resource(name = "slee/resources/http/provider")
private HttpProvider httpProvider;

@Resource(name = "slee/resources/http/acifactory")
private HttpActivityContextInterfaceFactory httpACIFactory;

Standard SLEE facilities

All standard SLEE facilities can be automatically injected as well, just by using @Resource on variables of those types:

import javax.slee.facilities.*;

@Resource
private AlarmFacility alarmFacility;

@Resource
private ActivityContextNamingFacility acinamingFacility;
Previous page Next page