]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/xvsm/cook/Cook.java
Space cook listens for pizza requests
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / xvsm / cook / Cook.java
1 package at.ac.tuwien.sbc.valesriegler.xvsm.cook;
2
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5
6 import at.ac.tuwien.sbc.valesriegler.xvsm.AbstractXVSMConnector;
7 import at.ac.tuwien.sbc.valesriegler.xvsm.CookXVSM;
8 import at.ac.tuwien.sbc.valesriegler.xvsm.XVSMConnector;
9
10 public class Cook {
11         private static final String USAGE = "Cook needs exactly one parameter: ID of type Integer";
12         private static final Logger log = LoggerFactory.getLogger(Cook.class);
13         
14         private int id;
15         private CookXVSM xvsm;
16
17         public static void main(String[] args) {
18                 if(args.length != 1) {
19                         throw new IllegalArgumentException(USAGE);
20                 }
21                 
22                 int parsedId = 0;
23                 try {
24                         parsedId = Integer.parseInt(args[0]);
25                 } catch (NumberFormatException e) {
26                         log.error(USAGE);
27                         return;
28                 }
29                 
30                 Cook cook = new Cook(parsedId);
31                 cook.start();
32         }
33
34         private void start() {
35                 xvsm = new CookXVSM(id);
36                 
37                 xvsm.listenForPizzas();
38                 
39                 
40         }
41
42         public Cook(int id) {
43                 this.id = id;
44                 log.info("I AM A Cook WITH ID {}", id);
45         }
46
47 }