Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Title style corrected

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

The show_jobs command actually has an outdated behaviour, it is not recognizing the subfolders of the hotfolder and therefore the subfolders are not in the xml-response of this command.

The show_state command is much more "intelligent". With this command one can request folders and subfolders (and some other things more) in an even more performent way.

An example:

Code Block

     <show_state subsystems="folder job" what="folders"/>

...

To get the first level of a folder-structure only:

Code Block

     <show_state what="folders job_chains no_subfolders" />

This will result in a xml-response with all folders and files on level 1 of the hotfolder.
To get the structure of a subfolder, e.g. with name "oh", the command

Code Block

     <show_state what="folders job_chains no_subfolders" path="/oh"/>

...

a short example, how to use the SOSJobSchedulerModel paket:

Code Block

	@Test
	public final void testCreateShowJobsViaState() {

		JSCmdShowState objCmdShowState = objFactory.createShowState(); // http://localhost:4444/doc/en/xml/show_state.xml
		objCmdShowState.setMaxTaskHistory(BigInteger.valueOf(100));
		// objCmdShowState.setWhat("folders job_chains no_subfolders");
		objCmdShowState.setWhat("folders job_chains");
		objCmdShowState.run();

		State objState = objCmdShowState.getState();
		Folder objFolder = objState.getFolder();

		if (objFolder != null) {
			TraverseFolders(objFolder);
		}

		/**
		 * Jobs only with all Folders:
		 *		<show_state subsystems="folder job" what="folders"/>
		 *
		 * what for folder view in show_state
		 *
		 * 		<show_state what="folders job_chains no_subfolders" path="/oh"/>
		 */
	}

	private void TraverseFolders(Folder pobjFolder) {

		@SuppressWarnings("unused")
		final String conMethodName = conClassName + "::TraverseFolders";

		for (Object objAnObject : pobjFolder.getFileBasedOrJobsOrFolders()) {
			if (objAnObject instanceof FileBased) {
				FileBased objFB = (FileBased) objAnObject;
				logger.debug("file = " + objFB.getFile());
			}
			else
				if (objAnObject instanceof JobChains) {
					JobChains objJobChains = (JobChains) objAnObject;
					for (JobChain objJobChain : objJobChains.getJobChain()) {
						logger.debug(objJobChain.getName());
					}
				}
				else
					if (objAnObject instanceof Jobs) {
						Jobs objJobs = (Jobs) objAnObject;
						for (Job objJob : objJobs.getJob()) {
							logger.debug(objJob.getName());
						}
					}
					else
						if (objAnObject instanceof Folders) {
							Folders objFolders = (Folders) objAnObject;
							for (Folder objFolder : objFolders.getFolder()) {
								TraverseFolders(objFolder);
							}
						}
						else
							if (objAnObject instanceof Orders) {
								Orders objOrders = (Orders) objAnObject;
								for (Order objOrder : objOrders.getOrder()) {
									logger.debug(objOrder.getName());
								}
							}
							else
								if (objAnObject instanceof ProcessClasses) {
									ProcessClasses objProcessClasses = (ProcessClasses) objAnObject;
									for (ProcessClass objProcessClass : objProcessClasses.getProcessClass()) {
										logger.debug(objProcessClass.getName());
									}
								}
		}

	} // private void TraverseFolders