Power Tip: Configurable Properties

DDMSence exposes some properties, such as the namespace prefixes used for each XML namespace, so they can be configured by the end user. For example, if you are building components from scratch, and you wish to use "ic" as a namespace prefix for the Intelligence Community namespace instead of "ISM", you would set the "ism.prefix" property with a custom value of ic.

PropertyReader.setProperty("ism.prefix", "ic");

Figure 1. Command to change a configurable property.

If you are using DDMSence in a multithreaded environment, be aware that each running Thread has its own local PropertyReader. Changing properties in one Thread will not impact or overwrite properties in another Thread.

Only the subset of properties listed below can be set programmatically. Attempts to change other DDMSence properties will result in an exception.

Property NameDescriptionDefault Value
ddms.prefixDefault DDMS prefix used when generating components from scratchddms
gml.prefixDefault GML prefix used when generating components from scratchgml
ism.prefixDefault ISM prefix used when generating components from scratchISM
ntk.prefixDefault NTK prefix used when generating components from scratchntk
output.json.inlineAttributesRenders attributes with other component properties, rather than in a separate enclosurefalse
output.json.prettyPrintOutputs JSON strings with whitespace and indentationfalse
output.indexLevelControls the placement of 1-based indices on the HTML/Text output of fields which are allowed to have multiples (0 = Never use, 1 = Use unless exactly 1 item exists, 2 = Always use)0
sample.dataDefault data directory used by sample applicationsdata/sample/
tspi.prefixDefault TSPI prefix used when generating components from scratchtspi
virt.prefixDefault VIRT prefix used when generating components from scratchvirt
xlink.prefixDefault XLink prefix used when generating components from scratchxlink
xml.transform.TransformerFactoryXSLT Engine class name, for Schematron validationnet.sf.saxon.TransformerFactoryImpl

Table 1. Configurable Properties

Controlling JSON Output

The output.json.inlineAttributes property renders attribute groups inline with the parent component. Normally, related attributes are enclosed together, matching the class hierarchy of DDMSence. Setting this property to true removes the enclosure. The examples below show the expected output when this property is set to true or false, respectively:

{
  "security": {
    "excludeFromRollup": true,
    "classification": "U",
    "ownerProducer": [
      "USA"
    ]
  }
}

Figure 2. The JSON output of a Security component, with output.json.inlineAttributes set to true.

{
  "security": {
    "excludeFromRollup": true,
    "securityAttributes": {
      "classification": "U",
      "ownerProducer": [
        "USA"
      ]
    }
  }
}

Figure 3. The JSON output of a Security component, with output.json.inlineAttributes set to false.

The output.json.prettyPrint property applies pretty-printing to a JSON string, via the google-gson library. The examples below show the expected output when this property is set to true or false, respectively:

    {
      "qualifier": "http://purl.org/dc/elements/1.1/language",
      "value": "en"
    }

Figure 4. The JSON output of a Language component, with output.json.prettyPrint set to true.

{"qualifier":"http://purl.org/dc/elements/1.1/language","value":"en"}

Figure 5. The JSON output of a Language component, with output.json.prettyPrint set to false.

Controlling HTML/Text Output

The DDMS specification has no convention for the HTML/Text output of fields which might have multiple values, such as the name and phone number fields on a person. DDMSence optionally adds indices to the names of these values, based on the value of the output.indexLevel property. The example below shows a sample XML instance, and the expected output at each indexLevel:

<ddms:creator>
   <ddms:person>
      <ddms:name>Brian</ddms:name>
      <ddms:name>BU</ddms:name>
      <ddms:surname>Uri</ddms:surname>
      <ddms:phone>703-885-1000</ddms:phone>
   </ddms:person>
</ddms:creator>

Figure 6. A sample XML instance representing a creator with 2 names and 1 phone number.

creator.name: Brian
creator.name: BU
creator.surname: Uri
creator.phone: 703-885-1000

Figure 7. The Text output of this creator when output.indexLevel is 0

creator.name[1]: Brian
creator.name[2]: BU
creator.surname: Uri
creator.phone: 703-885-1000

Figure 8. The Text output of this creator when output.indexLevel is 1

creator.name[1]: Brian
creator.name[2]: BU
creator.surname: Uri
creator.phone[1]: 703-885-1000

Figure 9. The Text output of this creator when output.indexLevel is 2

Back to Top
Back to Power Tips