1 package at.ac.tuwien.sbc.valesriegler.xvsm.waiter;
3 import java.io.Serializable;
6 import org.mozartspaces.core.MzsCoreException;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
10 import at.ac.tuwien.sbc.valesriegler.DEP_Table;
11 import at.ac.tuwien.sbc.valesriegler.xvsm.XVSMConnector;
14 * This is a waiter using XVSM
16 * @author Gregor Riegler <gregor DOT riegler AT gmail DOT com>
19 public class Waiter implements Serializable {
20 private static final String USAGE = "Waiter needs exactly one parameter: ID of type Integer";
21 private static final Logger log = LoggerFactory.getLogger(Waiter.class);
24 private XVSMConnector xvsm;
26 public static void main(String[] args) {
27 if(args.length != 1) {
28 throw new IllegalArgumentException(USAGE);
33 parsedId = Integer.parseInt(args[0]);
34 } catch (NumberFormatException e) {
39 Waiter waiter = new Waiter(parsedId);
43 private void start() {
44 initSpaceCommunication();
47 xvsm.handleWaitingGroup(id);
49 xvsm.handleOrderRequest(id);
51 xvsm.handlePaymentRequest();
53 xvsm.handlePizzaDistribution();
58 private void initSpaceCommunication() {
59 xvsm = new XVSMConnector();
60 xvsm.initSpaceCommunication();
61 xvsm.useTablesContainer();
62 xvsm.useGroupsContainer();
64 log.info("Space Connection established!");
69 public Waiter(int id) {
71 log.info("I AM A WAITER WITH ID {}", id);