コード例 #1
0
 public void deregisterFeedActivity(FeedConnectJobInfo cInfo) {
   try {
     CentralFeedManager.getInstance()
         .getFeedLoadManager()
         .removeFeedActivity(cInfo.getConnectionId());
   } catch (Exception e) {
     if (LOGGER.isLoggable(Level.WARNING)) {
       LOGGER.warning("Unable to deregister feed activity for " + cInfo + " " + e.getMessage());
     }
   }
 }
コード例 #2
0
  private void registerFeedActivity(FeedConnectJobInfo cInfo) {
    Map<String, String> feedActivityDetails = new HashMap<String, String>();

    if (cInfo.getCollectLocations() != null) {
      feedActivityDetails.put(
          FeedActivity.FeedActivityDetails.INTAKE_LOCATIONS,
          StringUtils.join(cInfo.getCollectLocations().iterator(), ','));
    }

    if (cInfo.getComputeLocations() != null) {
      feedActivityDetails.put(
          FeedActivity.FeedActivityDetails.COMPUTE_LOCATIONS,
          StringUtils.join(cInfo.getComputeLocations().iterator(), ','));
    }

    if (cInfo.getStorageLocations() != null) {
      feedActivityDetails.put(
          FeedActivity.FeedActivityDetails.STORAGE_LOCATIONS,
          StringUtils.join(cInfo.getStorageLocations().iterator(), ','));
    }

    String policyName = cInfo.getFeedPolicy().get(BuiltinFeedPolicies.CONFIG_FEED_POLICY_KEY);
    feedActivityDetails.put(FeedActivity.FeedActivityDetails.FEED_POLICY_NAME, policyName);

    feedActivityDetails.put(
        FeedActivity.FeedActivityDetails.FEED_CONNECT_TIMESTAMP, (new Date()).toString());
    try {
      FeedActivity feedActivity =
          new FeedActivity(
              cInfo.getConnectionId().getFeedId().getDataverse(),
              cInfo.getConnectionId().getFeedId().getFeedName(),
              cInfo.getConnectionId().getDatasetName(),
              feedActivityDetails);
      CentralFeedManager.getInstance()
          .getFeedLoadManager()
          .reportFeedActivity(cInfo.getConnectionId(), feedActivity);

    } catch (Exception e) {
      e.printStackTrace();
      if (LOGGER.isLoggable(Level.WARNING)) {
        LOGGER.warning("Unable to register feed activity for " + cInfo + " " + e.getMessage());
      }
    }
  }