1. /*
  2. * @(#)RepositoryIdFactory.java 1.6 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.impl.orbutil;
  8. import com.sun.corba.se.spi.orb.ORBVersion;
  9. import com.sun.corba.se.spi.orb.ORB;
  10. public abstract class RepositoryIdFactory
  11. {
  12. private static final RepIdDelegator_1_3 legacyDelegator
  13. = new RepIdDelegator_1_3();
  14. private static final RepIdDelegator_1_3_1 ladybirdDelegator
  15. = new RepIdDelegator_1_3_1();
  16. private static final RepIdDelegator currentDelegator
  17. = new RepIdDelegator();
  18. /**
  19. * Returns the latest version RepositoryIdStrings instance
  20. */
  21. public static RepositoryIdStrings getRepIdStringsFactory()
  22. {
  23. return currentDelegator;
  24. }
  25. /**
  26. * Checks the version of the ORB and returns the appropriate
  27. * RepositoryIdStrings instance.
  28. */
  29. public static RepositoryIdStrings getRepIdStringsFactory(ORB orb)
  30. {
  31. if (orb != null) {
  32. switch (orb.getORBVersion().getORBType()) {
  33. case ORBVersion.NEWER:
  34. case ORBVersion.FOREIGN:
  35. case ORBVersion.JDK1_3_1_01:
  36. return currentDelegator;
  37. case ORBVersion.OLD:
  38. return legacyDelegator;
  39. case ORBVersion.NEW:
  40. return ladybirdDelegator;
  41. default:
  42. return currentDelegator;
  43. }
  44. } else
  45. return currentDelegator;
  46. }
  47. /**
  48. * Returns the latest version RepositoryIdUtility instance
  49. */
  50. public static RepositoryIdUtility getRepIdUtility()
  51. {
  52. return currentDelegator;
  53. }
  54. /**
  55. * Checks the version of the ORB and returns the appropriate
  56. * RepositoryIdUtility instance.
  57. */
  58. public static RepositoryIdUtility getRepIdUtility(ORB orb)
  59. {
  60. if (orb != null) {
  61. switch (orb.getORBVersion().getORBType()) {
  62. case ORBVersion.NEWER:
  63. case ORBVersion.FOREIGN:
  64. case ORBVersion.JDK1_3_1_01:
  65. return currentDelegator;
  66. case ORBVersion.OLD:
  67. return legacyDelegator;
  68. case ORBVersion.NEW:
  69. return ladybirdDelegator;
  70. default:
  71. return currentDelegator;
  72. }
  73. } else
  74. return currentDelegator;
  75. }
  76. }