Example #1
0
  /*
   * Removes a Service description from a ranking engine. Returns a
   * corresponding success/failure message
   */
  protected String removeServiceDescription(Service service, RankingEngineInterface engine) {
    String message;

    try {
      engine.removeService(service);
      message =
          "Successfully removed service description "
              + service.resource
              + " to "
              + "from "
              + engine.getClass().getSimpleName()
              + " engine";
    } catch (IllegalArgumentException e) {
      String failed =
          "Failed to Service description from " + engine.getClass().getSimpleName() + " engine";
      logger.warn(failed, e);
      message = failed + ":\n " + e.getMessage();
    }
    return message;
  }
Example #2
0
  /*
   * Adds a service to a ranking engine. Returns a corresponding
   * success/failure message
   */
  protected String addService(Service service, RankingEngineInterface engine) {
    String message;

    try {
      engine.addService(service);
      message =
          "Successfully added service "
              + service.resource
              + " to "
              + engine.getClass().getSimpleName()
              + " engine";
    } catch (RankingException e) {
      String failed =
          "Failed to add service description "
              + service.resource
              + " to "
              + engine.getClass().getSimpleName()
              + " engine";
      logger.warn(failed, e);
      message = failed + ":\n " + e.getMessage();
    }
    return message;
  }