public static void injectReferences(Object artifact, InjectionReferences injectionRefs) { if (logger.isLoggable(Level.FINE)) { logger.fine("Injecting references into: " + artifact); logger.fine("InjectionReferences = " + injectionRefs); } Map<String, Field> propertyMap = findPropertyFields(artifact); if (injectionRefs.getProps() != null) { injectProperties(artifact, injectionRefs.getProps(), propertyMap); } injectBatchContextFields(artifact, injectionRefs.getJobContext(), injectionRefs.getStepContext()); if (logger.isLoggable(Level.FINE)) { logger.exiting(sourceClass, "injectReferences"); } }
private void setupListeners() { JSLJob jobModel = jobExecution.getJobNavigator().getRootModelElement(); InjectionReferences injectionRef = new InjectionReferences(jobContext, null, null); listenerFactory = new ListenerFactory(jobModel, injectionRef); jobExecution.setListenerFactory(listenerFactory); }
private ListenerInfo buildListenerInfo(Listener listener, InjectionReferences injectionRefs) { String id = listener.getRef(); List<Property> propList = (listener.getProperties() == null) ? null : listener.getProperties().getPropertyList(); injectionRefs.setProps(propList); Object listenerArtifact = ProxyFactory.loadArtifact(id, injectionRefs); if (listenerArtifact == null) { throw new IllegalArgumentException("Load of artifact id: " + id + " returned <null>."); } ListenerInfo info = new ListenerInfo(listenerArtifact, propList); return info; }
public StepContext getStepContext() { return injectionReferences == null ? null : injectionReferences.getStepContext(); }
public JobContext getJobContext() { return injectionReferences == null ? null : injectionReferences.getJobContext(); }
public List<Property> getProps() { return injectionReferences == null ? null : injectionReferences.getProps(); }
private void setupListeners() { JSLJob jobModel = jobExecution.getJobNavigator().getRootModelElement(); InjectionReferences injectionRef = new InjectionReferences(jobContext, null, null); listenerFactory = new ListenerFactory(jobModel, injectionRef); jobExecution.setListenerFactory(listenerFactory); }
private ListenerInfo buildListenerInfo(Listener listener, InjectionReferences injectionRefs) { String id = listener.getRef(); List<Property> propList = (listener.getProperties() == null) ? null : listener.getProperties().getPropertyList(); injectionRefs.setProps(propList); Object listenerArtifact = ProxyFactory.loadArtifact(id, injectionRefs); if (listenerArtifact == null) { throw new IllegalArgumentException("Load of artifact id: " + id + " returned <null>."); } ListenerInfo info = new ListenerInfo(listenerArtifact, propList); return info; }
@Produces @Dependent public StepContext getStepContext() { if (ProxyFactory.getInjectionReferences() != null) { return ProxyFactory.getInjectionReferences().getStepContext(); } else { return null; } }
@Produces @Dependent public JobContext getJobContext() { if (ProxyFactory.getInjectionReferences() != null) { return ProxyFactory.getInjectionReferences().getJobContext(); } else { return null; } }
@Produces @Dependent @BatchProperty public String produceProperty(InjectionPoint injectionPoint) { //Seems like this is a CDI bug where null injection points are getting passed in. //We should be able to ignore these as a workaround. if (injectionPoint != null) { if (ProxyFactory.getInjectionReferences() == null) { return null; } BatchProperty batchPropAnnotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class); // If a name is not supplied the batch property name defaults to // the field name String batchPropName; if (batchPropAnnotation.name().equals("")) { batchPropName = injectionPoint.getMember().getName(); } else { batchPropName = batchPropAnnotation.name(); } List<Property> propList = ProxyFactory.getInjectionReferences().getProps(); return DependencyInjectionUtility.getPropertyValue(propList, batchPropName); } return null; }
private void setupListeners() { JSLJob jobModel = runtimeWorkUnitExecution.getJobNavigator().getRootModelElement(); InjectionReferences injectionRef = new InjectionReferences(runtimeWorkUnitExecution.getWorkUnitJobContext(), null, null); listenerFactory = new ListenerFactory(jobModel, injectionRef); runtimeWorkUnitExecution.setListenerFactory(listenerFactory); }
public static void injectReferences(Object artifact, InjectionReferences injectionRefs) { if (logger.isLoggable(Level.FINE)) { logger.fine("Injecting references into: " + artifact); logger.fine("InjectionReferences = " + injectionRefs); } Map<String, Field> propertyMap = findPropertyFields(artifact); if (injectionRefs.getProps() != null) { injectProperties(artifact, injectionRefs.getProps(), propertyMap); } injectBatchContextFields(artifact, injectionRefs.getJobContext(), injectionRefs.getStepContext()); if (logger.isLoggable(Level.FINE)) { logger.exiting(sourceClass, "injectReferences"); } }
private ListenerInfo buildListenerInfo(Listener listener, InjectionReferences injectionRefs) { String id = listener.getRef(); List<Property> propList = (listener.getProperties() == null) ? null : listener.getProperties().getPropertyList(); injectionRefs.setProps(propList); Object listenerArtifact = ProxyFactory.loadArtifact(id, injectionRefs); if (listenerArtifact == null) { throw new IllegalArgumentException("Load of artifact id: " + id + " returned <null>."); } ListenerInfo info = new ListenerInfo(listenerArtifact, propList); return info; }
@Produces @Dependent public StepContext getStepContext() { if (ProxyFactory.getInjectionReferences() != null) { return ProxyFactory.getInjectionReferences().getStepContext(); } else { return null; } } }
@Produces @Dependent public JobContext getJobContext() { if (ProxyFactory.getInjectionReferences() != null) { return ProxyFactory.getInjectionReferences().getJobContext(); } else { return null; } }
@Produces @Dependent @BatchProperty public String produceProperty(InjectionPoint injectionPoint) { //Seems like this is a CDI bug where null injection points are getting passed in. //We should be able to ignore these as a workaround. if (injectionPoint != null) { if (ProxyFactory.getInjectionReferences() == null) { return null; } BatchProperty batchPropAnnotation = injectionPoint.getAnnotated().getAnnotation(BatchProperty.class); // If a name is not supplied the batch property name defaults to // the field name String batchPropName = null; if (batchPropAnnotation.name().equals("")) { batchPropName = injectionPoint.getMember().getName(); } else { batchPropName = batchPropAnnotation.name(); } List<Property> propList = ProxyFactory.getInjectionReferences().getProps(); String propValue = DependencyInjectionUtility.getPropertyValue(propList, batchPropName); return propValue; } return null; }
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); } }
public static void injectReferences(Object artifact, InjectionReferences injectionRefs) { if (logger.isLoggable(Level.FINE)) { logger.fine("Injecting references into: " + artifact); logger.fine("InjectionReferences = " + injectionRefs); } Map<String, Field> propertyMap = findPropertyFields(artifact); if (injectionRefs.getProps() != null) { injectProperties(artifact, injectionRefs.getProps(), propertyMap); } injectBatchContextFields(artifact, injectionRefs.getJobContext(), injectionRefs.getStepContext()); if (logger.isLoggable(Level.FINE)) { logger.exiting(sourceClass, "injectReferences"); } }
InjectionReferences injectionRef = new InjectionReferences(runtimeWorkUnitExecution.getWorkUnitJobContext(), runtimeStepExecution, propList);