예제 #1
0
  private static boolean UpdateConfigs() throws UnknownHostException, Exception {
    try {
      boolean successfullremove = false;
      if (config.getCacheDeployment().getClientNodes() == null) {
        System.out.println("Error : Client node(s) not found.");
        return false;
      }

      if (config.getCacheDeployment().getClientNodes().getNodesList() == null) {
        System.out.println("Error : Client node(s) not found.");
        return false;
      }

      com.alachisoft.tayzgrid.config.newdom.ClientNode[] existingClientNodes =
          config.getCacheDeployment().getClientNodes().getNodes();
      for (com.alachisoft.tayzgrid.config.newdom.ClientNode cNode : existingClientNodes) {
        if (cParam.getClientNode().toString().equals(cNode.getName())) {
          config.getCacheDeployment().getClientNodes().getNodesList().remove(cNode);
          successfullremove = true;
        }
      }

      if (!successfullremove) {
        System.out.println("Error : Client node(s) not found.");
        return false;
      }

      byte[] userId = null;
      byte[] paswd = null;

      for (Iterator it = currentServerNodes.iterator(); it.hasNext(); ) {
        String node = (String) it.next();
        NCache.setServerName(node);
        cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 30));
        cacheServer.RegisterCache(cParam.getCacheId(), config, "", true, userId, paswd, true);
      }

      NCache.setServerName(cParam.getClientNode());
      cacheServer = NCache.GetCacheServer(new TimeSpan(0, 0, 30));
      ClientConfiguration clientConfiguration =
          cacheServer.GetClientConfiguration(cParam.getCacheId());
      CacheConfiguration cacheConfiguration =
          clientConfiguration.getCacheConfigurationsMap().get(cParam.getCacheId());
      cacheServer.RemoveCacheFromClientConfig(cParam.getCacheId());

      return true;

    } catch (RuntimeException ex) {
      System.out.println("Error: " + ex.getMessage());
      return false;
    }
  }
예제 #2
0
  private static boolean ValidateParameters() {
    // Validating CacheId

    AssemblyUsage.PrintLogo(cParam.getIsLogo());

    if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(cParam.getCacheId())) {
      System.err.println("Error: Cache Name not specified");
      return false;
    }

    if (tangible.DotNetToJavaStringHelper.isNullOrEmpty(cParam.getClientNode())) {
      System.err.println("Error: Client Node not specified");
      return false;
    }

    return true;
  }