The ORB provides a NameServiceFactory
initial object
reference that can be used to create instances of COS NameServices.
Using the LifespanPolicy
argument you can specify whether you want a
transient or a persistent namespace. A Transient namespace has transient
NamingContext
objects and the state of the objects is also not made persistent.
That is, when the server in which the NameService terminates, the namespace
is no longer accessible. Persistent NameService uses persistent NamingContext
objects and their state is also persistent. A persistent namespace is always
available even when its server is not active.
You can also secure the namespace using the AccessPolicy.
package com.sssw.jbroker.api.naming; import org.omg.PortableServer.POA; import org.omg.PortableServer.LifespanPolicyValue; public interface NameServiceFactory extends org.omg.CORBA.Object { /** * Create a Name Service. */ NameService createNameService(POA parent, String serviceName, LifespanPolicyValue lifespan, AccessPolicy accessPolicy, String realm); /** * Create a Name Service using the user supplied DataStore. */ NameService createNameService(POA parent, String serviceName, LifespanPolicyValue lifespan, DataStore dataStore, AccessPolicy accessPolicy, String realm); }
In this sample program we will use the
NameServiceFactory
to create a transient NameService and then we will bind its root context as an initial object reference using the Initial References Service (IRS).
Persistent NameService Example
In this sample program we will use the
NameServiceFactory
to create a persistent NameService and then we will bind its root context as an initial object reference using the Initial References Service (IRS). The data store provided by the ORB, by default, saves naming context state in the $(NOVELL_EXTEND_HOME)/MP/db/names/<server alias>/<serviceName>. You can override that by specifying theORBNamesDirectory
property. See the example's build file.
Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.