Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


oracle.ldap.util.discovery
Class DiscoveryHelper

java.lang.Object
  extended by oracle.ldap.util.discovery.DiscoveryHelper


public class DiscoveryHelper
extends java.lang.Object

This class provides the functionality required for OID server related information discovery.

The first step in discovering information is to create a discovery handle. Discovery handle specifies the source from which information will be discovered.

DiscoveryHelper disco = new DiscoveryHelper(DiscoveryHelper.DNS_DISCOVER);

The argument passed "DiscoveryHelper.DNS_DISCOVER" specifies the source. Currently following sources are supported :- DNS_DISCOVER ,CFGFILE_DISCOVER,AUTO_DISCOVER, OID_DISCOVER

Each source may require some inputs to be specified for discovery of information.

 // Set the property for the DNS_DN
 disco.setProperty(DiscoveryHelper.DNS_DN,"dc=us,dc=fiction,dc=com");
 
 // Set the property for the DNS_DISCOVER_METHOD
 disco.setProperty(DiscoveryHelper.DNS_DISCOVER_METHOD
                               ,DiscoveryHelper.USE_INPUT_DN_METHOD);
  
 // Set the property for the SSLMODE
 disco.setProperty(DiscoveryHelper.SSLMODE,DiscoveryHelper.SSL_FALSE);
 

Now the information can be discovered.

// Call the discover method
int ret = disco.discover(reshdl);

The various error codes that can be returned by discover() method are :-
LDAP_SUCCESS, LDAP_NO_INFO_OBTAINED ,LDAP_LOOKUP_ERROR,LDAP_DNS_ADDR_NOT_FOUND, LDAP_FILE_NOT_FOUND, LDAP_FILE_PARSE_ERROR, LDAP_PARAM_ERROR

The discovered information is returned in a result handle. Now the results can be extracted from the result handle. The type of results obtained will be dependent upon the source selected for discovering information. Eg. if source is DNS_DISCOVER then result obtained will be ldap hostname information (DiscoveryHelper.DIR_SERVERS).

 ArrayList result = (ArrayList)reshdl.get(DiscoveryHelper.DIR_SERVERS);

 if (result != null)
 {
   if (result.size() == 0) return;
   System.out.println("The hostnames are :-");
   for (int i = 0; i < result.size();i++)
   {
     String host = (String)result.get(i);
     System.out.println((i+1)+".\t\""+host+"\"");
   }
 }
 


Since:
IAS 9.0.4

Field Summary
static java.lang.Integer ALTDIR_SERVERS
           
static int AUTO_DISCOVER
          This source will first try to locate and parse configuration file.
static int CFGFILE_DISCOVER
          This source will parse the configuration file (ldap.ora) and return the value of parameters present in it.
static java.lang.Integer CFGFL_PATH
           
static java.lang.Integer DEF_ADMIN_CTXT
           
static java.lang.Integer DETAILED_ERROR_INFO
           
static java.lang.Integer DIR_SERVER_CONN_SEC
           
static java.lang.Integer DIR_SERVER_TYPE
           
static java.lang.Integer DIR_SERVERS
           
 int discoveryType
           
static int DNS_DISCOVER
          This source will discover hostname information from DNS server.
static java.lang.String DNS_DISCOVER_METHOD
          This property specifies the method to be used for dns discovery.
static java.lang.String DNS_DN
          This property specifies the dn required for dns discovery
static java.lang.String GEN_DETAILED_ERR_RPT
          This property specifies whether detailed error information is required for AUTO discovery
static java.lang.String HOSTINFO
          This property specifies the host:port information required for OID discovery
static int LDAP_DNS_ADDR_NOT_FOUND
           
static int LDAP_FILE_NOT_FOUND
           
static int LDAP_FILE_PARSE_ERROR
           
static int LDAP_LOOKUP_ERROR
           
static int LDAP_NO_INFO_OBTAINED
           
static int LDAP_PARAM_ERROR
           
static int LDAP_SUCCESS
           
static java.lang.Integer NONSSL_PORT
           
static int OID_DISCOVER
          This source will discover information from OID server.
static java.lang.Integer ORCLCOMMCTXMAP
           
static java.lang.String SSL_FALSE
           
static java.lang.Integer SSL_PORT
           
static java.lang.String SSL_TRUE
           
static java.lang.String SSLMODE
          This property specifies whether ssl based or non-ssl based server information is to be discovered.
