Scoping

Scoping is the conceptual reference to a hierarchy of elements represented by boundaries. Scoping is used to create elements in a specified way or to retrieve specified linked objects.

For instance, if you want to create a pool of resources with two resources attached to it, you must represent the resources as children of the pool. In this case, the scoping of the structure will use the following syntax:

C#

ApplicationAPI.PoolScope scope = new ApplicationAPI.PoolScope();
scope.resources = new ApplicationAPI.ResourceScope();

Java

PoolScope scope = new PoolScope();
scope.setResources(new ResourceScope());

In this example, you must first create a PoolScope taking into account to later save a Pool container. Use the following syntax to create the main element:

C#

ApplicationAPI.PoolScope scope = new ApplicationAPI.PoolScope();

Java

PoolScope scope = new PoolScope();

The next step consists of placing the scope of the children under the scope of the parent. In this case, the resources are the children of the PoolScope but there are many other possible hierarchy structures. To represent the resources as the children of the PoolScope, set the PoolScope resources member using the following syntax:

C#

scope.resources = new ApplicationAPI.ResourceScope();

Java

scope.setResources(new ResourceScope());

Once the scope is created, you can save or load or modify the containers in the RPM Database. Send the message containing the scope using the following syntax:

C# and Java

application.save(sessionid, pool, scope, reloadtype);

If you do not want to save the children or parents, simply use the save method specifying a null value for the scope:

C# and Java

application.save(sessionid, pool, null, reloadtype);