/** * Take all the contexts from the factories provided and pass them to the {@link JobLoader}. * * @see Lifecycle#start() */ @Override public void start() { synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; } }
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader(); for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); GenericApplicationContextFactory factory = new GenericApplicationContextFactory(path); factory.setApplicationContext(parentContext); jobLoader.load(factory); } } }
@Test public void testNoStepRegistryAvailable() throws DuplicateJobException { final JobLoader loader = new DefaultJobLoader(jobRegistry); GenericApplicationContextFactory factory = new GenericApplicationContextFactory( new ClassPathResource("job-context-with-steps.xml", getClass())); loader.load(factory); // No step registry available so just registering the jobs assertEquals(2, jobRegistry.getJobNames().size()); }
@Test public void testLoadWithJobThatIsNotAStepLocatorNoStepRegistry() throws DuplicateJobException { final JobLoader loader = new DefaultJobLoader(jobRegistry); GenericApplicationContextFactory factory = new GenericApplicationContextFactory( new ByteArrayResource(BASIC_JOB_XML.getBytes())); try { loader.load(factory); } catch (UnsupportedOperationException e) { fail("Should not have failed with a [" + UnsupportedOperationException.class.getName() + "] as " + "stepRegistry is not available for this JobLoader instance."); } }
/** * Take all the contexts from the factories provided and pass them to the {@link JobLoader}. * * @see Lifecycle#start() */ @Override public void start() { synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; } }
/** * Take all the contexts from the factories provided and pass them to teh * {@link JobLoader}. * * @see Lifecycle#start() */ public void start() { synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; } }
/** * Take all the contexts from the factories provided and pass them to the {@link JobLoader}. * * @see Lifecycle#start() */ @Override public void start() { synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; } }
/** * Take all the contexts from the factories provided and pass them to the {@link JobLoader}. * * @see Lifecycle#start() */ @Override public void start() { synchronized (this.lifecycleMonitor) { if (running) { return; } for (ApplicationContextFactory factory : applicationContextFactories) { try { jobLoader.load(factory); } catch (DuplicateJobException e) { throw new IllegalStateException(e); } } running = true; } }
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader(); for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); GenericApplicationContextFactory factory = new GenericApplicationContextFactory(path); factory.setApplicationContext(parentContext); jobLoader.load(factory); } } }
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader(); for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); GenericApplicationContextFactory factory = new GenericApplicationContextFactory(path); factory.setApplicationContext(parentContext); jobLoader.load(factory); } } }
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader(); for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); GenericApplicationContextFactory factory = new GenericApplicationContextFactory(path); factory.setApplicationContext(parentContext); jobLoader.load(factory); } } }
private void register(String[] paths) throws DuplicateJobException, IOException { maybeCreateJobLoader(); for (int i = 0; i < paths.length; i++) { Resource[] resources = parentContext.getResources(paths[i]); for (int j = 0; j < resources.length; j++) { Resource path = resources[j]; logger.info("Registering Job definitions from " + Arrays.toString(resources)); ClassPathXmlApplicationContextFactory factory = new ClassPathXmlApplicationContextFactory(); factory.setApplicationContext(parentContext); factory.setResource(path); jobLoader.load(factory); } } }