]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/spacehelpers/SpaceListenerImpl.java
[XVSM] SpaceListener refactoring
[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 java.io.Serializable;
4 import java.util.List;
5
6 import org.mozartspaces.capi3.FifoCoordinator;
7 import org.mozartspaces.core.Capi;
8 import org.mozartspaces.core.ContainerReference;
9 import org.mozartspaces.core.MzsConstants;
10 import org.mozartspaces.core.MzsConstants.RequestTimeout;
11 import org.mozartspaces.notifications.NotificationManager;
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
25
26     public SpaceListenerImpl(Capi capi, ContainerReference cref, int timeout, SpaceAction spaceAction, NotificationManager notificationManager, boolean lookaround) {
27         this.capi = capi;
28         this.cref = cref;
29         this.timeout = timeout;
30         this.spaceAction = spaceAction;
31         this.notificationManager = notificationManager;
32         this.lookAround = lookaround;
33     }
34
35     @Override
36         List<? extends Serializable> getEntries() throws Exception {
37                 return capi.read(cref, FifoCoordinator
38                                 .newSelector(MzsConstants.Selecting.COUNT_MAX),
39                                 RequestTimeout.DEFAULT, null);
40         }
41 }