1 7 8 package com.sun.corba.se.spi.extension ; 9 10 import org.omg.CORBA.Policy ; 11 import org.omg.CORBA.LocalObject ; 12 import com.sun.corba.se.impl.orbutil.ORBConstants ; 13 14 38 public class ServantCachingPolicy extends LocalObject implements Policy 39 { 40 44 public static final int NO_SERVANT_CACHING = 0 ; 45 46 50 public static final int FULL_SEMANTICS = 1 ; 51 52 57 public static final int INFO_ONLY_SEMANTICS = 2 ; 58 59 61 public static final int MINIMAL_SEMANTICS = 3 ; 62 63 private static ServantCachingPolicy policy = null ; 64 private static ServantCachingPolicy infoOnlyPolicy = null ; 65 private static ServantCachingPolicy minimalPolicy = null ; 66 67 private int type ; 68 69 public String typeToName() 70 { 71 switch (type) { 72 case FULL_SEMANTICS: 73 return "FULL" ; 74 case INFO_ONLY_SEMANTICS: 75 return "INFO_ONLY" ; 76 case MINIMAL_SEMANTICS: 77 return "MINIMAL" ; 78 default: 79 return "UNKNOWN(" + type + ")" ; 80 } 81 } 82 83 public String toString() 84 { 85 return "ServantCachingPolicy[" + typeToName() + "]" ; 86 } 87 88 private ServantCachingPolicy( int type ) 89 { 90 this.type = type ; 91 } 92 93 public int getType() 94 { 95 return type ; 96 } 97 98 100 public synchronized static ServantCachingPolicy getPolicy() 101 { 102 return getFullPolicy() ; 103 } 104 105 public synchronized static ServantCachingPolicy getFullPolicy() 106 { 107 if (policy == null) 108 policy = new ServantCachingPolicy( FULL_SEMANTICS ) ; 109 110 return policy ; 111 } 112 113 public synchronized static ServantCachingPolicy getInfoOnlyPolicy() 114 { 115 if (infoOnlyPolicy == null) 116 infoOnlyPolicy = new ServantCachingPolicy( INFO_ONLY_SEMANTICS ) ; 117 118 return infoOnlyPolicy ; 119 } 120 121 public synchronized static ServantCachingPolicy getMinimalPolicy() 122 { 123 if (minimalPolicy == null) 124 minimalPolicy = new ServantCachingPolicy( MINIMAL_SEMANTICS ) ; 125 126 return minimalPolicy ; 127 } 128 129 public int policy_type () 130 { 131 return ORBConstants.SERVANT_CACHING_POLICY ; 132 } 133 134 public org.omg.CORBA.Policy copy () 135 { 136 return this ; 137 } 138 139 public void destroy () 140 { 141 } 143 } 144 | Popular Tags |