KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > servicecontext > ORBVersionServiceContext


1 /*
2  * @(#)ORBVersionServiceContext.java 1.10 04/06/21
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.spi.servicecontext;
9
10 import org.omg.CORBA.SystemException JavaDoc;
11 import org.omg.CORBA_2_3.portable.InputStream JavaDoc ;
12 import org.omg.CORBA_2_3.portable.OutputStream JavaDoc ;
13
14 import com.sun.corba.se.spi.orb.ORBVersion ;
15 import com.sun.corba.se.spi.orb.ORBVersionFactory ;
16
17 import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
18 import com.sun.corba.se.spi.servicecontext.ServiceContext ;
19 import com.sun.corba.se.impl.orbutil.ORBConstants ;
20
21 public class ORBVersionServiceContext extends ServiceContext {
22
23     public ORBVersionServiceContext( )
24     {
25         version = ORBVersionFactory.getORBVersion() ;
26     }
27
28     public ORBVersionServiceContext( ORBVersion ver )
29     {
30     this.version = ver ;
31     }
32
33     public ORBVersionServiceContext(InputStream JavaDoc is, GIOPVersion gv)
34     {
35     super(is, gv) ;
36     // pay particular attention to where the version is being read from!
37
// is contains an encapsulation, ServiceContext reads off the
38
// encapsulation and leaves the pointer in the variable "in",
39
// which points to the long value.
40

41     version = ORBVersionFactory.create( in ) ;
42     }
43
44     // Required SERVICE_CONTEXT_ID and getId definitions
45
public static final int SERVICE_CONTEXT_ID = ORBConstants.TAG_ORB_VERSION ;
46     public int getId() { return SERVICE_CONTEXT_ID ; }
47
48     public void writeData( OutputStream JavaDoc os ) throws SystemException JavaDoc
49     {
50     version.write( os ) ;
51     }
52
53     public ORBVersion getVersion()
54     {
55     return version ;
56     }
57
58     // current ORB Version
59
private ORBVersion version = ORBVersionFactory.getORBVersion() ;
60
61     public String JavaDoc toString()
62     {
63     return "ORBVersionServiceContext[ version=" + version + " ]" ;
64     }
65 }
66
Popular Tags