Enterprise Information Portal APIs

com.ibm.gcs.db.component
Class DB2Pool

java.lang.Object
  |
  +--com.ibm.gcs.db.component.DB2Pool
Direct Known Subclasses:
DB2HiddenPool, DB2Queue, DB2VisitedPool

public abstract class DB2Pool
extends java.lang.Object

DB2Pool is a view or abstract represention of a set of URLs in the url database table. These URL records satisfy a SQL query defined by extending classes

      SELECT * 
      FROM urlpoolstable
      WHERE <defined by extending classes>
 

When a URLContainer is added to a DB2Pool, the concrete class sets the fields in the URLContainer object to reflect the properties of the class. For example, DB2Queue sets hide=0 and state_id=1 for a DB2URLContainer. Hence, when the container is explicitly saved, it will be saved as a member of the corresponding DB2Pool.

The DB2Pool classes may be used by DB2Collection classes to get and put DB2URLContainers into the database.


Field Summary
static boolean debug
           
 
Constructor Summary
DB2Pool()
          Default Constructor.
 
Method Summary
abstract  boolean contains(DB2URLContainer urlC, Transaction t)
          Checks to see if the specified URL is in the pool.
abstract  java.lang.String getSQLCount()
          Return a SQL SELECT COUNT(*) statement.
abstract  java.lang.String getSQLSelect()
          Return the SQL SELECT statement.
 java.util.Enumeration getURLContainers(int max, Transaction t)
          Returns an enumeration of the next urls from this pool as DB2URLContainers.
abstract  void insert(DB2URLContainer urlC)
          Updates the state information of the java URL object to reflect a URL in this pool but does not save this information in the database.
 int num(Transaction t)
          Returns the number of URLs in this pool.
 java.lang.String toString(Transaction t)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Constructor Detail

DB2Pool

public DB2Pool()
Default Constructor.
Method Detail

getURLContainers

public java.util.Enumeration getURLContainers(int max,
                                              Transaction t)
                                       throws TransactionException

Returns an enumeration of the next urls from this pool as DB2URLContainers.

This method calls getSelectSQL() to get the SQL SELECT statement from extending classes. It constructs the URLContainer using the URLContainerFactory and sets the fields with values in the database record.

Parameters:
max - The maximum number of URLs to return.
t - The transaction object for DB2 access.
Returns:
Enumeration of DB2URLContainers.
Throws:
TransactionException - on failed SQL execution.

num

public int num(Transaction t)
        throws TransactionException
Returns the number of URLs in this pool.

This method calls getSQLCount to get the SELECT COUNT statement from extending classes.

Parameters:
t - The transaction object for DB2 access.
Returns:
int The number of URLs in this pool.
Throws:
TransactionException - on failed SQL execution.

contains

public abstract boolean contains(DB2URLContainer urlC,
                                 Transaction t)
                          throws TransactionException
Checks to see if the specified URL is in the pool.

Extending classes check the urlC for a match and load the database record, if it has not already been loaded.

Parameters:
urlC - The DB2URLContainer to check.
t - The transaction object for DB2 access.
Returns:
true if the URL container is in the pool, false otherwise.
Throws:
TransactionException - on failed SQL execution.

insert

public abstract void insert(DB2URLContainer urlC)
Updates the state information of the java URL object to reflect a URL in this pool but does not save this information in the database. (The URL object must be saved explicitly.)
Parameters:
urlC - The DB2URLContainer to check.

getSQLSelect

public abstract java.lang.String getSQLSelect()
Return the SQL SELECT statement. Extending classes return a statement of the form:
      SELECT * 
      FROM urlpoolstable
      WHERE <defined by extending class>
 
Returns:
the SQL select statement

getSQLCount

public abstract java.lang.String getSQLCount()
Return a SQL SELECT COUNT(*) statement. Extending classes return a statement of the form:
      SELECT COUNT(*) 
      FROM urlpoolstable
      WHERE <defined by extending class>
 

toString

public java.lang.String toString(Transaction t)
                          throws TransactionException

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.