SendingContextServiceContext.java revision 608:7e06bf1dcb09
1234287Sdim/*
2234287Sdim * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
3234287Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4234287Sdim *
5234287Sdim * This code is free software; you can redistribute it and/or modify it
6234287Sdim * under the terms of the GNU General Public License version 2 only, as
7234287Sdim * published by the Free Software Foundation.  Oracle designates this
8234287Sdim * particular file as subject to the "Classpath" exception as provided
9234287Sdim * by Oracle in the LICENSE file that accompanied this code.
10234287Sdim *
11234287Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
12234287Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13234287Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14234287Sdim * version 2 for more details (a copy is included in the LICENSE file that
15234287Sdim * accompanied this code).
16234287Sdim *
17249423Sdim * You should have received a copy of the GNU General Public License version
18234287Sdim * 2 along with this work; if not, write to the Free Software Foundation,
19234287Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20234287Sdim *
21234287Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22234287Sdim * or visit www.oracle.com if you need additional information or have any
23234287Sdim * questions.
24234287Sdim */
25234287Sdim
26234287Sdimpackage com.sun.corba.se.spi.servicecontext;
27234287Sdim
28234287Sdimimport org.omg.CORBA.SystemException;
29234287Sdimimport org.omg.CORBA_2_3.portable.InputStream ;
30234287Sdimimport org.omg.CORBA_2_3.portable.OutputStream ;
31234287Sdimimport com.sun.corba.se.spi.ior.IOR ;
32234287Sdimimport com.sun.corba.se.spi.ior.iiop.GIOPVersion;
33234287Sdimimport com.sun.corba.se.spi.servicecontext.ServiceContext ;
34234287Sdimimport com.sun.corba.se.impl.encoding.MarshalOutputStream ;
35234287Sdimimport com.sun.corba.se.impl.ior.IORImpl ;
36234287Sdim
37234287Sdimpublic class SendingContextServiceContext extends ServiceContext {
38234287Sdim    public SendingContextServiceContext( IOR ior )
39234287Sdim    {
40261991Sdim        this.ior = ior ;
41261991Sdim    }
42234287Sdim
43234287Sdim    public SendingContextServiceContext(InputStream is, GIOPVersion gv)
44234287Sdim    {
45234287Sdim        super(is, gv) ;
46234287Sdim        ior = new IORImpl( in ) ;
47234287Sdim    }
48234287Sdim
49234287Sdim    // Required SERVICE_CONTEXT_ID and getId definitions
50234287Sdim    public static final int SERVICE_CONTEXT_ID = 6 ;
51234287Sdim    public int getId() { return SERVICE_CONTEXT_ID ; }
52234287Sdim
53234287Sdim    public void writeData( OutputStream os ) throws SystemException
54234287Sdim    {
55234287Sdim        ior.write( os ) ;
56234287Sdim    }
57234287Sdim
58234287Sdim    public IOR getIOR()
59234287Sdim    {
60234287Sdim        return ior ;
61234287Sdim    }
62234287Sdim
63234287Sdim    private IOR ior = null ;
64234287Sdim
65234287Sdim    public String toString()
66234287Sdim    {
67234287Sdim        return "SendingContexServiceContext[ ior=" + ior + " ]" ;
68234287Sdim    }
69234287Sdim}
70234287Sdim