<?xml version="1.0" encoding="US-ASCII"?>
<!--
License:
Copyright 2008 GreatBizTools, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright: GreatBizTools, LLC
$Id: mach-ii_1_6_0.dtd 948 2008-08-10 22:49:03Z peterfarrell $

Created version: 1.0.0
Updated version: 1.6.0

Notes:
The DTD for the Mach-II Application Configuration File, Version 1.6.0.

To support validation of the configuration file, include one of the
following DOCTYPE elements at the beginning (after the "xml" declaration):

<!DOCTYPE mach-ii PUBLIC
	"-//Mach-II//DTD Mach-II Configuration 1.6.0//EN"
	"http://www.mach-ii.com/dtds/mach-ii_1_6_0.dtd">

<!DOCTYPE mach-ii SYSTEM
	"http://localhost:8500/MachII/mach-ii_1_6_0.dtd">
	
<!DOCTYPE mach-ii SYSTEM
	"http://pathToMachII/mach-ii_1_6_0.dtd">
-->

<!--
	"mach-ii"
		version - the version of the DTD being used for configuration
-->
<!ELEMENT mach-ii ((includes?, modules?, properties?, listeners?, message-subscribers?, event-filters?, event-handlers?, subroutines?, page-views?, plugins?)|(includes?, modules?, properties?, listeners?, message-subscribers?, event-filters?, plugins?, event-handlers?, subroutines?, page-views?))>
<!ATTLIST mach-ii 
	version CDATA #IMPLIED
>

<!--
	The "includes" element defines includes you get inserted into that document before Mach II parses
	and validates the xml file.
	Attributes: file - the path relative to app root where the file is located
-->

<!ELEMENT includes (include*)>
<!ELEMENT include EMPTY>
<!ATTLIST include 
	file CDATA #REQUIRED
	override CDATA #IMPLIED
>

<!--
	The "module" element defines Mach-II modules (sub-applications).
	and validates the xml file.
	Attributes: name - the name of the module that this node defines
-->

<!ELEMENT modules (module*)>
<!ELEMENT module (mach-ii?)>
<!ATTLIST module 
	name CDATA #REQUIRED
	file CDATA #IMPLIED
>

<!--
	The "properties" element defines properties to configure the Mach-II application framework.
	Several properties are recommended to be defined for every project.
	Properties are referenced by name.
	
	Properties that should be defined:
		defaultEvent - the event for the framework to handle if one is not specified in a new request
		exceptionEvent - the event to announce if there's an unhandled exception
		maxEvents - the maximum number of events to process for a single request
		eventParameter - the name of the request parameter that will define the event (defaults to 'event')
		applicationRoot - the path to the application's folder relative to the web-server root (i.e. '/SampleApp')
		parameterPrecedence - form | url : which to favor for conflicting request parameters
	
	"property"
		name - the name of the property
		value - the value of the property
-->
<!ELEMENT properties (property*)>
<!ELEMENT property (parameters?, array?, struct?)>
<!ATTLIST property 
	name CDATA #REQUIRED
	value CDATA #IMPLIED
	type CDATA #IMPLIED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>

<!--
	The "listeners" element defines all of the listeners to be registered with the framework.
	Listeners are the components that contain application logic.
	Listeners are referenced by name.
	
	"listener"
		name - the name of the listener
		type - the type of the listener (fully qualified path)
	
	"invoker"
		type - the type of the invoker (fully qualified path)
-->
<!ELEMENT listeners (listener*)>
<!ELEMENT listener (invoker?, parameters?)>
<!ATTLIST listener 
	name CDATA #REQUIRED
	type CDATA #REQUIRED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>
<!ELEMENT invoker EMPTY>
<!ATTLIST invoker 
	type CDATA #REQUIRED
>

<!--
	The "message-subscribers" element defines all of the message-subscribers to be registered with
	the framework. Message-subscribers respond to publish commands.
	Message-subscribers are references by message name.
-->
<!ELEMENT message-subscribers (message*)>
<!ELEMENT message (subscribe*)>
<!ATTLIST message
	name CDATA #REQUIRED
	multithreaded (true|false) #IMPLIED
	waitForThreads (true|false) #IMPLIED
	timeout CDATA #IMPLIED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>
<!ELEMENT subscribe EMPTY>
<!ATTLIST subscribe
	listener CDATA #REQUIRED
	method CDATA #REQUIRED
	resultArg CDATA #IMPLIED
>

<!--
	The "event-filters" element defines all of the event-filters to be registered with the framework.
	Event-filters can manipulate events and can abort/continue event processing.
	Event-filters are referenced by name.
	
	"event-filter"
		name - the name of the event-filter
		type - the type of the event-filter (fully qualified path)
