01: /*
02: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License version
07: * 2 only, as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * General Public License version 2 for more details (a copy is
13: * included at /legal/license.txt).
14: *
15: * You should have received a copy of the GNU General Public License
16: * version 2 along with this work; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18: * 02110-1301 USA
19: *
20: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
21: * Clara, CA 95054 or visit www.sun.com if you need additional
22: * information or have any questions.
23: */
24:
25: package com.sun.midp.push.gcf;
26:
27: import java.io.IOException;
28:
29: /**
30: * Protocol-dependent representation of connection which could become
31: * a reservation later.
32: *
33: * <p>
34: * The instance of this class are expected to be just data holders (see
35: * probable additional requirements below).
36: * </p>
37: *
38: * @see ConnectionReservation
39: * @see ReservationDescriptorFactory
40: */
41: public interface ReservationDescriptor {
42: /**
43: * Reserves the connection.
44: *
45: * <p>
46: * The very moment this method returns, the correspondong connection cannot
47: * be opened by any other application (including native ones) until
48: * reservation is cancelled. The connection cannot be reserved by
49: * <em>any</em> application (including one for which it has been reserved).
50: * <code>IOException</code> should be thrown to report such a situation.
51: * </p>
52: *
53: * <p>
54: * Pair <code>midletSuiteId</code> and <code>midletClassName</code>
55: * should refer to valid <code>MIDlet</code>
56: * </p>
57: *
58: * @param midletSuiteId <code>MIDlet</code> suite ID
59: *
60: * @param midletClassName name of <code>MIDlet</code> class
61: *
62: * @param dataAvailableListener data availability listener
63: *
64: * @return connection reservation
65: *
66: * @throws IOException if connection cannot be reserved
67: * for the given application
68: */
69: ConnectionReservation reserve(int midletSuiteId,
70: String midletClassName,
71: DataAvailableListener dataAvailableListener)
72: throws IOException;
73:
74: /**
75: * Gets connection name of descriptor.
76: *
77: * <p>
78: * Should be identical to one passed into
79: * {@link ReservationDescriptorFactory#getDescriptor}.
80: * </p>
81: *
82: * @return connection name
83: */
84: String getConnectionName();
85:
86: /**
87: * Gets filter of descriptor.
88: *
89: * <p>
90: * Should be identical to one passed into
91: * {@link ReservationDescriptorFactory#getDescriptor}.
92: * </p>
93: *
94: * @return connection filter
95: */
96: String getFilter();
97: }
|