KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > orbutil > RepositoryIdFactory


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
8 package com.sun.corba.se.impl.orbutil;
9
10 import com.sun.corba.se.spi.orb.ORBVersion;
11 import com.sun.corba.se.spi.orb.ORB;
12
13 public abstract class RepositoryIdFactory
14 {
15     private static final RepIdDelegator_1_3 legacyDelegator
16         = new RepIdDelegator_1_3();
17
18     private static final RepIdDelegator_1_3_1 ladybirdDelegator
19         = new RepIdDelegator_1_3_1();
20
21     private static final RepIdDelegator currentDelegator
22         = new RepIdDelegator();
23
24     /**
25      * Returns the latest version RepositoryIdStrings instance
26      */

27     public static RepositoryIdStrings getRepIdStringsFactory()
28     {
29         return currentDelegator;
30     }
31
32     /**
33      * Checks the version of the ORB and returns the appropriate
34      * RepositoryIdStrings instance.
35      */

36     public static RepositoryIdStrings getRepIdStringsFactory(ORB orb)
37     {
38         if (orb != null) {
39             switch (orb.getORBVersion().getORBType()) {
40                 case ORBVersion.NEWER:
41                 case ORBVersion.FOREIGN:
42                 case ORBVersion.JDK1_3_1_01:
43                     return currentDelegator;
44                 case ORBVersion.OLD:
45                     return legacyDelegator;
46                 case ORBVersion.NEW:
47                     return ladybirdDelegator;
48                 default:
49                     return currentDelegator;
50             }
51         } else
52             return currentDelegator;
53     }
54
55     /**
56      * Returns the latest version RepositoryIdUtility instance
57      */

58     public static RepositoryIdUtility getRepIdUtility()
59     {
60         return currentDelegator;
61     }
62
63     /**
64      * Checks the version of the ORB and returns the appropriate
65      * RepositoryIdUtility instance.
66      */

67     public static RepositoryIdUtility getRepIdUtility(ORB orb)
68     {
69         if (orb != null) {
70             switch (orb.getORBVersion().getORBType()) {
71                 case ORBVersion.NEWER:
72                 case ORBVersion.FOREIGN:
73                 case ORBVersion.JDK1_3_1_01:
74                     return currentDelegator;
75                 case ORBVersion.OLD:
76                     return legacyDelegator;
77                 case ORBVersion.NEW:
78                     return ladybirdDelegator;
79                 default:
80                     return currentDelegator;
81             }
82         } else
83             return currentDelegator;
84     }
85 }
86
Popular Tags