I guess there are "more things in heaven and earth, Greg,than are dreamt of in our philosophy" since it seems what I was after for native property default values is already there (3.4.10 build 9605)! Alex?
The rationale for this approach is that, in order to create the required "Dynamically settable configuration placeholder" type, the combination of commands (provided by all Managed-Entity sub-types) and at least two string type properties (one to hold the placeholder's substitution token, and one for its value) is all that's required.
Fortunately, the Deployment type has four type properties to choose from:
deployment-basedir
deployment-install-root
deployment-runlevel
deployment-startup-rank
I first created the Placeholder "base" type that eliminates all of Deployment's allowed resources and establishes the two type property attribute names:
[anthony@services modules]$ cat Placeholder/type.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
This document is used to define one or more Types.
For reference, see: http://wiki.controltier.org/wiki/Type-v10.xml
-->
<types
xmlns:module="http://open.controltier.com/base/Modules#"
xmlns:type="http://open.controltier.com/base/Types#"
xmlns:cmd="http://open.controltier.com/base/Modules/Commands#">
<!-- The type element defines a Type and command module. -->
<type
name="Placeholder"
role="concrete"
uniqueInstances="true">
<!-- description of the Type -->
<description>Dynamically settable configuration placeholder</description>
<supertype>
<!-- supertype/typereference: defines the supertype of the Type -->
<typereference name="Deployment"/>
</supertype>
<command-settings>
<!-- command-settings: properties of the command module -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#command-settings -->
<notification notify="false"/>
<template-directory></template-directory>
<dependency-view parents="false" children="true" proximity="1"/>
<logger name="Placeholder"/>
</command-settings>
<attributes>
<!-- Define attributes of the Type here -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#attributes -->
<attribute name="placeholderValue" type-property="deployment-basedir"/>
<attribute name="placeholderToken" type-property="deployment-install-root"/>
</attributes>
<constraints>
<!-- Define constraints of the Type here -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#constraints -->
<dependency-constraint enforced="false" kind="child">
<allowedtypes>
</allowedtypes>
<singletontypes>
</singletontypes>
</dependency-constraint>
<dependency-constraint enforced="false" kind="parent">
<allowedtypes>
<typereference name="Deployment"/>
<typereference name="Node"/>
</allowedtypes>
</dependency-constraint>
</constraints>
<commands>
<!-- Define commands here -->
<!-- See the Documentation on the ControlTier Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#commands -->
</commands>
</type>
<!--
Multiple <type> elements are allowed.
-->
</types>
I then created a Placeholder sub-type that uses the allowed-value constraint to setup default values for both type properties and hence their attributes.
[anthony@services modules]$ cat MyPlaceholder/type.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
This document is used to define one or more Types.
For reference, see: http://wiki.controltier.org/wiki/Type-v10.xml
-->
<types
xmlns:module="http://open.controltier.com/base/Modules#"
xmlns:type="http://open.controltier.com/base/Types#"
xmlns:cmd="http://open.controltier.com/base/Modules/Commands#">
<!-- The type element defines a Type and command module. -->
<type
name="MyPlaceholder"
role="concrete"
uniqueInstances="true">
<!-- description of the Type -->
<description>A specific type of placeholder</description>
<supertype>
<!-- supertype/typereference: defines the supertype of the Type -->
<typereference name="Placeholder"/>
</supertype>
<command-settings>
<!-- command-settings: properties of the command module -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#command-settings -->
<notification notify="false"/>
<template-directory></template-directory>
<dependency-view parents="false" children="true" proximity="1"/>
<logger name="MyPlaceholder"/>
</command-settings>
<attributes>
<!-- Define attributes of the Type here -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#attributes -->
</attributes>
<constraints>
<!-- Define constraints of the Type here -->
<!-- See Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#constraints -->
<allowedvalue-constraint enforced="false" type-property="deployment-basedir">
<allowedvalue value="myplaceholdervalue" default="true"/>
</allowedvalue-constraint>
<allowedvalue-constraint enforced="false" type-property="deployment-install-root">
<allowedvalue value="myplaceholdertoken" default="true"/>
</allowedvalue-constraint>
</constraints>
<commands>
<!-- Define commands here -->
<!-- See the Documentation on the ControlTier Wiki: -->
<!-- http://wiki.controltier.org/wiki/Type-v10.xml#commands -->
</commands>
</type>
<!--
Multiple <type> elements are allowed.
-->
</types>
Note that by not enforcing the allowed value constraint, the door is still open to assign any value to the properties (although, in some cases, such enforcement will be very useful).
Finally, I created an instance of MyPlaceholder and examined the set of properties. Low and behold:
[anthony@services modules]$ ctl -p anthony -t MyPlaceholder -o myMyPlaceholder -c Properties -- -format plain | fgrep deployment-
entity.deployment-basedir=myplaceholdervalue
entity.deployment-install-root=myplaceholdertoken
entity.deployment-manages=false
entity.deployment-startup-rank=
[anthony@services modules]$ ctl -p anthony -t MyPlaceholder -o myMyPlaceholder -c Properties -- -format plain | fgrep entity.attribute.placeholder
entity.attribute.placeholderToken=myplaceholdertoken
entity.attribute.placeholderValue=myplaceholdervalue
Bloody hell is all I can say! Bingo! Perhaps Alex knows something we don't about this neck of the woods ...
Looking forward; the way is open to implementing commands (e.g. getPlaceholder, setPlaceholder, validatePlaceholder, etc) that manage the value and token attribute values for a given instance. I envisage managing sets of placeholders as resources of deployments in a similar manner to how we work with packages.
Sweet.
Anthony.