4
|
1 |
/*
|
5555
|
2 |
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
|
4
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5555
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
4
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5555
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
4
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5555
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
4
|
24 |
*/
|
|
25 |
|
|
26 |
package com.sun.corba.se.impl.ior;
|
|
27 |
|
|
28 |
import org.omg.CORBA.INTERNAL ;
|
|
29 |
import org.omg.CORBA.OctetSeqHolder ;
|
|
30 |
|
|
31 |
import org.omg.CORBA_2_3.portable.InputStream ;
|
|
32 |
import org.omg.CORBA_2_3.portable.OutputStream ;
|
|
33 |
|
|
34 |
import com.sun.corba.se.spi.orb.ORB ;
|
|
35 |
import com.sun.corba.se.spi.orb.ORBVersion ;
|
|
36 |
import com.sun.corba.se.spi.orb.ORBVersionFactory ;
|
|
37 |
|
|
38 |
import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
|
|
39 |
|
|
40 |
/**
|
|
41 |
* @author Ken Cavanaugh
|
|
42 |
*/
|
|
43 |
public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase
|
|
44 |
{
|
|
45 |
/** This constructor reads the template ONLY from the stream
|
|
46 |
*/
|
|
47 |
public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
|
|
48 |
{
|
|
49 |
this( orb, magic, scid, is.read_long(), is.read_long(), is.read_long() ) ;
|
|
50 |
}
|
|
51 |
|
|
52 |
/** This constructor reads a complete ObjectKey (template and Id)
|
|
53 |
* from the stream.
|
|
54 |
*/
|
|
55 |
public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
|
|
56 |
OctetSeqHolder osh )
|
|
57 |
{
|
|
58 |
this( orb, magic, scid, is ) ;
|
|
59 |
osh.value = readObjectKey( is ) ;
|
|
60 |
}
|
|
61 |
|
|
62 |
public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, int serverid,
|
|
63 |
int orbid, int poaid)
|
|
64 |
{
|
|
65 |
super( orb, magic, scid, serverid,
|
|
66 |
Integer.toString( orbid ),
|
|
67 |
new ObjectAdapterIdNumber( poaid ) ) ;
|
|
68 |
}
|
|
69 |
|
|
70 |
public void writeTemplate(OutputStream os)
|
|
71 |
{
|
|
72 |
os.write_long( getMagic() ) ;
|
|
73 |
os.write_long( getSubcontractId() ) ;
|
|
74 |
os.write_long( getServerId() ) ;
|
|
75 |
|
|
76 |
int orbid = Integer.parseInt( getORBId() ) ;
|
|
77 |
os.write_long( orbid ) ;
|
|
78 |
|
|
79 |
ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ;
|
|
80 |
int poaid = oaid.getOldPOAId() ;
|
|
81 |
os.write_long( poaid ) ;
|
|
82 |
}
|
|
83 |
|
|
84 |
public ORBVersion getORBVersion()
|
|
85 |
{
|
|
86 |
if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
|
|
87 |
return ORBVersionFactory.getOLD() ;
|
|
88 |
else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
|
|
89 |
return ORBVersionFactory.getNEW() ;
|
|
90 |
else
|
|
91 |
throw new INTERNAL() ;
|
|
92 |
}
|
|
93 |
}
|