Context and Deployment Descriptor > The Context Services > Image Repository Service

The image repository service is defined by the interface IlpImageRepository. It is used to load all JViews TGO images. This service will return the requested image if it is already in the repository. Otherwise, it will use the URL access service to locate the image. If the image cannot be found, a default image is returned.

The image repository serves two main purposes:

  1. It matches an image and the file location of this image.
  2. It provides memory management, that is, reuse of images that have already been loaded.
  3. By keeping one reusable instance of an image in a repository, the image does not need to be loaded in memory multiple times.

The IlpImageRepository interface provides five methods to manage the image repository:

How to Use the Image Repository Service Through the API

The following code extract shows you how you can use this service in your application:

IlpContext context = IltSystem.GetDefaultContext();
IlpImageRepository repository = context.getImageRepository();
Image img = repository.getImage("ilog/tgo/check.png");

By default, the image repository service is implemented by the class IltDefaultImageRepository.

How to Customize the Image Repository Service Through the API

The following code extract shows you how you can customize the context to use your own image repository implementation:

context.addService(IlpImageRepository.class, myImageRepository);