Repository navigation
Expand file tree
/
Copy pathHWatch.java
More file actions
78 lines (67 loc) · 1.93 KB
/
Copy pathHWatch.java
File metadata and controls
78 lines (67 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
// Copyright (c) 2012, Brian Frank
// Licensed under the Academic Free License version 3.0
//
// History:
// 28 Sep 2012 Brian Frank
//
package org.projecthaystack;
/**
* HWatch models a subscription to a list of entity records.
* Use HProj.watchOpen to create a new watch.
*
* @see <a href='http://project-haystack.org/doc/Rest#watches'>Project Haystack</a>
*/
public abstract class HWatch
{
/**
* Unique watch identifier within a project database.
* The id may not be assigned until after the first call
* to "sub", in which case return null.
*/
public abstract String id();
/**
* Debug display string used during "HProj.watchOpen"
*/
public abstract String dis();
/**
* Lease period or null if watch has not been opened yet.
*/
public abstract HNum lease();
/**
* Convenience for "sub(ids, true)"
*/
public final HGrid sub(HRef[] ids){ return sub(ids, true); }
/**
* Add a list of records to the subscription list and return their
* current representation. If checked is true and any one of the
* ids cannot be resolved then raise UnknownRecException for first id
* not resolved. If checked is false, then each id not found has a
* row where every cell is null.
* <p>
* The HGrid that is returned must contain metadata entries
* for 'watchId' and 'lease'.
*/
public abstract HGrid sub(HRef[] ids, boolean checked);
/**
* Remove a list of records from watch. Silently ignore
* any invalid ids.
*/
public abstract void unsub(HRef[] ids);
/**
* Poll for any changes to the subscribed records.
*/
public abstract HGrid pollChanges();
/**
* Poll all the subscribed records even if there have been no changes.
*/
public abstract HGrid pollRefresh();
/**
* Close the watch and free up any state resources.
*/
public abstract void close();
/**
* Return whether this watch is currently open.
*/
public abstract boolean isOpen();
}