Developing a Java Application to Communicate with a NIC Proxy

Configuration tasks that use the API calls to communicate with the NIC proxy are:

Instantiating a Configuration Manager

The application must instantiate a configuration manager.

To enable the application to instantiate a configuration manager to obtain a NIC instance from the NIC factory:

Passing a Reference to the Configuration Manager to the NIC Factory

To pass a reference to the configuration manager to the NIC factory class:

Instantiating the NIC Factory Class

The way you instantiate the NIC factory depends on the object request broker (ORB) configuration:

Initializing Logging

You must initialize logging only if you want to view the logging information produced by the NIC proxy.

To enable the application to initialize logging:

Instantiating the NIC Proxy

To enable the application to instantiate a NIC proxy:

Managing a Resolution Request

To enable the application to submit a resolution request and obtain the associated values:

  1. Construct a NicKey object to enable the application to pass the data key to the NIC proxy:
    NicKey nicKey = new NicKey(stringKey);
    • stringKey—Data key for which you want to find corresponding values.

    For the syntax of allowed data types, see NIC Resolution Process Overview.

  2. If the resolution process specifies constraints that you wish to provide in the resolution request, add them to the NicKey object:
    NicKey.addConstraint(constName, constValue);
    • constName—Name of the constraint.

    For the allowed data types and their syntax, see NIC Resolution Process Overview.

    • constValue—Specific value of the constraint.

    For the allowed syntax for the data types, see NIC Resolution Process Overview.

  3. Call a method that starts the resolution process.

    For example, you can call a method specified in the NIC interface:

    NicValue val = nicProxy.lookupSingle(nicKey);

    Alternatively, if the expected data value is an SAE reference, you can call the following method:

    SaeId saeId = nicProxy.lookupSae(nicKey);
  4. Call the getValue method to access the string representation of the data value obtained by the NIC proxy.
    String val=val.getValue();

    Alternatively, if the expected data value is an SAE reference:

    String val=saeId.getValue();
  5. (Optional) Call a method to get intermediate values obtained during a resolution.
    • Call the getIntermediateValue method if the application expects only one value. This method takes the name of a data type and returns as a string the first value it finds.
      String getIntermediateValue(String dataTypeName){};}

      For information about data types, see NIC Resolution Process Overview.

    • Call the getIntermediateValues or getAllIntermediateValues method if the application expects multiple values. These methods take the name of a data type and return values as follows:
      • The getIntermediateValues method returns a list of values as a string array.
        String[] getIntermediateValues(String dataTypeName){};
      • For information about data types, see NIC Resolution Process Overview
        • The getAllIntermediateValues method returns a map of all intermediate values for the request. The key for the map is the name of the network data type, and the value of the map is a string array of the intermediate values.
          Map getAllIntermediateValues();

Deleting Invalid Results from the NIC Proxy’s Cache

If the application receives an exception when using values that the NIC proxy returned for a specific key, it must inform the NIC proxy to delete this entry from its cache.

To enable the application to inform the NIC proxy to delete an entry from its cache:

Removing the NIC Proxies

Make sure that before your application shuts down, it removes the NIC proxy instances to release resources for other software processes.

To remove one NIC proxy instance:

Related Documentation