User: starksm 
  Date: 01/11/09 02:40:29

  Modified:    src/main/org/jboss/naming Tag: Branch_2_4 Util.java
  Log:
  Add method overrides that accept a Name value
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.6.2   +43 -6     jboss/src/main/org/jboss/naming/Util.java
  
  Index: Util.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/naming/Util.java,v
  retrieving revision 1.2.6.1
  retrieving revision 1.2.6.2
  diff -u -r1.2.6.1 -r1.2.6.2
  --- Util.java 2001/07/01 01:06:56     1.2.6.1
  +++ Util.java 2001/11/09 10:40:28     1.2.6.2
  @@ -1,5 +1,9 @@
  -
  -
  +/*
  + * JBoss, the OpenSource EJB server
  + *
  + * Distributable under LGPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.naming;
   
   import javax.naming.Context;
  @@ -9,8 +13,8 @@
   
   /** A static utility class for common JNDI operations.
    *
  - * @author [EMAIL PROTECTED]
  - * @version $Revision: 1.2.6.1 $
  + * @author [EMAIL PROTECTED]
  + * @version $Revision: 1.2.6.2 $
    */
   public class Util
   {
  @@ -60,8 +64,41 @@
       public static void bind(Context ctx, String name, Object value) throws 
NamingException
       {
           Name n = ctx.getNameParser("").parse(name);
  -        String atom = n.get(n.size()-1);
  -        Context parentCtx = createSubcontext(ctx, n.getPrefix(n.size()-1));
  +        bind(ctx, n, value);
  +    }
  +    /** Bind val to name in ctx, and make sure that all intermediate contexts exist
  +    @param ctx, the parent JNDI Context under which value will be bound
  +    @param name, the name relative to ctx where value will be bound
  +    @param value, the value to bind.
  +    */
  +    public static void bind(Context ctx, Name name, Object value) throws 
NamingException
  +    {
  +        int size = name.size();
  +        String atom = name.get(size-1);
  +        Context parentCtx = createSubcontext(ctx, name.getPrefix(size-1));
           parentCtx.bind(atom, value);
  +    }
  +
  +    /** Rebind val to name in ctx, and make sure that all intermediate contexts 
exist
  +    @param ctx, the parent JNDI Context under which value will be bound
  +    @param name, the name relative to ctx where value will be bound
  +    @param value, the value to bind.
  +    */
  +    public static void rebind(Context ctx, String name, Object value) throws 
NamingException
  +    {
  +        Name n = ctx.getNameParser("").parse(name);
  +        rebind(ctx, n, value);
  +    }
  +    /** Rebind val to name in ctx, and make sure that all intermediate contexts 
exist
  +    @param ctx, the parent JNDI Context under which value will be bound
  +    @param name, the name relative to ctx where value will be bound
  +    @param value, the value to bind.
  +    */
  +    public static void rebind(Context ctx, Name name, Object value) throws 
NamingException
  +    {
  +        int size = name.size();
  +        String atom = name.get(size-1);
  +        Context parentCtx = createSubcontext(ctx, name.getPrefix(size-1));
  +        parentCtx.rebind(atom, value);
       }
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to