Esempio n. 1
0
  @SuppressWarnings("deprecation")
  public void run() {
    System.out.println("Inside NewStack.DynamicIP: Starting DynamicIP");
    while (true) {
      try {
        Thread.sleep(1000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      flag = true;
      startCheck = true;
      String localIP = detectPPP();
      if (!localIP.equals(controlIP)) {
        controlIP = localIP;
        String custodian = "";
        String[] splitInfo = controlIP.split(",");
        if (!splitInfo[0].equals("127.0.0.1")) {
          if (splitInfo[1].equals("y")) custodian = AppConfig.getProperty("User.Custodian.IP");
          else custodian = AppConfig.getProperty("User.Custodian.IP");

          try {
            Registry registry = LocateRegistry.getRegistry(custodian);

            // Changes by arvind
            if (oldIPAddressGPRS == null || (!oldIPAddressGPRS.equals(splitInfo[0]))) {
              ICustodian stub =
                  (ICustodian) registry.lookup(AppConfig.getProperty("User.Custodian.Service"));
              stub.infoIP(userId, splitInfo[0]);
              oldIPAddressGPRS = splitInfo[0];
            }

          } catch (Exception e) {
            e.printStackTrace();
            System.out.println(
                "Inside NewStack.DynamicIP: Error in locating service for Custodian");
            controlIP = "";
          }
        }
      }

      Status st = Status.getStatus();
      if (!st.executeQuery("select * from status")) {
        flag = false;
        System.out.println("Inside NewStack.DynamicIP: Nothing in Status file");
        suspend();
      }
    }
  }
Esempio n. 2
0
  public void run() {
    System.out.println("Inside prototype.cache.FileRegister: Level main");
    while (execute) {
      try {

        String newFile = files.take();
        Registry registry =
            LocateRegistry.getRegistry(AppConfig.getProperty("CacheServer.RootServer.IP"));
        IRootServer stub =
            (IRootServer) registry.lookup(AppConfig.getProperty("CacheServer.RootServer.Service"));
        String location =
            AppConfig.getProperty("CacheServer.Id")
                + ":"
                + AppConfig.getProperty("CacheServer.Port")
                + ":"
                + AppConfig.getProperty("CacheServer.Id");
        stub.register(newFile, location); // should be config driven

      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Esempio n. 3
0
 private DynamicIP() {
   userId = AppConfig.getProperty("User.Id");
 }