Overview

The Naming Service provides access to JNDI contexts.

It is written for use in Turbine but it can be used in any container compatible with Avalon's ECM container.

Configuration

First, here is the role configuration.

    
        <role
            name="org.apache.fulcrum.naming.NamingService"
            shorthand="naming"
            default-class="org.apache.fulcrum.naming.DefaultNamingService"/>
    
    

And here is the configuration:


    
        <naming/> (TODO)
    
    

Usage

try
{
    // Set up the naming provider. This may not always be necessary,
    // depending on how your Java system is configured.
    System.setProperty("java.naming.factory.initial",
      "org.jnp.interfaces.NamingContextFactory");
    System.setProperty("java.naming.provider.url",
      "localhost:1099");
    // Get a naming context
    InitialContext jndiContext = new InitialContext();

    // Get a reference to the Interest Bean
    Object ref = jndiContext.lookup("interest/Interest");

    // Get a reference from this to the Bean's Home interface
    InterestHome home = (InterestHome)
        PortableRemoteObject.narrow (ref, InterestHome.class);

    // Create an Interest object from the Home interface
    m_interest = home.create();
}
catch(Exception e)
{
    out.println("<LI>Context failed: " + e);
}