org.objectweb.jonas.resource.pool.api
Interface PoolMatchFactory

All Known Implementing Classes:
ConnectionManagerImpl

public interface PoolMatchFactory

The interface PoolMatchFactory defines the object used by a Pool to test if a given resource of a Pool matches with the hints passed with the Pool getResource method. It also allows such a Pool to allocate a Object as needed, conforming to the passed hints.


Method Summary
 java.lang.Object createResource(java.lang.Object hints)
          createResource creates a new Object.
 boolean matchResource(java.lang.Object pr, java.lang.Object hints)
          matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.
 java.lang.Object matchResource(java.util.Set res, java.lang.Object hints)
          matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.
 void releaseResource(java.lang.Object pr)
          releaseResource make sure that any cleanup needed for this entry is done
 void validateResource(java.util.Set res)
          validateResource tests if a given resource of a Pool is invalid
 

Method Detail

createResource

java.lang.Object createResource(java.lang.Object hints)
                                throws java.lang.Exception
createResource creates a new Object.

Parameters:
hints - The "properties" that the created Object should conform to.
Returns:
The created Object.
Throws:
java.lang.Exception - if an error occurs

matchResource

boolean matchResource(java.lang.Object pr,
                      java.lang.Object hints)
matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.

Parameters:
pr - The Object to test its matching with some "properties" specified by hints.
hints - The "properties" that the Object specified by pr should match.
Returns:
true if the pr Object matches the hints "properties".

matchResource

java.lang.Object matchResource(java.util.Set res,
                               java.lang.Object hints)
                               throws java.lang.Exception
matchResource tests if a given resource of a Pool matches with the hints passed with the Pool getResource method.

Parameters:
res - A set of Objects to test if matching with some "properties" specified by hints.
hints - The "properties" that the Object specified by pr should match.
Returns:
Object that matches the hints "properties". or null if no match.
Throws:
java.lang.Exception - Description of Exception

releaseResource

void releaseResource(java.lang.Object pr)
                     throws java.lang.Exception
releaseResource make sure that any cleanup needed for this entry is done

Parameters:
pr - The Object to release
Throws:
java.lang.Exception - Description of Exception

validateResource

void validateResource(java.util.Set res)
                      throws java.lang.Exception
validateResource tests if a given resource of a Pool is invalid

Parameters:
res - A set of Objects to test if matching with some "properties" specified by hints.
Throws:
java.lang.Exception - Description of Exception