The Big Picture |
A basic service provider has the following necessary components.The following picture illustrates how these three components interact. The arrows indicate instantiation paths.
- Context implementation. A class that implements the Context interface or one of its subinterfaces. This implementation is the guts of the provider. It is responsible for handling almost all of the requests submitted by the user application.
- Initial context factory. A class that implements the InitialContextFactory interface. This factory creates the root context that will satisfy method invocations on the InitialContext or its subclasses. The root context that is created by the initial context factory is typically an instance of the context implementation.
- Name parser. A class that implements the NameParser interface. The context implementation uses this parser to parse names that belong to its namespace.
Adding Extensibility
To make a context implementation extensible, you should use methods provided by the JNDI SPI framework. These methods are described in detail in the The Essential Pieces lesson. They use the object, state, and response control factories accessible to the application. These factories might be packaged with the service provider or be supplied by the application. The following picture depicts how a basic service provider interacts with these factories.
The Big Picture |