protected HashMap<String, String> getCoordProperties(COORDINATORAPP coord) { HashMap<String, String> props = new HashMap<String, String>(); for (CONFIGURATION.Property prop : coord.getAction().getWorkflow().getConfiguration().getProperty()) { props.put(prop.getName(), prop.getValue()); } return props; }
@Override public List<Properties> buildCoords(Cluster cluster, Path buildPath) throws FalconException { org.apache.falcon.entity.v0.feed.Cluster feedCluster = FeedHelper.getCluster(entity, cluster.getName()); if (feedCluster == null) { return null; } COORDINATORAPP coord = new COORDINATORAPP(); String coordName = getEntityName(); coord.setName(coordName); Date endDate = feedCluster.getValidity().getEnd(); coord.setEnd(SchemaHelper.formatDateUTC(endDate)); if (feedCluster.getValidity().getEnd().before(new Date())) { Date startDate = DateUtils.addMinutes(endDate, -1); coord.setStart(SchemaHelper.formatDateUTC(startDate)); } else { coord.setStart(SchemaHelper.formatDateUTC(new Date())); } coord.setTimezone(entity.getTimezone().getID()); TimeUnit timeUnit = entity.getFrequency().getTimeUnit(); if (timeUnit == TimeUnit.hours || timeUnit == TimeUnit.minutes) { coord.setFrequency("${coord:hours(6)}"); } else { coord.setFrequency("${coord:days(1)}"); } Path coordPath = getBuildPath(buildPath); Properties props = createCoordDefaultConfiguration(coordName); WORKFLOW workflow = new WORKFLOW(); Properties wfProps = OozieOrchestrationWorkflowBuilder.get(entity, cluster, Tag.RETENTION) .build(cluster, coordPath); workflow.setAppPath(getStoragePath(wfProps.getProperty(OozieEntityBuilder.ENTITY_PATH))); props.putAll(getProperties(coordPath, coordName)); // Add the custom properties set in feed. Else, dryrun won't catch any missing props. props.putAll(EntityUtil.getEntityProperties(entity)); workflow.setConfiguration(getConfig(props)); ACTION action = new ACTION(); action.setWorkflow(workflow); coord.setAction(action); Path marshalPath = marshal(cluster, coord, coordPath); return Arrays.asList(getProperties(marshalPath, coordName)); }
@SuppressWarnings("unchecked") protected WORKFLOWAPP getWorkflowapp(FileSystem fs, COORDINATORAPP coord) throws JAXBException, IOException { String wfPath = coord.getAction().getWorkflow().getAppPath().replace("${nameNode}", ""); return getWorkflowapp(fs, new Path(wfPath, "workflow.xml")); }