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 (in the API reference documentation) 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 (in the API reference documentation) interface. This factory creates the root context that will satisfy method invocations on the InitialContext (in the API reference documentation) 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 (in the API reference documentation) interface. The context implementation uses this parser to parse names that belong to its namespace.
Basic SPI Pieces
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 (in the Building a Service Provider trail) 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.Customization