KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > hajdbc > Balancer


1 /*
2  * HA-JDBC: High-Availability JDBC
3  * Copyright (c) 2004-2006 Paul Ferraro
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact: ferraro@users.sourceforge.net
20  */

21 package net.sf.hajdbc;
22
23 import java.util.List JavaDoc;
24
25 /**
26  * @author Paul Ferraro
27  * @since 1.0
28  */

29 public interface Balancer
30 {
31     /**
32      * Removes the specified database from this balancer.
33      * @param database a database descriptor
34      * @return true, if the database was removed successfully, false if it did not exist.
35      */

36     public boolean remove(Database database);
37
38     /**
39      * Adds the specified database to this balancer.
40      * @param database a database descriptor
41      * @return true, if the database was added successfully, false if already existed.
42      */

43     public boolean add(Database database);
44
45     /**
46      * Returns the first database from this balancer
47      * @return the first database from this balancer
48      */

49     public Database first();
50
51     /**
52      * Returns the next database from this balancer
53      * @return the next database from this balancer
54      */

55     public Database next();
56
57     /**
58      * Returns an unmodifiable collection of databases known to this balancer
59      * @return a collection of database descriptors
60      */

61     public List JavaDoc<Database> list();
62
63     /**
64      * Check whether the specified database is known to this balancer
65      * @param database a database descriptor
66      * @return true, if the database is known to this balancer, false otherwise
67      */

68     public boolean contains(Database database);
69     
70     /**
71      * Called before an operation is performed on the specified database retrieved via {@link #next()}.
72      * @param database a database descriptor
73      */

74     public void beforeOperation(Database database);
75     
76     /**
77      * Called after an operation is performed on the specified database retrieved via {@link #next()}.
78      * @param database a database descriptor
79      */

80     public void afterOperation(Database database);
81 }
Popular Tags