public ProvenanceReportingSchema(Map map) { schedulingStrategy = getRequiredKeyAsType(map, SCHEDULING_STRATEGY_KEY, String.class, PROVENANCE_REPORTING_KEY); if (schedulingStrategy != null) { try { SchedulingStrategy.valueOf(schedulingStrategy); } catch (IllegalArgumentException e) { addValidationIssue(SCHEDULING_STRATEGY_KEY, PROVENANCE_REPORTING_KEY, "it is not a valid scheduling strategy"); } } schedulingPeriod = getRequiredKeyAsType(map, SCHEDULING_PERIOD_KEY, String.class, PROVENANCE_REPORTING_KEY); destinationUrl = getRequiredKeyAsType(map, DESTINATION_URL_KEY, String.class, PROVENANCE_REPORTING_KEY); portName = getRequiredKeyAsType(map, PORT_NAME_KEY, String.class, PROVENANCE_REPORTING_KEY); comment = getOptionalKeyAsType(map, COMMENT_KEY, String.class, PROVENANCE_REPORTING_KEY, ""); originatingUrl = getOptionalKeyAsType(map, ORIGINATING_URL_KEY, String.class, PROVENANCE_REPORTING_KEY, DEFAULT_ORGINATING_URL); useCompression = getOptionalKeyAsType(map, USE_COMPRESSION_KEY, Boolean.class, PROVENANCE_REPORTING_KEY, DEFAULT_USE_COMPRESSION); timeout = getOptionalKeyAsType(map, TIMEOUT_KEY, String.class, PROVENANCE_REPORTING_KEY, DEFAULT_TIMEOUT); batchSize = getOptionalKeyAsType(map, BATCH_SIZE_KEY, Number.class, PROVENANCE_REPORTING_KEY, DEFAULT_BATCH_SIZE); }
protected static void addProvenanceReportingTask(final Element element, ConfigSchema configSchema) throws ConfigurationChangeException { try { ProvenanceReportingSchema provenanceProperties = configSchema.getProvenanceReportingProperties(); final Element taskElement = element.getOwnerDocument().createElement("reportingTask"); addTextElement(taskElement, "id", "Provenance-Reporting"); addTextElement(taskElement, "name", "Site-To-Site-Provenance-Reporting"); addTextElement(taskElement, "comment", provenanceProperties.getComment()); addTextElement(taskElement, "class", DEFAULT_PROV_REPORTING_TASK_CLASS); addTextElement(taskElement, "schedulingPeriod", provenanceProperties.getSchedulingPeriod()); addTextElement(taskElement, "scheduledState", "RUNNING"); addTextElement(taskElement, "schedulingStrategy", provenanceProperties.getSchedulingStrategy()); Map<String, Object> attributes = new HashMap<>(); attributes.put("Destination URL", provenanceProperties.getDestinationUrl()); attributes.put("Input Port Name", provenanceProperties.getPortName()); attributes.put("Instance URL", provenanceProperties.getOriginatingUrl()); attributes.put("Compress Events", provenanceProperties.getUseCompression()); attributes.put("Batch Size", provenanceProperties.getBatchSize()); attributes.put("Communications Timeout", provenanceProperties.getTimeout()); SecurityPropertiesSchema securityProps = configSchema.getSecurityProperties(); if (securityProps.useSSL()) { attributes.put("SSL Context Service", "SSL-Context-Service"); } addConfiguration(taskElement, attributes); element.appendChild(taskElement); } catch (Exception e) { throw new ConfigurationChangeException("Failed to parse the config YAML while trying to add the Provenance Reporting Task", e); } }