Retrieving a Resource Bundle from a specific Module

The Infinity Process Platform QueryService provides the following method to retrieve a resource bundle from a specific engine resource bundle module:

ResourceBundle getResourceBundle(String moduleId, String bundleName, Locale locale);

Hereby, parameter moduleId determines the Id that identifies the resource bundle provider. bundleName defines the name of the bundle and locale is the locale to retrieve the resource bundle for.

The method returns the resource bundle object ResourceBundle containing the resources in form of a map and its related locale or null if no resource bundle was found.

Resource Bundle Properties

The following resource bundle properties can be used to

Constant Value Description
RepositoryResourceBundle.MODULE_ID repository-provider The fixed moduleId for RepositoryResourceBundles.
IRepositoryProviderInfo#getProviderId() The providerId of each provider is used as bundleName.
RepositoryResourceBundle.REPOSITORY_CONFIGURATION_NAME RepositoryConfiguration.name The property for keys in IRepositoryConfiguration#getAttributes()
RepositoryResourceBundle.REPOSITORY_CONFIGURATION_VALUE RepositoryConfiguration.value The property for values in IRepositoryConfiguration#getAttributes()

Example

List<IRepositoryProviderInfo> providerInfos = getDms().getRepositoryProviderInfos();
IRepositoryProviderInfo jcrVfsProviderInfo = getJcrVfs(providerInfos);
IRepositoryConfiguration jcrVfsConfigurationTemplate = jcrVfsProviderInfo.getConfigurationTemplate();
 
ResourceBundle resourceBundle = sf.getQueryService().getResourceBundle(
      RepositoryResourceBundle.MODULE_ID,
      jcrVfsProviderInfo.getProviderId(), Locale.ENGLISH);
 
Assert.assertEquals(Locale.ENGLISH, resourceBundle.getLocale());
 
Map<String, Serializable> resources = resourceBundle.getResources();
Assert.assertFalse(resources.isEmpty());
Map<String, Serializable> attributes = jcrVfsConfigurationTemplate.getAttributes();
Assert.assertFalse(attributes.isEmpty());
 
for (Map.Entry<String,Serializable> entry : attributes.entrySet())
{
   String name = (String) resources.get(RepositoryResourceBundle.REPOSITORY_CONFIGURATION_NAME
         + entry.getKey());
   String value = (String) resources.get(RepositoryResourceBundle.REPOSITORY_CONFIGURATION_VALUE
         + entry.getKey());
   Assert.assertNotNull(name);
   Assert.assertNotNull(value);
}