skip to main content
Programmers documentation > Context and Deployment Descriptor > The context services > Class loader
 
Class loader
The Class Loader service is defined by the interface IlpClassLoaderService.
It enables JViews TGO to load classes used in the definition of the business model and in the styling of the components and objects. This is performed with a class loader that is different from the default class loader provided by the Java™ framework. By default, it is done with the class loader service defined by the class IlpDefaultClassLoaderService which tries to load classes in the following order:
1. Using the thread context class loader
2. Using the class loader used to load this service
3. Using the system class loader
IlpClassLoaderService provides the method loadClass which returns the Java class that corresponds to the given class name. If the class name cannot be loaded, this method should throw a ClassNotFoundException.
 
public Class loadClass (String name) throws ClassNotFoundException
How to initialize the class loader service through the deployment descriptor file
You can initialize the class loader service in the deployment descriptor file using the tag <classLoader> as follows:
 
[<classLoader javaClass="class name"/>]
where javaClass indicates the name of a Java class that implements the IlpClassLoaderService interface.
The following example illustrates the customization of the class loader service through the deployment descriptor:
 
<?xml version="1.0"?>
<deployment xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/deploy.xsd">
  <classLoader javaClass = "package.MyClassLoader" />
</deployment>
How to Initialize the Class Loader Service Through the API
 
IlpDefaultContext context = ...
  IlpClassLoaderService service = new MyClassLoaderService();
context.addService(IlpClassLoaderService.class, service);

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.