KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > explorer > CosTrading > Queries


1 /*===========================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA - USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Sylvain Leblanc.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.openccm.explorer.CosTrading;
28
29 /** Java Imports. */
30 import java.util.List JavaDoc;
31 import java.util.LinkedList JavaDoc;
32
33 /** OMG CosTrading imports. */
34 import org.omg.CosTrading.Lookup;
35
36 /**
37  * Wrapper class used to provide a node in the administration console
38  * tree which children are <code>Query</code> instances. This class
39  * also provided class-methods to manage created queries.
40  *
41  * @author <a HREF="mailto:Sylvain.Leblanc@lifl.fr">Sylvain Leblanc</a>
42  * @version 0.1
43  */

44 public class Queries {
45
46     // ==================================================================
47
//
48
// Internal state.
49
//
50
// ==================================================================
51

52     /**
53      * A list of created queries.
54      */

55     protected static List JavaDoc queries;
56
57     /**
58      * The CosTrading Lookup interface used to create new queries.
59      */

60     protected Lookup lookup_;
61
62     // ==================================================================
63
//
64
// Constructors.
65
//
66
// ==================================================================
67

68     public Queries(Lookup lookup)
69     {
70         lookup_ = lookup;
71         if (Queries.queries == null) Queries.queries = new LinkedList JavaDoc();
72     }
73
74     // ==================================================================
75
//
76
// Internal methods.
77
//
78
// ==================================================================
79

80     // ==================================================================
81
//
82
// Public methods.
83
//
84
// ==================================================================
85

86     /**
87      * Returns the lookup reference to use in order to create new
88      * queries.
89      *
90      * @return The lookup reference to use in order to create new
91      * queries.
92      */

93     public Lookup
94     getLookup()
95     {
96         return lookup_;
97     }
98
99     /**
100      * Returns all queries created and added to the queries list.
101      *
102      * @return All queries created and added to the queries list.
103      */

104     public Query[]
105     getQueries()
106     {
107         return (Query[])Queries.queries.toArray(new Query[0]);
108     }
109
110     /**
111      * Adds a new query in the queries list.
112      *
113      * @param q The query to add the queries list.
114      */

115     public void
116     addQuery(Query q)
117     {
118         Queries.queries.add(q);
119     }
120
121     /**
122      * Removes a query from the queries list.
123      *
124      * @param q The query to remove from the list.
125      */

126     public void
127     removeQuery(Query q)
128     {
129         boolean rmvd = Queries.queries.remove(q);
130     }
131
132     /**
133      * Returns the size of the queries list.
134      *
135      * @return The size of the queries list.
136      */

137     public int
138     getSize()
139     {
140         return Queries.queries.size();
141     }
142
143     /**
144      * Cleans the queries list.
145      */

146     public void
147     clean()
148     {
149         Queries.queries.clear();
150     }
151
152 }
153
Popular Tags