<document>
  <header>
    <product>resin</product>
    <title>Resin Environment Relax-NG Schema</title>
    <version>Resin 3.0</version>
    <description>
      <p>The formal definition for the Resin environment configuration.</p>
    </description>
  </header>

  <body>
    <summary/>

<section title="Relax-NG Schema">

<def title="com/caucho/server/resin/env.rnc">
namespace local = ""
namespace L = ""
default namespace r = "http://caucho.com/ns/resin"

namespace rcore = "http://caucho.com/ns/resin/core"

include "../resin/resin-j2ee.rnc"

r_boolean-Type =
  "true"
  | "false"
  | "yes"
  | "no"

r_jndi = string
r_int = string
r_period = string
r_kbytes = string

r_path-Type =  string
r_int-Type = string
r_period-Type = string
r_kbytes-Type = string
r_jndi-Type = string
r_class-Type = string

r_any-Group = text | (attribute * {string} | element * { r_any-Group })*

## The basic environment tags
r_env-Basis =
  r_authenticator*

  & r_case-insensitive?

  & r_character-encoding?

  & r_cluster?

  & r_cluster-definition*

  & r_connector*

  & r_ejb-server*

  & r_env-entry*

  & r_database*

  & r_dependency*

  & r_dependency-check-interval?

  & r_grant*

  & rcore_import*

  & rcore_include*

  & r_javac?

  & r_jndi-link*

  & r_log*

  & r_reference*

  & r_resource*

  & r_resource-deploy*

  & r_stderr-log?

  & r_stdout-log?

  & r_system-property*

  & r_temp-dir?

  & r_work-dir?

  & rcore_log*

  & rcore_set*

  & rcore_include*

## The environment, including control structures
r_env-Flow =
  r_env-Basis

  & element rcore:env { r_class-loader-Group, r_env-Flow }*

  & element rcore:if { rcore_if-Args, r_env-Flow }*

  & element rcore:choose {
      element rcore:when { rcore_when-Args, r_env-Flow }+,
      element rcore:otherwise { r_env-Flow }?
    }*

## The environment contents
r_env-Content = r_env-Flow

r_authenticator = element authenticator {
  r_jndi-name?,

  r_type,

  r_init?
}

r_arg = element arg { r_any-Group }

r_case-insensitive =
  attribute case-insensitive { r_boolean-Type }
  | element case-insensitive { r_boolean-Type }

r_character-encoding =
  attribute character-encoding { string }
  | element character-encoding { string }

r_class = attribute class { string } | element class { string }

r_class-loader = element class-loader {
  r_simple-loader*

  & r_library-loader*

  & r_compiling-loader*

  & r_enhancer*

  & r_make-loader*

  & r_servlet-hack?

  & r_tree-loader*
}

r_class-loader-Group =
  r_class-loader?

r_cluster = element cluster {
  r_cluster-ref

  | (attribute id { string }?

     & (r_cluster-port* | r_cluster-group*)

     & r_cluster-store?)
}

r_cluster-definition = element cluster-definition {
  attribute id { string },

  (r_cluster-port* | r_cluster-group*)
}

r_cluster-group = element group {
  r_cluster-port*
}

r_cluster-ref =
  (attribute cluster-ref { string } | element cluster-ref { string })

r_cluster-store = element cluster-store {
  r_jndi-name?

  & ((attribute path { string } | element path { string })

    | ((attribute type { string} | element type { string })

      & r_init*)
    )

  & (attribute always-load { string } | element always-load { string })?

  & (attribute always-save { string } | element always-save { string })?
}

r_cluster-port-Content =
  (attribute id { string }
   | attribute server-id { string }
   | element server-id { string })?

  & (attribute backup { string } | element backup { string })?

  & (attribute dead-time { r_period } | element dead-time { r_period })?

  & (attribute host { string } | element host { string })?

  & (attribute index { string } | element index { string })?

  & (attribute live-time { r_period } | element live-time { r_period })?

  & (r_openssl | r_jsse-ssl)?

  & (attribute port { string } | element port { string })

  & (attribute protocol { string } | element protocol { string })?

  & (attribute socket-listen-backlog { r_int-Type }
     | element socket-listen-backlog { r_int-Type })?

  & (attribute tcp-no-delay { r_boolean-Type }
     | element tcp-no-delay { r_boolean-Type })?

  & (attribute timeout { r_period } | element tcp-no-delay { r_period })?

