org.opends.admin.ads.util
Class ServerLoader

java.lang.Object
  extended by java.lang.Thread
      extended by org.opends.admin.ads.util.ServerLoader
All Implemented Interfaces:
java.lang.Runnable

public class ServerLoader
extends java.lang.Thread

Class used to load the configuration of a server. Basically the code uses some provided properties and authentication information to connect to the server and then generate a ServerDescriptor object based on the read configuration.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerLoader(java.util.Map<ADSContext.ServerProperty,java.lang.Object> serverProperties, java.lang.String dn, java.lang.String pwd, ApplicationTrustManager trustManager, java.util.LinkedHashSet<PreferredConnection> preferredLDAPURLs, TopologyCacheFilter filter)
          Constructor.
 
Method Summary
 javax.naming.ldap.InitialLdapContext createContext()
          Create an InitialLdapContext based in the provide server properties and authentication data provided in the constructor.
 TopologyCacheException getLastException()
          Returns the last exception that occurred while trying to generate the ServerDescriptor object.
 ServerDescriptor getServerDescriptor()
          Returns the ServerDescriptor that could be retrieved.
 void interrupt()
          
 void run()
          The method where we try to generate the ServerDescriptor object.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerLoader

public ServerLoader(java.util.Map<ADSContext.ServerProperty,java.lang.Object> serverProperties,
                    java.lang.String dn,
                    java.lang.String pwd,
                    ApplicationTrustManager trustManager,
                    java.util.LinkedHashSet<PreferredConnection> preferredLDAPURLs,
                    TopologyCacheFilter filter)
Constructor.

Parameters:
serverProperties - the server properties of the server we want to load.
dn - the DN that we must use to bind to the server.
pwd - the password that we must use to bind to the server.
trustManager - the ApplicationTrustManager to be used when we try to connect to the server.
preferredLDAPURLs - the list of preferred LDAP URLs that we want to use to connect to the server. They will be used only if they correspond to the URLs that we found in the the server properties.
filter - the topology cache filter to be used. This can be used not to retrieve all the information.
Method Detail

getServerDescriptor

public ServerDescriptor getServerDescriptor()
Returns the ServerDescriptor that could be retrieved.

Returns:
the ServerDescriptor that could be retrieved.

getLastException

public TopologyCacheException getLastException()
Returns the last exception that occurred while trying to generate the ServerDescriptor object.

Returns:
the last exception that occurred while trying to generate the ServerDescriptor object.

interrupt

public void interrupt()

Overrides:
interrupt in class java.lang.Thread

run

public void run()
The method where we try to generate the ServerDescriptor object.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

createContext

public javax.naming.ldap.InitialLdapContext createContext()
                                                   throws javax.naming.NamingException
Create an InitialLdapContext based in the provide server properties and authentication data provided in the constructor.

Returns:
an InitialLdapContext based in the provide server properties and authentication data provided in the constructor.
Throws:
javax.naming.NamingException - if an error occurred while creating the InitialLdapContext.