com.wles.blm.pool
Class BLMContextFactory

java.lang.Object
  extended byorg.apache.commons.pool.BasePoolableObjectFactory
      extended bycom.wles.blm.pool.BLMContextFactory
All Implemented Interfaces:
PoolableObjectFactory

public class BLMContextFactory
extends BasePoolableObjectFactory

Implements PoolableObjectFactory for managing BLMContextManager instances. The validateObject(Object) method assures that the instances in the pool are periodically destroyed. The factory also allows to plug-in an additional BLMContextManager validator.

See Also:
GenericObjectPool, BLMContextFactory(String, String, String, BLMContextValidator, long)

Constructor Summary
BLMContextFactory(java.lang.String url, BLMAdminSubjectIdentityAssertionTokenType token)
           
BLMContextFactory(java.lang.String blmURL, BLMAdminSubjectIdentityAssertionTokenType token, BLMContextValidator validator, long maxContextLifeTime)
           
BLMContextFactory(java.lang.String url, java.lang.String username, java.lang.String password)
          Same as BLMContextFactory(url, username, password, null, 5).
BLMContextFactory(java.lang.String url, java.lang.String username, java.lang.String password, BLMContextValidator blmContextValidator, long maxContextLifeTime)
          Creates an instance of BLMContextFactory
 
Method Summary
 void destroyObject(java.lang.Object obj)
           
 java.lang.Object makeObject()
           
 boolean validateObject(java.lang.Object obj)
           
 
Methods inherited from class org.apache.commons.pool.BasePoolableObjectFactory
activateObject, passivateObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BLMContextFactory

public BLMContextFactory(java.lang.String url,
                         BLMAdminSubjectIdentityAssertionTokenType token)
Parameters:
url -
token -

BLMContextFactory

public BLMContextFactory(java.lang.String blmURL,
                         BLMAdminSubjectIdentityAssertionTokenType token,
                         BLMContextValidator validator,
                         long maxContextLifeTime)
Parameters:
blmURL -
token -
validator -
maxContextLifeTime - Context lifetime in seconds

BLMContextFactory

public BLMContextFactory(java.lang.String url,
                         java.lang.String username,
                         java.lang.String password)
Same as BLMContextFactory(url, username, password, null, 5). Creates a BLMContextFactory object with no additional validator and maximum duration of context lives equal to five minutes.

Parameters:
url - BLM server URL
username - BLM user's name
password - password that corresponds to username

BLMContextFactory

public BLMContextFactory(java.lang.String url,
                         java.lang.String username,
                         java.lang.String password,
                         BLMContextValidator blmContextValidator,
                         long maxContextLifeTime)
Creates an instance of BLMContextFactory

Parameters:
url - BLM server URL
username - BLM user's name
password - password that corresponds to username
blmContextValidator - optional BLMContextValidator that is called when an instance of BLMContextManager is validated. E.g., you can implement a BLMContextValidator based on calling some 'inexpensive' BLM method. The value can be null. In that case, no additional validation will take place.
maxContextLifeTime - maximum time in minutes the context should live before it is destroyed. Only the contexts in the pool are destroyed and not the ones that are borrowed. If value is 0, the object will never be destroyed.
See Also:
PoolableObjectFactory
Method Detail

destroyObject

public void destroyObject(java.lang.Object obj)
                   throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
PoolableObjectFactory.destroyObject(Object)

makeObject

public java.lang.Object makeObject()
                            throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
PoolableObjectFactory.makeObject()

validateObject

public boolean validateObject(java.lang.Object obj)
See Also:
PoolableObjectFactory.validateObject(Object)


Copyright © 2004-2008, Oracle and/or its affiliates. All rights reserved.