KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dspace > checker > BitstreamDispatcher


1 /*
2  * Copyright (c) 2004-2005, Hewlett-Packard Company and Massachusetts
3  * Institute of Technology. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * - Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * - Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * - Neither the name of the Hewlett-Packard Company nor the name of the
17  * Massachusetts Institute of Technology nor the names of their
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
30  * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
31  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32  * DAMAGE.
33  */

34 package org.dspace.checker;
35
36
37 /**
38  * <p>
39  * BitstreamDispatchers are strategy objects that hand bitstream ids out to
40  * workers. Implementations must be threadsafe.
41  * </p>
42  *
43  * <p>
44  * The rationale behind the use of the Sentinel pattern (rather than the more
45  * traditional iterator pattern or a cursor c.f. java.sql.ResultSet): -
46  * </p>
47  * <ol>
48  * <li>To make it easy to make implementations thread safe - multithreaded
49  * invocation of the dispatchers is seen as a next step use case. In simple
50  * terms, this requires that a single method does all the work.</li>
51  * <li>Shouldn't an exception as the sentinel, as reaching the end of a loop is
52  * not an exceptional condition.</li>
53  * </ol>
54  *
55  *
56  * @author Jim Downing
57  * @author Grace Carpenter
58  * @author Nathan Sarr
59  *
60  */

61 public interface BitstreamDispatcher
62 {
63     /**
64      * This value should be returned by <code>next()</code> to indicate that
65      * there are no more values.
66      */

67     public static int SENTINEL = -1;
68
69     /**
70      * Returns the next id for checking, or a sentinel value if there are no
71      * more to check.
72      *
73      * @return the next bitstream id, or BitstreamDispatcher.SENTINEL if there
74      * isn't another value
75      *
76      */

77     public int next();
78 }
79
Popular Tags