01: /*
02: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
03: *
04: * This file is part of Resin(R) Open Source
05: *
06: * Each copy or derived work must preserve the copyright notice and this
07: * notice unmodified.
08: *
09: * Resin Open Source is free software; you can redistribute it and/or modify
10: * it under the terms of the GNU General Public License as published by
11: * the Free Software Foundation; either version 2 of the License, or
12: * (at your option) any later version.
13: *
14: * Resin Open Source is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17: * of NON-INFRINGEMENT. See the GNU General Public License for more
18: * details.
19: *
20: * You should have received a copy of the GNU General Public License
21: * along with Resin Open Source; if not, write to the
22: *
23: * Free Software Foundation, Inc.
24: * 59 Temple Place, Suite 330
25: * Boston, MA 02111-1307 USA
26: *
27: * @author Scott Ferguson
28: */
29:
30: package com.caucho.iiop;
31:
32: import com.caucho.iiop.orb.*;
33: import com.caucho.iiop.any.*;
34: import com.caucho.server.util.CauchoSystem;
35: import com.caucho.util.*;
36: import com.caucho.vfs.ReadStream;
37: import com.caucho.vfs.TempBuffer;
38:
39: import org.omg.CORBA.Principal;
40: import org.omg.CORBA.TCKind;
41: import org.omg.CORBA.TypeCode;
42: import org.omg.CORBA.portable.IndirectionException;
43: import org.omg.SendingContext.RunTime;
44:
45: import javax.rmi.CORBA.Util;
46: import javax.rmi.CORBA.ValueHandler;
47: import java.io.EOFException;
48: import java.io.IOException;
49: import java.io.Serializable;
50: import java.lang.reflect.Proxy;
51: import java.util.ArrayList;
52: import java.util.HashMap;
53: import java.util.logging.Logger;
54:
55: public final class WriterContext {
56: private IntMap _savedStrings = new IntMap();
57: private IdentityIntMap _refMap = new IdentityIntMap();
58: private ValueHandler _valueHandler = Util.createValueHandler();
59: private RunTime _runTime = _valueHandler.getRunTimeCodeBase();
60:
61: public int getString(String v) {
62: return _savedStrings.get(v);
63: }
64:
65: public void putString(String v, int offset) {
66: _savedStrings.put(v, offset);
67: }
68:
69: public void putRef(Object v, int offset) {
70: _refMap.put(v, offset);
71: }
72:
73: public int getRef(Object v) {
74: return _refMap.get(v);
75: }
76:
77: public ValueHandler getValueHandler() {
78: return _valueHandler;
79: }
80:
81: public RunTime getRunTime() {
82: return _runTime;
83: }
84: }
|