KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > ior > NewObjectKeyTemplateBase


1 /*
2  * @(#)NewObjectKeyTemplateBase.java 1.9 04/03/01
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.ior;
9
10 import java.io.IOException JavaDoc ;
11
12 import org.omg.CORBA_2_3.portable.InputStream JavaDoc ;
13 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc ;
14
15 import com.sun.corba.se.spi.ior.ObjectId ;
16 import com.sun.corba.se.spi.ior.ObjectAdapterId ;
17 import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
18
19 import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
20
21 import com.sun.corba.se.spi.orb.ORB ;
22 import com.sun.corba.se.spi.orb.ORBVersion ;
23 import com.sun.corba.se.spi.orb.ORBVersionFactory ;
24
25 import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
26
27 public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase
28 {
29     public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
30     String JavaDoc orbid, ObjectAdapterId oaid )
31     {
32     super( orb, magic, scid, serverid, orbid, oaid ) ;
33     // subclass must set the version, since we don't have the object key here.
34

35     if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER)
36         throw wrapper.badMagic( new Integer JavaDoc( magic ) ) ;
37     }
38    
39     public void write(ObjectId objectId, OutputStream JavaDoc os)
40     {
41     super.write( objectId, os ) ;
42     getORBVersion().write( os ) ;
43     }
44
45     public void write(OutputStream JavaDoc os)
46     {
47     super.write( os ) ;
48     getORBVersion().write( os ) ;
49     }
50
51     protected void setORBVersion( InputStream JavaDoc is )
52     {
53     ORBVersion version = ORBVersionFactory.create( is ) ;
54     setORBVersion( version ) ;
55     }
56 }
57
Popular Tags