01: package org.jacorb.orb.giop;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * 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: /**
24: * This interface allows classes, registered with the TransportManager to
25: * receive notifications about the use of a Transport (by the current thread).
26: *
27: * Events are generated before starting the request sending sequence, for
28: * parties interested in what Transport is going to be used. Similarly,
29: * events are generated before starting the request handling.
30: *
31: * @author Iliyan Jeliazkov
32: * @version $Id: TransportListener.java,v 1.4 2006/08/16 17:46:36 iliyan.jeliazkov Exp $
33: *
34: */
35: public interface TransportListener {
36:
37: public static class Event {
38:
39: private final GIOPConnection giopc_;
40:
41: public Event(GIOPConnection giopc) {
42: giopc_ = giopc;
43: }
44:
45: public org.omg.ETF.Profile profile() {
46: if (transport().get_server_profile() == null) {
47: if (giopc_.getProfile() == null) {
48:
49: // This looks like the most appropriate exception to throw
50: throw new NullPointerException("Primary profile");
51: }
52: return giopc_.getProfile();
53: }
54:
55: return transport().get_server_profile();
56: }
57:
58: public org.omg.ETF.Connection transport() {
59: if (giopc_.getTransport() == null) {
60: // This looks like the most appropriate exception to throw
61: throw new NullPointerException("Transport");
62: }
63: return giopc_.getTransport();
64: }
65:
66: public String toString() {
67: return "[" + profile() + ']';
68: }
69:
70: public StatisticsProvider getStatisticsProvider(int orderno) {
71: return giopc_.getStatisticsProvider(orderno);
72: }
73: };
74:
75: /**
76: * Call-back for handling Transport selection events.
77: * @param event TODO
78: */
79: void transportSelected(Event event);
80:
81: }
|