コード例 #1
0
  /**
   * processControlEvent is the method that will be called when an event is received for a module
   * that has registered itself as a client of the External Control Interface
   *
   * @param Command - command that is understand by the client module
   * @param Init - we are performing initial configuration if true
   * @param Parameter - parameter for the command
   * @return The result string of the operation
   */
  @Override
  public String processControlEvent(String Command, boolean Init, String Parameter) {
    SearchGroup tmpSearchGroup;
    Collection<String> tmpGroups;
    Iterator<String> GroupIter;
    String tmpGroupName;
    int Objects = 0;
    int ResultCode = -1;

    // Return the number of objects in the cache
    if (Command.equalsIgnoreCase(SERVICE_GROUP_COUNT)) {
      return Integer.toString(GroupCache.size());
    }

    if (Command.equalsIgnoreCase(SERVICE_OBJECT_COUNT)) {
      tmpGroups = GroupCache.keySet();
      GroupIter = tmpGroups.iterator();

      while (GroupIter.hasNext()) {
        tmpGroupName = GroupIter.next();
        tmpSearchGroup = GroupCache.get(tmpGroupName);
        Objects += tmpSearchGroup.SearchGroup.size();
      }

      return Integer.toString(Objects);
    }

    // Return the number of objects in the cache
    if (Command.equalsIgnoreCase(SERVICE_DUMP_MAP)) {
      // onl< dump on a positive command
      if (Parameter.equalsIgnoreCase("true")) {
        DumpMapData();
      }

      ResultCode = 0;
    }

    if (ResultCode == 0) {
      OpenRate.getOpenRateFrameworkLog()
          .debug(LogUtil.LogECICacheCommand(getSymbolicName(), Command, Parameter));

      return "OK";
    } else {
      return super.processControlEvent(Command, Init, Parameter);
    }
  }
コード例 #2
0
  /**
   * processControlEvent is the method that will be called when an event is received for a module
   * that has registered itself as a client of the External Control Interface
   *
   * @param Command - command that is understand by the client module
   * @param Init - we are performing initial configuration if true
   * @param Parameter - parameter for the command
   * @return The result string of the operation
   */
  @Override
  public String processControlEvent(String Command, boolean Init, String Parameter) {
    int ResultCode = -1;

    // Set the status of the invalidate duplicates
    if (Command.equalsIgnoreCase(SERVICE_INVALIDATE_DUPLICATE)) {
      if (Parameter.equalsIgnoreCase("true")) {
        // Set the value
        invalidateOnDuplicate = true;

        // done
        ResultCode = 0;
      } else if (Parameter.equalsIgnoreCase("false")) {
        // Set the value
        invalidateOnDuplicate = false;

        // done
        ResultCode = 0;
      } else if (Parameter.equals("")) {
        // return the current state
        if (invalidateOnDuplicate) {
          return "true";
        } else {
          return "false";
        }
      }
    }

    if (ResultCode == 0) {
      OpenRate.getOpenRateFrameworkLog()
          .debug(LogUtil.LogECICacheCommand(getSymbolicName(), Command, Parameter));

      return "OK";
    } else {
      return super.processControlEvent(Command, Init, Parameter);
    }
  }