1. /*
  2. * @(#)NamingContextHelper.java 1.10 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. /*
  11. * File: ./org/omg/CosNaming/NamingContextHelper.java
  12. * From: nameservice.idl
  13. * Date: Tue Aug 11 03:12:09 1998
  14. * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
  15. */
  16. package org.omg.CosNaming;
  17. public class NamingContextHelper {
  18. // It is useless to have instances of this class
  19. private NamingContextHelper() { }
  20. public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CosNaming.NamingContext that) {
  21. out.write_Object(that);
  22. }
  23. public static org.omg.CosNaming.NamingContext read(org.omg.CORBA.portable.InputStream in) {
  24. return org.omg.CosNaming.NamingContextHelper.narrow(in.read_Object());
  25. }
  26. public static org.omg.CosNaming.NamingContext extract(org.omg.CORBA.Any a) {
  27. org.omg.CORBA.portable.InputStream in = a.create_input_stream();
  28. return read(in);
  29. }
  30. public static void insert(org.omg.CORBA.Any a, org.omg.CosNaming.NamingContext that) {
  31. org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
  32. write(out, that);
  33. a.read_value(out.create_input_stream(), type());
  34. }
  35. private static org.omg.CORBA.TypeCode _tc;
  36. synchronized public static org.omg.CORBA.TypeCode type() {
  37. if (_tc == null)
  38. _tc = org.omg.CORBA.ORB.init().create_interface_tc(id(), "NamingContext");
  39. return _tc;
  40. }
  41. public static String id() {
  42. return "IDL:omg.org/CosNaming/NamingContext:1.0";
  43. }
  44. public static org.omg.CosNaming.NamingContext narrow(org.omg.CORBA.Object that)
  45. throws org.omg.CORBA.BAD_PARAM {
  46. if (that == null)
  47. return null;
  48. if (that instanceof org.omg.CosNaming.NamingContext)
  49. return (org.omg.CosNaming.NamingContext) that;
  50. if (!that._is_a(id())) {
  51. throw new org.omg.CORBA.BAD_PARAM();
  52. }
  53. org.omg.CORBA.portable.Delegate dup = ((org.omg.CORBA.portable.ObjectImpl)that)._get_delegate();
  54. org.omg.CosNaming.NamingContext result = new org.omg.CosNaming._NamingContextStub(dup);
  55. return result;
  56. }
  57. }