org.openorb.util
Class MapNamingContext

java.lang.Object
  |
  +--java.util.AbstractMap
        |
        +--java.util.TreeMap
              |
              +--org.openorb.util.MapNamingContext
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable, java.util.SortedMap

Deprecated. This class has been deprecated since OpenORB 1.2.2. A new version has been made available in the NamingService package under org.openorb.tns. See the INS documentation for details. This class will be removed very soon now, i.e. after the 1.3.0 release.

public class MapNamingContext
extends java.util.TreeMap

This class can be used for an easy to use transient naming context. The context implements the SortedMap interface, and stores all it's bindings as name/value pairs. Using the put operation with a key containing a non-existent context parent(s) will result in the parent contexts being created.

Special notes:

Deleting an internal context with the remove operation on any of the associated iterators or collections will cause undefined behaviour. This may change in the future.

Version:
$Revision: 1.17 $ $Date: 2002/06/28 08:59:06 $
Author:
Chris Wood
See Also:
Serialized Form

Inner classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
MapNamingContext(ORB orb, POA rootPOA)
          Deprecated. Create a new MapNamingContext.
MapNamingContext(ORB orb, POA rootPOA, java.lang.String poaName)
          Deprecated. Create a new MapNamingContext.
 
Method Summary
 NamingContextExt addContext(NameComponent[] name)
          Deprecated. Add a context to the map, adding ancestor contexts as neccicary.
 NamingContextExt addContext(java.lang.String context)
          Deprecated. Add a context to the map, adding ancestor contexts as neccicary.
 java.lang.String bindCorbaloc()
          Deprecated. Bind the nameservice in the forward adapter, if there is a forward adapter.
 void deactivate(boolean waitForComplete)
          Deprecated. Deactivate the server reference, and all other naming contexts created with the create_context operation.
 boolean getAllowSelfDestruct()
          Deprecated. Will the destroy_context operation work on the root context?
 java.lang.String getCorbaname(NameComponent[] name)
          Deprecated. Return a corbaname style address for the name passed.
 java.lang.String getCorbaname(java.lang.String str)
          Deprecated. Return a corbaname style address for the string name passed.
 NamingContextExt getRootCtxt()
          Deprecated. Get a reference to the root naming context.
static NamingContextExt initialize(java.lang.String[] args, ORB orb)
          Deprecated. This method provides an alternative way of starting the name service.
 boolean isContext(java.lang.String context)
          Deprecated. Determine if the specified name is a subcontext and must be removed with the removeContext operation.
static void main(java.lang.String[] args)
          Deprecated. Main method.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Deprecated. Add a binding to the map.
 void putAll(java.util.Map p1)
          Deprecated. Put all entries in the map.
 Object putName(NameComponent[] name, Object obj)
          Deprecated. Add a binding to the map, creating ancestor contexts as neccicary.
 Object putStr(java.lang.String str, Object obj)
          Deprecated. Add a binding to the map, creating ancestor contexts as neccicary.
 boolean removeContext(java.lang.String context)
          Deprecated. Remove a context.
 void setAllowSelfDestruct(boolean allowSelfDestruct)
          Deprecated. When this is set to true the root context may be destroyed with the destroy operation.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

MapNamingContext

public MapNamingContext(ORB orb,
                        POA rootPOA)
Deprecated. 
Create a new MapNamingContext. The context's poa name will be somthing like NameServ_10.
Parameters:
orb - orb under which the context is to be activated.
rootPOA - parent POA under which to create the context's poa. If null the orb's root POA is used.

MapNamingContext

public MapNamingContext(ORB orb,
                        POA rootPOA,
                        java.lang.String poaName)
                 throws AdapterAlreadyExists
Deprecated. 
Create a new MapNamingContext.
Parameters:
orb - orb under which the context is to be activated.
rootPOA - parent POA under which to create the context's poa. If null the orb's root POA is used.
poaName - name of poa created under rootPOA. If null the name will be somthing like NameServ_10.
Throws:
AdapterAlreadyExists - An adapter with the specified name already exists. This is never thrown if poaName is null.
Method Detail

getRootCtxt

public NamingContextExt getRootCtxt()
Deprecated. 
Get a reference to the root naming context.
Returns:
NamingContextExt the root context

bindCorbaloc

public java.lang.String bindCorbaloc()
                              throws java.lang.IllegalStateException
Deprecated. 
Bind the nameservice in the forward adapter, if there is a forward adapter.
Returns:
A corbaloc style reference.
Throws:
java.lang.IllegalStateException - if no default adapter exists.

getCorbaname

public java.lang.String getCorbaname(java.lang.String str)
                              throws java.lang.IllegalArgumentException,
                                     java.lang.IllegalStateException
Deprecated. 
Return a corbaname style address for the string name passed.
Parameters:
str - stringified corbaname of target.
Returns:
String the corbaname
Throws:
java.lang.IllegalArgumentException - if str is not a valid stringified name
java.lang.IllegalStateException - nameservice has not been bound as a corbaloc.

getCorbaname

public java.lang.String getCorbaname(NameComponent[] name)
                              throws java.lang.IllegalArgumentException,
                                     java.lang.IllegalStateException
