1 package iotcode.GreenLawn;
3 import java.io.IOException;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import iotrmi.Java.IoTRMICall;
8 import iotrmi.Java.IoTRMIObject;
10 import iotcode.interfaces.*;
12 public class Lawn_Skeleton implements Lawn {
15 private IoTRMIObject rmiObj;
17 private String callbackAddress;
18 private final static int object0Id = 0; //LawnSmart
19 private static Integer[] object0Permission = { };
20 private static List<Integer> set0Allowed;
23 public Lawn_Skeleton(Lawn _mainObj, String _callbackAddress, int _port) throws Exception {
25 callbackAddress = _callbackAddress;
26 rmiObj = new IoTRMIObject(_port);
27 set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
28 ___waitRequestInvokeMethod();
31 private void ___waitRequestInvokeMethod() throws IOException {
33 rmiObj.getMethodBytes();
34 int _objectId = rmiObj.getObjectId();
35 int methodId = rmiObj.getMethodId();
36 if (_objectId == object0Id) {
37 if (!set0Allowed.contains(methodId)) {
38 throw new Error("Object with object Id: " + _objectId + " is not allowed to access method: " + methodId);
42 throw new Error("Object Id: " + _objectId + " not recognized!");
46 throw new Error("Method Id " + methodId + " not recognized!");