DPML
DPML Metro: Context Directive
HomeUtilitiesStationMetro
Context Directive
Description

Declaration of the initial context model state together including context entry key/value bindings. A context directive typically contains a series of <entry> directives where each directive asserts a default inital value for a context entry key. Any required context entry declared by a component must be associated with a context entry directive. Failure to provide context entry directives for all required context keys will result in a deployment failure.

Context Nested Elements
entry The entry element may contain 0..n nested <entry> directives. A entry directive allows the creation by (value or reference) of a value associated with a context entry key.
context If the context entry return type is itself a context interface then the context element may be supplied as the value solution.
map Nested entries are used to construct an instance of java.util.Map. If the entry class attribute is not null, the constructed map will be used as a constructor argument to the class declared by the class attribute.
Examples
General Example

The following example demonstrates a variety of context entry directives including the usage of symbolic values, static field references, direct value creation, composite value creation, and service wiring.

<context>
  <entry key="name" value="${user.name}"/>
  <entry key="printer" lookup="org.acme.Printer"/>
  <entry key="background" method="RED"/>
  <entry key="foreground">
    <param class="float" value="100"/>
    <param class="float" value="200"/>
    <param class="float" value="0"/>
  </entry>
  <entry key="widget" class="org.acme.DefaultWidget">
    <param class="org.acme.DefaultGizmo">
      <param class="float" value="0"/>
      <param class="int" value="1024"/>
    </param>
  </entry>
</context>