1. /*
  2. * @(#)ResolverDefault.java 1.7 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.spi.resolver ;
  8. import java.io.File ;
  9. import com.sun.corba.se.impl.resolver.LocalResolverImpl ;
  10. import com.sun.corba.se.impl.resolver.ORBInitRefResolverImpl ;
  11. import com.sun.corba.se.impl.resolver.ORBDefaultInitRefResolverImpl ;
  12. import com.sun.corba.se.impl.resolver.BootstrapResolverImpl ;
  13. import com.sun.corba.se.impl.resolver.CompositeResolverImpl ;
  14. import com.sun.corba.se.impl.resolver.INSURLOperationImpl ;
  15. import com.sun.corba.se.impl.resolver.SplitLocalResolverImpl ;
  16. import com.sun.corba.se.impl.resolver.FileResolverImpl ;
  17. import com.sun.corba.se.spi.orb.ORB ;
  18. import com.sun.corba.se.spi.orb.Operation ;
  19. import com.sun.corba.se.spi.orb.StringPair ;
  20. /** Utility class that provides factory methods for all of the
  21. * standard resolvers that we provide.
  22. */
  23. public class ResolverDefault {
  24. /** Return a local resolver that simply stores bindings in a map.
  25. */
  26. public static LocalResolver makeLocalResolver( )
  27. {
  28. return new LocalResolverImpl() ;
  29. }
  30. /** Return a resolver that relies on configured values of ORBInitRef for data.
  31. */
  32. public static Resolver makeORBInitRefResolver( Operation urlOperation,
  33. StringPair[] initRefs )
  34. {
  35. return new ORBInitRefResolverImpl( urlOperation, initRefs ) ;
  36. }
  37. public static Resolver makeORBDefaultInitRefResolver( Operation urlOperation,
  38. String defaultInitRef )
  39. {
  40. return new ORBDefaultInitRefResolverImpl( urlOperation,
  41. defaultInitRef ) ;
  42. }
  43. /** Return a resolver that uses the proprietary bootstrap protocol
  44. * to implement a resolver. Obtains the necessary host and port
  45. * information from the ORB.
  46. */
  47. public static Resolver makeBootstrapResolver( ORB orb, String host, int port )
  48. {
  49. return new BootstrapResolverImpl( orb, host, port ) ;
  50. }
  51. /** Return a resolver composed of the two given resolvers. result.list() is the
  52. * union of first.list() and second.list(). result.resolve( name ) returns
  53. * first.resolve( name ) if that is not null, otherwise returns the result of
  54. * second.resolve( name ).
  55. */
  56. public static Resolver makeCompositeResolver( Resolver first, Resolver second )
  57. {
  58. return new CompositeResolverImpl( first, second ) ;
  59. }
  60. public static Operation makeINSURLOperation( ORB orb, Resolver bootstrapResolver )
  61. {
  62. return new INSURLOperationImpl(
  63. (com.sun.corba.se.spi.orb.ORB)orb, bootstrapResolver ) ;
  64. }
  65. public static LocalResolver makeSplitLocalResolver( Resolver resolver,
  66. LocalResolver localResolver )
  67. {
  68. return new SplitLocalResolverImpl( resolver, localResolver ) ;
  69. }
  70. public static Resolver makeFileResolver( ORB orb, File file )
  71. {
  72. return new FileResolverImpl( orb, file ) ;
  73. }
  74. }