Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353105

Summary: [JABX] Enhancement to the stream parser "target-type" element
Product: [Tools] PTP Reporter: Greg Watson <g.watson>
Component: RMAssignee: Project Inbox <ptp-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: arossi
Version: 5.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Greg Watson CLA 2011-07-26 09:29:30 EDT
The stream parser allows actions to be taken once tokenization has reached the end of the stream using the "test" element. Test elements are applied in turn, and each can contain an "else" clause to reverse the sense of the test. However, there is no way to deal with the situation where none of the tests match, but an action still needs to be taken. For example, job states might be represented by the symbols A, B, ..., Z, but only the first few (say, A, B, and C) carry any useful information, but the remaining symbols all effectively mean the same thing. In the current XML, it would be necessary to enumerate all symbols, making the XML somewhat unwieldy. It would be clearer if there was an "else" or "default" element to handle this situation. The "else" element would only be run if none of the test elements (or their else elements) succeeded:

			<stdout-parser delim="\n">
				<target ref="@jobId">
					<match>
						<expression>jobid:[\d]+:state:([A-Z]+):slots:[\d]+:num procs:[\d]+</expression>
						<set field="value">
							<entry valueGroup="1"/>
						</set>
					</match>
					<test op="EQ">
						<value>#value</value>
						<value>A</value>
						<set field="value">
							<entry value="RUNNING"/>
						</set>
					</test>
					<test op="EQ">
						<value>#value</value>
						<value>B</value>
						<set field="value">
							<entry value="SUSPENDED"/>
						</set>
					</test>
					<test op="EQ">
						<value>#value</value>
						<value>C</value>
						<set field="value">
							<entry value="COMPLETED"/>
						</set>
					</test>
					<else>
						<set field="value">
							<entry value="COMPLETED"/>
						</set>
					</else>
				</target>
			</stdout-parser>
Comment 1 Albert L. Rossi CLA 2011-08-01 21:09:04 EDT
Done.  Committed to 5_0 and HEAD.