KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.sun.corba.se.impl.resolver ;
2
3 import com.sun.corba.se.spi.resolver.Resolver ;
4
5 import com.sun.corba.se.spi.orb.ORB ;
6
7 import com.sun.corba.se.spi.orb.Operation ;
8 import com.sun.corba.se.spi.orb.StringPair ;
9
10 public class ORBInitRefResolverImpl implements Resolver {
11     Operation urlHandler ;
12     java.util.Map JavaDoc orbInitRefTable ;
13
14     public ORBInitRefResolverImpl( Operation urlHandler, StringPair[] initRefs )
15     {
16     this.urlHandler = urlHandler ;
17     orbInitRefTable = new java.util.HashMap JavaDoc() ;
18
19         for( int i = 0; i < initRefs.length ; i++ ) {
20         StringPair sp = initRefs[i] ;
21         orbInitRefTable.put( sp.getFirst(), sp.getSecond() ) ;
22     }
23     }
24
25     public org.omg.CORBA.Object JavaDoc resolve( String JavaDoc ident )
26     {
27     String JavaDoc url = (String JavaDoc)orbInitRefTable.get( ident ) ;
28     if (url == null)
29         return null ;
30
31     org.omg.CORBA.Object JavaDoc result =
32         (org.omg.CORBA.Object JavaDoc)urlHandler.operate( url ) ;
33     return result ;
34     }
35
36     public java.util.Set JavaDoc list()
37     {
38     return orbInitRefTable.keySet() ;
39     }
40 }
41
Popular Tags