This chapter contains information on how to use mvPath. It includes complete mvPath syntax and copious examples of its use.
Several CLI commands use mvPath expressions to refer to containers and properties.
mvPath is similar to XPath, but is designed specifically for navigating the data hierarchy in Application Configuration Console. If you're not familiar with XPath but have experience typing directory and file names at a DOS or UNIX command prompt, you should find mvPath intuitive.
All mvPath expressions refer to a context, which you can usually think of as the current location in the data hierarchy.
mvPath is an expression language for referring to objects in Application Configuration Console such as containers and properties. In Application Configuration Console you use mvPath when specifying variables and constraints, when using the command line interface, and when writing your own scripts.
The mvPath view of configuration data is simple: everything is a container except for properties and metadata. Projects, environments, layers, folders, assets, configurations, views, configuration elements -- they're all containers. Both containers and properties can have metadata, and properties and metadata can have values.
You use mvPath to navigate up and down the hierarchy of containers. All mvPath expressions are evaluated in relation to a context. A context as a container in the data hierarchy (a contexts is always a container). The context for an mvPath expression is usually the current container. However, if an expression starts with / then the context is the data root.
mvPath expressions are constructed from a fairly short list of words and punctuation.
value()/list("^[a-zA-Z]*") returns "SIBusMember"
value()/list("[0-9]*$") returns "114678997643"
value()/list("M[a-z]*") returns "Member"
value()/slice("2:5") returns "CDE"
value()/slice("2:-2") returns "CDE"
value()/slice("2:") returns "CDEFG"
value()/slice(":5") returns "ABCDE
value()/slice("-3:") returns "EFG"
mvcontainer.ContainerDefinitions
. To get the actual string, type the following in the CLI console view:import mvcontainer
mvcontainer.ContainerDefinitions.<CONSTANT>
<CONSTANT>
is a containerDefinitions constant, for example:mvcontainer.ContainerDefinitions.PROJECT
ASSET = http://mvalent.com/2003/container#asset
ASSET_RESOURCE_VIEW = http://mvalent.com/2003/container#asset_resource_view
AUTHPACK_FOLDER = http://mvalent.com/2003/container#authpack_folder
CONFIGURATION = http://mvalent.com/2003/container#configuration
CONFIGURATION_VIEW = http://mvalent.com/2003/container#configuration_view
CUSTOM_VIEW = http://mvalent.com/2003/container#custom_view
CUSTOM_VIEW_FOLDER = http://mvalent.com/2003/container#custom_view_folder
ELEMENT_TREE = http://mvalent.com/2003/container#element_tree
ENVIRONMENT = http://mvalent.com/2003/container#environment
FILE_FOLDER = http://mvalent.com/2003/container#file_folder
FILE_TEMPLATE = http://mvalent.com/2003/container#file_template
FOLDER = http://mvalent.com/2003/container#folder
HOST_FOLDER = http://mvalent.com/2003/container#host_folder
LAYER = http://mvalent.com/2003/container#layer
MV_CONFIG_ASSET = http://mvalent.com/2003/container#mv_config_asset
PROJECT = http://mvalent.com/2003/container#project
RESOURCESPEC_FOLDER = http://mvalent.com/2003/container#resourcespec_folder
mvcontainer.Type
. To get the actual string, type the following in the CLI console view:regex(".*.xml")
<CONSTANT>
is the mvcontainer.Type
, for example:mvcontainer.Type.ORGANIZATION.uri()
ASSET = http://mvalent.com/2003/container#asset
ASSET_VIEW = http://mvalent.com/2003/container#asset_view
AUTHPACK_FOLDER = http://mvalent.com/2003/container#authpack_folder
CONFIGURATION = http://mvalent.com/2003/container#configuration
CONFIGURATION_VIEW = http://mvalent.com/2003/container#configuration_view
ELEMENT_TREE = http://mvalent.com/2003/container#element_tree
FILE_TEMPLATE = http://mvalent.com/2003/container#file_template
HOST_FOLDER = http://mvalent.com/2003/container#host_folder
MV_CONFIG = http://mvalent.com/2003/container#mv_config
ORGANIZATION = http://mvalent.com/2003/container#organization
RESOURCESPEC_FOLDER = http://mvalent.com/2003/container#resourcespec_folder
import mvcontainer
mvcontainer.Type.<CONSTANT>.uri()
The examples below use a simple data hierarchy, represented graphically here in the Client Navigator view:
In addition to what is visible here, both config1.xml and propertyA have metadata.The context for all examples will be Folder1 that is highlighted in Project1.
Refer to a container by location:
Returns all child containers of Asset1. In this example, it would just return Resource View.
Returns the current container and all its descendant containers.
Returns Layer1, the parent of the current container.
Returns Environment1 (and any siblings if it had any).
Refer to a container by name:
Returns Asset1 under the current context, which is Folder1.
Returns config1.xml under Asset1.
Returns Element1 in the Primary View of config1.xml, which is under Resource View of Asset1. Note that both views and elements are containers in the hierarchy. You must specify a view to access the elements and properties in a configuration.
Returns all of the containers named "config1.xml" in the entire system.
Returns all containers named "Primary View" that are descendants of Asset1 but are not configurations or under configurations. There are no matches in the example, so nothing would be returned.
Returns the root project named "Project1."
Returns all the containers named "Primary View" in the entire system.
Returns all the descendants of the current container named "Primary View" plus the container itself if it is named "Primary View."
Returns the parent container.
Returns Asset2.
Returns Layer1, but does not look below Layer1 for any other containers named Layer1.
Refer to a container by something it contains:
Returns Asset1 if it has a child container named "config1.xml" in its Resource View.
Returns config1.xml if it is a child of Asset1's Resource View and if it has a child container named "CustomView."
Returns Asset1 if it has a child container named "config1.xml" in its Resource View that has a child container named "CustomView."
Returns Asset1 if it has a child container named "config1.xml" in its Resource View that has metadata named "metadata1."
Returns config1.xml if it has metadata named "metadata1."
Returns config1.xml if it has metadata named "metadata1" with a value of "value1."
Returns config1.xml if it is a child of Asset1 and has a child container named "Primary View" which contains a property named "propertyA."
Returns any containers that are children of Asset1's Resource View and have a child container named "Primary View" which contains a property named "propertyA."
Returns any containers that are children of Asset1's Resource View and have a child container named "Primary View" which contains a property named "propertyA" with value "valueA."
Returns both config1.xml and config2.xml because they both match the wildcard path and they both contain a container named "Primary View."
Returns the container Element1, because it contains "propertyA" with value "valueA". Note that this returns the container (which is an element in this case), not the property.
Returns the container Element1, because it contains "propertyA" with value "valueA" and "propertyB" with "valueB."
Refer to a container by type:
Returns the child containers of Asset1 that have a container type of "organization."
Refer to a container by definition:
Returns all containers that are children of Asset1 and have a definition of "D1."
Refer to the name of a container:
Returns the name of Asset1 under the current context.
Returns the names of all containers directly under Asset1.
Refer to the type of a container:
Returns the container type of Asset1.
Refer to the ID of a container:
Returns the id of Asset1.
Refer to a property by location:
Returns all properties that are in Element1 of the Primary View of config1.xml.
Returns all properties that are in the Primary View of config1.xml.
Refer to a property by name:
Returns propertyA in Element1 of the configuration. Note that a view is considered a container in the hierarchy and must be included in the mvPath to reach elements and properties. In other words, properties are contained in elements (which are containers) which are contained in views.
Returns all properties named "propertyA" underneath Asset1. With the sample data, this returns the same property as the previous example because there aren't any other properties with that name.
Refer to a property by value:
Returns all properties in Element1 with value "valueA."
Refer to a property by name and value:
Returns all properties named "propertyA" with value "valueA" that are descendants of Asset1.
Refer to a property by metadata name:
Returns propertyA in Element1if it has metadata named "metadataA."
Returns all properties that are descendants of Asset1 and that have metadata named "metadataA."
Refer to a property by metadata name and value:
Returns all properties that have metadata named "metadataA" with value "valueA" that are descendants of Asset1.
Refer to a property by definition:
Returns all properties in Element1 that have a definition of "port."
Refer to a property by another property in the same element:
Returns propertyA in Element1 if Element1 contains propertyB with value "valueB."
Refer to the name of a property:
Returns the name of propertyA.
Returns the names of all properties in Element1.
Refer to the value of a property:
Returns the value of propertyA in Element1.
Refer to the definition of a property:
Returns the property definition of the property named "propertyA." (Properties are linked to definitions in the property dictionaries.)
Refer to the ID of a property:
Returns the id of propertyA.
Refer to metadata by location:
Returns all container metadata of the config1.xml container.
Returns all property metadata of the property named "propertyA."
Refer to metadata by name:
Returns metadataA of propertyA in Element1 of the configuration.
Returns metadata1 of the config1.xml container.
Refer to metadata by value:
Returns all metadata in the config1.xml container with value "value1."
Refer to metadata by name and value:
Returns all metadata named "metadata1" with value "value1" that are descendants of Asset1.
Refer to metadata names:
Returns the name of metadataA on propertyA.
Returns the names of all metadata in config1.xml.
Refer to metadata values:
Returns the value of metadataA on propertyA in Element1.
Returns the value of metadata1 in config1.xml.
Refer to metadata ID:
Returns the id of metadataA.
Syntax:
[objectPath]operator("objectName")
Where:
objectPath
is the optional path to objectName
. The path references the root, that is, it begins with /, as in /F1/F2/F3/…
operator
is one of the following:
authpack host resourcespec
objectName
is the optional name of the object to resolve. If no name is specified, all objects of the target type are returned for the specified context.
Refer to a connector by name:
Returns an authentication pack named passport from the global name space.
Refer to a connector by name and location:
Returns a resource specification named xmlConfig under the folder hierarchy /F1/F2/F3/.
Refer to all connectors of a target type:
Returns all hosts in the global name space.
Returns all hosts under the folder hierarchy /F1/F2/F3/.