Add Resources to the Class Metadata
In the /usr/lib/sstore/metadata/json/site/ directory, create the file class.app.util2.json with the following content to include the three static resources for the util2 application. In this version, the description and the name of the application are updated . The stat-names element is the same as in the previous example. The following elements are new:
-
instance-metadata -
namespaces -
static-instances
Note that the value of resource-name in the namespaces element matches the value of namespace in the static-instances element.
{
"$schema": "//:class",
"description": "Example util1 plus statically-allocated resources",
"id": "app/util2",
"instance-metadata": {
"description": "Instances of util2",
"stability": "stable"
},
"namespaces": [
{
"name-type": "string",
"resource-name": "inst"
}
],
"stability": "stable",
"stat-names": [
"//:stat.reads",
"//:stat.writes",
"//:stat.errors"
],
"static-instances": [
{
"name": "Customers",
"namespace": "inst"
},
{
"name": "Products",
"namespace": "inst"
},
{
"name": "Orders",
"namespace": "inst"
}
]
}Create the file stat.util2.json, which is the same as the stat.util1.json file except that util1 is changed to util2 in each id value.
[
{
"$schema": "//:stat",
"description": "reads",
"id": "//:class.app/util2//:stat.reads",
"stability": "stable",
"type": "counter",
"units": "operations"
},
{
"$schema": "//:stat",
"description": "writes",
"id": "//:class.app/util2//:stat.writes",
"stability": "stable",
"type": "counter",
"units": "operations"
},
{
"$schema": "//:stat",
"description": "errors",
"id": "//:class.app/util2//:stat.errors",
"stability": "stable",
"type": "counter",
"units": "errors"
}
]Restart the sstore:default service and view the util2 statistic metadata.
$ svcadm restart sstore:default $ sstore info //:class.app/util2 Identifier: //:class.app/util2 namespaces: {'0': '{'name-type': 'string', 'resource-name': 'inst'}'} $schema: //:class description: Example util1 plus statically-allocated resources id: app/util2 instance-metadata: {'description': 'Instances of util2', 'stability': 'stable'} static-instances: {'0': '{'name': 'Customers', 'namespace': 'inst'}', '1': '{'name': 'Products', 'namespace': 'inst'}', '2': '{'name': 'Orders', 'namespace': 'inst'}'} stability: stable stat-names: //:stat.reads stat-names: //:stat.writes stat-names: //:stat.errors