Skip to content

Instantly share code, notes, and snippets.

@randaalex
Created June 12, 2013 09:14
Show Gist options
  • Save randaalex/5763912 to your computer and use it in GitHub Desktop.
Save randaalex/5763912 to your computer and use it in GitHub Desktop.
default namespace sa = "http://apstandard.com/ns/1"
namespace local = ""
grammar {
start = Application
Application = element application {
## Version of APS format used
attribute version { "1.2" },
## Packaging date
attribute packaged { xsd:dateTime }?,
## Unique application identifier
element id { xsd:anyURI },
element name { text },
element version { text },
element release { text },
element homepage { xsd:anyURI }?,
## Reference on master package for add-on package
element master-package {
element package {
attribute id { xsd:anyURI },
attribute match { text } ?
}+
}?,
element vendor {
element name { attribute xml:lang { text }?,
text }+,
element homepage { attribute xml:lang { text }?,
xsd:anyURI }*,
element icon { attribute path { text } }?
}?,
element packager {
element name { attribute xml:lang { text }?,
text }+,
element homepage { attribute xml:lang { text }?,
xsd:anyURI }*,
element icon { attribute path { text } }?,
element uri { xsd:anyURI }?
}?,
element presentation {
element summary { attribute xml:lang { text }?,
text }*,
element description { attribute xml:lang { text }?,
text }*,
element icon { attribute path { text } }?,
element screenshot { attribute path { text },
element description {
attribute xml:lang { text }?,
text }+
}*,
element changelog {
element version { attribute version { text },
attribute release { text },
attribute date { xsd:dateTime }?,
element entry {
attribute xml:lang { text }?,
text }+
}*
}?,
element categories { element category { text }+ }?,
element languages { element language {
xsd:string { pattern = "[a-z]{2,3}" } }+ }?,
element extension { AnyElement* }?
}?,
element global-settings { ( Setting | SettingGroup )* }?,
element patch { attribute match { text },
attribute recommended { "true" }? } *,
element upgrade { attribute match { text },
attribute mode { "managed" | "backup" }? } *,
element content { ContentDeliveryMethod }?,
element provision { element verify-script { VerifyScript }? }?,
Service*
}
AnyElement = element * { attribute * { text }*,
( text | AnyElement)* }
ContentDeliveryMethod = DefinedByAspect
## Services
Service = element service {
attribute id { text },
attribute class { "account" |
"service" |
"ecommerce" |
text }?,
attribute singular { "true" }?,
element license { EULA }?,
element presentation { Presentation }?,
element settings { ( Setting | SettingGroup )* }?,
element resources { Resource * }?,
## Requirements specification [5.4.4]
element requirements {
element choice { element requirements { attribute id { text },
Requirement+ }+
}*,
Requirement*
}?,
element provision {
element when-chosen { attribute requirements-id { text },
ProvisionMethod+
}*,
ProvisionMethod+
}?,
Service*
}
## End-user license agreement
EULA = ( attribute must-accept { xsd:boolean },
( element free { empty } |
element commercial { empty } )?,
element text { attribute xml:lang { text }?,
element name { text }?,
( element url { xsd:anyURI } |
element file { text } )
}+
)
## GUI-related settings
Presentation =
## Textual description of the service
element name { attribute xml:lang { text }?, text }*,
element summary { attribute xml:lang { text }?, text }*,
element icon { attribute path { text } }?,
## Informational link specification [5.2.2]
element infolinks {
element link { attribute xml:lang { text }?,
attribute class { "official" |
"community" |
"howto" |
"support" |
"demo" |
text }?,
attribute href { xsd:anyURI },
text }+
}?,
element entry-points {
element entry { attribute class { "control-panel" |
"login" |
"frontpage" |
"check" |
text }?,
## URI templates are allowed
attribute dst { xsd:anyURI | text }?,
attribute method { "GET" |
"POST" |
text }?,
element label { attribute xml:lang { text }?,
text }+,
element description { attribute xml:lang { text }?,
text }*,
element icon { attribute path { text } }?,
## Optional parameters for using entry point
element variable { attribute name { text },
attribute class { "login" |
"password" |
"locale" |
text }?,
attribute value-of-setting
{ text }?,
text
}*,
element extension { AnyElement* }?
}+
}?,
element extension { AnyElement* }?
## Settings
div {
SettingGroup = element group { attribute class { "authn" |
"presentation" |
"web" |
"vcard" |
"type" |
text }?,
## groups with name of @class "type" are used to
## express hCard subproperties
# Due to XML Schema restrictions, distinct definitions were joined
element name { attribute xml:lang { text }?,
attribute class { "type" }?,
text }*,
## Nested anonymous groups are allowed for the sake of
## microformats compliance
( SettingGroup | Setting )*
}
Setting = element setting { attribute id { text },
attribute class { text }?,
attribute uniq { "global" | "application" | "instance" | "service" }?,
attribute uuid { xsd:anyURI | text }?,
attribute optional { "true" }?,
attribute visibility { "hidden" }?,
attribute protected { "true" }?,
attribute value-of-setting { text }?,
attribute generate { "sequence" | "uuid" | "random" | "password" }?,
( attribute installation-only { "true" } |
attribute track-old-value { "true" } )?,
element name { attribute xml:lang { text }?, text }*,
element description { attribute xml:lang { text }?, text }*,
element error-message { attribute xml:lang { text }?, text }*,
# Settings types
( ( attribute type { "boolean" },
attribute default-value { "true" | "false" }? )
| ( attribute type { "string" | "password" },
SettingTypeString,
attribute default-value { text }? )
| ( attribute type { "integer" },
SettingTypeInteger,
attribute default-value { xsd:integer }? )
| ( attribute type { "float" },
SettingTypeFloat,
attribute default-value { xsd:float }? )
| ( attribute type { "email" },
attribute default-value { text }? )
| ( attribute type { "domain-name" },
attribute default-value { text }? )
| ( attribute type { "host-name" },
attribute default-value { text }? )
| ( attribute type { "enum" },
attribute default-value { text }?,
element choice { attribute id { text },
element name { attribute xml:lang { text }?,
text }*
}+ )
| ( attribute type { "list" },
attribute list-order { "id" | "name" | "custom" }?,
attribute min-items { xsd:nonNegativeInteger }?,
attribute max-items { xsd:nonNegativeInteger }?,
## Possible list elements defined below
( ( attribute element-type { "string" },
SettingTypeString,
element default-value { text }* )
| ( attribute element-type { "integer" },
SettingTypeInteger,
element default-value { xsd:integer }* )
| ( attribute element-type { "float" },
SettingTypeFloat,
element default-value { xsd:float }* )
| ( attribute element-type { "email" },
element default-value { text }* )
| ( attribute element-type { "domain-name" },
element default-value { text }* )
| ( attribute element-type { "host-name" },
element default-value { text }* )
| ( attribute element-type { "enum" },
element default-value { text }*,
element choice {
attribute id { text },
element name { attribute xml:lang { text }?, text }*
}+ )
)
)
)
}
}
SettingTypeString = attribute min-length { xsd:nonNegativeInteger }?,
attribute max-length { xsd:nonNegativeInteger }?,
( attribute regex { text } |
attribute charset { text } )?
SettingTypeInteger = attribute min { xsd:integer }?,
attribute max { xsd:integer }?
SettingTypeFloat = attribute min { xsd:float }?,
attribute max { xsd:float }?
Requirement = DefinedByAspect
## Placeholder for aspect-specific URL handlers
UrlHandler = DefinedByAspect
## Aspect must use own namespace
DefinedByAspect = element * - ( sa:* | local:* ) {
attribute * { text }*,
( text | DefinedByAspect )*
}
## Provision specification
div {
ProvisionMethod = element url-mapping { UrlMapping } ? &
element configuration-script { ConfScript } ? &
element backup-script { BackupScript } ? &
element verify-script { VerifyScript } ? &
element resource-script { ResourceScript } ? &
DefinedByAspect*
## URL Mapping
UrlMapping = element default-prefix { xsd:string { minLength = "1" } }?,
element installed-size { xsd:nonNegativeInteger }?,
element site-root { empty }?,
element mapping { Mapping }*
Mapping = RegularMapping | VirtualMapping
RegularMapping =
attribute url { xsd:string { minLength = "1" } },
attribute path { xsd:string { minLength = "1" } }?,
attribute shared { "true" }?,
UrlHandler*,
element mapping { Mapping }*
VirtualMapping =
attribute url { xsd:string { minLength = "1" } },
(
attribute virtual { "virtual" } |
(
attribute virtual { "redirect" },
element href { xsd:anyURI }
)
),
element mapping { Mapping }*
## Generic script Script
BaseScript = attribute name { text },
attribute privileged { "true" }?,
( element script-language { text } |
element binary-executable { empty } )
## Configuration Script
ConfScript = BaseScript
& element status-control { empty }?
& element structured-output { empty }?
## Backup/Restore script
BackupScript = BaseScript &
element sufficient { empty }?
## Verify script
VerifyScript = BaseScript
& element structured-output { empty }?
## Resource script
ResourceScript = BaseScript &
## Hint to controller how often to poll for resource usage
## examples: 30m or 2h or 1d
attribute poll-interval { xsd:string { pattern = "(\d+m)|(\d+h)|(\d+d)?" } }?
}
## Resource specification
div {
## Resource definition
Resource = element resource {
## Unique resource identifier
attribute id { text },
## Resource class represents basic idea what is measured by that resource
attribute class { "item" | "b" | "kb" | "mb" | "gb" | text },
## Limiting setting hints to controller what setting limits that resource
attribute limiting-setting { text }?,
## Resource name
element name { attribute xml:lang { text }?, text }+,
## Resource description
element description { attribute xml:lang { text }?, text }*
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment