geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java ReadOnlyContext.java
Date Wed, 03 Sep 2003 17:21:17 GMT
jboynes     2003/09/03 10:21:17

  Modified:    modules/core/src/test/org/apache/geronimo/naming/java
                        BasicContextTest.java
               modules/core/src/java/org/apache/geronimo/naming/java
                        ReadOnlyContext.java
  Log:
  Support LinkRef entries in java: naming context
  
  Revision  Changes    Path
  1.4       +4 -2      incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/BasicContextTest.java
  
  Index: BasicContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/naming/java/BasicContextTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BasicContextTest.java	30 Aug 2003 09:33:32 -0000	1.3
  +++ BasicContextTest.java	3 Sep 2003 17:21:16 -0000	1.4
  @@ -69,6 +69,7 @@
   import javax.naming.NameClassPair;
   import javax.naming.NamingEnumeration;
   import javax.naming.NamingException;
  +import javax.naming.LinkRef;
   
   import org.apache.geronimo.common.StopWatch;
   
  @@ -116,7 +117,7 @@
       }
   
       public void testLookupLink() throws NamingException {
  -        assertEquals("Hello", envContext.lookup("hello"));
  +        assertEquals("Hello", envContext.lookup("link"));
       }
   
       public void testComposeName() throws NamingException {
  @@ -206,6 +207,7 @@
           envBinding = new HashMap();
           envBinding.put("hello", "Hello");
           envBinding.put("world", "Hello World");
  +        envBinding.put("link", new LinkRef("java:comp/env/hello"));
           envContext = new ReadOnlyContext(envBinding);
   
           compBinding.put("env", envContext);
  
  
  
  1.3       +7 -2      incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ReadOnlyContext.java
  
  Index: ReadOnlyContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/naming/java/ReadOnlyContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ReadOnlyContext.java	23 Aug 2003 22:13:15 -0000	1.2
  +++ ReadOnlyContext.java	3 Sep 2003 17:21:16 -0000	1.3
  @@ -70,6 +70,7 @@
   import javax.naming.NamingException;
   import javax.naming.NotContextException;
   import javax.naming.OperationNotSupportedException;
  +import javax.naming.LinkRef;
   import javax.naming.spi.NamingManager;
   
   /**
  @@ -140,7 +141,11 @@
               }
               throw new NameNotFoundException();
           }
  -        // @todo handle References
  +        if (result instanceof LinkRef) {
  +            LinkRef ref = (LinkRef) result;
  +            String link = (String) ref.get("LinkAddress").getContent();
  +            result = lookup(link);
  +        }
           return result;
       }
   
  
  
  

Mime
View raw message