Create the Class and Statistic Definition Files

In the /usr/lib/sstore/metadata/json/site/ directory, create the file class.app.example.json with the following content to define the class for the example application.

{
    "$schema": "//:class",
    "description": "example of sstore_data_update()",
    "id": "app/example",
    "stability": "stable",
    "stat-names": [
        "//:stat.one",
        "//:stat.two"
    ]   
}

To define the statistics for this example, create the file stat.example.json with the following content in the /usr/lib/sstore/metadata/json/site/ directory:

[
    {   
        "$schema": "//:stat",
        "description": "example stat one",
        "id": "//:class.app/example//:stat.one",
        "stability": "stable",
        "type": "counter",
        "units": "calls"
    },  
    {   
        "$schema": "//:stat",
        "description": "example stat two",
        "id": "//:class.app/example//:stat.two",
        "stability": "stable",
        "type": "counter",
        "units": "calls"
    }   
]

Run the soljsonfmt tool on the .json file to check for JSON syntactic errors. Run the soljsonvalidate tool on the .json file to check for JSON semantic errors:

# soljsonvalidate class.app.example.json stat.example.json
# soljsonfmt class.app.example.json stat.example.json

You must restart the sstore:default service to see the new class SSID.

$ svcadm restart sstore:default

Ensure that sstore:default and other services are online:

$ svcs -x

Check whether the metadata files imported correctly:

$ tail `svcs -L sstore`

The log file should show no errors and should show that the start method exited with status 0.

List the new class SSID:

$ sstore list //:class.app/example
IDENTIFIER
//:class.app/example

Show the metadata for the class:

$ sstore info //:class.app/example
 Identifier: //:class.app/example
    $schema: //:class
         id: app/example
description: example of sstore_data_update()
 stat-names: //:stat.one
 stat-names: //:stat.two
  stability: stable