KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > test > orb > etf > wiop > WIOPConnection


1 package org.jacorb.test.orb.etf.wiop;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2003 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22
23 import org.omg.ETF.*;
24
25 /**
26  * @author <a HREF="mailto:spiegel@gnu.org">Andre Spiegel</a>
27  * @version $Id: WIOPConnection.java,v 1.1 2003/07/11 00:20:33 andre.spiegel Exp $
28  */

29 public class WIOPConnection extends _ConnectionLocalBase
30 {
31     private int tag = 0;
32     private Connection delegate = null;
33     
34     public WIOPConnection (Connection delegate, int tag)
35     {
36         this.delegate = delegate;
37         this.tag = tag;
38     }
39     
40     public void write (boolean is_first,
41                        boolean is_last,
42                        byte[] data,
43                        int offset,
44                        int length,
45                        long time_out)
46     {
47         WIOPFactories.transportInUse = true;
48         delegate.write (is_first, is_last, data, offset, length, time_out);
49     }
50
51     public void read (BufferHolder data,
52                       int offset,
53                       int min_length,
54                       int max_length,
55                       long time_out)
56     {
57         WIOPFactories.transportInUse = true;
58         delegate.read (data, offset, min_length, max_length, time_out);
59     }
60
61     public void flush()
62     {
63         delegate.flush();
64     }
65
66     public void connect(Profile server_profile, long time_out)
67     {
68         if (server_profile instanceof WIOPProfile)
69         {
70             delegate.connect (((WIOPProfile)server_profile).getDelegate(),
71                               time_out);
72         }
73         else
74         {
75             throw new org.omg.CORBA.BAD_PARAM JavaDoc
76                 ( "attempt to connect an WIOP connection "
77                 + "to a non-WIOP profile: " + server_profile.getClass());
78         }
79     }
80
81     public void close()
82     {
83         delegate.close();
84     }
85
86     public boolean is_connected()
87     {
88         return delegate.is_connected();
89     }
90
91     public Profile get_server_profile()
92     {
93         return new WIOPProfile (delegate.get_server_profile(),
94                                 this.tag);
95     }
96
97     public boolean is_data_available()
98     {
99         return delegate.is_data_available();
100     }
101
102     public boolean wait_next_data(long time_out)
103     {
104         return delegate.wait_next_data (time_out);
105     }
106
107     public boolean supports_callback()
108     {
109         return delegate.supports_callback();
110     }
111
112     public boolean use_handle_time_out()
113     {
114         return delegate.use_handle_time_out();
115     }
116
117 }
118
Popular Tags