55 */
66package org .phoebus .channelfinder ;
77
8+ import org .phoebus .channelfinder .Channel .Builder ;
9+
10+ import javax .ws .rs .core .MultivaluedMap ;
811import java .util .Collection ;
912import java .util .Map ;
1013
1417 *
1518 * @author shroffk
1619 */
17- public interface ChannelFinderClient {
20+ public interface ChannelFinderClient extends AutoCloseable {
1821
1922 /**
2023 * Get a list of all the properties currently present on the
@@ -24,6 +27,16 @@ public interface ChannelFinderClient {
2427 */
2528 Collection <Property > getAllProperties ();
2629
30+ /**
31+ * Get a list of names of all the properties currently present on the
32+ * channelfinder service.
33+ *
34+ * @return list of names of all existing {@link Property}s.
35+ */
36+ Collection <String > getAllPropertyNames ();
37+
38+ Collection <Channel > getAllChannels ();
39+
2740 /**
2841 * GEt a list of all the tags
2942 *
@@ -39,6 +52,204 @@ public interface ChannelFinderClient {
3952 */
4053 Collection <String > getAllTagNames ();
4154
55+ /**
56+ * Returns a channel that exactly matches the channelName
57+ * <code>channelName</code>.
58+ *
59+ * @param channelName - name of the required channel.
60+ * @return {@link Channel} with name <code>channelName</code> or null
61+ * @throws ChannelFinderException - channelfinder exception
62+ */
63+ Channel getChannel (String channelName ) throws ChannelFinderException ;
64+
65+ /**
66+ * Destructively set a single channel <code>channel</code>, if the channel
67+ * already exists it will be replaced with the given channel.
68+ *
69+ * @param channel the channel to be added
70+ * @throws ChannelFinderException - channelfinder exception
71+ */
72+ void set (Channel .Builder channel ) throws ChannelFinderException ;
73+
74+
75+ /**
76+ * Destructively set a Tag <code>tag</code> with no associated channels to the
77+ * database.
78+ *
79+ * @param tag - the tag to be set.
80+ */
81+ void set (Tag .Builder tag );
82+
83+ /**
84+ * Destructively set tag <code>tag</code> to channel <code>channelName</code> and
85+ * remove the tag from all other channels.
86+ *
87+ * @param tag - the tag to be set.
88+ * @param channelName - the channel to which the tag should be set on.
89+ * @throws ChannelFinderException - channelfinder exception
90+ */
91+ void set (Tag .Builder tag , String channelName )
92+ throws ChannelFinderException ;
93+
94+ /**
95+ * Set tag <code>tag</code> on the set of channels {channels} and remove it from
96+ * all others.
97+ *
98+ * @param tag - the tag to be set.
99+ * @param channelNames - the list of channels to which this tag will be added and
100+ * removed from all others.
101+ * @throws ChannelFinderException - channelfinder exception
102+ */
103+ void set (Tag .Builder tag , Collection <String > channelNames )
104+ throws ChannelFinderException ;
105+
106+ /**
107+ * Destructively set a new property <code>property</code>.
108+ *
109+ * @param prop - the property to be set.
110+ */
111+ void set (Property .Builder prop ) throws ChannelFinderException ;
112+
113+ /**
114+ * Destructively set property <code>prop</code> and add it to the channel
115+ * <code>channelName</code> and remove it from all others.
116+ *
117+ * @param prop - property to be set.
118+ * @param channelName - the channel to which this property must be added.
119+ */
120+ void set (Property .Builder prop , String channelName );
121+
122+ /**
123+ * Destructively set property <code>prop</code> and add it to the channels
124+ * <code>channelNames</code> removing it from all other channels. By default all
125+ * channels will contain the property with the same value specified in the
126+ * <code>prop</code>.<br>
127+ * to individually set the value for each channel use channelPropertyMap.
128+ *
129+ * @param prop - the property to be set.
130+ * @param channelNames - the channels to which this property should be added and
131+ * removed from all others.
132+ */
133+ void set (Property .Builder prop , Collection <String > channelNames );
134+
135+ /**
136+ * Destructively set the property <code>prop</code> and add it to the channels
137+ * specified in the <code>channelPropertyMap</code>, where the map key is the
138+ * channel name and the associated value is the property value to be used
139+ * for that channel.
140+ *
141+ * @param prop - the property to be set.
142+ * @param channelPropertyMap - map with channel names and property values
143+ */
144+ void set (Property .Builder prop , Map <String , String > channelPropertyMap );
145+
146+ /**
147+ * Update existing channel with <code>channel</code>.
148+ *
149+ * @param channel - channel builder
150+ * @throws ChannelFinderException - channelfinder exception
151+ */
152+ void update (Channel .Builder channel ) throws ChannelFinderException ;
153+
154+ /**
155+ * Update Tag <code>tag </code> by adding it to Channel with name
156+ * <code>channelName</code>, without affecting the other instances of this tag.
157+ *
158+ * @param tag the tag to be added
159+ * @param channelName Name of the channel to which the tag is to be added
160+ * @throws ChannelFinderException - channelfinder exception
161+ */
162+ void update (Tag .Builder tag , String channelName )
163+ throws ChannelFinderException ;
164+
165+ /**
166+ * Update the Tag <code>tag</code> by adding it to the set of the channels with
167+ * names <code>channelNames</code>, without affecting the other instances of
168+ * this tag.
169+ *
170+ * @param tag - the tag that needs to be updated.
171+ * @param channelNames - list of channels to which this tag should be added.
172+ * @throws ChannelFinderException - channelfinder exception
173+ */
174+ void update (Tag .Builder tag , Collection <String > channelNames )
175+ throws ChannelFinderException ;
176+
177+ /**
178+ * Update Property <code>property</code> by adding it to the channel
179+ * <code>channelName</code>, without affecting the other channels.
180+ *
181+ * @param property - the property to be updated
182+ * @param channelName - the channel to which this property should be added or
183+ * updated.
184+ * @throws ChannelFinderException - channelfinder exception
185+ */
186+ void update (Property .Builder property , String channelName )
187+ throws ChannelFinderException ;
188+
189+
190+ /**
191+ * Update the channels identified with <code>channelNames</code> with the
192+ * property <code>property</code>
193+ *
194+ * @param property - property builder
195+ * @param channelNames - list of channel names
196+ * @throws ChannelFinderException - channelfinder exception
197+ */
198+ void update (Property .Builder property ,
199+ Collection <String > channelNames ) throws ChannelFinderException ;
200+
201+ /**
202+ * Update the property <code>property</code> on all channels specified in the
203+ * channelPropValueMap, where the key in the map is the channel name and the
204+ * value is the value for that property
205+ *
206+ * @param property - property builder
207+ * @param channelPropValueMap - property value map
208+ * @throws ChannelFinderException - channelfinder exception
209+ */
210+ void update (Property .Builder property , Map <String , String > channelPropValueMap )
211+ throws ChannelFinderException ;
212+
213+ /**
214+ * Search for channels who's name match the pattern <code>pattern</code>.<br>
215+ * The pattern can contain wildcard char * or ?.<br>
216+ *
217+ * @param pattern - the search pattern for the channel names
218+ * @return A Collection of channels who's name match the pattern
219+ * <code>pattern</code>
220+ * @throws ChannelFinderException - channelfinder exception
221+ */
222+ Collection <Channel > findByName (String pattern )
223+ throws ChannelFinderException ;
224+
225+ /**
226+ * Search for channels with tags who's name match the pattern
227+ * <code>pattern</code>.<br>
228+ * The pattern can contain wildcard char * or ?.<br>
229+ *
230+ * @param pattern - the search pattern for the tag names
231+ * @return A Collection of channels which contain tags who's name match the
232+ * pattern <code>pattern</code>
233+ * @throws ChannelFinderException - channelfinder exception
234+ */
235+ Collection <Channel > findByTag (String pattern )
236+ throws ChannelFinderException ;
237+
238+ /**
239+ * Search for channels with properties who's Value match the pattern
240+ * <code>pattern</code>.<br>
241+ * The pattern can contain wildcard char * or ?.<br>
242+ *
243+ * @param property - the name of the property.
244+ * @param pattern - the seatch pattern for the property value.
245+ * @return A collection of channels containing the property with name
246+ * <code>propertyName</code> who's value matches the pattern
247+ * <code> pattern</code>.
248+ * @throws ChannelFinderException - channelfinder exception
249+ */
250+ Collection <Channel > findByProperty (String property ,
251+ String ... pattern ) throws ChannelFinderException ;
252+
42253 /**
43254 * Space seperated search criterias, patterns may include * and ? wildcards
44255 * channelNamePattern propertyName=valuePattern1,valuePattern2
@@ -76,6 +287,62 @@ public interface ChannelFinderClient {
76287 Collection <Channel > find (Map <String , String > map )
77288 throws ChannelFinderException ;
78289
290+ /**
291+ * uery for channels based on the multiple criteria specified in the map.
292+ * Map.put("~name", "*")<br>
293+ * Map.put("~tag", "tag1")<br>
294+ * Map.put("Cell", "1")<br>
295+ * Map.put("Cell", "2")<br>
296+ * Map.put("Cell", "3")<br>
297+ * <p>
298+ * this will return all channels with name=any name AND tag=tag1 AND
299+ * property Cell = 1 OR 2 OR 3.
300+ *
301+ * @param map - multivalued map of all search criteria
302+ * @return Collection of channels which satisfy the search map.
303+ * @throws ChannelFinderException - channelfinder exception
304+ */
305+ Collection <Channel > find (MultivaluedMap <String , String > map )
306+ throws ChannelFinderException ;
307+
308+ /**
309+ * Completely Delete {tag} with name = tagName from all channels and the
310+ * channelfinder service.
311+ *
312+ * @param tagName - name of tag to be deleted.
313+ * @throws ChannelFinderException - channelfinder exception
314+ */
315+ void deleteTag (String tagName ) throws ChannelFinderException ;
316+
317+ /**
318+ * Completely Delete property with name = propertyName from all channels and
319+ * the channelfinder service.
320+ *
321+ * @param propertyName - name of property to be deleted.
322+ * @throws ChannelFinderException - channelfinder exception
323+ */
324+ void deleteProperty (String propertyName )
325+ throws ChannelFinderException ;
326+
327+ /**
328+ * Delete the channel identified by <code>channel</code>
329+ *
330+ * @param channelName channel to be removed
331+ * @throws ChannelFinderException - channelfinder exception
332+ */
333+ void deleteChannel (String channelName ) throws ChannelFinderException ;
334+
335+
336+ /**
337+ * Delete the set of channels identified by <code>channels</code>
338+ *
339+ * @param channels - list of channel builders
340+ * @throws ChannelFinderException - channelfinder exception
341+ */
342+ @ Deprecated
343+ void delete (Collection <Channel .Builder > channels )
344+ throws ChannelFinderException ;
345+
79346 /**
80347 * Delete tag <code>tag</code> from the channel with the name
81348 * <code>channelName</code>
@@ -119,33 +386,12 @@ void delete(Property.Builder property, String channelName)
119386 * @throws ChannelFinderException - channelfinder exception
120387 */
121388 void delete (Property .Builder property ,
122- Collection <String > channelNames ) throws ChannelFinderException ;
123-
124-
125- /**
126- *
127- * Update the Tag <code>tag</code> by adding it to the set of the channels with
128- * names <code>channelNames</code>, without affecting the other instances of
129- * this tag.
130- *
131- * @param tag
132- * - the tag that needs to be updated.
133- * @param channelNames
134- * - list of channels to which this tag should be added.
135- * @throws ChannelFinderException - channelfinder exception
136- */
137- void update (Tag .Builder tag , Collection <String > channelNames )
138- throws ChannelFinderException ;
389+ Collection <String > channelNames ) throws ChannelFinderException ;
139390
140391 /**
141- * Update the channels identified with <code>channelNames</code> with the
142- * property <code>property</code>
143- *
144- * @param property - property builder
145- * @param channelNames - list of channel names
146- * @throws ChannelFinderException - channelfinder exception
392+ * close
147393 */
148- void update (Property .Builder property ,
149- Collection <String > channelNames ) throws ChannelFinderException ;
394+ void close ();
150395
396+ void set (Collection <Builder > channels );
151397}
0 commit comments