-->
<!ELEMENT event-filters (event-filter*)>
<!ELEMENT event-filter (parameters?)>
<!ATTLIST event-filter 
	name CDATA #REQUIRED
	type CDATA #REQUIRED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>

<!--
	The "event-handlers" element defines all of the logical elements for handling an event.
	Event-handlers are referenced by the event property (target event name).
	
	"event-handler"
		event - the name of the event to handle
		access - the access attribute of the event handler (public|private)
-->
<!ELEMENT event-handlers (event-handler*)>
<!ELEMENT event-handler (filter | notify | event-arg | event-mapping | view-page | announce | event-bean | redirect | execute | publish | cache | cache-clear)*>
<!ATTLIST event-handler 
	event CDATA #REQUIRED 
	access (public|private) "public"
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>

<!--
	The "subroutine-handlers" element defines all of the logical elements for handling an subroutine.
	Subroutine-handlers are referenced by the subroutine property (target subroutine name).
	
	"subroutine-handler"
		subroutine - the name of the subroutine to handle
-->
<!ELEMENT subroutines (subroutine*)>
<!ELEMENT subroutine (filter | notify | event-arg | event-mapping | view-page | announce | event-bean | redirect | execute | publish |cache | cache-clear)*>
<!ATTLIST subroutine 
	name CDATA #REQUIRED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>

<!--
	The "page-views" element defines all of the views to be registered with the framework.
	Views are referenced by name.
	
	"page-view"
		name - the name of the view
		page - relative path to the view file
-->
<!ELEMENT page-views (page-view*)>
<!ELEMENT page-view EMPTY>
<!ATTLIST page-view 
	name CDATA #REQUIRED
	page CDATA #IMPLIED
	overrideAction (useParent|addFromParent) #IMPLIED
	useParentAppRoot (true|false) #IMPLIED
	mapping CDATA #IMPLIED
>

<!--
	The "plugins" element defines all of the plugins to be registered with the framework.
	Plugins are referenced by name.
	
	"plugin"
		name - the name of the plugin
		type - the type of the plugin (fully qualified path)
-->
<!ELEMENT plugins (plugin*)>
<!ATTLIST plugins
	runParent (none|after|before) #IMPLIED
>

<!ELEMENT plugin (parameters?)>
<!ATTLIST plugin 
	name CDATA #REQUIRED
	type CDATA #REQUIRED
	overrideAction (useParent|addFromParent) #IMPLIED
	mapping CDATA #IMPLIED
>


<!--
	Event-Handler tags.
-->
<!--
	A "filter" element will apply an event-filter to the current event being handled.
		name - the name of the filter being referenced
-->
<!ELEMENT filter (parameter*)>
<!ATTLIST filter 
	name CDATA #REQUIRED
>

<!--
	An "notify" element will invoke a listener's method using the event and its arguments.
		listener - the name of the listener being referenced
		method - the name of the listener method to invoke
		[resultKey] - the key to store the result of the method call in
		[resultArg] - the event arg to store the result of the method call in
-->
<!ELEMENT notify EMPTY>
<!ATTLIST notify 
	listener CDATA #REQUIRED
	method CDATA #REQUIRED
	resultKey CDATA #IMPLIED
	resultArg CDATA #IMPLIED
>

<!--
	An "event-arg" element will set an argument in the current event being handled.
	Either value or variable should be defined.
		name - the name of the arg to set in the event
		value - the value of the arg to set in the event
		[variable] - a variable to set as the value in the event
-->
<!ELEMENT event-arg EMPTY>
<!ATTLIST event-arg 
	name CDATA #REQUIRED
	value CDATA #IMPLIED
	variable CDATA #IMPLIED
	overwrite (true|false) "true"
>

<!--
	An "event-mapping" element will set a temporary mapping in the framework that
	will map one event (if announced) to another.
		event - the name of the event to map
		mapping - the name of the event to map to
		[module] - the name of the module of the event to map to
-->
<!ELEMENT event-mapping EMPTY>
<!ATTLIST event-mapping 
	event CDATA #REQUIRED
	mapping CDATA #REQUIRED
	mappingModule CDATA #IMPLIED
>

<!--
	A "view-page" element will invoke a view and optionally store the generated 
	content instead of outputting it.
		name - the name of the view being referenced
		[contentKey] - the key to store the content produced in (instead of outputting directly)
		[contentArg] - the event arg to store the content produced in (instead of outputting directly)
		[append] - whether to append content to the content key (or overwrite it)
