Adding Static Resources

Resources are defined in a static-instances element in the class metadata file. The name and namespace properties are required. The name is the unique name of the particular resource. The namespace groups similar resources and matches the value of a resource-name in the namespaces element. You can add metadata for the resources in the instance-metadata element.

The following partial example of a class metadata file shows the required namespaces and static-instances elements and the optional instance-metadata element:

"instance-metadata": {
    "description": "Instances of util2",
    "stability": "stable"
},
"namespaces": [
    {
        "name-type": "string",
        "resource-name": "inst"
    }
],
"static-instances": [
    {
        "name": "inst1",
        "namespace": "inst"
    },
    {
        "name": "inst2",
        "namespace": "inst"
    }
]

See Collect Data for Statically Allocated Resources for a complete example.

In the following excerpt from class.svc.json, one resource is defined. Other resources (services) are added dynamically.

    "namespaces": [
        {
            "name-type": "string",
            "resource-name": "fmri"
        }
    ],
...
    "static-instances": [
        {
            "name": "system/svc/restarter:default",
            "namespace": "fmri"
        }
    ]