1 7 8 package com.sun.corba.se.spi.ior.iiop ; 9 10 import org.omg.CORBA_2_3.portable.InputStream ; 11 12 import com.sun.corba.se.spi.ior.Identifiable ; 13 import com.sun.corba.se.spi.ior.IdentifiableFactory ; 14 import com.sun.corba.se.spi.ior.EncapsulationFactoryBase ; 15 import com.sun.corba.se.spi.ior.ObjectId ; 16 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; 17 18 import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; 19 import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; 20 import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; 21 22 import com.sun.corba.se.spi.orb.ORB ; 23 24 import com.sun.corba.se.impl.encoding.MarshalInputStream ; 25 26 import com.sun.corba.se.impl.ior.iiop.IIOPAddressImpl ; 27 import com.sun.corba.se.impl.ior.iiop.CodeSetsComponentImpl ; 28 import com.sun.corba.se.impl.ior.iiop.AlternateIIOPAddressComponentImpl ; 29 import com.sun.corba.se.impl.ior.iiop.JavaCodebaseComponentImpl ; 30 import com.sun.corba.se.impl.ior.iiop.MaxStreamFormatVersionComponentImpl ; 31 import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent; 32 import com.sun.corba.se.impl.ior.iiop.ORBTypeComponentImpl ; 33 import com.sun.corba.se.impl.ior.iiop.IIOPProfileImpl ; 34 import com.sun.corba.se.impl.ior.iiop.IIOPProfileTemplateImpl ; 35 import com.sun.corba.se.impl.ior.iiop.RequestPartitioningComponentImpl ; 36 import com.sun.corba.se.impl.orbutil.ORBConstants; 37 import com.sun.corba.se.impl.orbutil.ORBConstants; 38 39 import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; 40 import org.omg.IOP.TAG_CODE_SETS ; 41 import org.omg.IOP.TAG_JAVA_CODEBASE ; 42 import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT ; 43 import org.omg.IOP.TAG_ORB_TYPE ; 44 import org.omg.IOP.TAG_INTERNET_IOP ; 45 46 51 public abstract class IIOPFactories { 52 private IIOPFactories() {} 53 54 public static IdentifiableFactory makeRequestPartitioningComponentFactory() 55 { 56 return new EncapsulationFactoryBase(ORBConstants.TAG_REQUEST_PARTITIONING_ID) { 57 public Identifiable readContents(InputStream in) 58 { 59 int threadPoolToUse = in.read_ulong(); 60 Identifiable comp = 61 new RequestPartitioningComponentImpl(threadPoolToUse); 62 return comp; 63 } 64 }; 65 } 66 67 public static RequestPartitioningComponent makeRequestPartitioningComponent( 68 int threadPoolToUse) 69 { 70 return new RequestPartitioningComponentImpl(threadPoolToUse); 71 } 72 73 public static IdentifiableFactory makeAlternateIIOPAddressComponentFactory() 74 { 75 return new EncapsulationFactoryBase(TAG_ALTERNATE_IIOP_ADDRESS.value) { 76 public Identifiable readContents( InputStream in ) 77 { 78 IIOPAddress addr = new IIOPAddressImpl( in ) ; 79 Identifiable comp = 80 new AlternateIIOPAddressComponentImpl( addr ) ; 81 return comp ; 82 } 83 } ; 84 } 85 86 public static AlternateIIOPAddressComponent makeAlternateIIOPAddressComponent( 87 IIOPAddress addr ) 88 { 89 return new AlternateIIOPAddressComponentImpl( addr ) ; 90 } 91 92 public static IdentifiableFactory makeCodeSetsComponentFactory() 93 { 94 return new EncapsulationFactoryBase(TAG_CODE_SETS.value) { 95 public Identifiable readContents( InputStream in ) 96 { 97 return new CodeSetsComponentImpl( in ) ; 98 } 99 } ; 100 } 101 102 public static CodeSetsComponent makeCodeSetsComponent( ORB orb ) 103 { 104 return new CodeSetsComponentImpl( orb ) ; 105 } 106 107 public static IdentifiableFactory makeJavaCodebaseComponentFactory() 108 { 109 return new EncapsulationFactoryBase(TAG_JAVA_CODEBASE.value) { 110 public Identifiable readContents( InputStream in ) 111 { 112 String url = in.read_string() ; 113 Identifiable comp = new JavaCodebaseComponentImpl( url ) ; 114 return comp ; 115 } 116 } ; 117 } 118 119 public static JavaCodebaseComponent makeJavaCodebaseComponent( 120 String codebase ) 121 { 122 return new JavaCodebaseComponentImpl( codebase ) ; 123 } 124 125 public static IdentifiableFactory makeORBTypeComponentFactory() 126 { 127 return new EncapsulationFactoryBase(TAG_ORB_TYPE.value) { 128 public Identifiable readContents( InputStream in ) 129 { 130 int type = in.read_ulong() ; 131 Identifiable comp = new ORBTypeComponentImpl( type ) ; 132 return comp ; 133 } 134 } ; 135 } 136 137 public static ORBTypeComponent makeORBTypeComponent( int type ) 138 { 139 return new ORBTypeComponentImpl( type ) ; 140 } 141 142 public static IdentifiableFactory makeMaxStreamFormatVersionComponentFactory() 143 { 144 return new EncapsulationFactoryBase(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value) { 145 public Identifiable readContents(InputStream in) 146 { 147 byte version = in.read_octet() ; 148 Identifiable comp = new MaxStreamFormatVersionComponentImpl(version); 149 return comp ; 150 } 151 }; 152 } 153 154 public static MaxStreamFormatVersionComponent makeMaxStreamFormatVersionComponent() 155 { 156 return new MaxStreamFormatVersionComponentImpl() ; 157 } 158 159 public static IdentifiableFactory makeJavaSerializationComponentFactory() { 160 return new EncapsulationFactoryBase( 161 ORBConstants.TAG_JAVA_SERIALIZATION_ID) { 162 public Identifiable readContents(InputStream in) { 163 byte version = in.read_octet(); 164 Identifiable cmp = new JavaSerializationComponent(version); 165 return cmp; 166 } 167 }; 168 } 169 170 public static JavaSerializationComponent makeJavaSerializationComponent() { 171 return JavaSerializationComponent.singleton(); 172 } 173 174 public static IdentifiableFactory makeIIOPProfileFactory() 175 { 176 return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { 177 public Identifiable readContents( InputStream in ) 178 { 179 Identifiable result = new IIOPProfileImpl( in ) ; 180 return result ; 181 } 182 } ; 183 } 184 185 public static IIOPProfile makeIIOPProfile( ORB orb, ObjectKeyTemplate oktemp, 186 ObjectId oid, IIOPProfileTemplate ptemp ) 187 { 188 return new IIOPProfileImpl( orb, oktemp, oid, ptemp ) ; 189 } 190 191 public static IIOPProfile makeIIOPProfile( ORB orb, 192 org.omg.IOP.TaggedProfile profile ) 193 { 194 return new IIOPProfileImpl( orb, profile ) ; 195 } 196 197 public static IdentifiableFactory makeIIOPProfileTemplateFactory() 198 { 199 return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { 200 public Identifiable readContents( InputStream in ) 201 { 202 Identifiable result = new IIOPProfileTemplateImpl( in ) ; 203 return result ; 204 } 205 } ; 206 } 207 208 public static IIOPProfileTemplate makeIIOPProfileTemplate( ORB orb, 209 GIOPVersion version, IIOPAddress primary ) 210 { 211 return new IIOPProfileTemplateImpl( orb, version, primary ) ; 212 } 213 214 public static IIOPAddress makeIIOPAddress( ORB orb, String host, int port ) 215 { 216 return new IIOPAddressImpl( orb, host, port ) ; 217 } 218 219 public static IIOPAddress makeIIOPAddress( InputStream is ) 220 { 221 return new IIOPAddressImpl( is ) ; 222 } 223 } 224 | Popular Tags |