r_cluster-port =
  element port { r_cluster-port-Content }
  | element srun { r_cluster-port-Content }

r_compiling-loader = element compiling-loader {
  r_path

  & (attribute args { string }
     | element args { string })*

  & (attribute batch { string }
     | element batch { string })?

  & (attribute encoding { string }
     | element encoding { string })?

  & (attribute require-source { r_boolean-Type }
     | element require-source { r_boolean-Type })?

  & (attribute source { r_path-Type }
     | element source { r_path-Type })?

  & (attribute source-extension { string }
     | element source-extension { string })?

  & (attribute compiler { string }
     | element compiler { string })?
}

r_connection-factory = element connection-factory {
  r_jndi-name

  & r_type?

  & r_init?

  & (attribute local-transaction-optimization { r_boolean-Type }
     | element local-transaction-optimization { r_boolean-Type })?

  & (attribute shareable { r_boolean-Type }
     | element shareable { r_boolean-Type })?
}

r_connector = element connector {
  r_type,

  r_resource-adapter?,

  (r_connection-factory*

   & r_connector-message-listener*

   & r_connector-resource*)
}

r_connector-message-listener = element message-listener {
  r_type?,

  r_init?,

  r_endpoint-factory
}

r_connector-resource = element resource {
  r_jndi-name?,

  r_type?,

  r_init?
}

r_database = element database {
  r_jndi-name

  & r_driver+

  & (attribute user { string }
     | element user { string })?

  & (attribute password { string }
     | element password { string })?

  & (attribute connection-wait-time { r_period }
     | element connection-wait-time { r_period })?

  & (attribute max-active-time { r_period }
     | element max-active-time { r_period })?

  & (attribute max-connections { r_int }
     | element max-connections { r_int })?

  & (attribute max-create-connections { r_int }
     | element max-create-connections { r_int })?

  & (attribute max-idle-time { r_period }
     | element max-idle-time { r_period })?

  & (attribute max-overflow-connections { r_int }
     | element max-overflow-connections { r_int })?

  & (attribute max-pool-time { r_period }
     | element max-pool-time { r_period })?

  & (attribute ping { r_boolean-Type }
     | element ping { r_boolean-Type })?

  & (attribute ping-table { string }
     | element ping-table { string })?

  & (attribute ping-query { string }
     | element ping-query { string })?

  & (attribute ping-interval { r_period }
     | element ping-interval { r_period })?

  & (attribute prepared-statement-cache-size { r_int }
     | element prepared-statement-cache-size { r_int })?

  & (attribute save-allocation-stack-trace { r_boolean-Type }
     | element save-allocation-stack-trace { r_boolean-Type })?

  & (attribute spy { r_boolean-Type }
     | element spy { r_boolean-Type })?

  & (attribute transaction-timeout { r_period }
     | element transaction-timeout { r_period })?

  & (attribute xa { r_boolean-Type }
     | element xa { r_boolean-Type })?
}

r_data-source =
  attribute data-source { string }
  | element data-source { string }

r_dependency = element dependency {
  (attribute path { string }
   | element path { string })
}

r_dependency-check-interval =
  attribute dependency-check-interval { r_period }
  | element dependency-check-interval { r_period }

r_driver = element (driver|backup-driver) {
  (r_type,

   r_any-Group?)

  | r_data-source
}

r_endpoint-factory = element endpoint-factory {
  r_type,

  r_init?
}

rcore_env-Args =
  r_class-loader?

