com.tivoli.pd.jutil
Class DefaultPooledPDContextBuilder

java.lang.Object
  extended by com.tivoli.pd.jutil.DefaultPooledPDContextBuilder
All Implemented Interfaces:
PooledContextBuilder<PDContext>

public class DefaultPooledPDContextBuilder
extends java.lang.Object
implements PooledContextBuilder<PDContext>

Default PooledContextBuilder implementation for initializing the ContextPool behavior.

See Also:
ContextPool

Constructor Summary
DefaultPooledPDContextBuilder(java.util.Locale locale, java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.util.Locale locale, java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL, boolean useCert)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.util.Locale locale, java.lang.String userid, char[] password, java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.util.Locale locale, java.lang.String userid, char[] password, java.net.URL configURL, boolean useCert)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.util.Locale locale, java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.lang.String userid, char[] password, java.lang.String domain, java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.lang.String userid, char[] password, java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
DefaultPooledPDContextBuilder(java.net.URL configURL)
          Creates a DefaultPooledPDContextBuilder.
 
Method Summary
 PDContext build()
          Create a new shared context.
 PDContext onCheckoutContext(ContextPool<PDContext> pool, PDContext context)
          Prepares a PDContext before returning it to the client.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.util.Locale locale,
                                     java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
locale - locale for any data that is returned.
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.util.Locale locale,
                                     java.lang.String userid,
                                     char[] password,
                                     java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.util.Locale locale,
                                     java.lang.String userid,
                                     char[] password,
                                     java.net.URL configURL,
                                     boolean useCert)
Creates a DefaultPooledPDContextBuilder.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data.
useCert - if useCert is false, info related to the certificate will not be included

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.util.Locale locale,
                                     java.lang.String userid,
                                     char[] password,
                                     java.lang.String domain,
                                     java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
locale - locale for any data that is returned.
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.lang.String userid,
                                     char[] password,
                                     java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.lang.String userid,
                                     char[] password,
                                     java.lang.String domain,
                                     java.net.URL configURL)
Creates a DefaultPooledPDContextBuilder.

Parameters:
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data.

DefaultPooledPDContextBuilder

public DefaultPooledPDContextBuilder(java.util.Locale locale,
                                     java.lang.String userid,
                                     char[] password,
                                     java.lang.String domain,
                                     java.net.URL configURL,
                                     boolean useCert)
Creates a DefaultPooledPDContextBuilder.

Parameters:
userid - id of the user to be authenticated as.
password - password of the user to be authenticated as.
domain - the domain to which the user will be authenticated.
configURL - a URL reference to configuration data.
useCert - if useCert is false, info related to the certificate will not be included.
Method Detail

build

public PDContext build()
                throws PDException
Description copied from interface: PooledContextBuilder
Create a new shared context. This method will be called by the ContextPool to create a new PDContext to be shared in the pool.

Specified by:
build in interface PooledContextBuilder<PDContext>
Returns:
a PDContext to be managed by the pool.
Throws:
PDException - when an error has occurred.

onCheckoutContext

public PDContext onCheckoutContext(ContextPool<PDContext> pool,
                                   PDContext context)
                            throws PDException
Prepares a PDContext before returning it to the client.

We perform the following in this implementation

  1. Resets the PDContext state. This is so that we don't want the previous client's state to be propagated to the next client
  2. Wraps the real PDContext with a PDContextProxy and returns the proxy to the client. The link from the proxy to the real PDContext is severed when the client calls the proxy's PDContext.close() method. This is so that we can isolate the real PDContext from the client code and ensure a PDContext is accessible by only one client at any one time.

Specified by:
onCheckoutContext in interface PooledContextBuilder<PDContext>
context - the shared context checked out.
Returns:
a context to the ContextPool.getContext() caller.
Throws:
PDException - when an error has occurred.