ModulesService.GetResourceDirectoryPath() method usage

ModulesService.GetResourceDirectoryPath() method usage

book

Article ID: KB0079918

calendar_today

Updated On:

Products Versions
Spotfire Developer All Versions

Description

A public resource is a file that is packaged and deployed as part of a Spotfire package and explicitly given a public resource name, as well as an optional culture with a publicResource element in the resources section of the module.xml file of the package.

Spotfire custom packages are built using the Package Builder application, which is available in the TIBCO Spotfire Developer Software (SDK). The package builder allows a configuration file included in custom packages to be marked as a public resource. If a resource with the specified name and the calling threads CurrentUICulture is defined, the path to this resource will be returned. Or, if a resource with the specified name and no culture is defined, the path to this resource will still be returned. Otherwise, "null" is returned. 

Issue/Introduction

ModulesService.GetResourceDirectoryPath() method usage

Resolution

Thus, the API ModulesService.GetResourceDirectoryPath("resourceName") is mostly used to simplify access to the directory of a resource in order to import the file as a module in Spotfire.

For example, you can create a package file called "cobranding," which contains *.png images and an XML configuration file called "cobranding.config" that specifies how you would like to change the User Interface of Spotfire. In order to import the XML configuration file, "cobranding.config," you would specify it as a public resource of the created package. So, when the application loads the extension, it will also import the configuration file as the module. In this case, the ModulesService.GetResourceDirectoryPath("cobranding.config") method will return the correct absolute path for the resource file.

<module>

  <id>cd128d4e-c862-4f40-8b83-373d7c1d419c</id>

  <name>cobranding</name>

  <version>1.0.0.0</version>

  <intendedClient>Core</intendedClient>

  <resources>

    <publicResource name="cobranding.config" relativePath="cobranding.config" />

  </resources>

</module>

Additional Information

API Reference: GetResourceDirectoryPath