KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > triactive > jdo > store > SetStore


1 /*
2  * Copyright 2004 (C) TJDO.
3  * All rights reserved.
4  *
5  * This software is distributed under the terms of the TJDO License version 1.0.
6  * See the terms of the TJDO License in the documentation provided with this software.
7  *
8  * $Id: SetStore.java,v 1.4 2004/01/18 03:01:06 jackknifebarber Exp $
9  */

10
11 package com.triactive.jdo.store;
12
13 import com.triactive.jdo.StateManager;
14 import java.util.Collection JavaDoc;
15 import java.util.Iterator JavaDoc;
16
17
18 /**
19  * Implements the backing store for a Set field.
20  * <p>
21  * Different implementations of SetStore employ different techniques for
22  * modeling the Java concept of a Set in a relational data store.
23  * Individual instances of SetStore are responsible for managing the storage
24  * for some Java class's Collection or Set field across all instances of that
25  * class.
26  *
27  * @author <a HREF="mailto:mmartin5@austin.rr.com">Mike Martin</a>
28  * @version $Revision: 1.4 $
29  */

30
31 public interface SetStore
32 {
33     StoreManager getStoreManager();
34
35     Class JavaDoc getElementType();
36
37     boolean allowsNulls();
38
39     Collection JavaDoc load(StateManager sm);
40
41     int size(StateManager sm);
42
43     boolean isEmpty(StateManager sm);
44
45     boolean contains(StateManager sm, Object JavaDoc element);
46
47     boolean add(StateManager sm, Object JavaDoc element);
48
49     boolean addAll(StateManager sm, Collection JavaDoc elements);
50
51     boolean remove(StateManager sm, Object JavaDoc element);
52
53     void clear(StateManager sm);
54
55     QueryStatement newQueryStatement(StateManager sm, Class JavaDoc candidateClass);
56
57     Query.ResultObjectFactory newResultObjectFactory(StateManager sm, QueryStatement stmt);
58
59     /**
60      * Create a subquery for the given query that joins a <code>SetStore</code>s
61      * element table to the owner table. This subquery can subsequently be used
62      * in an EXISTS expression to determine whether a Set is empty or not.
63      *
64      * @param ownerIDColumn The QueryColumn of the owner ID.
65      * @param setRangeVar The range variable for the "Set" table.
66      *
67      * @return A subquery for the given query that joins a <code>SetStore</code>s
68      * element table to the owner table.
69      */

70     QueryStatement getExistsSubquery(QueryStatement.QueryColumn ownerIDColumn,
71                                      SQLIdentifier setRangeVar);
72
73     QueryStatement.QueryColumn
74         joinElementsTo(QueryStatement stmt,
75                        QueryStatement.QueryColumn ownerIDColumn,
76                        SQLIdentifier setRangeVar,
77                        Class JavaDoc filteredElementType,
78                        SQLIdentifier elementRangeVar);
79 }
80
Popular Tags