Managed-Entity
Represents an abstract manageable object.
Overview
Managed-Entity:
Represents an abstract manageable object.
A Managed-Entity represents any resource that can benefit from or require a management interface. No assumption is made about how or where Managed-Entity is applied but its effective use has been found for a wide variety of administration tasks.
The Managed-Entity type defines an abstraction useful for automating tasks such as control, configuration and measurement.
- control: Control operations are defined as "commands". Managed-Entity establishes several basic commands useful for bootstrapping and other basic administration needed by by the CTL framework. Users can override the base commands and or define additional commands.
- configuration: Configuration information falls into two general categories: attributes and dependencies. Attributes : Characteristics about the Managed-Entity itself are described as a named property called an attribute. An attribute can have a default value defined at the type level but overriden at the instance level. Dependencies : A Managed-Entity can aggregate other Managed-Entities to form composition hierarchies. Dependency relationships are characterized as either parent and child.
- measurement: The managed object may have statistical data and metrics available at run time or accumulate over time.
Control Hierarchy
Composed Managed-Entities represent a control hierarchy. Under this arrangement, a top level Managed-Entity dispatches actions to its child Managed-Enitity dependencies and each child Managed-Entity in turn dispatches that same action to their own children. This dispatching pattern is easiest when it is the same command names and arugments passed down the hierarchy (eg, polymorphic).
Model
The Managed-Entity can also be used as a low-level conceptual model from which higher order models can be defined. Higher order models are established by defining subtypes of Managed-Entity that are domain specific and work together via pre-defined control workflows.
Design
- Super Type
- Assembly
| Role | Abstract. (Objects cannot be created.) |
| Instance Names | Unique |
| Notification | false |
| Template Directory | ${module.dir}/templates |
| Data View | Children, proximity: 1 |
| Logger Name | Managed-Entity |
Constraints
No constraints
Attributes
Managed-Entity declares several basic attributes.
Defaults for Imported Attributes
| Name | Default | Description |
|---|---|---|
| dirlist | bin,logs,var | List of subdirectories to create |
Commands
Managed-Entity is a base type establishing several adminstrative operations. Your subtypes will declare additional actions. See the Developing a module page for instructions on creating subtypes and defining commands.
Get-Properties
Gets the properties for the object.
Retrieves the configuration data for the Managed-Entity object. This data is made accessible to your command execution context.
Access
Managed-Entity includes this base implementation for accessing and storing property data driven by the following two parameters.
- entity.properties.file: This property references the file where property data will be stored. By default it is stored as ${entity.instance.dir}/var/entity.properties.
- entity.properties.url: This property references a URL that can be used to retrieve the file.
The locations for either property above can be modified via the framework configuration file, ${antdepo.base}/etc/entity.properties.
For efficiency sake, this implementation uses a timestamp check to compare if the ${entity.properties.url} is newer than ${entity.properties.file}, and if so, will download a new copy.
Data Format
CTL uses Java properties as its own data format but you are not required to follow that convention. Since it is only your commands that load and interpret the data, you are free to choose alternative formats such as XML, YAML, CSV, etc.
If you do choose, another format, be sure to override the Properties command to provide a pretty format for it.
- Usage
- Get-Properties [-destfile <>] [-force] [-noexpand] [-print]
Options
| Option | Description |
|---|---|
| destfile |
file to save property data
If the property is unset, the data will be saved to the value of ${entity.properties.file}. |
| force | Remove old properties file first |
| noexpand |
Do not expand the property values
Normally, the data is expanded to resolve any embeded property references. This is generally preferable but can be avoided if -noexpand flag is used. |
| flag specifying Properties command should run after properties are saved |
Get-Supers
Gets the supertype module.
Looks up supertype module for the given module and for each one found, requests and installs it via Install-Module.
- Usage
- Get-Supers [-depot <>] [-module <>]
Options
| Option | Description |
|---|---|
| depot | project depot |
| module | module name |
Install-Module
Installs the specified module.
Installs the specified module. Downloads from the repository and extracts it.
Access
Managed-Entity includes this base implementation for retrieving and installing modules driven by the following two parameters.
- modules.dir: This property references the directory where the module archive will be extracted.
- modules.url: This property references a base URL that can be used to retrieve the modules archives from a repository.
The locations for either property above can be modified via the framework configuration file, ${antdepo.base}/etc/modules.properties.
For efficiency sake, this implementation uses a timestamp check to compare if the module archive found in ${modules.url} is newer than the locally installed one, and if so, will download a new copy and install the new one.
- Usage
- Install-Module [-depot <>] [-downloaddir <${framework.var.dir}/tmp/downloads/${context.depot}>] [-module <>] [-modulesurl <>] [-version <head>]
Options
| Option | Description |
|---|---|
| depot | project depot |
| downloaddir | destination directory where module jars are downloaded |
| module | module name |
| modulesurl |
base uri where published modules are staged
This command uses this URL base to construct a URL that includes the module name and version. The URL format is: ${opts.modulesurl} +"/" + ${opts.module}+"-"+${opts.version}+".jar" |
| version |
required module version
Modules have a version associated with them and in archive form have a version identifier. Typically, these are numeric but by CTL convention one may also use the version named "head" to represent the latest version. |
Install
Initializes object workspace.
This command creates the directory referenced ${entity.instance.dir}, calls Install-Module, and then Get-Properties.
Since it is a bootstrapping command it can be run outside of an object context if the the necessary flags are supplied.
static: This command can be run outside of an object context.
- Usage
- Install [-basedir <>] [-depot <>] [-name <>] [-nodir] [-nomodule] [-noproperties] [-subdirs <bin,conf,logs,var>] [-type <>]
Options
| Option | Description |
|---|---|
| basedir | base directory |
| depot |
object depot
Not required unless run outside of object context for bootstrapping. |
| name |
object name
Not required unless run outside of object context for bootstrapping. |
| nodir |
do not create directories
If specified the ${entity.instance.dir} directory is not created. |
| nomodule |
do not update module
If specified the Install-Module command is not executed. |
| noproperties |
do not update properties
If specified the Get-Properties command is not executed. |
| subdirs | directory list |
| type |
object type
Not required unless run outside of object context for bootstrapping. |
Properties
Prints out entity properties.
This command reads the information generated by Get-Properties command and prints it to the console using the specified format.
- Usage
- Properties [-detail] [-file <>] [-format <pretty>]
Options
| Option | Description |
|---|---|
| detail |
print more detail
This flag works in conjunction with the -format pretty flag and signifies to show properties besides those of this entity. |
| file | file containing property data |
| format |
output format. pretty or plain
Two formats are defined:
|
Purge
Removes the object.
Moves the object entity.instance.dir from the depot and into the depot archive.
- Usage
- Purge



