My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/**
* BlueCove - Java library for Bluetooth
*
* Java docs licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* (c) Copyright 2001, 2002 Motorola, Inc. ALL RIGHTS RESERVED.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
* @version $Id$
*/
package javax.obex;

import java.io.IOException;

import javax.microedition.io.Connection;

/**
* The <code>SessionNotifier</code> interface defines a connection notifier for
* server-side OBEX connections. When a <code>SessionNotifier</code> is created
* and calls <code>acceptAndOpen()</code>, it will begin listening for clients
* to create a connection at the transport layer. When the transport layer
* connection is received, the <code>acceptAndOpen()</code> method will return a
* <code>javax.microedition.io.Connection</code> that is the connection to the
* client. The <code>acceptAndOpen()</code> method also takes a
* <code>ServerRequestHandler</code> argument that will process the requests
* from the client that connects to the server.
*
*/
public interface SessionNotifier extends Connection {

/**
* Waits for a transport layer connection to be established and specifies
* the handler to handle the requests from the client. No authenticator is
* associated with this connection, therefore, it is implementation
* dependent as to how an authentication challenge and authentication
* response header will be received and processed.
* <P>
* <H4>Additional Note for OBEX over Bluetooth</H4>
* If this method is called on a <code>SessionNotifier</code> object that
* does not have a <code>ServiceRecord</code> in the SDDB, the
* <code>ServiceRecord</code> for this object will be added to the SDDB.
* This method requests the BCC to put the local device in connectable mode
* so that it will respond to connection attempts by clients.
* <P>
* The following checks are done to verify that the service record provided
* is valid. If any of these checks fail, then a
* <code>ServiceRegistrationException</code> is thrown.
* <UL>
* <LI>ServiceClassIDList and ProtocolDescriptorList, the mandatory service
* attributes for a <code>btgoep</code> service record, must be present in
* the <code>ServiceRecord</code> associated with this notifier.
* <LI>L2CAP, RFCOMM and OBEX must all be in the ProtocolDescriptorList
* <LI>The <code>ServiceRecord</code> associated with this notifier must not
* have changed the RFCOMM server channel number
* </UL>
* <P>
* This method will not ensure that <code>ServiceRecord</code> associated
* with this notifier is a completely valid service record. It is the
* responsibility of the application to ensure that the service record
* follows all of the applicable syntactic and semantic rules for service
* record correctness.
* <p>
* Note : once an application invokes {@code close()} on any {@code
* SessionNotifier}, {@code L2CAPConnectionNotifier}, or {@code
* StreamConnectionNotifer} instance, all pending {@code acceptAndOpen()}
* methods that have been invoked previously on that instance MUST throw
* {@code InterruptedIOException}. This mechanism provides an application
* with the means to cancel any outstanding {@code acceptAndOpen()} method
* calls.
*
* @param handler
* the request handler that will respond to OBEX requests
*
* @return the connection to the client
*
* @exception IOException
* if an error occurs in the transport layer
*
* @exception NullPointerException
* if <code>handler</code> is <code>null</code>
*
* @exception ServiceRegistrationException
* if the structure of the associated service record is
* invalid or if the service record could not be added
* successfully to the local SDDB. The structure of service
* record is invalid if the service record is missing any
* mandatory service attributes, or has changed any of the
* values described above which are fixed and cannot be
* changed. Failures to add the record to the SDDB could be
* due to insufficient disk space, database locks, etc.
*
* @exception BluetoothStateException
* if the server device could not be placed in connectable
* mode because the device user has configured the device to
* be non-connectable
*/
public Connection acceptAndOpen(ServerRequestHandler handler) throws IOException;

/**
* Waits for a transport layer connection to be established and specifies
* the handler to handle the requests from the client and the
* <code>Authenticator</code> to use to respond to authentication challenge
* and authentication response headers.
* <P>
* <H4>Additional Note for OBEX over Bluetooth</H4>
* If this method is called on a <code>SessionNotifier</code> object that
* does not have a <code>ServiceRecord</code> in the SDDB, the
* <code>ServiceRecord</code> for this object will be added to the SDDB.
* This method requests the BCC to put the local device in connectable mode
* so that it will respond to connection attempts by clients.
* <P>
* The following checks are done to verify that the service record provided
* is valid. If any of these checks fail, then a
* <code>ServiceRegistrationException</code> is thrown.
* <UL>
* <LI>ServiceClassIDList and ProtocolDescriptorList, the mandatory service
* attributes for a <code>btgoep</code> service record, must be present in
* the <code>ServiceRecord</code> associated with this notifier.
* <LI>L2CAP, RFCOMM and OBEX must all be in the ProtocolDescriptorList
* <LI>The <code>ServiceRecord</code> associated with this notifier must not
* have changed the RFCOMM server channel number
* </UL>
* <P>
* This method will not ensure that <code>ServiceRecord</code> associated
* with this notifier is a completely valid service record. It is the
* responsibility of the application to ensure that the service record
* follows all of the applicable syntactic and semantic rules for service
* record correctness.
* <p>
* Note : once an application invokes {@code close()} on any {@code
* SessionNotifier}, {@code L2CAPConnectionNotifier}, or {@code
* StreamConnectionNotifer} instance, all pending {@code acceptAndOpen()}
* methods that have been invoked previously on that instance MUST throw
* {@code InterruptedIOException}. This mechanism provides an application
* with the means to cancel any outstanding {@code acceptAndOpen()} method
* calls.
*
* @param handler
* the request handler that will respond to OBEX requests
*
* @param auth
* the <code>Authenticator</code> to use with this connection; if
* <code>null</code> then no <code>Authenticator</code> will be
* used
*
* @return the connection to the client
*
* @exception IOException
* if an error occurs in the transport layer
*
* @exception NullPointerException
* if <code>handler</code> is <code>null</code>
*
* @exception ServiceRegistrationException
* if the structure of the associated service record is
* invalid or if the service record could not be added
* successfully to the local SDDB. The structure of service
* record is invalid if the service record is missing any
* mandatory service attributes, or has changed any of the
* values described above which are fixed and cannot be
* changed. Failures to add the record to the SDDB could be
* due to insufficient disk space, database locks, etc.
*
* @exception BluetoothStateException
* if the server device could not be placed in connectable
* mode because the device user has configured the device to
* be non-connectable
*/
public Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth) throws IOException;
}

Change log

r2532 by skarzhevskyy on Dec 9, 2008   Diff
sync package javax.obex javadocs with
JSR-82 1.1.1
Go to: 
Project members, sign in to write a code review

Older revisions

r2471 by skarzhevskyy on Nov 30, 2008   Diff
Change license to Apache License,
Version 2.0, Update headers
r2408 by skarzhevskyy on Oct 9, 2008   Diff
organize product to modules
r862 by skarzhevskyy on Jul 31, 2007   Diff
Clean some problems reported by
FindBugs
All revisions of this file

File info

Size: 9374 bytes, 186 lines

File properties

svn:mime-type
text/plain
svn:eol-style
native
svn:keywords
Date Author Id Revision
Powered by Google Project Hosting