static java.lang.String USE_ALL_METHODS
          This method tries all the above mentioned methods in succession stopping when any of these methods succeeds in DNS lookup.
static java.lang.String USE_DFLT_LOOKUP_METHOD
          This discover method specifies that default domain name should be used for DNS lookup
static java.lang.String USE_INPUT_DN_METHOD
          This discover method specifies that dn(distinguished name) be used to obtain domain name required for DNS lookup.
static java.lang.String USE_MC_DOMAIN_METHOD
          This discover method specifies that domain component of client machine is to used for obtaining domain name required for DNS lookup.

 

Constructor Summary
DiscoveryHelper(int type)
          Create an instance to discover information from a specified source.

 

Method Summary
 int discover(java.util.HashMap reshdl)
          Discover the information from the source.
 java.util.ArrayList getMultiValProperty(java.lang.String property)
          Get all property values.
 java.lang.String getProperty(java.lang.String property)
          Get the property value.
 java.lang.Object setMultiValProperty(java.lang.String property, java.util.ArrayList lst)
          Set multiple values for a property.
 java.lang.Object setProperty(java.lang.String property, java.lang.String value)
          Set the property value.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

discoveryType

public int discoveryType

DNS_DISCOVER

public static final int DNS_DISCOVER
This source will discover hostname information from DNS server. The properties associated with this source are:-
DNS_DN , DNS_DISCOVER_METHOD, SSLMODE
The results that can be discovered by this source are :-
DIR_SERVERS
See Also:
Constant Field Values

CFGFILE_DISCOVER

public static final int CFGFILE_DISCOVER
This source will parse the configuration file (ldap.ora) and return the value of parameters present in it. The properties associated with this source are :-
SSLMODE
The results that can be discovered by this source are :-
DIR_SERVERS, DEF_ADMIN_CTXT, DIR_SERVER_TYPE
See Also:
Constant Field Values

AUTO_DISCOVER

public static final int AUTO_DISCOVER
This source will first try to locate and parse configuration file. If successful then it returns all the parameter values found. Else it will obtain DIR_SERVERS from DNS server and connect to it. It will then obtain remaining parameter values from connected server. The value of DIR_SERVER_TYPE will be set to "UNKNOWN" in this case. The properties associated with this source are:-
SSLMODE, GEN_DETAILED_ERR_RPT
The results that can be discovered by this source are :-
DIR_SERVERS, DEF_ADMIN_CTXT, DIR_SERVER_TYPE ALTDIR_SERVERS, ORCLCOMMCTXMAP, DIR_SERVER_CONN_SEC, DETAILED_ERROR_INFO
See Also:
Constant Field Values

OID_DISCOVER

public static final int OID_DISCOVER
This source will discover information from OID server. The properties associated with this source are:-
HOSTINFO , SSLMODE
The results that can be discovered by this source are :-
NONSSL_PORT, SSL_PORT, DEF_ADMIN_CTXT, ORCLCOMMCTXMAP
See Also:
Constant Field Values

DEF_ADMIN_CTXT

public static final java.lang.Integer DEF_ADMIN_CTXT

DIR_SERVERS

public static final java.lang.Integer DIR_SERVERS

DIR_SERVER_TYPE

public static final java.lang.Integer DIR_SERVER_TYPE

ALTDIR_SERVERS

public static final java.lang.Integer ALTDIR_SERVERS

ORCLCOMMCTXMAP

public static final java.lang.Integer ORCLCOMMCTXMAP

DIR_SERVER_CONN_SEC

public static final java.lang.Integer DIR_SERVER_CONN_SEC

CFGFL_PATH

public static final java.lang.Integer CFGFL_PATH

SSL_PORT

public static final java.lang.Integer SSL_PORT

NONSSL_PORT

public static final java.lang.Integer NONSSL_PORT

DETAILED_ERROR_INFO

public static final java.lang.Integer DETAILED_ERROR_INFO

SSL_FALSE

public static final java.lang.String SSL_FALSE
See Also:
Constant Field Values

SSL_TRUE

public static final java.lang.String SSL_TRUE
See Also:
Constant Field Values

DNS_DN

public static final java.lang.String DNS_DN
This property specifies the dn required for dns discovery
See Also:
Constant Field Values

DNS_DISCOVER_METHOD