Deprecated. 
Return a corbaname style address for the name passed.
Parameters:
name - the name to use.
Returns:
String the corbaname
Throws:
java.lang.IllegalArgumentException - if name is invalid for some reason.
java.lang.IllegalStateException - nameservice has not been bound as a corbaloc.

getAllowSelfDestruct

public boolean getAllowSelfDestruct()
Deprecated. 
Will the destroy_context operation work on the root context?
Returns:
Value of property allowSelfDestruct.

setAllowSelfDestruct

public void setAllowSelfDestruct(boolean allowSelfDestruct)
Deprecated. 
When this is set to true the root context may be destroyed with the destroy operation.
Parameters:
allowSelfDestruct - New value of property allowSelfDestruct.

deactivate

public void deactivate(boolean waitForComplete)
Deprecated. 
Deactivate the server reference, and all other naming contexts created with the create_context operation.
Parameters:
waitForComplete - wait for completion before returning. If this parameter is true and this operation is called from a server thread an exception will be thrown.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws java.lang.NullPointerException,
                            java.lang.ClassCastException,
                            java.lang.IllegalArgumentException,
                            java.lang.IllegalStateException
Deprecated. 
Add a binding to the map.

To insert a new empty context into the map use a key string ending in / The object reference in this case will be ignored.

Overrides:
put in class java.util.TreeMap
Parameters:
key - String or NameComponent[] composing the binding's name.
value - org.omg.CORBA.Object to be bound to the name.
Returns:
Object
Throws:
java.lang.NullPointerException - if key is null.
java.lang.ClassCastException - if key or value is the wrong type.
java.lang.IllegalArgumentException - the key is not a valid name.
java.lang.IllegalStateException - the name is bound to a context, or one of it's ancestors are bound to an object.

putName

public Object putName(NameComponent[] name,
                      Object obj)
               throws java.lang.NullPointerException,
                      java.lang.IllegalStateException,
                      java.lang.IllegalArgumentException
Deprecated. 
Add a binding to the map, creating ancestor contexts as neccicary.
Parameters:
name - The binding's name.
obj - org.omg.CORBA.Object to be bound to the name.
Returns:
Object
Throws:
java.lang.NullPointerException - if key is null.
java.lang.IllegalArgumentException - the key is not a valid name.
java.lang.IllegalStateException - the name is bound to a context, or one of it's ancestors are bound to an object.

putStr

public Object putStr(java.lang.String str,
                     Object obj)
              throws java.lang.NullPointerException,
                     java.lang.IllegalArgumentException,
                     java.lang.IllegalStateException
Deprecated. 
Add a binding to the map, creating ancestor contexts as neccicary.

To insert a new empty context into the map use a key string ending in / The object reference in this case will be ignored.

Parameters:
str - The binding's name.
obj - org.omg.CORBA.Object to be bound to the name.
Returns:
org.omg.CORBA.Object object
Throws:
java.lang.NullPointerException - if key is null.
java.lang.IllegalArgumentException - the key is not a valid name.
java.lang.IllegalStateException - the name is bound to a context, or one of it's ancestors are bound to an object.

addContext

public NamingContextExt addContext(java.lang.String context)
                            throws java.lang.NullPointerException,
                                   java.lang.IllegalArgumentException,
                                   java.lang.IllegalStateException
Deprecated. 
Add a context to the map, adding ancestor contexts as neccicary.
Parameters:
context - Name of the context.
Returns:
NamingContextExt naming context
Throws:
java.lang.NullPointerException - if context is null.
java.lang.IllegalArgumentException - the context is not a valid name.
java.lang.IllegalStateException - the context or one of it's ancestors are bound to an object.

addContext

public NamingContextExt addContext(NameComponent[] name)
                            throws java.lang.NullPointerException,
                                   java.lang.IllegalArgumentException,
                                   java.lang.IllegalStateException
Deprecated. 
Add a context to the map, adding ancestor contexts as neccicary.
Parameters:
name - Name of the context.
Returns:
NamingContextExt naming context
Throws:
java.lang.NullPointerException - if name is null.
java.lang.IllegalArgumentException - the name is not a valid name.
java.lang.IllegalStateException - the name or one of it's ancestors are bound to an object.

removeContext

public boolean removeContext(java.lang.String context)
Deprecated. 
Remove a context. This will remove the context and all it's decendants.
Parameters:
context - the name of the context.
Returns:
boolean true if the context was destroyed.

isContext

public boolean isContext(java.lang.String context)
Deprecated. 
Determine if the specified name is a subcontext and must be removed with the removeContext operation.
Parameters:
context - the name of the context.
Returns:
true if the name is bound to a context.

putAll

public void putAll(java.util.Map p1)
Deprecated. 
Put all entries in the map.
Overrides:
putAll in class java.util.TreeMap
Parameters:
p1 - the map

main

public static void main(java.lang.String[] args)
Deprecated. 
Main method.
Parameters:
args - command line args

initialize

public static NamingContextExt initialize(java.lang.String[] args,
                                          ORB orb)
Deprecated. 
This method provides an alternative way of starting the name service. Other projects, e.g. the OpenEJB container, use only one ORB for all the services to make use the optimized CORBA local invocations.
Parameters:
args - the command line flags in the same format as in the main method
orb - the ORB instance the name service should be registered with
Returns:
the root name context