-->
<!ELEMENT view-page EMPTY>
<!ATTLIST view-page 
	name CDATA #REQUIRED
	contentKey CDATA #IMPLIED
	contentArg CDATA #IMPLIED
	append CDATA #IMPLIED
>

<!--
	An "announce" element will broadcast an event to registered listeners.
		event - the event name to announce
		module - the module name to announce
		copyEventArgs - whether or not to copy the event args of the current event into the event being announced
-->
<!ELEMENT announce EMPTY>
<!ATTLIST announce
	event CDATA #REQUIRED
	module CDATA #IMPLIED
	copyEventArgs (true|false) "true"
>

<!--
	An "event-bean" element will create a bean in the event and populate the
	bean with properties from the event.
		name - the name of the bean in the event
		type - the type of the bean to create
		[fields] - the fields in the event to set in the bean
		[reinit] - allows you to reuse and repopulate the bean if it is available in the Event object
-->
<!ELEMENT event-bean EMPTY>
<!ATTLIST event-bean
	name CDATA #REQUIRED
	type CDATA #REQUIRED
	fields CDATA #IMPLIED
	reinit (true|false) "true"
>

<!--
	A "redirect" element will send a redirect.
		event - the event the redirect will relocate to
		module - the module the redirect will relocate to
		url - the url to redirect to
		args - a comma-delimited list of event args to attach to the redirect url
		[persist] - a boolean that allows you to persist complex event arguments across a redirect
		[persistArgs] - a list of event args to persist across a redirect (if empty quotes or not defined - entire event is persisted)
		[statusType] - the HTTP status code to that is sent on the redirect (permanent = 301, temporary = 302 [default], prg [post-redirect-get] = 303)
		
-->
<!ELEMENT redirect EMPTY>
<!ATTLIST redirect
	event CDATA #IMPLIED
	module CDATA #IMPLIED
	url CDATA #IMPLIED
	args CDATA #IMPLIED
	persist (true|false) "false"
	persistArgs CDATA #IMPLIED
	statusType (permanent|temporary|prg) "temporary"
>

<!--
	A "execute" element will execute a subroutine.
		name - the name of the subroutine being referenced
-->
<!ELEMENT execute (parameter*)>
<!ATTLIST execute 
	subroutine CDATA #REQUIRED
>

<!--
	A "publish" element will publish a message for listener subscriber.
		message - the name of message to be published
-->
<!ELEMENT publish EMPTY>
<!ATTLIST publish 
	message CDATA #REQUIRED
>

<!--
	An "cache" stores the result of a block of commands which put data in the event object or output data.
		cacheName - the name of the cache being referenced, this cacheName should match a cacheName specified in a CacheProperty
		[criteria] - a comma delimited list of event arguments that form the cache key.
-->
<!ELEMENT cache (filter | notify | event-arg | view-page | event-bean | execute | publish | cache-clear)*>
<!ATTLIST cache 
	id CDATA #IMPLIED
	name CDATA #IMPLIED
	alias CDATA #IMPLIED
	criteria CDATA #IMPLIED
>

<!--
	An "cache-clear" causes a cache to be completely cleared or clears a specific cache key through the use of the criteria attribute.
		cacheName - the name of the cache being referenced, this cacheName should match a cacheName specified in a CacheProperty
		[criteria] - a comma delimited list of event arguments that form the cache key.
		[condition] - a boolean expression that determines if the cache should be cleared
-->
<!ELEMENT cache-clear EMPTY>
<!ATTLIST cache-clear
	name CDATA #REQUIRED
	alias CDATA #IMPLIED
	criteria CDATA #IMPLIED
	condition CDATA #IMPLIED
>

<!--
	Broadly used tags.
-->
<!--
	"parameters"
		name - the name of the parameter
		value - the value of the parameter
-->
<!ELEMENT parameters (parameter*)>
<!ELEMENT parameter (value?, struct?, array?)>
<!ATTLIST parameter 
	name CDATA #REQUIRED
	value CDATA #IMPLIED
>

<!--
	Builds a "struct" via XML
		name - the name of the struct key
		[value] - the value of the struct key
-->
<!ELEMENT struct (key*)>
<!ELEMENT key (value?, struct?, array?)>
<!ATTLIST key 
	name CDATA #REQUIRED
	value CDATA #IMPLIED
>

<!--
	Builds a "array" via XML
		value - the value of the array element
-->
<!ELEMENT array (element*)>
<!ELEMENT element (value?, struct?, array?)>
<!ATTLIST element 
	value CDATA #REQUIRED
>

<!ELEMENT value (#PCDATA)>