notes revision 608:7e06bf1dcb09
195533SmikeNotes on IOR implementation
295533Smike
395533Smike1. Writeable is an interface that can write itself to an OutputStream.
495533Smike
595533Smike2. IdEncapsulation is  a particular kind of Writeable that has an Id and
695533Smike   an Encapsulation (a sequence of bytes) representing some other structure
795533Smike   in a CDR encapsulation.
895533Smike
995533Smike3. ContainerBase is a base class for containers of IdEncapsulations.
1095533Smike
1195533Smike4. An IOR is a ContainerBase.
1295533Smike
1395533Smike5. A TaggedComponent is not a ContainerBase.
1495533Smike
1595533Smike6. Some (not all) Profiles are ContainerBases.
1695533Smike
1795533Smike7. IIOPAddress contains (host, port)
1895533Smike    IIOPServerLocation contains:
1995533Smike	- A primary IIOPAddress
2095533Smike	- 0 or more secondary IIOPAddresses (these get placed in 
2195533Smike	  TAG_ALTERNATE_IIOP_ADDRESS components)
2295533Smike
2395533Smike8. IIOPProfileTemplate:
2495533Smike    - major, minor version
2595533Smike    - 0 or more TaggedComponents
2695533Smike    - ObjectKeyTemplate
2795533Smike
2895533Smike9. ObjectKeyTemplate:
2995533Smike    - contains only wire data, not internal structures
3095533Smike
3195533Smike    write( object id, output stream ): write the object key out 
3295533Smike	to the output stream with the given object id
3395737Smike	
3495533Smike10. Significant problem: must of the dispatch path code is written in terms of
3595533Smike    IORs when it should be based on profiles.  Only a single profile is used in 
36208331Sphk    a request, and that is what should be passed around.  This needs fixing soon
37208331Sphk    to accommodate the eventual implementation of CORBA FT, and also to work
38208331Sphk    properly with the new IOR.
39208331Sphk
40208331Sphk11. Another question: since profile contains key which contains scid, what if 
4195737Smike    we have multiple profiles with different scids?
4295737Smike    One answer: create a cluster subcontract that invokes the individual 
4395737Smike    profiles for FT.  This may not mesh well with the FT spec.
4495737Smike
4595737Smike12. Uses of IORs in the ORB:
4695737Smike
4795737SmikeActivation/ServerManagerImpl.java
4895737Smike    - Construct IOR for bad ID handler location forward
4995737Smikecorba/ClientDelegate.java
5095737Smike    - marshal, getIOR, unmarshal are all questionable and make
5195737Smike      poor use of IOR.
5295737Smike    - gets forwarded IOR from response
5395737Smike    - IORs handled in some service contexts
5495737Smike    - createRequest needs to parse IOR
5595737Smike	- gets the (one) IIOP profile that we care about
5695533Smike	- gets the object key
5795533Smikecorba/InitialNamingClient.java
5895533Smike    - constructs IOR from address info, object key
5995533Smike    - current implementation should use AlternateIIOPAddress components
6095533Smike    - constructs IOR with key "INIT" for old bootstrap
6195533Smikecorba/ORB.java
6295533Smike    - stringify and destringify IOR
6395533Smikecorba/ServerDelegate.java
6495533Smike    - access IOR from sending context service context
6595533Smike    - destroyObjref directly access transient key from a known offset.
6695533Smike    - creation sets up key inline with known offsets
6795533Smikecore/IOR.java
6895533Smike    - IOR sometimes stores a servant
6995533Smike    - IOR contains the following
7095533Smike	- Object servant
7195737Smike	- Endpoint ep
7295737Smike	- String codebase
7395737Smike	- boolean cachedCodebase
7495533Smike	- TaggedComponent localCodeBaseTC
7595533Smike	- InternetIOPTag
7695533Smike    - The two constructors that take full args also
7795533Smike      construct tagged components
7895737Smike    - will need alternate address components for INS
7995737Smikecore/SendingContextServiceContext.java
8095737Smike    - reads IOR from input stream
8195533Smikeiiop/CDRInputStream.java
8295737Smike    - needs type id, code base from IOR
8395737Smikeiiop/IIOPOutputStream.java
8495737Smike    - needs to access objkey as a sequence of bytes to realing requests.
8595533SmikePOA/GenericPOAClientSC.java
8695533Smike    - needs to pull POA ID out of object key
8795533Smike    - needs to created a new IOR that has an updated scid
8895533SmikePOA/GenericPOAServerSC.java
8995737Smike    - creates IORs
9095737SmikeTransactionalPOA/TransactionalServerSC.java
9195737Smike    - inline access to known offset in object key to
9295533Smike      determine whether transactional
9395533Smike
9495533SmikeGuide to the files:
9595533Smike
9695533SmikeBasic Interfaces:
97113005Sphk    Identifiable.java (Object has an Id)
98113005Sphk    Writeable.java (Object can write to OutputStream)
99113005Sphk    IdEncapsulation.java (Writeable, Identifiable interface)
100113005Sphk    IdEncapsulationFactory.java (Factory interface for IdEncapsulation)
101113005Sphk    IdEncapsulationFactoryFinder.java (Finder interface for IdEncapsulationFactoryFinder)
102208331Sphk
103113005Sphk    IIOPAddress.java (class containing host and port for IIOP)
104113005Sphk
105113005SphkBasic support for IdEncapsulations (shared for components and profiles):
106113005Sphk    GenericIdEncapsulation.java (Has id, octet sequence: used for generic
107113005Sphk	TaggedComponent and TaggedProfile objects)
108113005Sphk    FreezableList.java (Delegated implementation of List that can be made 
109113005Sphk	immutable after construction)
110208331Sphk    IdentifiableContainerBase.java (extends FreezableList: container of Identifiable: 
111113005Sphk	supports iteratorById.)
112208331Sphk    IdEncapsulationContainerBase.java (extends IdenitifableContainerBase:
113113005Sphk	container of IdEncapsulation: supports read/write IdEncapsulationSequence)
114113005Sphk
115113005SphkObject Keys:
116113005Sphk    ObjectKeyFactory.java
117113005Sphk    ObjectKeyTemplate.java (interface for the following:)
118208331Sphk	JIDLObjectKeyTemplate.java (object key used in *Delegate)
119113005Sphk	POAObjectKeyTemplate.java (object key used in GenericPOA*SC)
120113005Sphk	WireObjectKeyTemplate.java (used for non-Sun ORB IORs)
121113005Sphk    ObjectId.java (a simple wrapper for byte[])
122113005Sphk    ObjectKey.java (contains ObjectId and ObjectKeyTemplate)
123113005Sphk
124113005SphkComponents:
125113005Sphk    TaggedComponentFactories.java (contains method for registering factories)
126208331Sphk    TaggedComponentFactoryFinder.java (contains registered factories)
127113005Sphk    TaggedComponent.java (interface of all tagged components)
128113005Sphk	AlternateIIOPAddressComponent.java
129113005Sphk	CodeSetsComponent.java
130113005Sphk	JavaCodebaseComponent.java
131113005Sphk	ORBTypeComponent.java
132113005Sphk	PoliciesComponent.java
133113005Sphk
134208331SphkProfiles:
135113005Sphk    IIOPProfile.java (IIOPProfileTemplate and ObjectId)
136208331Sphk    IIOPProfileTemplate.java (contains version, address, ObjectKeyTemplate, 
137113005Sphk	list of TaggedComponent)
138113005Sphk    TaggedProfile.java (interface for all TaggedProfiles)
139113005Sphk    TaggedProfileFactoryFinder.java
140113005Sphk    TaggedProfileTemplate.java
141113005Sphk
142208331SphkIOR:
143113005Sphk    IOR.java
144113009Sphk    IORTemplate.java (List of IIOPProfileTemplate
145113005Sphk    ObjectIds.java (List of ObjectId: needed for an IOR constructor)
146113005Sphk
147113005SphkNotes from integration code review:
148113005Sphk
149113005SphkGeneral:
150208331Sphk    - Look at making IOR API public, or
151113005Sphk      move everything into com.sun.corba.se.impl.ior
152113005Sphk      (don't hold up putback for this)
153113005Sphk    Making public:
154113005Sphk	- Writeable needs getBytes() as well as write()
155113005Sphk	  methods.
156113005Sphk	- codec can be used with an Any to convert between
157113005Sphk	  IDL data type and sequence of bytes.
158113005Sphk	- write() needs to use getBytes, then write id, length,
159208331Sphk	  octets to output stream.
160113005Sphk	- getBytes() method needs to get typecode from IDL
161113005Sphk	  then create Any.
162113005Sphk	- IdEncapsulations need to have constructor that takes
163113005Sphk	  byte[] (encapsulation of value).
164113005Sphk    Why not?
165113005Sphk	- Unencapsulated object keys can't be made portable
166113005Sphk	- Lots of dependencies on ORB code in ObjectKey support
167113005Sphk    Conclusion: 
168113005Sphk	- move to internal (DONE)
169113005Sphk    - JAVA_MAGIC should move to ObjectKeyTemplates (DONE)
170208331Sphk    - check for intToBytes/bytesToInt related to object key
171113005Sphk	corba/ServerDelegate (DONE)
172208331Sphk	POA/GenericPOAServerSC (DONE)
173208331Sphk	POA/SubcontractResponseHandler (DONE)
174113005Sphk	TransactionalPOA/TransactionalClientSC.java (DONE)
175113005Sphk	TransactionalPOA/TransactionalServerSC.java (DONE)
176113005Sphk
177113005Sphk./com/sun/corba/se/impl/cosnaming/BootstrapServer.java
178113005Sphk    - remove sc_init_key_* (DONE)
179208331Sphk
180113005Sphk./com/sun/corba/se/impl/poa/POAImpl.java
181113005Sphk    - remove line 130: comment on other endpoints, e.g. SSL (DONE)
182113005Sphk    - add revisit comment on line 133: use multiple server port API (DONE)
183113005Sphk
184113005Sphk./com/sun/corba/se/impl/corba/ORB.java
185113005Sphk    - object_to_string: add comment that connect only takes place in
186113005Sphk      non-POA cases. (DONE)
187113005Sphk
188208331Sphk./com/sun/corba/se/impl/corba/ServerDelegate.java
189113005Sphk    - chase down the object key offsets  (DONE)
190113005Sphk      (search for bytesToInt and intToBytes)
191113005Sphk
192113005Sphk./com/sun/corba/se/impl/core/SubcontractRegistry.java
193113005Sphk    - getServerSubcontract: add b-e l-e comment and history on INIT, TINI (DONE)
194113005Sphk    - getServerSubcontract: reference to constants (May not do this?)
195113005Sphk    - getServerSubcontract: return null at end IS reachable, in the
196113005Sphk      case where we have essentially a name in the key that isn't
197113005Sphk      one of the ones we support.  Throw an exception? (DONE)
198113005Sphk    - add minor code for INTERNAL (and string) (DONE)
199208331Sphk    - remove setId calls in callers to getClientSubcontract (DONE)
200113005Sphk    - throw INTERNAL exception for temp.size() != 1 case (DONE)
201208331Sphk      Think about INST corbaloc problems (multi-profile IORs)
202208331Sphk      both return nulls should throw exceptions (DONE)
203113005Sphk
204113005Sphk./com/sun/corba/se/impl/core/IOR.java
20595533Smike    - Add some comments to getIORfromString about 4/2 constants (DONE)
206    - fix name: should be getIORFromString (DONE)
207    - IOR( InputStream ) has a problem with cachedCodeBase:
208      is should not call getCodeBase: must refactor to 
209      an internal implementation method. (DONE)
210    - isEquivalent and isLocal should assert failure 
211      if multiple profiles (through exception in getProfile) (DONE)
212      (add comments about multi case)
213
214./com/sun/corba/se/impl/iiop/CDRInputStream_1_0.java
215    - read_Object: add assert in case servant is not Tie or objref (DONE)
216
217./com/sun/corba/se/internal/TransactionalPOA/TransactionalPOAImpl.java
218    - add comment about transactionalIortemplate: goes away after
219      we get to OTS 1.2 transactional policy. (DONE)
220    - change transactionalClone( ObjectKeyTemplate ) so that
221      we get an error (INTERNAL) if NOT POAObjectKeyTemplate (DONE)
222    - line 138: get string constant from 
223      org.omg.CosTransactions.TransactionalObject (DONE)
224    - remove Delegate d decl. (DONE)
225
226We need to assign minor codes for all exceptions!
227
228We need to clean up the minor code base usage! (DONE)
229
230Add equals/toString to:
231    Do not try to develop a reflective universal equals: too slow!
232    Do we really want equals on lists?  
233	If we do, define collectionEqual on FreezableList
234
235CodeSetsComponent: toString
236FreezableList: basic toString, equals methods
237IIOPProfile: toString
238IIOPProfileTemplate: toString
239IOR: toString
240IORTemplate.java: toString, equals (inherit?)
241IdEncapsulationContainerBase.java: make abstract, but provide base toString/equals
242IdentifiableContainerBase.java: make abstract (no other changes)
243    (ContainerBase classes need some explanation)
244ObjectIds.java needs toString, equals (use FreezableList?)
245ObjectKey: toString
246ObjectKeyFactory.java: singleton: don't add toString or equals
247PoliciesComponent.java: should finish this sometime (after we figure out
248    exactly what to do with it)
249TaggedComponentBase.java: should be abstract
250TaggedComponentFactories.java: a singelton
251TaggedComponentFactoryFinder.java: a singleton
252TaggedProfileFactoryFinder.java: a singleton
253JIDLObjectKeyTemplate: toString
254POAObjectKeyTemplate: toString
255WireObjectKeyTemplate: toString uninteresting: no data, equals not useful
256
257use util/Utility.objectToString to implement toString methods.
258
259Other changes:
260
261    IIOPAddress.toString should include class name (DONE)
262
263    New tests needed:
264	IIOPProfile.getIOPComponents 
265	IIOPProfile.getIOPProfile
266	GenericTaggedProfile.getIOPComponents
267	GenericTaggedProfile.getIOPProfile
268	GenericTaggedComponent.getIOPComponent
269	ObjectKeyTemplate.getAdapterId
270
271    Plus, do a read/write test for IOP stuff:
272	construct profile
273	convert to IOP.TaggedProfile
274	write to stream
275	get input stream
276	construct profile
277	check for equal
278
279    do some tests on IOR.toString() just to see what gets printed.
280
281    Add getAdapterId to *ObjectKeyTemplate.java (DONE)
282    Add some tests for this:
283	- WireObjectKeyTemplate throws an exception
284	- Identically constructed ObjectKeyTemplates produce identical Adapter Ids.
285	- Different OKTs produce different adapter IDs.
286
287New tests for versioning support:
288
289ORBVersionFactory:
290    - for create array methods (DONE)
291	- returns expected values for version encodings
292	- throws INTERNAL for negative version
293    - test one case for create stream method (DONE)
294    - getORBVersion returns correct version (DONE)
295ORBVersionImpl:
296    - check equals on some ORBVersions (DONE)
297    - check that each ORBVersion returns correct orbtype (DONE)
298JIDLObjectKeyTemplate:
299    - non-key constructor gives NEWER version (DONE)
300POAObjectKeyTemplate:
301    - non-key constructor gives NEWER version (DONE)
302OldJIDLObjectKeyTemplate: (DONE)
303    - non-key constructor with OLD, NEW MAGIC and check version
304    - other values throw exception
305OldPOAObjectKeyTemplate: (DONE)
306    - non-key constructor with OLD, NEW MAGIC and check version (DONE)
307    - other values throw exception (DONE)
308WireObjectKeyTemplate (DONE)
309    - version is FOREIGN
310ObjectKeyFactory (DONE)
311    create the following keys and check results:
312	JIDL OLD	OldJIDL with correct magic, version
313	JIDL NEW	OldJIDL
314	JIDL NEWER	JIDL
315	POA OLD		OldPOA
316	POA NEW		OldPOA
317	POA NEWER	POA
318