Package org.apache.ivory.entity.v0.feed

Examples of org.apache.ivory.entity.v0.feed.Feed


            validateHDFSpaths(process, clusterName);

            if (process.getInputs() != null) {
                for (Input input : process.getInputs().getInputs()) {
                    validateEntityExists(EntityType.FEED, input.getFeed());
                    Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, input.getFeed());
                    CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName);
                    CrossEntityValidations.validateFeedRetentionPeriod(input.getStart(), feed, clusterName);
                    CrossEntityValidations.validateInstanceRange(process, input, feed);
                    if (input.getPartition() != null) {
                        CrossEntityValidations.validateInputPartition(input, feed);
                    }
                }
            }

            if (process.getOutputs() != null) {
                for (Output output : process.getOutputs().getOutputs()) {
                    validateEntityExists(EntityType.FEED, output.getFeed());
                    Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, output.getFeed());
                    CrossEntityValidations.validateFeedDefinedForCluster(feed, clusterName);
                    CrossEntityValidations.validateInstance(process, output, feed);
                }
            }
        }
View Full Code Here


          for (LateInput lp : process.getLateProcess().getLateInputs()) {
            if (!feeds.keySet().contains(lp.getInput())){
              throw new ValidationException("Late Input: " + lp.getInput() + " is not specified in the inputs");
        }
        try {
              Feed feed = (Feed) ConfigurationStore.get().get(EntityType.FEED, feeds.get(lp.getInput()));
              if(feed.getLateArrival()==null){
                throw new ValidationException("Late Input feed: "+lp.getInput()+" is not configured with late arrival cut-off" );
              }
        } catch (IvoryException e) {
          throw new ValidationException(e);
        }
View Full Code Here

      endTime = addTime(endTime, (int) feedCutOffPeriod);
      return endTime;
    } else if (entity.getEntityType() == EntityType.PROCESS) {
      Process process = (Process) entity;
      for (LateInput lp : process.getLateProcess().getLateInputs()) {
        Feed feed = null;
        String endInstanceTime = "";
        for (Input input : process.getInputs().getInputs()) {
          if (input.getName().equals(lp.getInput())) {
            endInstanceTime = input.getEnd();
            feed = store.get(EntityType.FEED, input.getFeed());
            break;
          }
        }
        if (feed.getLateArrival() == null) {
          LOG.debug("Feed's " + feed.getName()
              + " late arrival cut-off is not configured, ignoring this feed");
          continue;
        }
        String lateCutOff = feed.getLateArrival().getCutOff()
            .toString();
        endTime = evaluator.evaluate(endInstanceTime, Date.class);
        long feedCutOffPeriod = evaluator.evaluate(lateCutOff,
            Long.class);
        endTime = addTime(endTime, (int) feedCutOffPeriod);
View Full Code Here

  @Override
  public void onAdd(Entity entity) throws IvoryException {

    if (entity.getEntityType().equals(EntityType.FEED)) {
      Feed feed = (Feed) entity;
      if (feed.getGroups() == null || feed.getGroups().equals("")) {
        return;
      }
      Set<FeedGroup> groupSet = getGroups(feed);
      addGroups(feed.getName(), groupSet);
    }

  }
View Full Code Here

  }

  @Override
  public void onRemove(Entity entity) throws IvoryException {
    if (entity.getEntityType().equals(EntityType.FEED)) {
      Feed feed = (Feed) entity;
      if (StringUtils.isEmpty(feed.getGroups())) {
        return;
      }
      String[] groups = feed.getGroups().split(",");
      for (String group : groups) {
        groupsMapping.get(group).getFeeds().remove(entity.getName());
        if (groupsMapping.get(group).getFeeds().size() == 0) {
          groupsMapping.remove(group);
        }
View Full Code Here

        validateFeedGroups(feed);

        // Seems like a good enough entity object for a new one
        // But is this an update ?

        Feed oldFeed = ConfigurationStore.get().get(EntityType.FEED, feed.getName());
        if (oldFeed == null)
            return; // Not an update case

        // Is actually an update. Need to iterate over all the processes
        // depending on this feed and see if they are valid with the new
View Full Code Here

        assertEquals(process.getOutputs().getOutputs().get(0).getName(), coord.getOutputEvents().getDataOut().get(0).getDataset());

        assertEquals(6, coord.getDatasets().getDatasetOrAsyncDataset().size());
       
        ConfigurationStore store = ConfigurationStore.get();
        Feed feed = store.get(EntityType.FEED, process.getInputs().getInputs().get(0).getFeed());
        SYNCDATASET ds = (SYNCDATASET) coord.getDatasets().getDatasetOrAsyncDataset().get(0);
        assertEquals(SchemaHelper.formatDateUTC(feed.getClusters().getClusters().get(0).getValidity().getStart()), ds.getInitialInstance());
        assertEquals(feed.getTimezone().getID(), ds.getTimezone());
        assertEquals("${coord:"+feed.getFrequency().toString()+"}", ds.getFrequency());
        assertEquals("", ds.getDoneFlag());
        assertEquals(ds.getUriTemplate(),"${nameNode}" + FeedHelper.getLocation(feed, LocationType.DATA,feed.getClusters().getClusters().get(0).getName()).getPath());  
        for(Property prop:coord.getAction().getWorkflow().getConfiguration().getProperty()){
          if(prop.getName().equals("mapred.job.priority")){
            assertEquals(prop.getValue(), "LOW");
            break;
          }
View Full Code Here

                cluster.setName(name);
                store.publish(type, cluster);
                break;
               
            case FEED:
                Feed feed = (Feed) unmarshaller.unmarshal(this.getClass().getResource(FEED_XML));
                feed.setName(name);
                store.publish(type, feed);
                break;
               
            case PROCESS:
                Process process = (Process) unmarshaller.unmarshal(this.getClass().getResource(PROCESS_XML));
View Full Code Here

        .unmarshal(this.getClass().getResource(CLUSTER_XML));
    ClusterHelper.getInterface(cluster, Interfacetype.WRITE).setEndpoint(hdfsUrl);

    store.publish(EntityType.CLUSTER, cluster);

    Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        this.getClass().getResource(FEED1_XML));
    Feed feed2 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        this.getClass().getResource(FEED2_XML));
    Feed feed3 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal(
        this.getClass().getResource(FEED3_XML));

    store.publish(EntityType.FEED, feed1);
    store.publish(EntityType.FEED, feed2);
    store.publish(EntityType.FEED, feed3);
View Full Code Here

            joinedStr = "null";
        return joinedStr;
    }

    private SYNCDATASET createDataSet(String feedName, Cluster cluster, String datasetName, LocationType locationType) throws IvoryException {
        Feed feed = (Feed) EntityUtil.getEntity(EntityType.FEED, feedName);

        SYNCDATASET syncdataset = new SYNCDATASET();
        syncdataset.setName(datasetName);
    String locPath = FeedHelper.getLocation(feed, locationType,
        cluster.getName()).getPath();
    syncdataset.setUriTemplate(new Path(locPath).toUri().getScheme()!=null?locPath:"${nameNode}"
        + locPath);
        syncdataset.setFrequency("${coord:" + feed.getFrequency().toString() + "}");

        org.apache.ivory.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(feed, cluster.getName());
        syncdataset.setInitialInstance(SchemaHelper.formatDateUTC(feedCluster.getValidity().getStart()));
        syncdataset.setTimezone(feed.getTimezone().getID());
    if (feed.getAvailabilityFlag() == null) {
      syncdataset.setDoneFlag("");
    } else {
      syncdataset.setDoneFlag(feed.getAvailabilityFlag());
    }
        return syncdataset;
    }
View Full Code Here

TOP

Related Classes of org.apache.ivory.entity.v0.feed.Feed

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.