Example: Defining Used Capabilities in the ADF Application

public void DataControlDC()
{
    String handshakeId = (String) ADFContext.getCurrent().getPageFlowScope().get("handshakeId");
    if (handshakeId == null || (handshakeId != null && handshakeId.length() == 0))
    {
        userBean = new E1UserSessionBean(AIS_SERVER, USER_NAME, PASSWORD, ENVIRONMENT, ROLE, DEVICE_NAME);
    }
    else
    {
        // Initialize application About properties when running in the container.
        E1AdfUtils.intializeAppInstance("/com/oracle/e1/E0801/");
    }
        
    loginEnv = E1AdfUtils.getLoginEnvironment(userBean);
        
    // Load required capabilities.
    if (loginEnv != null)
    {
        List<String> reqCapabilities = loginEnv.getRequiredCapabilities();
        reqCapabilities.add(AISClientCapability.GRID);
        reqCapabilities.add(AISClientCapability.PROCESSING_OPTION);
    }
}

Service requests for a required capability can throw a CapabilityException, so the request needs to be embedded within a try-catch block. When you execute a service request for a capability that is not provided by the AIS Server, control will transfer to the CapabilityException catch block, which you can use to perform alternate logic in place of the service request. Alternatively, you can use the AISClientCapability.isCapabilityAvailable(LoginEnvironment loginEnv, String capability) method to verify that a required capability exists before executing a service request. This also gives you the option to add alternate logic when the capability is not available.