Forked from andreisavu/brooklyn-dependent-entity-config.json
Created
July 26, 2012 15:18
-
-
Save ahgittin/3182649 to your computer and use it in GitHub Desktop.
Suggestions from Alex for Brooklyn dependent entitiy configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name":"web-and-db", | |
"entities":[{ | |
"type":"brooklyn.entity.webapp.ElasticJavaWebAppService", | |
"config":{ | |
"java.options":{ | |
"type":"Map", | |
"operation":"put", | |
"values":{ | |
"brooklyn.example.db.url":{ | |
"type":"DependentConfiguration", | |
"source":"mysql", | |
"sensor":"MySqlNode.MYSQL_URL", | |
"acceptRegex":".+", | |
"postprocessSed":"s/^(.+)$/jdbc:$1visitors?user=brooklyn&password=br00k11n/" | |
} | |
} | |
} | |
}, | |
"policy":{ | |
"type":"brooklyn.policy.ResizerPolicy", | |
"config":{ | |
"sensor":"cluster.reqs.persec.average", | |
"sizeLowerBound":1, | |
"sizeUpperBound":5, | |
"metricLowerBound":10, | |
"metricUpperBound":100 | |
} | |
}, | |
"comment":{ | |
"TODO: allow comment blocks (string or list of strings; ignored)", | |
"TODO: allow an EntityFactory to be used as type as well as Entity", | |
"TODO (?): for config of type Map allow operation on map (put or set)", | |
"TODO (?): for config value of type DependentConfiguration allow some magic (", | |
"note: the convention is that if there is a 'type' key in a map, we do special things", | |
"note: if a value is simple e.g. a string or number we do the obvious thing", | |
"TODO (?): for DependentConfiguration also allow accept and postprocess regexes (sed?)", | |
"TODO (?): accept any recognised config 'flag' directly in the outer block (to simplify things)" | |
} | |
}, | |
{ | |
"name":"mysql", | |
"type":"brooklyn.entity.database.mysql.MySqlNode", | |
"creationScriptUrl":"classpath://visitors-creation-script.sql" | |
}], | |
"locations":[ | |
"/v1/locations/0" | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application name="web-and-db"> | |
<!-- TODO allow/use XML? --> | |
<entities> | |
<!-- TODO allow an EntityFactory to be used as type as well as Entity --> | |
<entity type="brooklyn.entity.webapp.ElasticJavaWebAppService"> | |
<config> | |
<!-- TODO MapProperty and DependentProperty are interpreted specially --> | |
<MapProperty name="java.options" operation="put"> | |
<DependentProperty name="brooklyn.example.db.url"> | |
<source>mysql</source> | |
<sensor>mysql.url</sensor> | |
<accept type="regex">.+</accept> | |
<postprocess type="sed">s/^(.+)$/jdbc:$1visitors?user=brooklyn&password=br00k11n/</postprocess> | |
</<DependentProperty> | |
</MapProperty> | |
<config> | |
<policies> | |
<policy type="brooklyn.policy.ResizerPolicy"> | |
<property name="sensor">cluster.reqs.persec.average</property> | |
<property name="sizeLowerBound">1</property> | |
<property name="sizeUpperBound">5</property> | |
<property name="metricLowerBound">10</property> | |
<property name="metricUpperBound">100</property> | |
</policy> | |
</policies> | |
</entity> | |
<entity name="mysql" type="brooklyn.entity.database.mysql.MySqlNode"> | |
<config> | |
<!-- TODO support 'flag' as a shortcut for a property name? (has benefit of allowing some error checking too); | |
could do this above for policy also --> | |
<property flag="creationScriptUrl">classpath://visitors-creation-script.sql</property> | |
<config> | |
</entity> | |
</entities> | |
<locations> | |
<location id="/v1/locations/0"/> | |
</locations> | |
</application> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment