]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/spacehelpers/SpaceListenerImpl.java
GUI fix for Tables OutOfBoundsException
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / xvsm / spacehelpers / SpaceListenerImpl.java
1 package at.ac.tuwien.sbc.valesriegler.xvsm.spacehelpers;
2
3 import org.mozartspaces.capi3.FifoCoordinator;
4 import org.mozartspaces.core.Capi;
5 import org.mozartspaces.core.ContainerReference;
6 import org.mozartspaces.core.MzsConstants;
7 import org.mozartspaces.core.MzsConstants.RequestTimeout;
8 import org.mozartspaces.notifications.NotificationManager;
9
10 import java.io.Serializable;
11 import java.util.List;
12
13 /**
14  * 
15  * @author Gregor Riegler <gregor DOT riegler AT gmail DOT com>
16  *
17  * @see SpaceListener
18  */
19 public class SpaceListenerImpl extends SpaceListener {
20
21     public final NotificationManager notificationManager;
22     private Capi capi;
23         private ContainerReference cref;
24     private final boolean countAll;
25
26
27     public SpaceListenerImpl(Capi capi, ContainerReference cref, int timeout, SpaceAction spaceAction, NotificationManager notificationManager, boolean lookaround, boolean countAll, String name) {
28         this.capi = capi;
29         this.cref = cref;
30         this.timeout = timeout;
31         this.spaceAction = spaceAction;
32         this.notificationManager = notificationManager;
33         this.lookAround = lookaround;
34         this.countAll = countAll;
35         this.name = name;
36     }
37
38     @Override
39         List<? extends Serializable> getEntries() throws Exception {
40         final int count = countAll ? MzsConstants.Selecting.COUNT_ALL : MzsConstants.Selecting.COUNT_MAX;
41         return capi.read(cref, FifoCoordinator
42                                 .newSelector(count),
43                                 RequestTimeout.DEFAULT, null);
44         }
45 }