KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > resolver > LocalResolverImpl


1 /*
2  * @(#)LocalResolverImpl.java 1.7 04/06/21
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.resolver ;
9
10 import com.sun.corba.se.spi.resolver.LocalResolver ;
11 import com.sun.corba.se.spi.orbutil.closure.Closure ;
12
13 public class LocalResolverImpl implements LocalResolver {
14     java.util.Map JavaDoc nameToClosure = new java.util.HashMap JavaDoc() ;
15
16     public synchronized org.omg.CORBA.Object JavaDoc resolve( String JavaDoc name )
17     {
18     Closure cl = (Closure)nameToClosure.get( name ) ;
19     if (cl == null)
20         return null ;
21
22     return (org.omg.CORBA.Object JavaDoc)(cl.evaluate()) ;
23     }
24
25     public synchronized java.util.Set JavaDoc list()
26     {
27     return nameToClosure.keySet() ;
28     }
29
30     public synchronized void register( String JavaDoc name, Closure closure )
31     {
32     nameToClosure.put( name, closure ) ;
33     }
34 }
35
Popular Tags