public static final java.lang.String DNS_DISCOVER_METHOD
This property specifies the method to be used for dns discovery. It can have following values : USE_INPUT_DN_METHOD , USE_MC_DOMAIN_METHOD , USE_DFLT_LOOKUP_METHOD , USE_ALL_METHODS
See Also:
Constant Field Values

SSLMODE

public static final java.lang.String SSLMODE
This property specifies whether ssl based or non-ssl based server information is to be discovered. It can have following values : SSL_FALSE , SSL_TRUE
See Also:
Constant Field Values

HOSTINFO

public static final java.lang.String HOSTINFO
This property specifies the host:port information required for OID discovery
See Also:
Constant Field Values

GEN_DETAILED_ERR_RPT

public static final java.lang.String GEN_DETAILED_ERR_RPT
This property specifies whether detailed error information is required for AUTO discovery
See Also:
Constant Field Values

USE_INPUT_DN_METHOD

public static final java.lang.String USE_INPUT_DN_METHOD
This discover method specifies that dn(distinguished name) be used to obtain domain name required for DNS lookup.
See Also:
Constant Field Values

USE_MC_DOMAIN_METHOD

public static final java.lang.String USE_MC_DOMAIN_METHOD
This discover method specifies that domain component of client machine is to used for obtaining domain name required for DNS lookup.
See Also:
Constant Field Values

USE_DFLT_LOOKUP_METHOD

public static final java.lang.String USE_DFLT_LOOKUP_METHOD
This discover method specifies that default domain name should be used for DNS lookup
See Also:
Constant Field Values

USE_ALL_METHODS

public static final java.lang.String USE_ALL_METHODS
This method tries all the above mentioned methods in succession stopping when any of these methods succeeds in DNS lookup.
See Also:
Constant Field Values

LDAP_NO_INFO_OBTAINED

public static final int LDAP_NO_INFO_OBTAINED
See Also:
Constant Field Values

LDAP_LOOKUP_ERROR

public static final int LDAP_LOOKUP_ERROR
See Also:
Constant Field Values

LDAP_DNS_ADDR_NOT_FOUND

public static final int LDAP_DNS_ADDR_NOT_FOUND
See Also:
Constant Field Values

LDAP_FILE_NOT_FOUND

public static final int LDAP_FILE_NOT_FOUND
See Also:
Constant Field Values

LDAP_FILE_PARSE_ERROR

public static final int LDAP_FILE_PARSE_ERROR
See Also:
Constant Field Values

LDAP_PARAM_ERROR

public static final int LDAP_PARAM_ERROR
See Also:
Constant Field Values

LDAP_SUCCESS

public static final int LDAP_SUCCESS
See Also:
Constant Field Values

Constructor Detail

DiscoveryHelper

public DiscoveryHelper(int type)
Create an instance to discover information from a specified source.
Parameters:
type - discovery information source. It can have following values :- DNS_DISCOVER, CFGFILE_DISCOVER, AUTO_DISCOVER

Method Detail

discover

public int discover(java.util.HashMap reshdl)
Discover the information from the source.
Parameters:
reshdl - Result map. It contains the result type and result array name-value pairs.

setProperty

public java.lang.Object setProperty(java.lang.String property,
                                    java.lang.String value)
Set the property value. These properties are required for discovering information from the source. This method can set only one value for a multivalued property. For setting mulitple values use setMultiValProperty(java.lang.String, java.util.ArrayList)
Parameters:
property - Property whose value is to be set.
value - value to be assigned to the property.

setMultiValProperty

public java.lang.Object setMultiValProperty(java.lang.String property,
                                            java.util.ArrayList lst)
Set multiple values for a property. These properties are required for discovering information from the source. This method sets mulitple values for a multivalued property. In case of single valued property the first value provided is used and rest are ignored
Parameters:
property - Property whose value is to be set.
lst - ArrayList of String values to be assigned to the property.

getProperty

public java.lang.String getProperty(java.lang.String property)
Get the property value. In case of multivalued property one first value is returned.
Parameters:
property - Property whose value is to be obtained.
Returns:
property value if found else null

getMultiValProperty

public java.util.ArrayList getMultiValProperty(java.lang.String property)
Get all property values. All the values of the property are returned in an ArrayList
Parameters:
property - Property whose value is to be obtained.
Returns:
property value if found else null

Skip navigation links

Oracle Internet Directory API Reference
11g Release 1 (11.1.1)

E10664-01


Copyright © 1999, 2009 Oracle. All Rights Reserved.