public static Batchlet cloneBatchlet(Batchlet batchlet){ Batchlet newBatchlet = jslFactory.createBatchlet(); newBatchlet.setRef(batchlet.getRef()); newBatchlet.setProperties(cloneJSLProperties(batchlet.getProperties())); return newBatchlet; }
@Override public Batchlet substituteProperties(final Batchlet batchlet, final Properties submittedProps, final Properties parentProps) { //resolve all the properties used in attributes and update the JAXB model batchlet.setRef(this.replaceAllProperties(batchlet.getRef(), submittedProps, parentProps)); // Resolve all the properties defined for this batchlet if (batchlet.getProperties() != null) { this.resolveElementProperties(batchlet.getProperties().getPropertyList(), submittedProps, parentProps); } return batchlet; }
private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException { String batchletId = batchlet.getRef(); List<Property> propList = (batchlet.getProperties() == null) ? null : batchlet.getProperties().getPropertyList(); String sourceMethod = "invokeBatchlet"; if (logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, sourceMethod, batchletId); } String exitStatus = null; InjectionReferences injectionRef = new InjectionReferences(jobExecutionImpl.getJobContext(), stepContext, propList); try { batchletProxy = ProxyFactory.createBatchletProxy(batchletId, injectionRef, stepContext); } catch (ArtifactValidationException e) { throw new BatchContainerServiceException("Cannot create the batchlet [" + batchletId + "]", e); } if (logger.isLoggable(Level.FINE)) logger.fine("Batchlet is loaded and validated: " + batchletProxy); if (wasStopIssued()) { logger.fine("Exit without executing batchlet since stop() request has been received."); } else { String processRetVal = batchletProxy.process(); logger.fine("Set process() return value = " + processRetVal + " for possible use as exitStatus"); stepContext.setBatchletProcessRetVal(processRetVal); logger.exiting(sourceClass, sourceMethod, exitStatus==null ? "<null>" : exitStatus); } }
if (batchlet != null) { if(logger.isLoggable(Level.FINER)) { logger.finer("Found batchlet: " + batchlet + ", with ref= " + batchlet.getRef());
/** * Create an instance of {@link Batchlet } * */ public Batchlet createBatchlet() { return new Batchlet(); }
@Override public Batchlet substituteProperties(final Batchlet batchlet, final Properties submittedProps, final Properties parentProps) { //resolve all the properties used in attributes and update the JAXB model batchlet.setRef(this.replaceAllProperties(batchlet.getRef(), submittedProps, parentProps)); // Resolve all the properties defined for this batchlet if (batchlet.getProperties() != null) { this.resolveElementProperties(batchlet.getProperties().getPropertyList(), submittedProps, parentProps); } return batchlet; }
private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException { String batchletId = batchlet.getRef(); List<Property> propList = (batchlet.getProperties() == null) ? null : batchlet.getProperties().getPropertyList(); String sourceMethod = "invokeBatchlet"; if (logger.isLoggable(Level.FINER)) { logger.entering(sourceClass, sourceMethod, batchletId); } String exitStatus = null; InjectionReferences injectionRef = new InjectionReferences(jobExecutionImpl.getJobContext(), stepContext, propList); try { batchletProxy = ProxyFactory.createBatchletProxy(batchletId, injectionRef, stepContext); } catch (ArtifactValidationException e) { throw new BatchContainerServiceException("Cannot create the batchlet [" + batchletId + "]", e); } if (logger.isLoggable(Level.FINE)) logger.fine("Batchlet is loaded and validated: " + batchletProxy); if (wasStopIssued()) { logger.fine("Exit without executing batchlet since stop() request has been received."); } else { logger.fine("Starting process() for the Batchlet Artifact"); String processRetVal = batchletProxy.process(); logger.fine("Set process() return value = " + processRetVal + " for possible use as exitStatus"); stepContext.setBatchletProcessRetVal(processRetVal); logger.exiting(sourceClass, sourceMethod, exitStatus==null ? "<null>" : exitStatus); } }
if (batchlet != null) { if(logger.isLoggable(Level.FINER)) { logger.finer("Found batchlet: " + batchlet + ", with ref= " + batchlet.getRef());
/** * Create an instance of {@link Batchlet } * */ public Batchlet createBatchlet() { return new Batchlet(); }
public static Batchlet cloneBatchlet(Batchlet batchlet){ Batchlet newBatchlet = jslFactory.createBatchlet(); newBatchlet.setRef(batchlet.getRef()); newBatchlet.setProperties(cloneJSLProperties(batchlet.getProperties())); return newBatchlet; }
@Override public Batchlet substituteProperties(final Batchlet batchlet, final Properties submittedProps, final Properties parentProps) { //resolve all the properties used in attributes and update the JAXB model batchlet.setRef(this.replaceAllProperties(batchlet.getRef(), submittedProps, parentProps)); // Resolve all the properties defined for this batchlet if (batchlet.getProperties() != null) { this.resolveElementProperties(batchlet.getProperties().getPropertyList(), submittedProps, parentProps); } return batchlet; }
private void invokeBatchlet(Batchlet batchlet) throws BatchContainerServiceException { String batchletId = batchlet.getRef(); List<Property> propList = (batchlet.getProperties() == null) ? null : batchlet.getProperties().getPropertyList();
if (batchlet != null) { if(logger.isLoggable(Level.FINER)) { logger.finer("Found batchlet: " + batchlet + ", with ref= " + batchlet.getRef());
/** * Create an instance of {@link Batchlet } * */ public Batchlet createBatchlet() { return new Batchlet(); }
public static Batchlet cloneBatchlet(Batchlet batchlet){ Batchlet newBatchlet = jslFactory.createBatchlet(); newBatchlet.setRef(batchlet.getRef()); newBatchlet.setProperties(cloneJSLProperties(batchlet.getProperties())); return newBatchlet; }
@Test public void testModelNoValidate() throws Exception { JAXBContext ctx = JAXBContext.newInstance("com.ibm.jbatch.jsl.model"); Unmarshaller u = ctx.createUnmarshaller(); FileInputStream fis = new FileInputStream(new File("test/files/valid.job1.xml")); // Use this for anonymous type //Job job = (Job)u.unmarshal(url.openStream()); // Use this for named complex type, which is what the spec uses. Object elem = u.unmarshal(fis); JSLJob job = (JSLJob)((JAXBElement)elem).getValue(); assertEquals("job1", job.getId()); assertEquals(1, job.getExecutionElements().size()); Step step = (Step)job.getExecutionElements().get(0); assertEquals("step1", step.getId()); Batchlet b = step.getBatchlet(); assertEquals("step1Ref", b.getRef()); }
@Test public void testModelValidate() throws Exception { JAXBContext ctx = JAXBContext.newInstance("com.ibm.jbatch.jsl.model"); Unmarshaller u = ctx.createUnmarshaller(); u.setSchema(ValidatorHelper.getXJCLSchema()); JSLValidationEventHandler handler = new JSLValidationEventHandler(); u.setEventHandler(handler); FileInputStream fis = new FileInputStream(new File("test/files/valid.job1.xml")); // Use this for anonymous type //Job job = (Job)u.unmarshal(url.openStream()); // Use this for named complex type, which is what the spec uses. Object elem = u.unmarshal(fis); assertFalse("XSD invalid, see sysout", handler.eventOccurred()); JSLJob job = (JSLJob)((JAXBElement)elem).getValue(); assertEquals("job1", job.getId()); assertEquals(1, job.getExecutionElements().size()); Step step = (Step)job.getExecutionElements().get(0); assertEquals("step1", step.getId()); Batchlet b = step.getBatchlet(); assertEquals("step1Ref", b.getRef()); }