/** * Creates a new JSLProperties list from a java.util.Properties * object. * * @param xmlProperties * @return */ public static JSLProperties javaPropsTojslProperties(final Properties javaProps) { JSLProperties newJSLProps = jslFactory.createJSLProperties(); Enumeration<?> keySet = javaProps.propertyNames(); while (keySet.hasMoreElements()) { String key = (String)keySet.nextElement(); String value = javaProps.getProperty(key); Property newProperty = jslFactory.createProperty(); newProperty.setName(key); newProperty.setValue(value); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
/** * Creates a new JSLProperties list from a java.util.Properties * object. * * @param xmlProperties * @return */ public static JSLProperties javaPropsTojslProperties(final Properties javaProps) { JSLProperties newJSLProps = jslFactory.createJSLProperties(); Enumeration<?> keySet = javaProps.propertyNames(); while (keySet.hasMoreElements()) { String key = (String)keySet.nextElement(); String value = javaProps.getProperty(key); Property newProperty = jslFactory.createProperty(); newProperty.setName(key); newProperty.setValue(value); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
/** * Creates a new JSLProperties list from a java.util.Properties * object. * * @param javaProps * @return */ public static JSLProperties javaPropsTojslProperties(final Properties javaProps) { JSLProperties newJSLProps = jslFactory.createJSLProperties(); Enumeration<?> keySet = javaProps.propertyNames(); while (keySet.hasMoreElements()) { String key = (String)keySet.nextElement(); String value = javaProps.getProperty(key); Property newProperty = jslFactory.createProperty(); newProperty.setName(key); newProperty.setValue(value); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
public static JSLProperties buildStepProperties(JobStepDefinition jobStepDefinition, JobStep jobStep, boolean hasNext) { JSLProperties jslProperties = new JSLProperties(); List<Property> jslPropertyList = jslProperties.getPropertyList(); Property jslStepIndexProperty = new Property(); jslStepIndexProperty.setName(StepContextPropertyNames.STEP_INDEX); jslStepIndexProperty.setValue(String.valueOf(jobStep.getStepIndex())); jslPropertyList.add(jslStepIndexProperty); if (hasNext) { Property jslStepNextIndexProperty = new Property(); jslStepNextIndexProperty.setName(StepContextPropertyNames.STEP_NEXT_INDEX); jslStepNextIndexProperty.setValue(String.valueOf(jobStep.getStepIndex() + 1)); jslPropertyList.add(jslStepNextIndexProperty); } jslPropertyList.addAll(buildCustomStepProperties(jobStepDefinition, jobStep)); return jslProperties; }
public static JSLProperties buildStepProperties(JobStepDefinition jobStepDefinition, JobStep jobStep, boolean hasNext) { JSLProperties jslProperties = new JSLProperties(); List<Property> jslPropertyList = jslProperties.getPropertyList(); Property jslStepIndexProperty = new Property(); jslStepIndexProperty.setName(StepContextPropertyNames.STEP_INDEX); jslStepIndexProperty.setValue(String.valueOf(jobStep.getStepIndex())); jslPropertyList.add(jslStepIndexProperty); if (hasNext) { Property jslStepNextIndexProperty = new Property(); jslStepNextIndexProperty.setName(StepContextPropertyNames.STEP_NEXT_INDEX); jslStepNextIndexProperty.setValue(String.valueOf(jobStep.getStepIndex() + 1)); jslPropertyList.add(jslStepNextIndexProperty); } jslPropertyList.addAll(buildCustomStepProperties(jobStepDefinition, jobStep)); return jslProperties; }
public static JSLProperties buildJobProperties(KapuaId scopeId, KapuaId jobId, JobStartOptions jobStartOptions) throws JAXBException { List<Property> jslPropertyList = new ArrayList<>(); // Scope id Property scopeIdProperty = new Property(); scopeIdProperty.setName(JobContextPropertyNames.JOB_SCOPE_ID); scopeIdProperty.setValue(scopeId.toCompactId()); jslPropertyList.add(scopeIdProperty); // Job id Property jobIdProperty = new Property(); jobIdProperty.setName(JobContextPropertyNames.JOB_ID); jobIdProperty.setValue(jobId.toCompactId()); jslPropertyList.add(jobIdProperty); // Job target sublist Property targetSublistProperty = new Property(); targetSublistProperty.setName(JobContextPropertyNames.JOB_TARGET_SUBLIST); targetSublistProperty.setValue(XmlUtil.marshal(new JobTargetSublist(jobStartOptions.getTargetIdSublist()))); jslPropertyList.add(targetSublistProperty); // Job from step index if (jobStartOptions.getFromStepIndex() != null) { Property stepFromIndexProperty = new Property(); stepFromIndexProperty.setName(JobContextPropertyNames.JOB_STEP_FROM_INDEX); stepFromIndexProperty.setValue(jobStartOptions.getFromStepIndex().toString()); jslPropertyList.add(stepFromIndexProperty); } // // Add them to the JBatch properties JSLProperties jslProperties = new JSLProperties(); jslProperties.getPropertyList().addAll(jslPropertyList); return jslProperties; }
public static JSLProperties buildJobProperties(KapuaId scopeId, KapuaId jobId, JobStartOptions jobStartOptions) throws JAXBException { List<Property> jslPropertyList = new ArrayList<>(); // Scope id Property scopeIdProperty = new Property(); scopeIdProperty.setName(JobContextPropertyNames.JOB_SCOPE_ID); scopeIdProperty.setValue(scopeId.toCompactId()); jslPropertyList.add(scopeIdProperty); // Job id Property jobIdProperty = new Property(); jobIdProperty.setName(JobContextPropertyNames.JOB_ID); jobIdProperty.setValue(jobId.toCompactId()); jslPropertyList.add(jobIdProperty); // Job target sublist Property targetSublistProperty = new Property(); targetSublistProperty.setName(JobContextPropertyNames.JOB_TARGET_SUBLIST); targetSublistProperty.setValue(XmlUtil.marshal(new JobTargetSublist(jobStartOptions.getTargetIdSublist()))); jslPropertyList.add(targetSublistProperty); // Job from step index if (jobStartOptions.getFromStepIndex() != null) { Property stepFromIndexProperty = new Property(); stepFromIndexProperty.setName(JobContextPropertyNames.JOB_STEP_FROM_INDEX); stepFromIndexProperty.setValue(jobStartOptions.getFromStepIndex().toString()); jslPropertyList.add(stepFromIndexProperty); } // // Add them to the JBatch properties JSLProperties jslProperties = new JSLProperties(); jslProperties.getPropertyList().addAll(jslPropertyList); return jslProperties; }
jobName.setName(TOP_LEVEL_JOB_NAME_PROP); jobName.setValue(getJobName()); properties.getPropertyList().add(jobName); instanceId.setName(TOP_LEVEL_INSTANCE_ID_PROP); instanceId.setValue(String.valueOf(getInstanceId())); properties.getPropertyList().add(instanceId); executionId.setName(TOP_LEVEL_EXECUTION_ID_PROP); executionId.setValue(String.valueOf(getExecutionId())); properties.getPropertyList().add(executionId);
public static Collection<Property> buildCustomStepProperties(JobStepDefinition jobStepDefinition, JobStep jobStep) { Map<String, Property> customStepProperties = new HashMap<>(); // // Add default properties for (JobStepProperty jobStepProperty : jobStepDefinition.getStepProperties()) { Property jslStepProperty = new Property(); jslStepProperty.setName(jobStepProperty.getName()); jslStepProperty.setValue(jobStepProperty.getPropertyValue()); customStepProperties.put(jobStepProperty.getName(), jslStepProperty); } // // Add custom values for (JobStepProperty jobStepProperty : jobStep.getStepProperties()) { if (jobStepProperty.getPropertyValue() != null) { Property jslStepProperty = new Property(); jslStepProperty.setName(jobStepProperty.getName()); jslStepProperty.setValue(jobStepProperty.getPropertyValue()); customStepProperties.put(jobStepProperty.getName(), jslStepProperty); } } return customStepProperties.values(); }
public static Collection<Property> buildCustomStepProperties(JobStepDefinition jobStepDefinition, JobStep jobStep) { Map<String, Property> customStepProperties = new HashMap<>(); // // Add default properties for (JobStepProperty jobStepProperty : jobStepDefinition.getStepProperties()) { Property jslStepProperty = new Property(); jslStepProperty.setName(jobStepProperty.getName()); jslStepProperty.setValue(jobStepProperty.getPropertyValue()); customStepProperties.put(jobStepProperty.getName(), jslStepProperty); } // // Add custom values for (JobStepProperty jobStepProperty : jobStep.getStepProperties()) { if (jobStepProperty.getPropertyValue() != null) { Property jslStepProperty = new Property(); jslStepProperty.setName(jobStepProperty.getName()); jslStepProperty.setValue(jobStepProperty.getPropertyValue()); customStepProperties.put(jobStepProperty.getName(), jslStepProperty); } } return customStepProperties.values(); }
/** * * @param elementProperties * xml properties that are direct children of the current element * @param submittedProps * submitted job properties * @param parentProps * resolved parent properties * @return the properties associated with this elements scope */ protected Properties resolveElementProperties( final List<Property> elementProperties, final Properties submittedProps, final Properties parentProps) { Properties currentXMLProperties = new Properties(); currentXMLProperties = this.inheritProperties(parentProps, currentXMLProperties); for (final Property prop : elementProperties) { String name = prop.getName(); name = this.replaceAllProperties(name, submittedProps, currentXMLProperties); String value = prop.getValue(); value = this.replaceAllProperties(value, submittedProps,currentXMLProperties); // add resolved properties to current properties currentXMLProperties.setProperty(name, value); // update JAXB model prop.setName(name); prop.setValue(value); } return currentXMLProperties; }
/** * * @param elementProperties * xml properties that are direct children of the current element * @param submittedProps * submitted job properties * @param parentProps * resolved parent properties * @return the properties associated with this elements scope */ protected Properties resolveElementProperties( final List<Property> elementProperties, final Properties submittedProps, final Properties parentProps) { Properties currentXMLProperties = new Properties(); currentXMLProperties = this.inheritProperties(parentProps, currentXMLProperties); for (final Property prop : elementProperties) { String name = prop.getName(); name = this.replaceAllProperties(name, submittedProps, currentXMLProperties); String value = prop.getValue(); value = this.replaceAllProperties(value, submittedProps,currentXMLProperties); // add resolved properties to current properties currentXMLProperties.setProperty(name, value); // update JAXB model prop.setName(name); prop.setValue(value); } return currentXMLProperties; }
/** * * @param elementProperties * xml properties that are direct children of the current element * @param submittedProps * submitted job properties * @param parentProps * resolved parent properties * @return the properties associated with this elements scope */ protected Properties resolveElementProperties( final List<Property> elementProperties, final Properties submittedProps, final Properties parentProps) { Properties currentXMLProperties = new Properties(); currentXMLProperties = this.inheritProperties(parentProps, currentXMLProperties); for (final Property prop : elementProperties) { String name = prop.getName(); name = this.replaceAllProperties(name, submittedProps, currentXMLProperties); String value = prop.getValue(); value = this.replaceAllProperties(value, submittedProps,currentXMLProperties); // add resolved properties to current properties currentXMLProperties.setProperty(name, value); // update JAXB model prop.setName(name); prop.setValue(value); } return currentXMLProperties; }
public static JSLProperties cloneJSLProperties(JSLProperties jslProps) { if (jslProps == null) { return null; } JSLProperties newJSLProps = jslFactory.createJSLProperties(); newJSLProps.setPartition(jslProps.getPartition());; for(Property jslProp : jslProps.getPropertyList()) { Property newProperty = jslFactory.createProperty(); newProperty.setName(jslProp.getName()); newProperty.setValue(jslProp.getValue()); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
public static JSLProperties cloneJSLProperties(JSLProperties jslProps) { if (jslProps == null) { return null; } JSLProperties newJSLProps = jslFactory.createJSLProperties(); newJSLProps.setPartition(jslProps.getPartition());; for(Property jslProp : jslProps.getPropertyList()) { Property newProperty = jslFactory.createProperty(); newProperty.setName(jslProp.getName()); newProperty.setValue(jslProp.getValue()); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
public static JSLProperties cloneJSLProperties(JSLProperties jslProps) { if (jslProps == null) { return null; } JSLProperties newJSLProps = jslFactory.createJSLProperties(); newJSLProps.setPartition(jslProps.getPartition());; for(Property jslProp : jslProps.getPropertyList()) { Property newProperty = jslFactory.createProperty(); newProperty.setName(jslProp.getName()); newProperty.setValue(jslProp.getValue()); newJSLProps.getPropertyList().add(newProperty); } return newJSLProps; }
jobName.setName(StepContextImpl.TOP_LEVEL_STEP_EXECUTION_ID_PROP);