2.1 Introduction

Before discussing each of the services included here, there are some concepts applicable to all of them that you need to understand.

The following topics contain generic concepts that apply to all the services:

NOTE:This new format has been implemented for nine of the Novell Services. The other service, NetWare® File System Provider, will be revised and updated to this new format in a future release of the NDK.

2.1.1 Important Components

Each of the important components (interfaces and classes) necessary for implementing the service are listed and briefly described. Hypertext links are provided to the Reference Guide documentation for each of these components.

2.1.2 Initial Context Implementations

This topic discusses how to construct an initial context implementation for the JNDI Providers. In order to access the service components you must construct an initial context implementation in one of three ways:

  • An initial context environment parameter implementation

    The property java.naming.factory.initial contains the fully-qualified class name of the initial context factor. The class must implement the initialContextFactory interface and have a public constructor that does not take any arguments. JNDI will load the initial context factory class and then invoke getInitialContext() on it to obtain a DirContext instance to be used as the initial context.

    An application that wants to use this initial context must supply the java.naming.factory.initial property either in the environment passed to the InitialContext or InitialDirContext constructors, or as one of the program's system properties. If the property is supplied as part of the environment, the system property is not consulted.

    Following is an example of how an initial context factory implementation might be constructed:

       Hashtable properties = new Hashtable();
       
       properties.put("jndi.initial.context.factory", "<class name>";
       
       DirContext initCtx = new InitialDirContext(properties);
       

    After the initial context has been implemented, if you need to get the session environment object use similar code to the following:

       InitialContext initCtx = new InitialContext (hash);
       
       hash = initCtx.getEnvironment ();
       
       Session sess = (Session) hash.get (Environment.SESSION.OBJECT);
       
  • A URL initial context implementation

    If a URL string is passed to the initial context, it will be resolved using the corresponding URL context implementation. This is independent of any initial context implementations obtained using java.naming.factory.initial environment or system property.

    The URL context implementation is obtained using an object factory for the URL scheme identified in the URL string. The factory's class name is of the form urlSchemeURLContextFactory in the package specified using the java.naming.factory.url.pkgs environment or system property, which contains a colon-separated list of package prefixes. Each package prefix in this property is tried in the order specified to load the factory class.

    The object factory class implements the objectFactory interface and has a public constructor that takes no arguments. It provides a getObjectInstance() method, which will create instances of DirContext for the URL scheme. These instances will then be used to carry out the originally intended DirContext operation on the URL supplied to the initial context.

    A two-step example using QMS is as follows:

       contextFactory = new com.novell.services.qms.naming.QMSInitialContextFactory(env);
       
       <instance> = factory.GetInitialContext(env);
       
  • An initial context factory builder implementation

    If an initial context factory builder has been installed, the application is effectively defining its own policy on how to locate and construct initial context implementations. When a factory has been installed, it is solely responsible for creating the initial context implementation. None of the default policies (java.naming.factory.initial property or URLcontext implementations) normally used by JNDI are employed.

    A service provider for an initial context factory builder must define a class that implements InitialContextFactoryBuilder. This class's createInitialContextFactory() method generates instances of InitialContextFactory. An application that wants to use this factory must first install it as follows:

       NamingManager.setInitialContextFactoryBuilder (factory);
       

2.1.3 Important Methods

The important methods provided by the service components are listed and briefly described. Hypertext links to the Reference Guide documentation are provided for each method listed. For a complete list of available methods you must go to the Reference Guide documentation.

2.1.4 Relationship of Classes and Interfaces

The relationship among the service components (interfaces and classes) is illustrated in diagrams. This is followed by a listing of the components and a discussion of the relationships among them. Hypertext links to the Reference Guide are provided for the most important service components.