Providing localized Labels for a User Interface

To provide localized labels for a User Interface, you can implement the IResourceBundleProvider.

@SPI(status = Status.Stable, useRestriction = UseRestriction.Public)
public interface IResourceBundleProvider
{

   public interface Factory
   {
      IResourceBundleProvider getInstance();
   }

   public ResourceBundle getResourceBundle(String bundleName, Locale locale);

   public String getModuleId();

}

Method getResourceBundle retrieves a resource bundle with a specified name and a specific locale to request the resources for.

Creating a custom Implementation

Create your own implementations for this interface. For details on how to configure custom Service Provider Interface implementations refer to chapter Configuring SPI Implementations per Tenant.

To publish an implementor to the engine, a file named by the interface's factory has to be created in the /META-INF/services folder of the jar as follows:

  1. Implement the interface as shown below
  2. Create a text file named org.eclipse.stardust.engine.core.spi.resources.IResourceBundleProvider. The file contents needs to be the fully qualified name of your implementation class, e.g. org.eclipse.stardust.example.ResourceBundleProviderImpl.
  3. Place the file into the META-INF/services folder of the jar that will contain your implementation class
package org.eclipse.stardust.example;
 
import java.util.Locale;

import org.eclipse.stardust.common.annotations.SPI;
import org.eclipse.stardust.common.annotations.Status;
import org.eclipse.stardust.common.annotations.UseRestriction;
import org.eclipse.stardust.engine.api.runtime.ResourceBundle;
import org.eclipse.stardust.engine.core.spi.resources.IResourceBundleProvider;

@SPI(status = Status.Stable, useRestriction = UseRestriction.Public)
public class ResourceBundleProviderImpl implements IResourceBundleProvider
{

   public interface Factory
   {
      IResourceBundleProvider getInstance();
   }

   public ResourceBundle getResourceBundle(String bundleName, Locale locale);

   public String getModuleId();

}