Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "PTP/designs/resource manager xsd"

< PTP‎ | designs
Line 540: Line 540:
 
Widget.java
 
Widget.java
 
</source>
 
</source>
 +
 +
'''I have not yet decided whether it will be simpler to use JAXB runtime to build the actual instance objects from valid instances of the XML, or whether we just might want to parse it in using a DOM parser and then pull from it as necessary.'''

Revision as of 19:20, 16 January 2011

The following is a draft of the proposed Resource Manager XML Schema (XSD). It has been annotated internally where I felt some explanation necessary.

Note that I have not attempted to figure out yet what the monitoring part will look like or what the control and monitoring sections may need to interact; it may also be the case that some things inside the control node should come up a level.

Secondly, the NCSA workflow engine uses an environment of "properties" defined by potentially recursive nestings of ${...} (see https://wiki.ncsa.illinois.edu/display/MRDPUB/3.+The+Ogrescript+Expression+Language). It would not be difficult to adapt this parser to the much simpler syntax needed to reference the proposed "environment" generated in conjunction with this configuration file.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified">
	<xs:element name="resource-manager">
		<xs:annotation>
			<xs:documentation>
				It is assumed that the xml instance of the schema
				will bear a name which sufficiently distinguishes it from others of
				a similar type; e.g., pbs-torque-v_2.3.7_abe is specific to an
				installation on the host abe, ll-v_4.0 suits all installations of
				LoadLeveler version 4, etc.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="control" />
				<xs:element ref="monitor" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="control">
		<xs:annotation>
			<xs:documentation>
				The implementation will construct a map serving as
				the resource manager "environment"; these are dereferenced in the
				configuration file via ${name} or ${name.part}; in addition to the
				properties specified at the top level of the control tree, all
				attributes and parsers will be mapped for reference. The top level
				of the tree represents the available commands/methods on all
				resource managers, places for defining stdout or stderr parsers, for
				defining the structure of a batch script to be used, for defining
				(job) attributes, and finally for describing how to construct the UI
				(Launch Configuration Tab).
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="property" />
				<xs:element minOccurs="0" ref="on-start-up" />
				<xs:element minOccurs="0" ref="retrieve-dynamic-attributes" />
				<xs:element minOccurs="0" ref="run-interactive" />
				<xs:element minOccurs="0" ref="run-batch" />
				<xs:element minOccurs="0" ref="run-debug" />
				<xs:element ref="cancel-job" />
				<xs:element minOccurs="0" ref="suspend-job" />
				<xs:element minOccurs="0" ref="resume-job" />
				<xs:element minOccurs="0" ref="on-shut-down" />
				<xs:element ref="commands" />
				<xs:element ref="parsers" />
				<xs:element minOccurs="0" ref="script" />
				<xs:element ref="attribute-definitions" />
				<xs:element ref="launch-tab" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="property">
		<xs:annotation>
			<xs:documentation>
				The value is any object type; these are set at
				runtime.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name="name" type="xs:NCName" />
		</xs:complexType>
	</xs:element>
	<xs:element name="on-start-up">
		<xs:annotation>
			<xs:documentation>
				Arbitrary commands which need to be run on startup.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="retrieve-dynamic-attributes">
		<xs:annotation>
			<xs:documentation>
				A command for retrieving (if possible) attributes
				defined by the service dynamically.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="run-interactive">
		<xs:annotation>
			<xs:documentation>
				The command(s) for running interactive jobs.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="run-batch">
		<xs:annotation>
			<xs:documentation>
				The command(s) for running jobs through the
				scheduler.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="run-debug">
		<xs:annotation>
			<xs:documentation>
				The command(s) for running debug jobs.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="cancel-job">
		<xs:annotation>
			<xs:documentation>
				The command(s) for cancelling or killing jobs.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="suspend-job">
		<xs:annotation>
			<xs:documentation>
				The command(s) for suspending jobs.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="resume-job">
		<xs:annotation>
			<xs:documentation>
				The command(s) for restarting suspended jobs.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="on-shut-down">
		<xs:annotation>
			<xs:documentation>
				Arbitrary commands which need to be run on startup.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="commands">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="parsers">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="stream-parser" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="script">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="directive-definitions" />
				<xs:element ref="environment-definitions" />
				<xs:element ref="pre-execute-commands" />
				<xs:element ref="execute-command" />
				<xs:element ref="post-execute-commands" />
			</xs:sequence>
			<xs:attribute name="shell" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="directive-definitions">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded"
					ref="directive-definition" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="directive-definition">
		<xs:annotation>
			<xs:documentation>
				'ValueFrom' refers to properties in the resource
				manager environment.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:attribute name="valueFrom" />
		</xs:complexType>
	</xs:element>
	<xs:element name="environment-definitions">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded"
					ref="environment-definition" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="environment-definition">
		<xs:annotation>
			<xs:documentation>
				'ValueFrom' refers to properties in the resource
				manager environment.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:attribute name="valueFrom" />
		</xs:complexType>
	</xs:element>
	<xs:element name="pre-execute-commands">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="execute-command">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="post-execute-commands">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="command" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="attribute-definitions">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="job-attribute" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="job-attribute">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="description" type="xs:string" />
				<xs:element name="tooltip" type="xs:string" />
				<xs:element name="choice" minOccurs="0" type="xs:string">
					<xs:annotation>
						<xs:documentation>
							A a comma-delimited set of values.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="defaultValue" minOccurs="0" type="xs:string" />
			</xs:sequence>
			<xs:attribute name="id" use="required" type="xs:NCName" />
			<xs:attribute name="name" use="required" type="xs:NCName" />
			<xs:attribute name="type" use="required" type="xs:NCName" />
			<xs:attribute name="basic" type="xs:boolean">
				<xs:annotation>
					<xs:documentation>
						Indicates if this attribute is part of a basic
						(required) set, or if it is an (advance) option.
					</xs:documentation>
				</xs:annotation>
			</xs:attribute>
			<xs:attribute name="minValue" type="xs:int" />
			<xs:attribute name="maxValue" type="xs:int" />
		</xs:complexType>
	</xs:element>
	<xs:element name="command">
		<xs:complexType mixed="true">
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="arg" />
				<xs:element maxOccurs="2" ref="stream-parser" />
			</xs:sequence>
			<xs:attribute name="name" type="xs:NCName" />
		</xs:complexType>
	</xs:element>
	<xs:element name="arg" type="xs:string">
		<xs:annotation>
			<xs:documentation>
				The text of the argument will be parsed for
				references to the resource manager environment; e.g., ${a}, v=${v},
				etc.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:element name="stream-parser">
		<xs:annotation>
			<xs:documentation>
				These are attached to the stdout or stderr streams
				in order to capture the output of the command and add values into
				the resource manager environment. It is understood that a parser
				tokenization is a list of matching tokens.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="parse-lines" />
				<xs:element maxOccurs="unbounded" ref="token" />
				<xs:element maxOccurs="unbounded" ref="put" />
			</xs:sequence>
			<xs:attribute name="name" use="required" type="xs:NCName" />
			<xs:attribute name="stderr" type="xs:boolean" />
		</xs:complexType>
	</xs:element>
	<xs:element name="parse-lines" type="xs:NMTOKEN">
		<xs:annotation>
			<xs:documentation>
				Which lines of output should be examined. Indicated
				by single numerical value, comma-delimited list, or colon-delimited
				range; by convention, N = total number of lines returned.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
	<xs:element name="put">
		<xs:annotation>
			<xs:documentation>
				Value assigned to the name is the token with the
				given index in the returned list; a put without index assigns the
				entire list to the name.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:attribute name="name" use="required" type="xs:NCName" />
			<xs:attribute name="index" type="xs:integer" />
		</xs:complexType>
	</xs:element>
	<xs:element name="token">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" ref="token" />
			</xs:sequence>
			<xs:attribute name="delim" use="required" />
			<xs:attribute name="return" use="required" type="xs:string">
				<xs:annotation>
					<xs:documentation>
						Indicates which segments generated by the
						tokenization should be returned; can be a single numerical value,
						comma-delimited list, or colon-delimited range; by convention, N =
						total number of segments created.
					</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="launch-tab">
		<xs:annotation>
			<xs:documentation>
				This is a recursive description of the main UI
				element associated with the control part, the Lauch Tab. NOTE: I do
				not as yet know how much of the underlying widget options need to be
				exposed here for effective building in the createControl method.
				What follows is minimal.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="tab-controller" />
			</xs:sequence>
			<xs:attribute name="advanced-mode-enabled" type="xs:boolean">
				<xs:annotation>
					<xs:documentation>
						If this is set to true, a tab-controller which
						allows the user to browse the local file system and/or workspace
						to open and edit a custom batch script will be created; this will
						include copy and renaming buttons.
					</xs:documentation>
				</xs:annotation>
			</xs:attribute>
		</xs:complexType>
	</xs:element>
	<xs:element name="tab-controller">
		<xs:annotation>
			<xs:documentation>
				as in:
				org.eclipse.ptp.rm.ui.launch.ExtendableRMLaunchConfigurationDynamicTab;
				a top-level "switch" between views.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="group" />
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="tab-folder" />
			</xs:sequence>
			<xs:attribute name="id" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="tab-folder">
		<xs:complexType>
			<xs:sequence>
				<xs:element maxOccurs="unbounded" ref="tab-item" />
			</xs:sequence>
			<xs:attribute name="title" use="required" />
		</xs:complexType>
	</xs:element>
	<xs:element name="tab-item">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="group" />
				<xs:element minOccurs="0" maxOccurs="unbounded" ref="tab-folder" />
			</xs:sequence>
			<xs:attribute name="name" use="required" type="xs:string" />
		</xs:complexType>
	</xs:element>
	<xs:element name="group">
		<xs:annotation>
			<xs:documentation>
				We may want a few tweaks here, such as borders,
				etc.
			</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="group" />
				<xs:element ref="widget" />
			</xs:choice>
			<xs:attribute name="columns" type="xs:integer" />
			<xs:attribute name="title" type="xs:string" />
		</xs:complexType>
	</xs:element>
	<xs:element name="widget">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="content">
					<xs:annotation>
						<xs:documentation>
							The text of this element will be parsed for
							references to the resource manager environment; e.g., ${a},
							version-${b}, etc.
						</xs:documentation>
					</xs:annotation>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="label" type="xs:string" />
			<xs:attribute name="type" default="text">
				<xs:annotation>
					<xs:documentation>
						Need to complete this list?
					</xs:documentation>
				</xs:annotation>
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:enumeration value="text" />
						<xs:enumeration value="push-button" />
						<xs:enumeration value="radio-button" />
						<xs:enumeration value="spinner" />
						<xs:enumeration value="checkbox" />
						<xs:enumeration value="combo" />
                                              <xs:enumeration value="browse-button" />
					</xs:restriction>
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="read-only" type="xs:boolean" />
		</xs:complexType>
	</xs:element>
	<xs:element name="monitor">
		<xs:annotation>
			<xs:documentation>
				I have for the moment left this undefined.
			</xs:documentation>
		</xs:annotation>
	</xs:element>
</xs:schema>


The classes generated by the JAXB compiler from this schema:

AttributeDefinitions.java
CancelJob.java
Command.java
Commands.java
Control.java
DirectiveDefinition.java
DirectiveDefinitions.java
EnvironmentDefinition.java
EnvironmentDefinitions.java
ExecuteCommand.java
Group.java
JobAttribute.java
LaunchTab.java
ObjectFactory.java
OnShutDown.java
OnStartUp.java
Parsers.java
PostExecuteCommands.java
PreExecuteCommands.java
Property.java
Put.java
ResourceManager.java
ResumeJob.java
RetrieveDynamicAttributes.java
RunBatch.java
RunDebug.java
RunInteractive.java
Script.java
StreamParser.java
SuspendJob.java
TabController.java
TabFolder.java
TabItem.java
Token.java
Widget.java

I have not yet decided whether it will be simpler to use JAXB runtime to build the actual instance objects from valid instances of the XML, or whether we just might want to parse it in using a DOM parser and then pull from it as necessary.

Back to the top