r_ejb-server = element ejb-server {
  r_jndi-name?

  & (attribute auto-compile { r_boolean-Type }
     | element auto-compile { r_boolean-Type })?

  & (attribute ejb-descriptor { string }
     | element ejb-descriptor { string })?

  & (attribute create-database-schema { r_boolean-Type }
     | element create-database-schema { r_boolean-Type })?

  & (attribute cache-size { r_int }
     | element cache-size { r_int })?

  & (attribute cache-timeout { r_period }
     | element cache-timeout { r_period })?

  & (attribute data-source { r_jndi }
     | element data-source { r_jndi })?

  & (attribute config-directory { r_path-Type }
     | element config-directory { r_path-Type })?

  & (attribute ejb-jar { r_path-Type }
     | element ejb-jar { r_path-Type })*

  & (attribute forbid-jvm-call { r_boolean-Type }
     | element forbid-jvm-call { r_boolean-Type })?

  & (attribute jdbc-isolation { string }
     | element jdbc-isolation { string })?

  & (attribute resin-isolation { string }
     | element resin-isolation { string })?

  & (attribute startup-mode { string }
     | element startup-mode { string })?

  & (attribute transaction-timeout { r_period }
     | element transaction-timeout { r_period })?

  & (attribute validate-database-schema { r_boolean-Type }
     | element validate-database-schema { r_boolean-Type })?

  & (attribute jms-connection-factory { string }
     | element jms-connection-factory { string })?
}

r_encoding =
  attribute encoding { string }
  | element encoding { string }

r_enhancer = element enhancer {
  r_resin-type,

  r_any-Group*
}

r_enhancing-loader = element enhancing-loader {
  r_path

  & r_enhancer*
}

r_fileset = element fileset {
  (attribute dir { r_path-Type }
   | element dir { r_path-Type })

  & r_fileset-exclude*

  & r_fileset-include*
}

r_fileset-exclude = element exclude {
  attribute name { string }
  | element name { string }
}

r_fileset-include = element include {
  attribute name { string }
  | element name { string }
}

r_formatter = element formatter {
  r_resin-type,

  r_any-Group
}

r_grant = element grant {
  r_permission*
}

r_handback =
  attribute handback { string }
  | element handback {
      r_resin-type,
      r_any-Group
    }

r_handler = element handler {
  r_resin-type,

  r_any-Group
}

rcore_if-Args =
  attribute test { string }

rcore_include =
  element rcore:include {
    attribute path { string }
    | attribute href { string }
  }
  | element resin:include {
    attribute path { string }
    | attribute href { string }
  }

rcore_import = element rcore:import {
  ((attribute path { string }
    | element path { string })

   | r_fileset)

  & (attribute optional { string }
     | element optional { string })?
}

r_init = element init {
  r_any-Group
}

r_init-param-Content = 
  r_description*,

  (((attribute param-name { string } | element param-name { string }),
    (attribute param-value { string } | element param-value { string }))
   | attribute * { string }
   | element * - (param-name | param-value | r_description) { string })*

r_init-param = element init-param {
  r_init-param-Content
}

r_javac = element javac {
  (attribute compiler { string }
   | element compiler { string })

   & (attribute args { string }
      | element args { string })?

   & (attribute encoding { string }
      | element encoding { string })?
}

r_jndi-link = element jndi-link {
  r_jndi-name

  & (attribute factory { string }
     | element factory { string })?

  & (attribute foreign-name { string }
     | element foreign-name { string })?

  & r_init-param*
}

r_jndi-name =
  attribute jndi-name { string }
  | element jndi-name { string }

r_jsse-ssl = element jsse-ssl {
  (attribute key-store-file { string }
   | element key-store-file { string })

  & (attribute password { string }
     | element password { string })

  & (attribute key-store-type { string }
     | element key-store-type { string })?

  & (attribute ssl-context { string }
     | element ssl-context { string })?

  & (attribute key-manager-factory { string }
     | element key-manager-factory { string })?
}

r_openssl = element openssl {
  (attribute certificate-file { string }
   | element certificate-file { string })

  & (attribute password { string }
     | element password { string })

  & (attribute ca-certificate-file { string }
     | element ca-certificate-file { string })?

  & (attribute ca-certificate-path { string }
     | element ca-certificate-path { string })?

  & (attribute certificate-chain-file { string }
     | element certificate-chain-file { string })?

  & (attribute certificate-key-file { string }
     | element certificate-key-file { string })?

  & (attribute cipher-suite { string }
     | element cipher-suite { string })?

  & (attribute protocol { string }
     | element protocol { string })?

  & (attribute session-cache { r_boolean-Type }
     | element session-cache { r_boolean-Type })?

  & (attribute session-cache-timeout { r_period }
     | element session-cache-timeout { r_period } )?

  & r_verify-client?

  & (attribute verify-depth { r_int }
     | element verify-depth { r_int })?
}

