Oracle Internet Directory API Reference
10g(9.0.4)

B10423-01

oracle.ldap.util.discovery
Class DiscoveryHelper

java.lang.Object
  |
  +--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

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 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 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 ORCLCOMMCTXMAP
           
static java.lang.String SSL_FALSE
           
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 an specified source.

 

Method Summary
 int discover(java.util.HashMap reshdl)
          Discover the information from the source.
 java.lang.String getProperty(java.lang.String property)
          Get the property value.
 java.lang.Object setProperty(java.lang.String property, java.lang.String value)
          Set the property value.

 

Methods inherited from class java.lang.Object
equals, 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. Currently no properties are associated with this source. 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
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_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

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 an specified source.
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.
Parameters:
value - value to be assigned to the property.

getProperty

public java.lang.String getProperty(java.lang.String property)
Get the property value.
Returns:
property value if found else null

Oracle Internet Directory API Reference
10g(9.0.4)

B10423-01

Copyright © 2003, Oracle. All Rights Reserved.