r_library-loader = element library-loader {
  r_path

  | r_fileset
}

rcore_log = element rcore:log {
  string
}

r_log = element log {
  r_logger-Content?

  & r_logger*

  & (r_handler | r_log-Content)

  & (r_formatter
     | (attribute format { string }
        | element format { string }))?
}

r_log-Content =
  (attribute path { r_path-Type }
   | element path { r_path-Type })

  & (attribute archive-format { string }
     | element archive-format { string })?

  & (attribute rollover-period { r_period }
     | element rollover-period { r_period })?

  & (attribute rollover-size { r_kbytes }
     | element rollover-size { r_kbytes })?

  & (attribute rollover-count { r_kbytes }
     | element rollover-count { r_kbytes })?

  & (attribute timestamp { string }
     | element timestamp { string })?


r_logger = element logger {
  r_logger-Content
}

r_logger-Content =
  (attribute name { string }
   | element name { string })

  & (attribute level { string }
     | element level { string })?

  & (attribute use-parent-handlers { r_boolean-Type }
     | element use-parent-handlers { r_boolean-Type })?

r_make-loader = element make-loader { r_any-Group }

r_mbean = element mbean {
  r_name,

  (r_type,

   r_arg*)?,

  (r_init*

   & r_mbean-listener*)
}

r_mbean-name = 
  attribute mbean-name { string }
  | element mbean-name { string }

r_mbean-interface = 
  attribute mbean-interface { string }
  | element mbean-interface { string }

r_mbean-listener = element mbean-listener {
  r_mbean-name,

  r_handback*
}

r_name =
  attribute name { string }
  | element name { string }

r_path =
  attribute path { r_path-Type }
  | element path { r_path-Type }

r_permission = element permission {
  r_type,

  r_arg*
}

r_reference = element reference {
  r_jndi-name,

  (attribute factory { string  } | element factory { string }),

  r_init-param*
}

r_resin-type =
  attribute rcore:type { string }
  | attribute resin:type { string }

r_resource = element resource {
  (r_jndi-name?

   & r_mbean-name?

   & r_mbean-interface?),

  (r_type,

   r_arg*)?,

  (r_init*

   & (attribute local-transaction-optimization { r_boolean-Type }
      | element local-transaction-optimization { r_boolean-Type })?

   & r_mbean-listener*

   & (attribute shareable { r_boolean-Type }
      | element shareable { r_boolean-Type })?
  )
}

r_resource-adapter = element resource-adapter {
  r_jndi-name?,

  r_init?
}

r_resource-deploy = element resource-deploy {
  (attribute path { string }
   | element path { string })

  & (attribute expand-path { string }
     | element expand-path { string })?
}

r_servlet-hack =
  attribute servlet-hack { r_boolean-Type }
  | element servlet-hack { r_boolean-Type }

rcore_set = element rcore:set {
  attribute * { string }+
}
  
r_simple-loader = element simple-loader {
  r_path,

  (attribute prefix { string }
   | element prefix {string})?
}

r_stderr-log = element stderr-log {
  r_log-Content
}

r_stdout-log = element stdout-log {
  r_log-Content
}

r_system-property = element system-property {
  (attribute * { string })+
}

r_temp-dir =
  attribute temp-dir { r_path-Type }
  | element temp-dir { r_path-Type }

r_tree-loader = element tree-loader {
  r_path
}

r_type =
  attribute type { string }
  | element type { string }

r_verify-client =
  attribute verify-client { r_verify-client-Type }
  | element verify-client { r_verify-client-Type }

r_verify-client-Type =
  "optional-no-ca"
  | "optional"
  | "require"

rcore_when-Args =
  attribute test { string }

r_work-dir =
  attribute work-dir { r_path-Type }
  | element work-dir { r_path-Type }
</def>
</section>

  </body>
</document>
  
