beepcore-java-commits Mailing List for Java BEEP Core (Page 3)
Status: Beta
Brought to you by:
huston
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(22) |
Aug
(1) |
Sep
|
Oct
(16) |
Nov
(60) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(3) |
Feb
|
Mar
(4) |
Apr
(2) |
May
(13) |
Jun
|
Jul
|
Aug
(10) |
Sep
(34) |
Oct
(27) |
Nov
(2) |
Dec
(2) |
| 2003 |
Jan
|
Feb
|
Mar
(3) |
Apr
(15) |
May
(11) |
Jun
(14) |
Jul
(5) |
Aug
(1) |
Sep
(24) |
Oct
(4) |
Nov
(26) |
Dec
(1) |
| 2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Huston F. <hu...@us...> - 2003-09-14 04:29:53
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv21570/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
SASLOTPProfile.java
Log Message:
Fixed IO handling
Index: SASLOTPProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** SASLOTPProfile.java 10 Jun 2003 18:59:24 -0000 1.11
--- SASLOTPProfile.java 14 Sep 2003 04:29:50 -0000 1.12
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
***************
*** 184,187 ****
--- 185,189 ----
return;
}
+ enableIO(channel.getSession());
throw new TuningResetException("SASL ANON RESET");
}
|
|
From: Huston F. <hu...@us...> - 2003-09-14 04:17:42
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo
In directory sc8-pr-cvs1:/tmp/cvs-serv19895/src/org/beepcore/beep/profile/echo
Modified Files:
EchoProfile.java
Log Message:
Removed reply thread
Index: EchoProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo/EchoProfile.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** EchoProfile.java 10 Jun 2003 18:59:21 -0000 1.17
--- EchoProfile.java 14 Sep 2003 04:17:39 -0000 1.18
***************
*** 71,114 ****
public void receiveMSG(MessageMSG message)
{
! new ReplyThread(message).start();
! }
! private class ReplyThread extends Thread {
! private MessageMSG message;
!
! ReplyThread(MessageMSG message) {
! this.message = message;
! }
!
! public void run() {
! OutputDataStream data = new OutputDataStream();
! InputDataStream ds = message.getDataStream();
!
! while (true) {
! try {
! BufferSegment b = ds.waitForNextSegment();
! if (b == null) {
! break;
! }
! data.add(b);
! } catch (InterruptedException e) {
! message.getChannel().getSession().terminate(e.getMessage());
! return;
}
}
! data.setComplete();
try {
! message.sendRPY(data);
! } catch (BEEPException e) {
! try {
! message.sendERR(BEEPError.CODE_REQUESTED_ACTION_ABORTED,
! "Error sending RPY");
! } catch (BEEPException x) {
! message.getChannel().getSession().terminate(x.getMessage());
! }
! return;
}
}
}
--- 71,102 ----
public void receiveMSG(MessageMSG message)
{
! OutputDataStream data = new OutputDataStream();
! InputDataStream ds = message.getDataStream();
! while (true) {
! try {
! BufferSegment b = ds.waitForNextSegment();
! if (b == null) {
! break;
}
+ data.add(b);
+ } catch (InterruptedException e) {
+ message.getChannel().getSession().terminate(e.getMessage());
+ return;
}
+ }
! data.setComplete();
+ try {
+ message.sendRPY(data);
+ } catch (BEEPException e) {
try {
! message.sendERR(BEEPError.CODE_REQUESTED_ACTION_ABORTED,
! "Error sending RPY");
! } catch (BEEPException x) {
! message.getChannel().getSession().terminate(x.getMessage());
}
+ return;
}
}
|
|
From: Huston F. <hu...@us...> - 2003-09-13 21:19:14
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/algorithm
In directory sc8-pr-cvs1:/tmp/cvs-serv19319/src/org/beepcore/beep/profile/sasl/otp/algorithm
Modified Files:
AlgorithmImpl.java
Log Message:
lower-case seed and pass phrase
Index: AlgorithmImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/algorithm/AlgorithmImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** AlgorithmImpl.java 5 Oct 2002 15:11:18 -0000 1.3
--- AlgorithmImpl.java 13 Sep 2003 21:19:10 -0000 1.4
***************
*** 74,78 ****
throws InvalidParameterException
{
! return generateHash(s.getBytes());
}
--- 74,78 ----
throws InvalidParameterException
{
! return generateHash(s.toLowerCase().getBytes()); ///@TODO use encoding
}
|
|
From: Huston F. <hu...@us...> - 2003-09-13 21:18:12
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv19162/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
OTPGenerator.java
Log Message:
cleanup
Index: OTPGenerator.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/OTPGenerator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** OTPGenerator.java 23 Apr 2003 15:23:03 -0000 1.6
--- OTPGenerator.java 13 Sep 2003 21:18:09 -0000 1.7
***************
*** 319,353 ****
}
}
-
- static void storeUserDb(String username, String algorithm,
- String lastHash, String orgLastHash,
- String seed, int sequence, int orgSequence)
- throws SASLException
- {
- if(!validateUserName(username))
- throw new SASLException(ERR_USER_DB_EXISTS);
- try
- {
- seed = seed.toLowerCase();
- validateSeed(seed);
- }
- catch(Exception x)
- {
- throw new SASLException(x.getMessage());
- }
-
- Properties p = new Properties();
- try {
- p.put(UserDatabasePool.OTP_AUTHENTICATOR, username);
- p.put(UserDatabasePool.OTP_ALGO, algorithm);
- p.put(UserDatabasePool.OTP_LAST_HASH, lastHash);
- p.put(UserDatabasePool.OTP_SEQUENCE, Integer.toString(orgSequence));
- p.put(UserDatabasePool.OTP_SEED, seed);
- p.store(new FileOutputStream(username + UserDatabasePool.OTP_SUFFIX),
- UserDatabasePool.OTP_HEADER);
- } catch (Exception x) {
- throw new SASLException(x.getMessage());
- }
-
- }
}
--- 319,321 ----
|
|
From: Huston F. <hu...@us...> - 2003-09-13 21:17:33
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv19027/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
OTPAuthenticator.java
Log Message:
Fix for empty authorized user
Index: OTPAuthenticator.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/OTPAuthenticator.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** OTPAuthenticator.java 10 Jun 2003 18:59:22 -0000 1.14
--- OTPAuthenticator.java 13 Sep 2003 21:17:30 -0000 1.15
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks License (the
***************
*** 227,231 ****
credential.put(SessionCredential.AUTHENTICATOR, authenticated);
! if (authorized != null) {
credential.put(SessionCredential.AUTHORIZED, authorized);
}
--- 228,234 ----
credential.put(SessionCredential.AUTHENTICATOR, authenticated);
! if (authorized == null || authorized.equals("")) {
! credential.put(SessionCredential.AUTHORIZED, authenticated);
! } else {
credential.put(SessionCredential.AUTHORIZED, authorized);
}
***************
*** 337,344 ****
}
boolean match = true;
! for(int i = 0; i < 8; i++)
{
if(nextHash[i] != responseHash[i])
! match = false;
}
if(!match)
--- 340,347 ----
}
boolean match = true;
! for(int i = 0; i < 8; i++) ///@TODO change to use array compare
{
if(nextHash[i] != responseHash[i])
! match = false; ///@TODO break;
}
if(!match)
***************
*** 465,469 ****
credential.put(SessionCredential.AUTHENTICATOR, authenticateId);
! if (authorizedId != null) {
credential.put(SessionCredential.AUTHORIZED, authorizedId);
}
--- 468,474 ----
credential.put(SessionCredential.AUTHENTICATOR, authenticateId);
! if (authorizedId == null || authorizedId.equals("")) {
! credential.put(SessionCredential.AUTHORIZED, authenticateId);
! } else {
credential.put(SessionCredential.AUTHORIZED, authorizedId);
}
***************
*** 513,519 ****
if (authorizeId != null) {
temp.append(authorizeId);
- } else {
- temp.append((char) 0);
}
temp.append(authenticateId);
--- 518,524 ----
if (authorizeId != null) {
temp.append(authorizeId);
}
+
+ temp.append((char) 0);
temp.append(authenticateId);
|
|
From: Huston F. <hu...@us...> - 2003-09-13 21:10:35
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory sc8-pr-cvs1:/tmp/cvs-serv17760/src/org/beepcore/beep/core
Modified Files:
ChannelImpl.java
Log Message:
Fix for hang with ERR messages
Index: ChannelImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** ChannelImpl.java 10 Jun 2003 18:59:17 -0000 1.7
--- ChannelImpl.java 13 Sep 2003 21:10:31 -0000 1.8
***************
*** 822,825 ****
--- 822,826 ----
if (ds.isComplete() && ds.availableSegment() == false &&
(status.getMessageType() == Message.MESSAGE_TYPE_RPY ||
+ status.getMessageType() == Message.MESSAGE_TYPE_ERR ||
status.getMessageType() == Message.MESSAGE_TYPE_NUL))
{
|
|
From: Huston F. <hu...@us...> - 2003-09-01 18:41:36
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse
In directory sc8-pr-cvs1:/tmp/cvs-serv6285/tls/org/beepcore/beep/profile/tls/jsse
Modified Files:
Tag: PIGGYBACKED
TLSProfileJSSE.java
Log Message:
cleanup
Index: TLSProfileJSSE.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse/TLSProfileJSSE.java,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** TLSProfileJSSE.java 13 Jul 2003 14:27:46 -0000 1.8.2.1
--- TLSProfileJSSE.java 1 Sep 2003 18:41:33 -0000 1.8.2.2
***************
*** 534,613 ****
{
channel.setRequestHandler(this, true);
- /*
- try {
- TCPSession oldSession = (TCPSession) channel.getSession();
-
- // if the data is <ready/> then respond with <proceed/>
- if (data != null) {
-
- // If data is a ready, prepare a message of proceed to
- // send to the begin call
- if (data.equals(READY1) || data.equals(READY2)) {
- data = PROCEED2;
- }
- }
-
- // Freeze this Peer
- // Send a profile back with data in the 3rd argument
- this.begin(channel, uri, data);
-
- // Negotiate TLS with the Socket
- Socket oldSocket = oldSession.getSocket();
- SSLSocket newSocket =
- (SSLSocket) socketFactory.createSocket(oldSocket,
- oldSocket.getInetAddress().getHostName(),
- oldSocket.getPort(),
- true);
- TLSHandshake l = new TLSHandshake();
-
- newSocket.addHandshakeCompletedListener(l);
- newSocket.setUseClientMode(false);
- newSocket.setNeedClientAuth(needClientAuth);
- newSocket.setEnabledCipherSuites(newSocket.getSupportedCipherSuites());
-
- l.session = channel.getSession();
-
- newSocket.startHandshake();
-
- synchronized (l) {
- if (!l.notifiedHandshake) {
- l.waitingForHandshake = true;
-
- l.wait();
-
- l.waitingForHandshake = false;
- }
- }
-
- // Consider the Profile Registry
- ProfileRegistry preg = oldSession.getProfileRegistry();
-
- preg.removeStartChannelListener(uri);
-
- if (abortSession) {
- this.abort(new BEEPError(451, ERR_TLS_NO_AUTHENTICATION),
- channel);
- } else {
- Hashtable hash = new Hashtable();
-
- hash.put(SessionTuningProperties.ENCRYPTION, "true");
-
- SessionTuningProperties tuning =
- new SessionTuningProperties(hash);
-
- // Cause the session to be recreated and reset
- this.complete(channel, generateCredential(), l.cred, tuning,
- preg, newSocket);
- }
- } catch (Exception x) {
-
- // @todo should be more detailed
- log.error(x.getMessage());
-
- throw new StartChannelException(450, x.getMessage());
- }
-
- throw new TuningResetException(uri);
- */
}
--- 534,537 ----
|
|
From: Huston F. <hu...@us...> - 2003-09-01 18:39:49
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv5982/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
Tag: PIGGYBACKED
SASLOTPProfile.java
Log Message:
Index: SASLOTPProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -C2 -r1.11.2.1 -r1.11.2.2
*** SASLOTPProfile.java 1 Sep 2003 17:54:33 -0000 1.11.2.1
--- SASLOTPProfile.java 1 Sep 2003 18:39:45 -0000 1.11.2.2
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
|
|
From: Huston F. <hu...@us...> - 2003-09-01 18:39:19
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv5905/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
Tag: PIGGYBACKED
OTPAuthenticator.java
Log Message:
Fix to build blob correctly when both authenticatedID and authorizedID are specified.
Fix to set authorizedID to authenticatedID if no authorizedID is specified.
Index: OTPAuthenticator.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/OTPAuthenticator.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -r1.14 -r1.14.2.1
*** OTPAuthenticator.java 10 Jun 2003 18:59:22 -0000 1.14
--- OTPAuthenticator.java 1 Sep 2003 18:39:15 -0000 1.14.2.1
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks License (the
***************
*** 227,231 ****
credential.put(SessionCredential.AUTHENTICATOR, authenticated);
! if (authorized != null) {
credential.put(SessionCredential.AUTHORIZED, authorized);
}
--- 228,234 ----
credential.put(SessionCredential.AUTHENTICATOR, authenticated);
! if (authorized == null || authorized.equals("")) {
! credential.put(SessionCredential.AUTHORIZED, authenticated);
! } else {
credential.put(SessionCredential.AUTHORIZED, authorized);
}
***************
*** 337,344 ****
}
boolean match = true;
! for(int i = 0; i < 8; i++)
{
if(nextHash[i] != responseHash[i])
! match = false;
}
if(!match)
--- 340,347 ----
}
boolean match = true;
! for(int i = 0; i < 8; i++) ///@TODO change to use array compare
{
if(nextHash[i] != responseHash[i])
! match = false; ///@TODO break;
}
if(!match)
***************
*** 465,469 ****
credential.put(SessionCredential.AUTHENTICATOR, authenticateId);
! if (authorizedId != null) {
credential.put(SessionCredential.AUTHORIZED, authorizedId);
}
--- 468,474 ----
credential.put(SessionCredential.AUTHENTICATOR, authenticateId);
! if (authorizedId == null || authorizedId.equals("")) {
! credential.put(SessionCredential.AUTHORIZED, authenticateId);
! } else {
credential.put(SessionCredential.AUTHORIZED, authorizedId);
}
***************
*** 513,519 ****
if (authorizeId != null) {
temp.append(authorizeId);
- } else {
- temp.append((char) 0);
}
temp.append(authenticateId);
--- 518,524 ----
if (authorizeId != null) {
temp.append(authorizeId);
}
+
+ temp.append((char) 0);
temp.append(authenticateId);
|
|
From: Huston F. <hu...@us...> - 2003-09-01 18:35:32
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/algorithm
In directory sc8-pr-cvs1:/tmp/cvs-serv5381/src/org/beepcore/beep/profile/sasl/otp/algorithm
Modified Files:
Tag: PIGGYBACKED
AlgorithmImpl.java
Log Message:
lower-case seed and passphrase
Index: AlgorithmImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/algorithm/AlgorithmImpl.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -r1.3 -r1.3.2.1
*** AlgorithmImpl.java 5 Oct 2002 15:11:18 -0000 1.3
--- AlgorithmImpl.java 1 Sep 2003 18:35:29 -0000 1.3.2.1
***************
*** 74,78 ****
throws InvalidParameterException
{
! return generateHash(s.getBytes());
}
--- 74,78 ----
throws InvalidParameterException
{
! return generateHash(s.toLowerCase().getBytes()); ///@TODO use encoding
}
|
|
From: Huston F. <hu...@us...> - 2003-09-01 17:54:37
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv29611/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
Tag: PIGGYBACKED
SASLOTPProfile.java
Log Message:
fixed state change for piggybacked tuning requests
Index: SASLOTPProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -r1.11 -r1.11.2.1
*** SASLOTPProfile.java 10 Jun 2003 18:59:24 -0000 1.11
--- SASLOTPProfile.java 1 Sep 2003 17:54:33 -0000 1.11.2.1
***************
*** 115,119 ****
return userDatabase;
}
!
static Algorithm getAlgorithm(String name)
{
--- 115,120 ----
return userDatabase;
}
!
! /// @TODO change this to be not static or add a static initializer for algoriths
static Algorithm getAlgorithm(String name)
{
***************
*** 184,187 ****
--- 185,189 ----
return;
}
+ enableIO(channel.getSession());
throw new TuningResetException("SASL ANON RESET");
}
|
|
From: Huston F. <hu...@us...> - 2003-08-20 16:04:07
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous
In directory sc8-pr-cvs1:/tmp/cvs-serv15431/src/org/beepcore/beep/profile/sasl/anonymous
Modified Files:
Tag: PIGGYBACKED
SASLAnonymousProfile.java
Log Message:
temporary fix for new tuning process
Index: SASLAnonymousProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/SASLAnonymousProfile.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -r1.10 -r1.10.2.1
*** SASLAnonymousProfile.java 10 Jun 2003 18:59:22 -0000 1.10
--- SASLAnonymousProfile.java 20 Aug 2003 14:34:41 -0000 1.10.2.1
***************
*** 121,124 ****
--- 121,125 ----
blob = new Blob(Blob.STATUS_COMPLETE,data);
sendProfile(t, uri, blob.toString(), channel);
+ enableIO(channel.getSession());
} catch (Exception x) {
channel.getSession().terminate(x.getMessage());
***************
*** 134,137 ****
--- 135,139 ----
auth.started(channel);
sendProfile(t, uri, null, channel);
+ enableIO(channel.getSession());
} catch (Exception x) {
channel.getSession().terminate(x.getMessage());
|
|
From: Huston F. <hu...@us...> - 2003-07-22 15:23:28
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory sc8-pr-cvs1:/tmp/cvs-serv10229/src/org/beepcore/beep/core
Modified Files:
Tag: PIGGYBACKED
TuningProfile.java PiggybackedMSG.java SessionImpl.java
Log Message:
fixed state change for piggybacked tuning requests
Index: TuningProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningProfile.java,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -C2 -r1.10.2.1 -r1.10.2.2
*** TuningProfile.java 13 Jul 2003 14:27:46 -0000 1.10.2.1
--- TuningProfile.java 22 Jul 2003 15:23:25 -0000 1.10.2.2
***************
*** 107,110 ****
--- 107,111 ----
((ChannelImpl)channel).setState(ChannelImpl.STATE_TUNING);
session.sendProfile(profile, data, (ChannelImpl)channel);
+ ((ChannelImpl)channel).setState(ChannelImpl.STATE_ACTIVE);
session.disableIO();
} catch (Exception x) {
***************
*** 257,260 ****
--- 258,262 ----
{
((SessionImpl)session).sendProfile(uri, data, (ChannelImpl)channel);
+ ((ChannelImpl)channel).setState(ChannelImpl.STATE_ACTIVE);
}
Index: PiggybackedMSG.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Attic/PiggybackedMSG.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** PiggybackedMSG.java 13 Jul 2003 14:27:46 -0000 1.1.2.1
--- PiggybackedMSG.java 22 Jul 2003 15:23:25 -0000 1.1.2.2
***************
*** 100,103 ****
--- 100,108 ----
}
+ if (this.channel.getState() != ChannelImpl.STATE_TUNING) {
+ this.channel.setState(ChannelImpl.STATE_ACTIVE);
+ ((SessionImpl)this.channel.getSession()).enableIO();
+ }
+
s.fireChannelStarted(this.channel);
Index: SessionImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -r1.8.2.1 -r1.8.2.2
*** SessionImpl.java 13 Jul 2003 14:27:46 -0000 1.8.2.1
--- SessionImpl.java 22 Jul 2003 15:23:25 -0000 1.8.2.2
***************
*** 963,967 ****
// Store the Channel
- ch.setState(ChannelImpl.STATE_ACTIVE);
channels.put(ch.getNumberAsString(), ch);
((MessageMSG)zero.getAppData()).sendRPY(ds);
--- 963,966 ----
***************
*** 1293,1296 ****
--- 1292,1296 ----
try {
sendProfile(p.uri, ch.getStartData(), ch);
+ ch.setState(ChannelImpl.STATE_ACTIVE);
} catch (BEEPException e) {
terminate("Error sending profile. " + e.getMessage());
***************
*** 1300,1307 ****
fireChannelStarted(ch);
- }
! if (p.data == null || ch.getState() != ChannelImpl.STATE_TUNING) {
! this.enableIO();
}
--- 1300,1307 ----
fireChannelStarted(ch);
! if (p.data == null && ch.getState() != ChannelImpl.STATE_TUNING) {
! this.enableIO();
! }
}
***************
*** 1958,1963 ****
static class CLOSED_SessionOperations implements SessionOperations {
public void changeState(SessionImpl s, int newState) throws BEEPException {
! throw new BEEPException("Illegal session state transition (" +
! newState + ")");
}
--- 1958,1967 ----
static class CLOSED_SessionOperations implements SessionOperations {
public void changeState(SessionImpl s, int newState) throws BEEPException {
! if (newState == Session.SESSION_STATE_ABORTED) {
! log.equals("Error aborting, session already in a closed state.");
! } else {
! throw new BEEPException("Illegal session state transition (" +
! newState + ")");
! }
}
|
|
From: Huston F. <hu...@us...> - 2003-07-13 14:56:44
|
Update of /cvsroot/beepcore-java/beepcore-java
In directory sc8-pr-cvs1:/tmp/cvs-serv5792
Added Files:
Tag: PIGGYBACKED
.project .classpath
Log Message:
eclipse project files
--- NEW FILE: .project ---
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>beepcore-java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
--- NEW FILE: .classpath ---
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="example"/>
<classpathentry kind="src" path="tls"/>
<classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
<classpathentry exported="true" kind="lib" path="lib/concurrent.jar"/>
<classpathentry kind="var" path="JAVA_HOME/jre/lib/jsse.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-logging.jar"/>
<classpathentry kind="lib" path="lib/cryptix-asn1.jar"/>
<classpathentry kind="lib" path="lib/cryptix32.jar"/>
<classpathentry kind="lib" path="lib/puretls.jar"/>
<classpathentry kind="var" path="JUNIT_HOME/lib/junit.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.6.jar"/>
<classpathentry kind="lib" path="lib/xerces.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
|
|
From: Huston F. <hu...@us...> - 2003-07-13 14:27:49
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory sc8-pr-cvs1:/tmp/cvs-serv2246/src/org/beepcore/beep/core
Modified Files:
Tag: PIGGYBACKED
ChannelImpl.java TuningProfile.java SessionImpl.java
Added Files:
Tag: PIGGYBACKED
PiggybackedMSG.java
Log Message:
Initial piggybacked changes
--- NEW FILE: PiggybackedMSG.java ---
/*
* RequestHandler.java $Revision: 1.1.2.1 $ $Date: 2003/07/13 14:27:46 $
*
* Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (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.beepcore.org/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
*/
package org.beepcore.beep.core;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import org.beepcore.beep.util.BufferSegment;
/**
* This class is used to wrap piggybacked data from the start channel request.
*
* @author Huston Franklin
* @version $Revision: 1.1.2.1 $, $Date: 2003/07/13 14:27:46 $
*/
class PiggybackedMSG extends MessageMSGImpl implements MessageMSG {
PiggybackedMSG(ChannelImpl channel, byte[] data, boolean base64encoding)
{
super(channel, -1, new InputDataStream());
try {
this.getDataStream().add(new BufferSegment("\r\n".getBytes("UTF-8")));
} catch (UnsupportedEncodingException e) {
this.channel.getSession().terminate("UTF-8 not supported");
return;
}
this.getDataStream().add(new BufferSegment(data));
this.getDataStream().setComplete();
}
public MessageStatus sendANS(OutputDataStream stream)
throws BEEPException
{
throw new BEEPException("ANS reply not valid for piggybacked requests");
}
public MessageStatus sendERR(BEEPError error) throws BEEPException {
throw new BEEPException("ERR reply not valid for piggybacked requests");
}
public MessageStatus sendERR(int code, String diagnostic)
throws BEEPException
{
throw new BEEPException("ERR reply not valid for piggybacked requests");
}
public MessageStatus sendERR(int code, String diagnostic, String xmlLang)
throws BEEPException
{
throw new BEEPException("ERR reply not valid for piggybacked requests");
}
public MessageStatus sendNUL() throws BEEPException {
throw new BEEPException("ANS reply not valid for piggybacked requests");
}
public MessageStatus sendRPY(OutputDataStream stream)
throws BEEPException
{
SessionImpl s = (SessionImpl)this.channel.getSession();
ByteArrayOutputStream tmp =
new ByteArrayOutputStream(SessionImpl.MAX_PCDATA_SIZE);
String data;
while (stream.availableSegment()) {
BufferSegment b = stream.getNextSegment(SessionImpl.MAX_PCDATA_SIZE);
tmp.write(b.getData(), 0, b.getLength());
}
try {
data = tmp.toString("UTF-8");
int crlf = data.indexOf("\r\n");
if (crlf != -1) {
data = data.substring(crlf + "\r\n".length());
}
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("UTF-8 not supported");
}
try {
s.sendProfile(this.channel.getProfile(), data, this.channel);
} catch (BEEPException e) {
s.terminate("Error sending profile. " + e.getMessage());
throw e;
}
s.fireChannelStarted(this.channel);
return new MessageStatus(this.channel, Message.MESSAGE_TYPE_RPY, -1,
stream);
}
}
Index: ChannelImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -r1.7 -r1.7.2.1
*** ChannelImpl.java 10 Jun 2003 18:59:17 -0000 1.7
--- ChannelImpl.java 13 Jul 2003 14:27:46 -0000 1.7.2.1
***************
*** 419,422 ****
--- 419,438 ----
}
+ void abort()
+ {
+ setState(ChannelImpl.STATE_ABORTED);
+ }
+
+ void addPiggybackedMSG(PiggybackedMSG msg) throws BEEPException
+ {
+ recvMSGQueue.add(msg);
+ try {
+ callbackQueue.execute(this);
+ } catch (InterruptedException e) {
+ /** @TODO handle this better */
+ throw new BEEPException(e);
+ }
+ }
+
/**
* get the number of this <code>Channel</code> as a <code>String</code>
Index: TuningProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningProfile.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -C2 -r1.10 -r1.10.2.1
*** TuningProfile.java 27 May 2003 21:37:41 -0000 1.10
--- TuningProfile.java 13 Jul 2003 14:27:46 -0000 1.10.2.1
***************
*** 75,79 ****
*
*/
! public void abort(BEEPError error, Channel channel) throws BEEPException
{
tuningChannels.remove(channel);
--- 75,79 ----
*
*/
! public void abort(BEEPError error, Channel channel)
{
tuningChannels.remove(channel);
***************
*** 120,123 ****
--- 120,132 ----
}
}
+
+ protected void begin(Channel channel)
+ {
+ log.debug("TuningProfile.begin");
+
+ SessionImpl session = (SessionImpl)channel.getSession();
+
+ ((ChannelImpl)channel).setState(ChannelImpl.STATE_TUNING);
+ }
/**
***************
*** 134,142 ****
*/
public void complete(Channel channel,
! SessionCredential localCred,
! SessionCredential peerCred,
! SessionTuningProperties tuning,
! ProfileRegistry registry,
! Object argument)
throws BEEPException
{
--- 143,151 ----
*/
public void complete(Channel channel,
! SessionCredential localCred,
! SessionCredential peerCred,
! SessionTuningProperties tuning,
! ProfileRegistry registry,
! Object argument)
throws BEEPException
{
Index: SessionImpl.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -r1.8 -r1.8.2.1
*** SessionImpl.java 10 Jun 2003 18:59:19 -0000 1.8
--- SessionImpl.java 13 Jul 2003 14:27:46 -0000 1.8.2.1
***************
*** 21,24 ****
--- 21,25 ----
import java.io.IOException;
+ import java.io.UnsupportedEncodingException;
import java.util.Hashtable;
***************
*** 38,41 ****
--- 39,44 ----
import org.xml.sax.SAXException;
+ import sun.misc.BASE64Decoder;
+
import org.beepcore.beep.core.event.ChannelEvent;
import org.beepcore.beep.core.event.ChannelListener;
***************
*** 86,90 ****
/** @todo check this */
! private static final int MAX_PCDATA_SIZE = 4096;
private static final int MAX_START_CHANNEL_WAIT = 60000;
private static final int MAX_START_CHANNEL_INTERVAL = 100;
--- 89,93 ----
/** @todo check this */
! static final int MAX_PCDATA_SIZE = 4096;
private static final int MAX_START_CHANNEL_WAIT = 60000;
private static final int MAX_START_CHANNEL_INTERVAL = 100;
***************
*** 977,981 ****
}
! private void fireChannelStarted(Channel c)
{
ChannelListener[] l = this.channelListeners;
--- 980,984 ----
}
! void fireChannelStarted(Channel c)
{
ChannelListener[] l = this.channelListeners;
***************
*** 1244,1247 ****
--- 1247,1252 ----
return;
} catch (StartChannelException e) {
+ this.enableIO();
+
try {
((MessageMSG)zero.getAppData()).sendERR(e);
***************
*** 1253,1265 ****
}
! try {
! sendProfile(p.uri, ch.getStartData(), ch);
! } catch (BEEPException e) {
! terminate("Error sending profile. " + e.getMessage());
! return;
! }
! fireChannelStarted(ch);
if (p.data == null || ch.getState() != ChannelImpl.STATE_TUNING) {
--- 1258,1304 ----
}
! if (p.data != null && ch.getStartData() == null) {
! byte[] data;
! if (p.base64Encoding) {
! try {
! data = new BASE64Decoder().decodeBuffer(p.data);
! } catch (IOException e) {
! ch.abort();
! this.enableIO();
! throw new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED,
! "Error parsing piggybacked data.");
! }
! } else {
! try {
! data = p.data.getBytes("UTF-8");
! } catch (UnsupportedEncodingException e) {
! terminate("UTF-8 not supported");
! return;
! }
! }
!
! PiggybackedMSG msg = new PiggybackedMSG(ch, data,
! p.base64Encoding);
! ch.setState(ChannelImpl.STATE_STARTING);
! try {
! ch.addPiggybackedMSG(msg);
! } catch (BEEPException e) {
! terminate("Error sending profile. " + e.getMessage());
!
! return;
! }
! } else {
! try {
! sendProfile(p.uri, ch.getStartData(), ch);
! } catch (BEEPException e) {
! terminate("Error sending profile. " + e.getMessage());
!
! return;
! }
!
! fireChannelStarted(ch);
! }
if (p.data == null || ch.getState() != ChannelImpl.STATE_TUNING) {
***************
*** 1269,1272 ****
--- 1308,1313 ----
return;
}
+
+ this.enableIO();
try {
|
|
From: Huston F. <hu...@us...> - 2003-07-13 14:27:49
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse
In directory sc8-pr-cvs1:/tmp/cvs-serv2246/tls/org/beepcore/beep/profile/tls/jsse
Modified Files:
Tag: PIGGYBACKED
TLSProfileJSSE.java
Log Message:
Initial piggybacked changes
Index: TLSProfileJSSE.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/jsse/TLSProfileJSSE.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -r1.8 -r1.8.2.1
*** TLSProfileJSSE.java 3 Jun 2003 02:43:43 -0000 1.8
--- TLSProfileJSSE.java 13 Jul 2003 14:27:46 -0000 1.8.2.1
***************
*** 33,37 ****
--- 33,40 ----
import java.security.KeyStore;
+ import java.io.BufferedReader;
import java.io.FileInputStream;
+ import java.io.InputStreamReader;
+ import java.io.IOException;
import org.apache.commons.logging.Log;
***************
*** 52,56 ****
*/
public class TLSProfileJSSE extends TLSProfile
! implements Profile, StartChannelListener {
// Constants
--- 55,59 ----
*/
public class TLSProfileJSSE extends TLSProfile
! implements Profile, StartChannelListener, RequestHandler {
// Constants
***************
*** 178,181 ****
--- 181,255 ----
}
+ class BeepListenerHCL implements HandshakeCompletedListener {
+
+ Channel channel;
+ boolean notifiedHandshake = false;
+ boolean waitingForHandshake = false;
+
+ BeepListenerHCL(Channel tuningChannel)
+ {
+ this.channel = tuningChannel;
+ }
+
+ public void handshakeCompleted(HandshakeCompletedEvent event)
+ {
+ Session oldSession = channel.getSession();
+
+ log.debug("HandshakeCompleted");
+ synchronized (handshakeListeners) {
+ Iterator i = TLSProfileJSSE.handshakeListeners.iterator();
+
+ while (i.hasNext()) {
+ TLSProfileJSSEHandshakeCompletedListener l =
+ (TLSProfileJSSEHandshakeCompletedListener) i.next();
+
+ if (l.handshakeCompleted(oldSession, event) == false) {
+ BEEPError e =
+ new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED,
+ ERR_TLS_NO_AUTHENTICATION);
+ TLSProfileJSSE.this.abort(e, channel);
+
+ return;
+ }
+ }
+ }
+
+ Hashtable h = new Hashtable();
+
+ try {
+ h.put(SessionCredential.AUTHENTICATOR,
+ event.getPeerCertificateChain()[0].getSubjectDN().getName());
+ h.put(SessionCredential.REMOTE_CERTIFICATE,
+ event.getPeerCertificateChain());
+ } catch (SSLPeerUnverifiedException e) {
+ h.put(SessionCredential.AUTHENTICATOR, "");
+ h.put(SessionCredential.REMOTE_CERTIFICATE, "");
+ }
+
+ ProfileRegistry preg = oldSession.getProfileRegistry();
+
+ preg.removeStartChannelListener(uri);
+
+ Hashtable hash = new Hashtable();
+
+ hash.put(SessionTuningProperties.ENCRYPTION, "true");
+
+ SessionTuningProperties tuning =
+ new SessionTuningProperties(hash);
+
+ // Cause the session to be recreated and reset
+ try {
+ TLSProfileJSSE.this.complete(channel, generateCredential(),
+ new SessionCredential(h), tuning,
+ preg, event.getSocket());
+ } catch (BEEPException e) {
+ BEEPError error =
+ new BEEPError(BEEPError.CODE_REQUESTED_ACTION_ABORTED,
+ ERR_TLS_NO_AUTHENTICATION);
+ TLSProfileJSSE.this.abort(error, channel);
+ }
+ }
+ }
+
/**
* TLS provides encryption and optionally authentication for a session
***************
*** 459,462 ****
--- 533,538 ----
throws StartChannelException
{
+ channel.setRequestHandler(this, true);
+ /*
try {
TCPSession oldSession = (TCPSession) channel.getSession();
***************
*** 533,538 ****
--- 609,670 ----
throw new TuningResetException(uri);
+ */
}
+ public void receiveMSG(MessageMSG msg)
+ {
+ Channel channel = msg.getChannel();
+
+ InputDataStreamAdapter is = msg.getDataStream().getInputStream();
+
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+
+ String data;
+
+ try {
+ try {
+ data = reader.readLine();
+ } catch (IOException e) {
+ msg.sendERR(BEEPError.CODE_PARAMETER_ERROR,
+ "Error reading data");
+ return;
+ }
+
+ if (data.equals(READY1) == false && data.equals(READY2) == false) {
+ msg.sendERR(BEEPError.CODE_PARAMETER_INVALID,
+ "Expected READY element");
+ }
+
+ this.begin(channel);
+
+ msg.sendRPY(new StringOutputDataStream(PROCEED2));
+ } catch (BEEPException e1) {
+ channel.getSession().terminate("unable to send ERR");
+ return;
+ }
+
+ try {
+ Socket oldSocket = ((TCPSession) channel.getSession()).getSocket();
+ /** @TODO add support for serverName */
+ SSLSocket newSocket =
+ (SSLSocket) socketFactory.createSocket(oldSocket,
+ oldSocket.getInetAddress().getHostName(),
+ oldSocket.getPort(),
+ true);
+
+ BeepListenerHCL l = new BeepListenerHCL(channel);
+
+ newSocket.addHandshakeCompletedListener(l);
+ newSocket.setUseClientMode(false);
+ newSocket.setNeedClientAuth(needClientAuth);
+ newSocket.setEnabledCipherSuites(newSocket.getSupportedCipherSuites());
+
+ newSocket.startHandshake();
+ } catch (IOException e) {
+ channel.getSession().terminate("TLS error: " + e.getMessage());
+ return;
+ }
+ }
+
/**
* Called when the underlying BEEP framework receives
|
|
From: Huston F. <hu...@us...> - 2003-07-13 14:26:08
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp
In directory sc8-pr-cvs1:/tmp/cvs-serv2050/src/org/beepcore/beep/transport/tcp
Modified Files:
Tag: PIGGYBACKED
TCPSession.java
Log Message:
Fix a couple of shutdown cases
Index: TCPSession.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/transport/tcp/TCPSession.java,v
retrieving revision 1.32
retrieving revision 1.32.2.1
diff -C2 -r1.32 -r1.32.2.1
*** TCPSession.java 3 Jun 2003 02:41:23 -0000 1.32
--- TCPSession.java 13 Jul 2003 14:26:05 -0000 1.32.2.1
***************
*** 220,223 ****
--- 220,224 ----
socket = null;
+ running = false;
}
}
***************
*** 410,413 ****
--- 411,419 ----
{
running = true;
+
+ if (socket == null) {
+ running = false;
+ return;
+ }
try {
|
|
From: Huston F. <hu...@us...> - 2003-06-10 18:59:56
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/org/beepcore/beep/core Modified Files: Channel.java ChannelImpl.java Session.java SessionImpl.java TuningResetException.java Added Files: RequestHandler.java Removed Files: ThreadedMessageListener.java Log Message: More interface cleanup, added RequestHandler to replace MessageListener. --- NEW FILE: RequestHandler.java --- /* * RequestHandler.java $Revision: 1.1 $ $Date: 2003/06/10 18:59:19 $ * * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (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.beepcore.org/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * */ package org.beepcore.beep.core; /** * This interface is used by profiles to receive MSG messages. This handler is * registered with a channel using the <code>setRequestHandler()</code> method. * * @author Huston Franklin * @version $Revision: 1.1 $, $Date: 2003/06/10 18:59:19 $ * */ public interface RequestHandler { /** * Called to process the request in received MSG message. * * @param message MSG Message received. * * @see MessageMSG */ public void receiveMSG(MessageMSG message); } Index: Channel.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Channel.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** Channel.java 21 Apr 2003 15:09:10 -0000 1.32 --- Channel.java 10 Jun 2003 18:59:16 -0000 1.33 *************** *** 60,63 **** --- 60,64 ---- * @param listener * @return The previous MessageListener or null if none was set. + * @deprecated */ public MessageListener setMessageListener(MessageListener listener); *************** *** 65,72 **** --- 66,103 ---- /** * Returns the message listener for this channel. + * @deprecated */ public MessageListener getMessageListener(); /** + * Returns the <code>RequestHandler</code> registered with this channel. + */ + public RequestHandler getRequestHandler(); + + /** + * Sets the MSG handler for this <code>Channel</code>. + * + * @param handler <code>RequestHandler</code> to handle received + * MSG messages. + * @return The previous <code>RequestHandler</code> or <code>null</code> if + * one wasn't set. + */ + public RequestHandler setRequestHandler(RequestHandler handler); + + /** + * Sets the MSG handler for this <code>Channel</code>. + * + * @param handler <code>RequestHandler</code> to handle received + * MSG messages. + * @param tuningReset flag indicating that the profile will request a + * tuning reset. + * + * @return The previous <code>RequestHandler</code> or <code>null</code> if + * one wasn't set. + */ + public RequestHandler setRequestHandler(RequestHandler handler, + boolean tuningReset); + + /** * Returns the session for this channel. * *************** *** 92,97 **** --- 123,134 ---- throws BEEPException; + /** + * @deprecated + */ public void setStartData(String data); + /** + * @deprecated + */ public String getStartData(); Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** ChannelImpl.java 3 Jun 2003 16:38:35 -0000 1.6 --- ChannelImpl.java 10 Jun 2003 18:59:17 -0000 1.7 *************** *** 21,24 **** --- 21,26 ---- import java.util.*; + import edu.oswego.cs.dl.util.concurrent.PooledExecutor; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; *************** *** 38,42 **** * */ ! class ChannelImpl implements Channel { // class variables --- 40,44 ---- * */ ! class ChannelImpl implements Channel, Runnable { // class variables *************** *** 54,57 **** --- 56,62 ---- new BufferSegment(new byte[0]); + private static final PooledExecutor callbackQueue = + new PooledExecutor(); + /** @todo check this */ *************** *** 59,62 **** --- 64,69 ---- static final int DEFAULT_WINDOW_SIZE = 4096; + static final RequestHandler defaultHandler = new DefaultMSGHandler(); + // instance variables *************** *** 75,80 **** private String startData; ! /** receiver of messages (or partial messages) */ ! private MessageListener listener; /** number of last message sent */ --- 82,87 ---- private String startData; ! /** receiver of MSG messages */ ! private RequestHandler handler; /** number of last message sent */ *************** *** 117,153 **** private int recvWindowFreed; - private boolean notifyOnFirstFrame = true; - private Object applicationData = null; - private boolean blockingMessageListener = false; - // tuningProfile indicates that the profile for this channel will // request a tuning reset private boolean tuningProfile = false; ! // in shutting down the session ! // something for waiting synchronous messages (semaphores or something) ! ! /** ! * Create a <code>Channel</code> object. ! * ! * @param profile URI string of the profile that this channel will "speak". ! * @param number The channel number. ! * @param listener message listener that will receive callbacks for ! * messages received on this channel ! * @param session <code>Session</code> over which this channel ! * sends/receives messages ! * ! * @see org.beepcore.beep.core.Session ! * @see org.beepcore.beep.core.MessageListener ! */ ! protected ChannelImpl(String profile, String number, MessageListener listener, ! boolean blocking, SessionImpl session) { this.profile = profile; this.encoding = Constants.ENCODING_DEFAULT; this.number = number; ! this.setMessageListener(listener, blocking); this.session = session; sentSequence = 0; --- 124,140 ---- private int recvWindowFreed; private Object applicationData = null; // tuningProfile indicates that the profile for this channel will // request a tuning reset private boolean tuningProfile = false; ! ChannelImpl(String profile, String number, ! RequestHandler handler, boolean tuningReset, SessionImpl session) { this.profile = profile; this.encoding = Constants.ENCODING_DEFAULT; this.number = number; ! this.setRequestHandler(handler, tuningReset); this.session = session; sentSequence = 0; *************** *** 166,192 **** } ! protected ChannelImpl(String profile, String number, SessionImpl session) { ! this(profile, number, null, false, session); } ! /** ! * This is a special constructor for Channel Zero ! * ! * @param Session ! * @param ReplyListener ! * ! */ ! ChannelImpl(SessionImpl session, String number, ReplyListener rl) { ! this(null, number, null, false, session); // Add a MSG to the SentMSGQueue to fake channel into accepting the // greeting which comes in an unsolicited RPY. ! sentMSGQueue.add(new MessageStatus(this, Message.MESSAGE_TYPE_MSG, 0, ! null, rl)); ! recvMSGQueue.add(new MessageMSGImpl(this, 0, null)); ! state = STATE_ACTIVE; } --- 153,178 ---- } ! ChannelImpl(String profile, String number, SessionImpl session) { ! this(profile, number, defaultHandler, false, session); } ! static ChannelImpl createChannelZero(SessionImpl session, ! ReplyListener reply, ! RequestHandler handler) { ! ChannelImpl channel = new ChannelImpl(null, "0", handler, ! true, session); // Add a MSG to the SentMSGQueue to fake channel into accepting the // greeting which comes in an unsolicited RPY. ! channel.sentMSGQueue.add(new MessageStatus(channel, ! Message.MESSAGE_TYPE_MSG, 0, ! null, reply)); ! channel.recvMSGQueue.add(new MessageMSGImpl(channel, 0, null)); ! ! channel.state = STATE_ACTIVE; ! return channel; } *************** *** 301,325 **** public MessageListener setMessageListener(MessageListener ml) { - return setMessageListener(ml, true); - } - - MessageListener setMessageListener(MessageListener ml, - boolean blocking) - { MessageListener tmp = getMessageListener(); ! if (ml == null) { ! this.listener = null; ! this.blockingMessageListener = false; ! return tmp; ! } ! ! if (blocking) { ! this.listener = new ThreadedMessageListener(this, ml); ! } else { ! this.listener = ml; ! } - this.blockingMessageListener = blocking; return tmp; } --- 287,294 ---- public MessageListener setMessageListener(MessageListener ml) { MessageListener tmp = getMessageListener(); ! this.handler = new MessageListenerAdapter(ml); return tmp; } *************** *** 330,339 **** public MessageListener getMessageListener() { ! if (this.blockingMessageListener) { ! return ! ((ThreadedMessageListener)this.listener).getMessageListener(); ! } else { ! return this.listener; } } --- 299,346 ---- public MessageListener getMessageListener() { ! if (!(this.handler instanceof MessageListenerAdapter)) { ! return null; } + + return ((MessageListenerAdapter)this.handler).getMessageListener(); + } + + /** + * Returns the <code>RequestHandler</code> registered with this channel. + */ + public RequestHandler getRequestHandler() + { + return this.handler; + } + + /** + * Sets the MSG handler for this <code>Channel</code>. + * + * @param handler <code>RequestHandler</code> to handle received MSG messages. + * @return The previous <code>RequestHandler</code> or <code>null</code> if + * one wasn't set. + */ + public RequestHandler setRequestHandler(RequestHandler handler) + { + return this.setRequestHandler(handler, false); + } + + /** + * Sets the MSG handler for this <code>Channel</code>. + * + * @param handler <code>RequestHandler</code> to handle received MSG messages. + * @param tuningReset flag indicating that the profile will request a + * tuning reset. + * @return The previous <code>RequestHandler</code> or <code>null</code> if + * one wasn't set. + */ + public RequestHandler setRequestHandler(RequestHandler handler, boolean tuningReset) + { + RequestHandler tmp = this.handler; + + this.handler = handler; + this.tuningProfile = tuningReset; + + return tmp; } *************** *** 347,350 **** --- 354,369 ---- } + public void run() { + MessageMSGImpl m; + synchronized (recvMSGQueue) { + m = (MessageMSGImpl) recvMSGQueue.getFirst(); + synchronized (m) { + m.setNotified(); + } + } + + handler.receiveMSG(m); + } + /** * Sends a message of type MSG. *************** *** 470,487 **** if (recvMSGQueue.size() == 1) { try { ! listener.receiveMSG(m); ! } catch (BEEPError e) { ! try { ! m.sendERR(e); ! } catch (BEEPException e2) { ! log.error("Error sending ERR", e2); ! } ! } catch (AbortChannelException e) { ! try { ! /* @todo change this to abort or something else */ ! ChannelImpl.this.close(); ! } catch (BEEPException e2) { ! log.error("Error closing channel", e2); ! } } } --- 489,496 ---- if (recvMSGQueue.size() == 1) { try { ! callbackQueue.execute(this); ! } catch (InterruptedException e) { ! /** @TODO handle this better */ ! throw new BEEPException(e); } } *************** *** 628,634 **** } ! // notify message listener if this message has not been ! // notified before and notifyOnFirstFrame is set, the ! // window is full, this is the last frame. synchronized (m) { if (m.isNotified()) { --- 637,641 ---- } ! // notify message listener if this message has not been notified before synchronized (m) { if (m.isNotified()) { *************** *** 682,687 **** receiveFrame(frame); ! return !(frame.isLast() == true && ! getState() == STATE_TUNING || tuningProfile == true); } --- 689,697 ---- receiveFrame(frame); ! if (frame.getMessageType() == Message.MESSAGE_TYPE_MSG) { ! return !(frame.isLast() == true && tuningProfile == true); ! } else { ! return !(frame.isLast() == true && getState() == STATE_TUNING); ! } } *************** *** 830,847 **** if (m != null) { try { ! listener.receiveMSG(m); ! } catch (BEEPError e) { ! try { ! m.sendERR(e); ! } catch (BEEPException e2) { ! log.error("Error sending ERR", e2); ! } ! } catch (AbortChannelException e) { ! try { ! /* @todo change this to abort or something else */ ! ChannelImpl.this.close(); ! } catch (BEEPException e2) { ! log.error("Error closing channel", e2); ! } } } --- 840,847 ---- if (m != null) { try { ! callbackQueue.execute(this); ! } catch (InterruptedException e) { ! /** @TODO handle this better */ ! throw new BEEPException(e); } } *************** *** 1081,1084 **** --- 1081,1132 ---- { return startData; + } + + static class MessageListenerAdapter implements RequestHandler { + MessageListenerAdapter(MessageListener listener) { + this.listener = listener; + } + + public void receiveMSG(MessageMSG message) { + try { + listener.receiveMSG(message); + } catch (BEEPError e) { + try { + message.sendERR(e); + } catch (BEEPException e2) { + log.error("Error sending ERR", e2); + } + } catch (AbortChannelException e) { + try { + message.getChannel().close(); + } catch (BEEPException e2) { + log.error("Error closing channel", e2); + } + } + } + + public MessageListener getMessageListener() { + return this.listener; + } + + private Log log = LogFactory.getLog(this.getClass()); + private MessageListener listener; + } + + private static class DefaultMSGHandler implements RequestHandler { + public void receiveMSG(MessageMSG message) { + log.error("No handler registered to process MSG received on " + + "channel " + message.getChannel().getNumber()); + try { + message.sendERR(BEEPError.CODE_REQUESTED_ACTION_ABORTED, + "No MSG handler registered"); + } catch (BEEPException e) { + log.error("Error sending ERR", e); + } + } + + + private Log log = LogFactory.getLog(this.getClass()); + private MessageListener listener; } } Index: Session.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Session.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** Session.java 23 Apr 2003 15:23:04 -0000 1.35 --- Session.java 10 Jun 2003 18:59:18 -0000 1.36 *************** *** 163,166 **** --- 163,167 ---- * state to create a new Channel). * @see MessageListener + * @deprecated */ public Channel startChannel(String profile, MessageListener listener) *************** *** 170,173 **** --- 171,194 ---- * Sends a request to start a new Channel on this Session for the * specified profile. This version of <code>startChannel</code> allows a + * <code>RequestHandler</code> to be specified to be registered once the + * Channel is started. This is useful for profiles that are peer-to-peer in + * nature. + * + * @param profile The URI of the profile for the new Channel. + * @param handler A <code>RequestHandler</code> to receive MSG messages + * sent by the remote peer of this Session. + * + * @throws BEEPError Thrown if the remote peer is unable or refuses to + * start a new Channel for the requested profile. + * @throws BEEPException Thrown for errors other than those defined by + * the BEEP protocol (e.g. the Session is not in a + * state to create a new Channel). + */ + public Channel startChannel(String profile, RequestHandler handler) + throws BEEPException, BEEPError; + + /** + * Sends a request to start a new Channel on this Session for the + * specified profile. This version of <code>startChannel</code> allows a * <code>MessageListener</code> to be specified to be registered once the * Channel is started. This is useful for profiles that are peer-to-peer in *************** *** 218,221 **** --- 239,243 ---- * state to create a new Channel). * @see MessageListener + * @deprecated */ public Channel startChannel(String profile, boolean base64Encoding, *************** *** 224,227 **** --- 246,268 ---- /** + * Sends a request to start a new Channel on this Session for the + * specified profile. This version of <code>startChannel</code> allows a + * <code>RequestHandler</code> to be specified to be registered once the + * Channel is started. + * + * @param profile + * @param handler A <code>RequestHandler</code> to receive MSG messages + * sent by the remote peer of this Session. + * + * @throws BEEPError Thrown if the remote peer is unable or refuses to + * start a new Channel for the requested profile. + * @throws BEEPException Thrown for errors other than those defined by + * the BEEP protocol (e.g. the Session is not in a + * state to create a new Channel). + */ + public Channel startChannel(StartChannelProfile profile, RequestHandler handler) + throws BEEPException, BEEPError; + + /** * Sends a start channel request using the given list of profiles. * *************** *** 237,244 **** --- 278,303 ---- * @see StartChannelProfile * @see MessageListener + * @deprecated */ public Channel startChannel(Collection profiles, MessageListener listener) throws BEEPException, BEEPError; + /** + * Sends a start channel request using the given list of profiles. + * + * @param profiles A collection of <code>StartChannelProfile</code>(s). + * @param handler A <code>RequestHandler</code> to receive MSG messages + * sent by the remote peer of this Session. + * + * @throws BEEPError Thrown if the remote peer is unable or refuses to + * start a new Channel for the requested profile. + * @throws BEEPException Thrown for errors other than those defined by + * the BEEP protocol (e.g. the Session is not in a + * state to create a new Channel). + * @see StartChannelProfile + * @see RequestHandler + */ + public Channel startChannel(Collection profiles, RequestHandler handler) + throws BEEPException, BEEPError; /** Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** SessionImpl.java 3 Jun 2003 16:38:35 -0000 1.7 --- SessionImpl.java 10 Jun 2003 18:59:19 -0000 1.8 *************** *** 173,178 **** GreetingListener greetingListener = new GreetingListener(); ! zero = new ChannelImpl(this, CHANNEL_ZERO, greetingListener); ! zero.setMessageListener(new ChannelZeroListener(), false); channels.put(CHANNEL_ZERO, zero); --- 173,178 ---- GreetingListener greetingListener = new GreetingListener(); ! zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener())); channels.put(CHANNEL_ZERO, zero); *************** *** 224,229 **** GreetingListener greetingListener = new GreetingListener(); ! zero = new ChannelImpl(this, CHANNEL_ZERO, greetingListener); ! zero.setMessageListener(new ChannelZeroListener(), false); channels.put(CHANNEL_ZERO, zero); --- 224,229 ---- GreetingListener greetingListener = new GreetingListener(); ! zero = ChannelImpl.createChannelZero(this, greetingListener, ! new ChannelImpl.MessageListenerAdapter(new ChannelZeroListener())); channels.put(CHANNEL_ZERO, zero); *************** *** 420,455 **** } - /** - * Sends a start channel request using the specified profile. - * - * @param profile The uri of the profile for the channel you wish to start. - * - * @return A <code>Channel</code> for the specified profile. - * - * @throws BEEPError Thrown if an error occurs in the under lying transport. - * @throws BEEPException Thrown if any of the parameters are invalid, - * or if the profile is unavailable on this <code>Session</code>. - */ public Channel startChannel(String profile) throws BEEPException, BEEPError { ! return startChannel(profile, null); } - /** - * Sends a start channel request using the specified profile. - * - * @param profile The uri of the profile for the channel you wish to start. - * @param listener An implementation of <code>MessageListener</code> that - * is to receive message callbacks for this channel. It can be null, but - * don't expect to be called back. - * - * @return A <code>Channel</code> for the specified profile. - * - * @throws BEEPError Thrown if an error occurs in the under lying transport. - * @throws BEEPException Thrown if any of the parameters are invalid, - * or if the profile is unavailable on this <code>Session</code>. - * @see MessageListener - */ public Channel startChannel(String profile, MessageListener listener) throws BEEPException, BEEPError --- 420,429 ---- } public Channel startChannel(String profile) throws BEEPException, BEEPError { ! return startChannel(profile, (RequestHandler)null); } public Channel startChannel(String profile, MessageListener listener) throws BEEPException, BEEPError *************** *** 463,493 **** } public Channel startChannel(String profile, boolean base64Encoding, String data) throws BEEPException, BEEPError { ! return startChannel(profile, base64Encoding, data, null); } - /** - * Sends a start channel request using the specified profile. - * - * @param profile The uri of the profile for the channel you wish to start. - * @param base64Encoding Indicates whether or not the data is base64 - * encoded. - * @param data The associated data or initial element for the profile of - * the channel you wish to start. - * @param listener An implementation of <code>MessageListener</code> that - * is to receive message callbacks for this channel. It can be null, but - * don't expect to be called back. - * - * @return A <code>Channel<code> for the specified profile. - * - * @throws BEEPError Thrown if an error occurs in the under lying - * transport. - * @throws BEEPException Thrown if any of the parameters are invalid, - * or if the profile is unavailable on this <code>Session</code>. - * @see MessageListener - */ public Channel startChannel(String profile, boolean base64Encoding, String data, MessageListener listener) --- 437,460 ---- } + public Channel startChannel(String profile, RequestHandler handler) + throws BEEPException, BEEPError + { + StartChannelProfile p = new StartChannelProfile(profile); + LinkedList l = new LinkedList(); + + l.add(p); + + return startChannelRequest(l, handler, false); + } + public Channel startChannel(String profile, boolean base64Encoding, String data) throws BEEPException, BEEPError { ! StartChannelProfile p = new StartChannelProfile(profile, ! base64Encoding, data); ! return startChannel(p, null); } public Channel startChannel(String profile, boolean base64Encoding, String data, MessageListener listener) *************** *** 502,523 **** return startChannelRequest(l, listener, false); } - /** - * Sends a start channel request using the given list of profiles. - * - * @param profiles A collection of <code>StartChannelProfile</code>(s). - * @param listener An implementation of <code>MessageListener</code> - * that is to receive message callbacks for this channel. - * It can be null, but don't expect to be called back. - * - * @return a started channel for the profile selected by the listener - * - * @throws BEEPError Thrown if an error occurs in the under lying - * transport. - * @throws BEEPException Thrown if any of the parameters are invalid, - * or if the profile is unavailable on this <code>Session</code>. - * @see StartChannelProfile - * @see MessageListener - */ public Channel startChannel(Collection profiles, MessageListener listener) throws BEEPException, BEEPError --- 469,483 ---- return startChannelRequest(l, listener, false); } + + public Channel startChannel(StartChannelProfile profile, RequestHandler handler) + throws BEEPException, BEEPError + { + LinkedList l = new LinkedList(); + + l.add(profile); + + return startChannelRequest(l, handler, false); + } public Channel startChannel(Collection profiles, MessageListener listener) throws BEEPException, BEEPError *************** *** 526,539 **** } - /** - * You should not see this. - */ Channel startChannelRequest(Collection profiles, MessageListener listener, boolean tuning) throws BEEPException, BEEPError { - // Block here if there's an exclusive lock, which - // would change our channel #... String channelNumber = getNextFreeChannelNumber(); --- 486,509 ---- } Channel startChannelRequest(Collection profiles, MessageListener listener, boolean tuning) + throws BEEPException, BEEPError + { + return startChannelRequest(profiles, + listener == null ? null : new ChannelImpl.MessageListenerAdapter(listener), + tuning); + } + + public Channel startChannel(Collection profiles, RequestHandler handler) + throws BEEPException, BEEPError + { + return startChannelRequest(profiles, handler, false); + } + + Channel startChannelRequest(Collection profiles, RequestHandler handler, + boolean tuning) throws BEEPException, BEEPError { String channelNumber = getNextFreeChannelNumber(); *************** *** 576,580 **** // @todo handle the data element // Create a channel ! ChannelImpl ch = new ChannelImpl(null, channelNumber, listener, true, this); // Make a message --- 546,551 ---- // @todo handle the data element // Create a channel ! ChannelImpl ch = new ChannelImpl(null, channelNumber, handler, false, ! this); // Make a message *************** *** 991,995 **** ch.setState(ChannelImpl.STATE_ACTIVE); channels.put(ch.getNumberAsString(), ch); ! ((Message)zero.getAppData()).sendRPY(ds); } --- 962,966 ---- ch.setState(ChannelImpl.STATE_ACTIVE); channels.put(ch.getNumberAsString(), ch); ! ((MessageMSG)zero.getAppData()).sendRPY(ds); } *************** *** 1089,1092 **** --- 1060,1065 ---- } + enableIO(); + ChannelImpl channel = (ChannelImpl) channels.get(channelNumber); *************** *** 1115,1119 **** try { ! ((Message)zero.getAppData()).sendRPY(sds); } catch (BEEPException x) { terminate("Error sending RPY for <close>"); --- 1088,1092 ---- try { ! ((MessageMSG)zero.getAppData()).sendRPY(sds); } catch (BEEPException x) { terminate("Error sending RPY for <close>"); *************** *** 1167,1170 **** --- 1140,1144 ---- changeState(SESSION_STATE_ACTIVE); + enableIO(); throw e; } catch (BEEPException x) { *************** *** 1182,1186 **** try { ! ((Message)zero.getAppData()).sendRPY(sds); } catch (BEEPException x) { terminate("Error sending RPY for <close> for channel 0"); --- 1156,1160 ---- try { ! ((MessageMSG)zero.getAppData()).sendRPY(sds); } catch (BEEPException x) { terminate("Error sending RPY for <close> for channel 0"); *************** *** 1189,1194 **** } - this.disableIO(); - try { this.changeState(SESSION_STATE_CLOSED); --- 1163,1166 ---- *************** *** 1240,1245 **** * we've received a start channel request over the wire. */ ! private boolean processStartChannel(String channelNumber, ! Collection profiles) throws BEEPError { --- 1212,1217 ---- * we've received a start channel request over the wire. */ ! private void processStartChannel(String channelNumber, ! Collection profiles) throws BEEPError { *************** *** 1270,1282 **** fireChannelStarted(ch); ! return true; } catch (StartChannelException e) { try { ! ((Message)zero.getAppData()).sendERR(e); } catch (BEEPException x) { terminate("Error sending ERR response to start channel"); } ! return false; } --- 1242,1254 ---- fireChannelStarted(ch); ! return; } catch (StartChannelException e) { try { ! ((MessageMSG)zero.getAppData()).sendERR(e); } catch (BEEPException x) { terminate("Error sending ERR response to start channel"); } ! return; } *************** *** 1286,1304 **** terminate("Error sending profile. " + e.getMessage()); ! return false; } fireChannelStarted(ch); ! return true; } try { ! ((Message)zero.getAppData()).sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, "all requested profiles are unsupported"); } catch (Exception x) { terminate("Error sending error. " + x.getMessage()); } - - return false; } --- 1258,1278 ---- terminate("Error sending profile. " + e.getMessage()); ! return; } fireChannelStarted(ch); ! if (p.data == null || ch.getState() != ChannelImpl.STATE_TUNING) { ! this.enableIO(); ! } ! ! return; } try { ! ((MessageMSG)zero.getAppData()).sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, "all requested profiles are unsupported"); } catch (Exception x) { terminate("Error sending error. " + x.getMessage()); } } *************** *** 1441,1477 **** else if (elementName.equals("close")) { log.debug("Received a channel close request"); ! String channelNumber = topElement.getAttribute("number"); ! ! if (channelNumber == null) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Malformed <close>: no channel number"); ! } ! String code = topElement.getAttribute("code"); ! if (code == null) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Malformed <close>: no code attribute"); ! } ! // this attribute is implied ! String xmlLang = topElement.getAttribute("xml:lang"); ! String data = null; ! Node dataNode = topElement.getFirstChild(); ! if (dataNode != null) { ! data = dataNode.getNodeValue(); ! if (data.length() > MAX_PCDATA_SIZE) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Element's PCDATA exceeds " + ! "the maximum size"); } } - SessionImpl.this.zero.setAppData(message); - SessionImpl.this.receiveCloseChannel(channelNumber, code, - xmlLang, data); } else { throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, --- 1415,1456 ---- else if (elementName.equals("close")) { log.debug("Received a channel close request"); + + try { + String channelNumber = topElement.getAttribute("number"); ! if (channelNumber == null) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Malformed <close>: no channel number"); ! } ! String code = topElement.getAttribute("code"); ! if (code == null) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Malformed <close>: no code attribute"); ! } ! // this attribute is implied ! String xmlLang = topElement.getAttribute("xml:lang"); ! String data = null; ! Node dataNode = topElement.getFirstChild(); ! if (dataNode != null) { ! data = dataNode.getNodeValue(); ! if (data.length() > MAX_PCDATA_SIZE) { ! throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, ! "Element's PCDATA exceeds " + ! "the maximum size"); ! } } + SessionImpl.this.zero.setAppData(message); + SessionImpl.this.receiveCloseChannel(channelNumber, code, + xmlLang, data); + } catch (BEEPError e) { + enableIO(); + throw e; } } else { throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR, *************** *** 1938,1942 **** static class CLOSED_SessionOperations implements SessionOperations { public void changeState(SessionImpl s, int newState) throws BEEPException { ! throw new BEEPException("Illegal session state transition"); } --- 1917,1922 ---- static class CLOSED_SessionOperations implements SessionOperations { public void changeState(SessionImpl s, int newState) throws BEEPException { ! throw new BEEPException("Illegal session state transition (" + ! newState + ")"); } Index: TuningResetException.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/TuningResetException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** TuningResetException.java 8 Nov 2001 05:51:34 -0000 1.2 --- TuningResetException.java 10 Jun 2003 18:59:20 -0000 1.3 *************** *** 37,40 **** --- 37,41 ---- * @param message * + * @TODO remove this class */ public TuningResetException(String message) --- ThreadedMessageListener.java DELETED --- |
|
From: Huston F. <hu...@us...> - 2003-06-10 18:59:56
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous
In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/org/beepcore/beep/profile/sasl/anonymous
Modified Files:
AnonymousAuthenticator.java SASLAnonymousProfile.java
Log Message:
More interface cleanup, added RequestHandler to replace MessageListener.
Index: AnonymousAuthenticator.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/AnonymousAuthenticator.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** AnonymousAuthenticator.java 23 Apr 2003 15:23:03 -0000 1.14
--- AnonymousAuthenticator.java 10 Jun 2003 18:59:22 -0000 1.15
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
***************
*** 48,52 ****
*/
class AnonymousAuthenticator
! implements MessageListener, ReplyListener {
// Constants
--- 49,53 ----
*/
class AnonymousAuthenticator
! implements RequestHandler, ReplyListener {
// Constants
***************
*** 132,136 ****
}
state = STATE_STARTED;
! ch.setMessageListener(this);
channel = ch;
}
--- 133,137 ----
}
state = STATE_STARTED;
! ch.setRequestHandler(this);
channel = ch;
}
***************
*** 278,282 ****
* @throws BEEPError if an ERR message is generated
*/
! public void receiveMSG(Message message) throws BEEPError
{
try
--- 279,283 ----
* @throws BEEPError if an ERR message is generated
*/
! public void receiveMSG(MessageMSG message)
{
try
Index: SASLAnonymousProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/anonymous/SASLAnonymousProfile.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** SASLAnonymousProfile.java 23 Apr 2003 15:23:03 -0000 1.9
--- SASLAnonymousProfile.java 10 Jun 2003 18:59:22 -0000 1.10
***************
*** 3,6 ****
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
+ * Copyright (c) 2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
***************
*** 217,223 ****
Channel ch = session.startChannel(SASLAnonymousProfile.uri,
! false, // true, ??
! new Blob(Blob.STATUS_NONE, id).toString(),
! null);
if ((ch.getStartData() != null)
--- 218,223 ----
Channel ch = session.startChannel(SASLAnonymousProfile.uri,
! false,
! new Blob(Blob.STATUS_NONE, id).toString());
if ((ch.getStartData() != null)
|
|
From: Huston F. <hu...@us...> - 2003-06-10 18:59:56
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/org/beepcore/beep/lib
Modified Files:
SharedChannel.java ChannelPool.java
Log Message:
More interface cleanup, added RequestHandler to replace MessageListener.
Index: SharedChannel.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib/SharedChannel.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** SharedChannel.java 23 Apr 2003 15:23:02 -0000 1.10
--- SharedChannel.java 10 Jun 2003 18:59:22 -0000 1.11
***************
*** 23,26 ****
--- 23,27 ----
import org.beepcore.beep.core.MessageListener;
import org.beepcore.beep.core.MessageStatus;
+ import org.beepcore.beep.core.RequestHandler;
import org.beepcore.beep.core.OutputDataStream;
import org.beepcore.beep.core.ReplyListener;
***************
*** 118,121 ****
--- 119,138 ----
{
return channel.getMessageListener();
+ }
+
+ public RequestHandler getRequestHandler()
+ {
+ return channel.getRequestHandler();
+ }
+
+ public RequestHandler setRequestHandler(RequestHandler handler)
+ {
+ return channel.setRequestHandler(handler);
+ }
+
+ public RequestHandler setRequestHandler(RequestHandler handler,
+ boolean tuningReset)
+ {
+ return channel.setRequestHandler(handler, tuningReset);
}
Index: ChannelPool.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/lib/ChannelPool.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** ChannelPool.java 23 Apr 2003 15:23:02 -0000 1.8
--- ChannelPool.java 10 Jun 2003 18:59:22 -0000 1.9
***************
*** 3,7 ****
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
! * Copyright (c) 2002 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
! * Copyright (c) 2002,2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
***************
*** 21,24 ****
--- 21,25 ----
import org.beepcore.beep.core.BEEPException;
import org.beepcore.beep.core.MessageListener;
+ import org.beepcore.beep.core.RequestHandler;
import org.beepcore.beep.core.Session;
***************
*** 125,131 ****
// nothing found, so create one and return it
if (!found) {
! sharedCh =
! new SharedChannel(this.session.startChannel(profile, null),
! this);
}
--- 126,131 ----
// nothing found, so create one and return it
if (!found) {
! sharedCh = new SharedChannel(this.session.startChannel(profile),
! this);
}
***************
*** 157,160 ****
--- 157,161 ----
*
* @throws BEEPException
+ * @deprecated
*/
synchronized public SharedChannel
***************
*** 198,201 ****
--- 199,261 ----
}
+ /**
+ * Returns a <code>SharedChannel</code> which supports the specified
+ * <code>profile</code> and calls back on the specified
+ * <code>DataListener</code>. Once it is no longer needed, call
+ * <code>release</code> on the <code>SharedChannel</code>
+ * to return it to the pool of available channels.
+ *
+ * @param profile Name of profile for the requested
+ * <code>SharedChannel</code>.
+ * @param listener <code>DataListener</code> for the requested
+ * <code>SharedChannel</code>.
+ *
+ * @return A <code>SharedChannel</code>.
+ *
+ * @see MessageListener
+ * @see SharedChannel
+ *
+ * @throws BEEPException
+ * @deprecated
+ */
+ synchronized
+ public SharedChannel getSharedChannel(String profile, RequestHandler handler)
+ throws BEEPException
+ {
+ SharedChannel sharedCh = null;
+ boolean found = false;
+
+ synchronized (availableChannels) {
+ Iterator i = availableChannels.iterator();
+
+ while (i.hasNext()) {
+ sharedCh = (SharedChannel) i.next();
+
+ if (sharedCh.getProfile().equals(profile)) {
+ log.trace("Found an available channel for sharing");
+ i.remove();
+
+ found = true;
+
+ break;
+ }
+ }
+ }
+
+ // nothing found, so create one and return it
+ if (!found) {
+ sharedCh =
+ new SharedChannel(this.session.startChannel(profile, handler),
+ this);
+ }
+
+ // clean up channels that have expired
+ garbageCollect();
+ if (log.isTraceEnabled()) {
+ log.trace("Sharing channel number:" + sharedCh.getNumber());
+ }
+
+ return sharedCh;
+ }
/**
* Called from <code>SharedChannel</code>. Releases the sharedCh and adds
|
|
From: Huston F. <hu...@us...> - 2003-06-10 18:59:56
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo
In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/org/beepcore/beep/profile/echo
Modified Files:
EchoProfile.java
Log Message:
More interface cleanup, added RequestHandler to replace MessageListener.
Index: EchoProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/echo/EchoProfile.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** EchoProfile.java 23 Apr 2003 15:23:07 -0000 1.16
--- EchoProfile.java 10 Jun 2003 18:59:21 -0000 1.17
***************
*** 3,7 ****
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
! * Copyright (c) 2002 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
--- 3,7 ----
*
* Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved.
! * Copyright (c) 2002,2003 Huston Franklin. All rights reserved.
*
* The contents of this file are subject to the Blocks Public License (the
***************
*** 37,41 ****
*/
public class EchoProfile
! implements Profile, StartChannelListener, MessageListener
{
--- 37,41 ----
*/
public class EchoProfile
! implements Profile, StartChannelListener, RequestHandler
{
***************
*** 55,59 ****
{
log.debug("EchoCCL StartChannel Callback");
! channel.setMessageListener(this);
}
--- 55,59 ----
{
log.debug("EchoCCL StartChannel Callback");
! channel.setRequestHandler(this);
}
***************
*** 61,65 ****
{
log.debug("EchoCCL CloseChannel Callback");
! channel.setMessageListener(null);
}
--- 61,65 ----
{
log.debug("EchoCCL CloseChannel Callback");
! channel.setRequestHandler(null);
}
***************
*** 69,73 ****
}
! public void receiveMSG(Message message) throws BEEPError
{
new ReplyThread(message).start();
--- 69,73 ----
}
! public void receiveMSG(MessageMSG message)
{
new ReplyThread(message).start();
***************
*** 75,81 ****
private class ReplyThread extends Thread {
! private Message message;
! ReplyThread(Message message) {
this.message = message;
}
--- 75,81 ----
private class ReplyThread extends Thread {
! private MessageMSG message;
! ReplyThread(MessageMSG message) {
this.message = message;
}
|
|
From: Huston F. <hu...@us...> - 2003-06-10 18:59:29
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp
In directory sc8-pr-cvs1:/tmp/cvs-serv21972/src/org/beepcore/beep/profile/sasl/otp
Modified Files:
OTPAuthenticator.java SASLOTPProfile.java
Log Message:
More interface cleanup, added RequestHandler to replace MessageListener.
Index: OTPAuthenticator.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/OTPAuthenticator.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** OTPAuthenticator.java 23 Apr 2003 15:23:03 -0000 1.13
--- OTPAuthenticator.java 10 Jun 2003 18:59:22 -0000 1.14
***************
*** 44,48 ****
*
*/
! class OTPAuthenticator implements MessageListener, ReplyListener {
// Constants
--- 44,48 ----
*
*/
! class OTPAuthenticator implements RequestHandler, ReplyListener {
// Constants
***************
*** 140,144 ****
state = STATE_STARTED;
channel = ch;
! channel.setMessageListener(this);
}
--- 140,144 ----
state = STATE_STARTED;
channel = ch;
! channel.setRequestHandler(this);
}
***************
*** 687,691 ****
* that's relative to the BEEP protocol is encountered.
*/
! public void receiveMSG(Message message) throws BEEPError
{
try
--- 687,691 ----
* that's relative to the BEEP protocol is encountered.
*/
! public void receiveMSG(MessageMSG message)
{
try
***************
*** 751,755 ****
{
message.sendRPY(new StringOutputDataStream(new Blob(Blob.STATUS_COMPLETE).toString()));
! channel.setMessageListener(null);
}
catch(BEEPException x)
--- 751,755 ----
{
message.sendRPY(new StringOutputDataStream(new Blob(Blob.STATUS_COMPLETE).toString()));
! channel.setRequestHandler(null);
}
catch(BEEPException x)
Index: SASLOTPProfile.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/profile/sasl/otp/SASLOTPProfile.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** SASLOTPProfile.java 23 Apr 2003 15:23:03 -0000 1.10
--- SASLOTPProfile.java 10 Jun 2003 18:59:24 -0000 1.11
***************
*** 165,169 ****
}
}
! channel.setMessageListener(temp);
if(blob != null)
sendProfile(channel.getSession(), URI, blob.toString(),
--- 165,169 ----
}
}
! channel.setRequestHandler(temp);
if(blob != null)
sendProfile(channel.getSession(), URI, blob.toString(),
***************
*** 322,327 ****
try
{
! ch = session.startChannel(SASLOTPProfile.URI, false, null,
! auth);
startData = ch.getStartData();
}
--- 322,326 ----
try
{
! ch = session.startChannel(SASLOTPProfile.URI, auth);
startData = ch.getStartData();
}
***************
*** 415,420 ****
try
{
! ch = session.startChannel(SASLOTPProfile.URI, false, null,
! auth);
startData = ch.getStartData();
}
--- 414,418 ----
try
{
! ch = session.startChannel(SASLOTPProfile.URI, auth);
startData = ch.getStartData();
}
***************
*** 529,534 ****
try
{
! ch = session.startChannel(SASLOTPProfile.URI, false, null,
! auth);
startData = ch.getStartData();
}
--- 527,531 ----
try
{
! ch = session.startChannel(SASLOTPProfile.URI, auth);
startData = ch.getStartData();
}
|
|
From: Huston F. <hu...@us...> - 2003-06-07 17:29:51
|
Update of /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls In directory sc8-pr-cvs1:/tmp/cvs-serv7279/tls/org/beepcore/beep/profile/tls/ptls Modified Files: TLSProfilePureTLSPemInit.java Log Message: cleanup Index: TLSProfilePureTLSPemInit.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/tls/org/beepcore/beep/profile/tls/ptls/TLSProfilePureTLSPemInit.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** TLSProfilePureTLSPemInit.java 9 Nov 2001 18:41:23 -0000 1.4 --- TLSProfilePureTLSPemInit.java 7 Jun 2003 17:29:47 -0000 1.5 *************** *** 30,34 **** import java.io.*; - import COM.claymoresystems.ptls.*; import COM.claymoresystems.sslg.*; import COM.claymoresystems.cert.*; --- 30,33 ---- *************** *** 67,71 **** "Trusted Certificates"; ! private TLSProfilePureTLS tlsp = new TLSProfilePureTLS(); /** --- 66,77 ---- "Trusted Certificates"; ! private TLSProfilePureTLS tlsp = null; ! ! /** ! * Default constructor ! */ ! public TLSProfilePureTLSPemInit(){ ! tlsp = new TLSProfilePureTLS(); ! } /** *************** *** 134,137 **** --- 140,145 ---- tlsp.setNeedPeerAuthentication(false); } + }else{ + tlsp.setNeedPeerAuthentication(true); } // set the cipher suites |
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core In directory sc8-pr-cvs1:/tmp/cvs-serv24317/src/org/beepcore/beep/core Modified Files: Message.java ChannelImpl.java MessageMSG.java SessionImpl.java Added Files: MessageImpl.java MessageMSGImpl.java Log Message: more interface refactoring --- NEW FILE: MessageImpl.java --- /* * Message.java $Revision: 1.1 $ $Date: 2003/06/03 16:38:35 $ * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (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.beepcore.org/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * */ package org.beepcore.beep.core; /** * Message encapsulates the BEEP MSG, RPY, ERR and NUL message types. * * @author Eric Dixon * @author Huston Franklin * @author Jay Kint * @author Scott Pead * @version $Revision: 1.1 $, $Date: 2003/06/03 16:38:35 $ */ public class MessageImpl implements Message { /** * Uninitialized BEEP message. */ public static final int MESSAGE_TYPE_UNK = 0; /** * BEEP message type. */ public static final int MESSAGE_TYPE_MSG = 1; /** * BEEP message type. */ public static final int MESSAGE_TYPE_RPY = 2; /** * BEEP message type. */ public static final int MESSAGE_TYPE_ERR = 3; /** * BEEP message type. */ public static final int MESSAGE_TYPE_ANS = 4; /** * BEEP message type. */ public static final int MESSAGE_TYPE_NUL = 5; /** BEEP message type of <code>Message</code>. */ int messageType = MESSAGE_TYPE_UNK; /** <code>Channel</code> to which <code>Message</code> belongs. */ ChannelImpl channel; /** Message number of <code>Message</code>. */ int msgno; /** Answer number of this BEEP message. */ int ansno; /** * BEEP message type for utility only. */ private static final int MESSAGE_TYPE_MAX = 6; private static final String NOT_MESSAGE_TYPE_MSG = "Message is not of type MSG"; private boolean notified = false; /** * Payload of the <code>Message</code> stored as a * <code>InputDataStream</code> * * @see org.beepcore.beep.core.InputDataStream */ private InputDataStream data; /** * Creates a new <code>Message</code>. * * @param channel <code>Channel</code> to which this <code>Message</code> * belongs. * @param msgno Message number of the BEEP message. * @param data <code>InputDataStream</code> containing the payload of the * message. * @param messageType Message type of the BEEP message. * * @see InputDataStream * @see Channel */ MessageImpl(ChannelImpl channel, int msgno, InputDataStream data, int messageType) { this.channel = channel; this.msgno = msgno; this.ansno = -1; this.data = data; this.messageType = messageType; } /** * Creates a BEEP message of type ANS * * @param channel <code>Channel</code> to which the message belongs. * @param msgno Message number of the message. * @param ansno * @param data <code>InputDataStream</code> contains the payload of the * message. * * @see Channel * @see InputDataStream */ MessageImpl(ChannelImpl channel, int msgno, int ansno, InputDataStream data) { this(channel, msgno, data, MESSAGE_TYPE_ANS); this.ansno = ansno; } /** * Returns <code>InputDataStream</code> belonging to <code>Message</code>. * * @see InputDataStream */ public InputDataStream getDataStream() { return this.data; } /** * Returns the <code>Channel</code> to which this <code>Message</code> * belongs. * * @see Channel */ public Channel getChannel() { return this.channel; } /** * Returns the message number of this <code>Message</code>. */ public int getMsgno() { return this.msgno; } /** * Returns the answer number of this <code>Message</code>. */ public int getAnsno() { return this.ansno; } /** * Returns the message type of this <code>Message</code>. */ public int getMessageType() { return this.messageType; } /** * Sends a message of type ANS. * * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream * @see MessageStatus * @see #sendNUL * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendANS(OutputDataStream stream) throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } /** * Sends a message of type ERR. * * @param error Error to send in the form of <code>BEEPError</code>. * * @see BEEPError * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendERR(BEEPError error) throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } /** * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. * @param diagnostic Message for <code>error</code> element. * * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendERR(int code, String diagnostic) throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } /** * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. * @param diagnostic Message for <code>error</code> element. * @param xmlLang <code>xml:lang</code> attibute in <code>error</code> * element. * * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } /** * Sends a message of type NUL. * * @see MessageStatus * @see #sendANS * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendNUL() throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } /** * Sends a message of type RPY. * * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered or if messageType is * not MESSAGE_TYPE_MSG. */ public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException { throw new BEEPException(NOT_MESSAGE_TYPE_MSG); } boolean isNotified() { return this.notified; } void setNotified() { this.notified = true; } } --- NEW FILE: MessageMSGImpl.java --- /* * MessageMSG.java $Revision: 1.1 $ $Date: 2003/06/03 16:38:35 $ * * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (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.beepcore.org/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * */ package org.beepcore.beep.core; /** * Represents received BEEP MSG messages. Provides methods to reply to * the MSG. * * @author Eric Dixon * @author Huston Franklin * @author Jay Kint * @author Scott Pead * @version $Revision: 1.1 $, $Date: 2003/06/03 16:38:35 $ * */ class MessageMSGImpl extends MessageImpl implements MessageMSG { MessageMSGImpl(ChannelImpl channel, int msgno, InputDataStream data) { super(channel, msgno, data, Message.MESSAGE_TYPE_MSG); } /** * Sends a message of type ANS. * * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream * @see MessageStatus * @see #sendNUL * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendANS(OutputDataStream stream) throws BEEPException { MessageStatus m; synchronized (this) { // reusing ansno (initialized to -1) from Message since // this is a MSG ++ansno; m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_ANS, this.msgno, this.ansno, stream); } this.channel.sendMessage(m); return m; } /** * Sends a message of type ERR. * * @param error Error to send in the form of <code>BEEPError</code>. * * @see BEEPError * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendERR(BEEPError error) throws BEEPException { OutputDataStream stream = new StringOutputDataStream(error.createErrorMessage()); MessageStatus m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_ERR, this.msgno, stream); this.channel.sendMessage(m); return m; } /** * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. * @param diagnostic Message for <code>error</code> element. * * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendERR(int code, String diagnostic) throws BEEPException { String error = BEEPError.createErrorMessage(code, diagnostic); MessageStatus m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_ERR, this.msgno, new StringOutputDataStream(error)); this.channel.sendMessage(m); return m; } /** * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. * @param diagnostic Message for <code>error</code> element. * @param xmlLang <code>xml:lang</code> attibute in <code>error</code> * element. * * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) throws BEEPException { String error = BEEPError.createErrorMessage(code, diagnostic, xmlLang); MessageStatus m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_ERR, this.msgno, new StringOutputDataStream(error)); this.channel.sendMessage(m); return m; } /** * Sends a message of type NUL. * * @see MessageStatus * @see #sendANS * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendNUL() throws BEEPException { MessageStatus m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_NUL, this.msgno, NULDataStream); this.channel.sendMessage(m); return m; } /** * Sends a message of type RPY. * * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream * @see MessageStatus * * @return MessageStatus * * @throws BEEPException if an error is encoutered. */ public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException { MessageStatus m = new MessageStatus(this.channel, Message.MESSAGE_TYPE_RPY, this.msgno, stream); this.channel.sendMessage(m); return m; } private static OutputDataStream NULDataStream; static { NULDataStream = new OutputDataStream(); NULDataStream.setComplete(); } } Index: Message.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Message.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** Message.java 23 Apr 2003 15:23:04 -0000 1.11 --- Message.java 3 Jun 2003 16:38:35 -0000 1.12 *************** *** 2,6 **** * Message.java $Revision$ $Date$ * ! * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the --- 2,6 ---- * Message.java $Revision$ $Date$ * ! * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the *************** *** 19,297 **** /** ! * Message encapsulates the BEEP MSG, RPY, ERR and NUL message types. * - * @author Eric Dixon * @author Huston Franklin - * @author Jay Kint - * @author Scott Pead * @version $Revision$, $Date$ */ ! public class Message { /** ! * Uninitialized BEEP message. */ public static final int MESSAGE_TYPE_UNK = 0; /** ! * BEEP message type. */ public static final int MESSAGE_TYPE_MSG = 1; /** ! * BEEP message type. */ public static final int MESSAGE_TYPE_RPY = 2; /** ! * BEEP message type. */ public static final int MESSAGE_TYPE_ERR = 3; /** ! * BEEP message type. */ public static final int MESSAGE_TYPE_ANS = 4; /** ! * BEEP message type. */ public static final int MESSAGE_TYPE_NUL = 5; - /** BEEP message type of <code>Message</code>. */ - int messageType = MESSAGE_TYPE_UNK; - - /** <code>Channel</code> to which <code>Message</code> belongs. */ - ChannelImpl channel; - - /** Message number of <code>Message</code>. */ - int msgno; - - /** Answer number of this BEEP message. */ - int ansno; - - /** - * BEEP message type for utility only. - */ - private static final int MESSAGE_TYPE_MAX = 6; - - private static final String NOT_MESSAGE_TYPE_MSG = - "Message is not of type MSG"; - - private boolean notified = false; - - /** - * Payload of the <code>Message</code> stored as a - * <code>InputDataStream</code> - * - * @see org.beepcore.beep.core.InputDataStream - */ - private InputDataStream data; - /** ! * Creates a new <code>Message</code>. ! * ! * @param channel <code>Channel</code> to which this <code>Message</code> ! * belongs. ! * @param msgno Message number of the BEEP message. ! * @param data <code>InputDataStream</code> containing the payload of the ! * message. ! * @param messageType Message type of the BEEP message. * * @see InputDataStream - * @see Channel */ ! Message(ChannelImpl channel, int msgno, InputDataStream data, int messageType) ! { ! this.channel = channel; ! this.msgno = msgno; ! this.ansno = -1; ! this.data = data; ! this.messageType = messageType; ! } /** ! * Creates a BEEP message of type ANS ! * ! * @param channel <code>Channel</code> to which the message belongs. ! * @param msgno Message number of the message. ! * @param ansno ! * @param data <code>InputDataStream</code> contains the payload of the ! * message. * * @see Channel - * @see InputDataStream */ ! Message(ChannelImpl channel, int msgno, int ansno, InputDataStream data) ! { ! this(channel, msgno, data, MESSAGE_TYPE_ANS); ! ! this.ansno = ansno; ! } ! ! /** ! * Returns <code>InputDataStream</code> belonging to <code>Message</code>. ! * ! * @see InputDataStream ! */ ! public InputDataStream getDataStream() ! { ! return this.data; ! } ! ! /** ! * Returns the <code>Channel</code> to which this <code>Message</code> ! * belongs. ! * ! * @see Channel ! */ ! public Channel getChannel() ! { ! return this.channel; ! } /** * Returns the message number of this <code>Message</code>. */ ! public int getMsgno() ! { ! return this.msgno; ! } /** * Returns the answer number of this <code>Message</code>. */ ! public int getAnsno() ! { ! return this.ansno; ! } /** * Returns the message type of this <code>Message</code>. */ ! public int getMessageType() ! { ! return this.messageType; ! } /** ! * Sends a message of type ANS. ! * ! * @param stream Data to send in the form of <code>OutputDataStream</code>. ! * ! * @see OutputDataStream ! * @see MessageStatus ! * @see #sendNUL ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ ! public MessageStatus sendANS(OutputDataStream stream) throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } /** ! * Sends a message of type ERR. ! * ! * @param error Error to send in the form of <code>BEEPError</code>. ! * ! * @see BEEPError ! * @see MessageStatus ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ ! public MessageStatus sendERR(BEEPError error) throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } /** ! * Sends a message of type ERR. ! * ! * @param code <code>code</code> attibute in <code>error</code> element. ! * @param diagnostic Message for <code>error</code> element. ! * ! * @see MessageStatus ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ public MessageStatus sendERR(int code, String diagnostic) ! throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } /** ! * Sends a message of type ERR. ! * ! * @param code <code>code</code> attibute in <code>error</code> element. ! * @param diagnostic Message for <code>error</code> element. ! * @param xmlLang <code>xml:lang</code> attibute in <code>error</code> ! * element. ! * ! * @see MessageStatus ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) ! throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } /** ! * Sends a message of type NUL. ! * ! * @see MessageStatus ! * @see #sendANS ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ ! public MessageStatus sendNUL() throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } /** ! * Sends a message of type RPY. ! * ! * @param stream Data to send in the form of <code>OutputDataStream</code>. ! * ! * @see OutputDataStream ! * @see MessageStatus ! * ! * @return MessageStatus ! * ! * @throws BEEPException if an error is encoutered or if messageType is ! * not MESSAGE_TYPE_MSG. */ ! public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException ! { ! throw new BEEPException(NOT_MESSAGE_TYPE_MSG); ! } ! ! boolean isNotified() ! { ! return this.notified; ! } ! ! void setNotified() ! { ! this.notified = true; ! } } --- 19,121 ---- /** ! * This interface represents the operations available for all types of ! * messages. * * @author Huston Franklin * @version $Revision$, $Date$ */ ! public interface Message { /** ! * Uninitialized <code>Message</code>. */ public static final int MESSAGE_TYPE_UNK = 0; /** ! * BEEP MSG message. */ public static final int MESSAGE_TYPE_MSG = 1; /** ! * BEEP RPY message. */ public static final int MESSAGE_TYPE_RPY = 2; /** ! * BEEP ERR message. */ public static final int MESSAGE_TYPE_ERR = 3; /** ! * BEEP ANS message. */ public static final int MESSAGE_TYPE_ANS = 4; /** ! * BEEP NUL message. */ public static final int MESSAGE_TYPE_NUL = 5; /** ! * Returns <code>InputDataStream</code> containing the payload for this ! * <code>Message</code>. * * @see InputDataStream */ ! public InputDataStream getDataStream(); /** ! * Returns the <code>Channel</code> on which this <code>Message</code> ! * was received. * * @see Channel */ ! public Channel getChannel(); /** * Returns the message number of this <code>Message</code>. */ ! public int getMsgno(); /** * Returns the answer number of this <code>Message</code>. */ ! public int getAnsno(); /** * Returns the message type of this <code>Message</code>. */ ! public int getMessageType(); /** ! * @deprecated use method on MessageMSG instead. */ ! public MessageStatus sendANS(OutputDataStream stream) throws BEEPException; /** ! * @deprecated use method on MessageMSG instead. */ ! public MessageStatus sendERR(BEEPError error) throws BEEPException; /** ! * @deprecated use method on MessageMSG instead. */ public MessageStatus sendERR(int code, String diagnostic) ! throws BEEPException; /** ! * @deprecated use method on MessageMSG instead. */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) ! throws BEEPException; /** ! * @deprecated use method on MessageMSG instead. */ ! public MessageStatus sendNUL() throws BEEPException; /** ! * @deprecated use method on MessageMSG instead. */ ! public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException; } Index: ChannelImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ChannelImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** ChannelImpl.java 3 Jun 2003 02:33:21 -0000 1.5 --- ChannelImpl.java 3 Jun 2003 16:38:35 -0000 1.6 *************** *** 186,190 **** sentMSGQueue.add(new MessageStatus(this, Message.MESSAGE_TYPE_MSG, 0, null, rl)); ! recvMSGQueue.add(new MessageMSG(this, 0, null)); state = STATE_ACTIVE; --- 186,190 ---- sentMSGQueue.add(new MessageStatus(this, Message.MESSAGE_TYPE_MSG, 0, null, rl)); ! recvMSGQueue.add(new MessageMSGImpl(this, 0, null)); state = STATE_ACTIVE; *************** *** 427,433 **** synchronized (recvMSGQueue) { ! MessageMSG m = null; if (recvMSGQueue.size() != 0) { ! m = (MessageMSG) recvMSGQueue.getLast(); if (m.getMsgno() != frame.getMsgno()) { --- 427,433 ---- synchronized (recvMSGQueue) { ! MessageMSGImpl m = null; if (recvMSGQueue.size() != 0) { ! m = (MessageMSGImpl) recvMSGQueue.getLast(); if (m.getMsgno() != frame.getMsgno()) { *************** *** 452,457 **** } ! m = new MessageMSG(this, frame.getMsgno(), ! new InputDataStream(this)); m.setNotified(); --- 452,457 ---- } ! m = new MessageMSGImpl(this, frame.getMsgno(), ! new InputDataStream(this)); m.setNotified(); *************** *** 491,495 **** } ! Message m = null; // This frame must be for a reply (RPY, ERR, ANS, NUL) --- 491,495 ---- } ! MessageImpl m = null; // This frame must be for a reply (RPY, ERR, ANS, NUL) *************** *** 539,544 **** } ! m = new Message(this, frame.getMsgno(), null, ! Message.MESSAGE_TYPE_NUL); mstatus.setMessageStatus(MessageStatus.MESSAGE_STATUS_RECEIVED_REPLY); --- 539,544 ---- } ! m = new MessageImpl(this, frame.getMsgno(), null, ! Message.MESSAGE_TYPE_NUL); mstatus.setMessageStatus(MessageStatus.MESSAGE_STATUS_RECEIVED_REPLY); *************** *** 563,567 **** while (i.hasNext()) { ! Message tmp = (Message) i.next(); if (tmp.getAnsno() == frame.getAnsno()) { --- 563,567 ---- while (i.hasNext()) { ! MessageImpl tmp = (MessageImpl) i.next(); if (tmp.getAnsno() == frame.getAnsno()) { *************** *** 575,580 **** // add it to the queue if (m == null) { ! m = new Message(this, frame.getMsgno(), frame.getAnsno(), ! new InputDataStream(this)); if (!frame.isLast()) { --- 575,581 ---- // add it to the queue if (m == null) { ! m = new MessageImpl(this, frame.getMsgno(), ! frame.getAnsno(), ! new InputDataStream(this)); if (!frame.isLast()) { *************** *** 590,596 **** synchronized (recvReplyQueue) { if (recvReplyQueue.size() == 0) { ! m = new Message(this, frame.getMsgno(), ! new InputDataStream(this), ! frame.getMessageType()); if (frame.isLast() == false) { --- 591,597 ---- synchronized (recvReplyQueue) { if (recvReplyQueue.size() == 0) { ! m = new MessageImpl(this, frame.getMsgno(), ! new InputDataStream(this), ! frame.getMessageType()); if (frame.isLast() == false) { *************** *** 601,605 **** // @todo sanity check: make sure this is the // right Message ! m = (Message) recvReplyQueue.getFirst(); if (frame.isLast()) { --- 602,606 ---- // @todo sanity check: make sure this is the // right Message ! m = (MessageImpl) recvReplyQueue.getFirst(); if (frame.isLast()) { *************** *** 813,822 **** status.getMessageType() == Message.MESSAGE_TYPE_NUL)) { ! MessageMSG m; synchronized (recvMSGQueue) { recvMSGQueue.removeFirst(); if (recvMSGQueue.size() != 0) { ! m = (MessageMSG) recvMSGQueue.getFirst(); synchronized (m) { m.setNotified(); --- 814,823 ---- status.getMessageType() == Message.MESSAGE_TYPE_NUL)) { ! MessageMSGImpl m; synchronized (recvMSGQueue) { recvMSGQueue.removeFirst(); if (recvMSGQueue.size() != 0) { ! m = (MessageMSGImpl) recvMSGQueue.getFirst(); synchronized (m) { m.setNotified(); Index: MessageMSG.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/MessageMSG.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** MessageMSG.java 21 Apr 2003 15:09:10 -0000 1.9 --- MessageMSG.java 3 Jun 2003 16:38:35 -0000 1.10 *************** *** 2,6 **** * MessageMSG.java $Revision$ $Date$ * ! * Copyright (c) 2001 Invisible Worlds, Inc. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the --- 2,6 ---- * MessageMSG.java $Revision$ $Date$ * ! * Copyright (c) 2003 Huston Franklin. All rights reserved. * * The contents of this file are subject to the Blocks Public License (the *************** *** 18,69 **** /** ! * Represents received BEEP MSG messages. Provides methods to reply to ! * the MSG. * - * @author Eric Dixon * @author Huston Franklin - * @author Jay Kint - * @author Scott Pead * @version $Revision$, $Date$ * */ ! class MessageMSG extends Message { - MessageMSG(ChannelImpl channel, int msgno, InputDataStream data) { - super(channel, msgno, data, MESSAGE_TYPE_MSG); - } - /** ! * Sends a message of type ANS. * ! * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream * @see MessageStatus * @see #sendNUL - * - * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ ! public MessageStatus sendANS(OutputDataStream stream) throws BEEPException ! { ! MessageStatus m; ! ! synchronized (this) { ! // reusing ansno (initialized to -1) from Message since ! // this is a MSG ! ++ansno; ! ! m = new MessageStatus(this.channel, MESSAGE_TYPE_ANS, this.msgno, ! this.ansno, stream); ! } ! ! this.channel.sendMessage(m); ! return m; ! } /** ! * Sends a message of type ERR. * * @param error Error to send in the form of <code>BEEPError</code>. --- 18,42 ---- /** ! * This interface represents the operations available for messages of type MSG. * * @author Huston Franklin * @version $Revision$, $Date$ * */ ! public interface MessageMSG extends Message { /** ! * Sends an ANS reply to this MSG message. * ! * @param stream Payload to be sent. * * @see OutputDataStream * @see MessageStatus * @see #sendNUL */ ! public MessageStatus sendANS(OutputDataStream stream) throws BEEPException; /** ! * Sends an ERR reply to this MSG message. * * @param error Error to send in the form of <code>BEEPError</code>. *************** *** 71,91 **** * @see BEEPError * @see MessageStatus - * - * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ ! public MessageStatus sendERR(BEEPError error) throws BEEPException ! { ! OutputDataStream stream = ! new StringOutputDataStream(error.createErrorMessage()); ! MessageStatus m = new MessageStatus(this.channel, MESSAGE_TYPE_ERR, ! this.msgno, stream); ! this.channel.sendMessage(m); ! return m; ! } /** ! * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. --- 44,52 ---- * @see BEEPError * @see MessageStatus */ ! public MessageStatus sendERR(BEEPError error) throws BEEPException; /** ! * Sends an ERR reply to this MSG message. * * @param code <code>code</code> attibute in <code>error</code> element. *************** *** 93,114 **** * * @see MessageStatus - * - * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ public MessageStatus sendERR(int code, String diagnostic) ! throws BEEPException ! { ! String error = BEEPError.createErrorMessage(code, diagnostic); ! MessageStatus m = new MessageStatus(this.channel, MESSAGE_TYPE_ERR, ! this.msgno, ! new StringOutputDataStream(error)); ! this.channel.sendMessage(m); ! return m; ! } /** ! * Sends a message of type ERR. * * @param code <code>code</code> attibute in <code>error</code> element. --- 54,63 ---- * * @see MessageStatus */ public MessageStatus sendERR(int code, String diagnostic) ! throws BEEPException; /** ! * Sends an ERR reply to this MSG message. * * @param code <code>code</code> attibute in <code>error</code> element. *************** *** 120,139 **** * * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) ! throws BEEPException ! { ! String error = BEEPError.createErrorMessage(code, diagnostic, xmlLang); ! MessageStatus m = new MessageStatus(this.channel, MESSAGE_TYPE_ERR, ! this.msgno, ! new StringOutputDataStream(error)); ! this.channel.sendMessage(m); ! return m; ! } /** ! * Sends a message of type NUL. * * @see MessageStatus --- 69,79 ---- * * @return MessageStatus */ public MessageStatus sendERR(int code, String diagnostic, String xmlLang) ! throws BEEPException; /** ! * Sends a reply of type NUL to this MSG message. This is sent as the ! * completion to a MSG/ANS/NUL message exchange. * * @see MessageStatus *************** *** 141,159 **** * * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ ! public MessageStatus sendNUL() throws BEEPException ! { ! MessageStatus m = new MessageStatus(this.channel, MESSAGE_TYPE_NUL, ! this.msgno, NULDataStream); ! this.channel.sendMessage(m); ! return m; ! } /** ! * Sends a message of type RPY. * ! * @param stream Data to send in the form of <code>OutputDataStream</code>. * * @see OutputDataStream --- 81,91 ---- * * @return MessageStatus */ ! public MessageStatus sendNUL() throws BEEPException; /** ! * Sends a RPY reply to this MSG message. * ! * @param stream Payload to be sent. * * @see OutputDataStream *************** *** 161,181 **** * * @return MessageStatus - * - * @throws BEEPException if an error is encoutered. */ ! public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException ! { ! MessageStatus m = new MessageStatus(this.channel, MESSAGE_TYPE_RPY, ! this.msgno, stream); ! this.channel.sendMessage(m); ! return m; ! } ! ! private static OutputDataStream NULDataStream; ! ! static { ! NULDataStream = new OutputDataStream(); ! NULDataStream.setComplete(); ! } ! } --- 93,97 ---- * * @return MessageStatus */ ! public MessageStatus sendRPY(OutputDataStream stream) throws BEEPException; } Index: SessionImpl.java =================================================================== RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/SessionImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** SessionImpl.java 3 Jun 2003 02:33:21 -0000 1.6 --- SessionImpl.java 3 Jun 2003 16:38:35 -0000 1.7 *************** *** 1345,1349 **** greeting); ! Message m = new MessageMSG(this.zero, 0, null); // send the greeting --- 1345,1349 ---- greeting); ! MessageMSG m = new MessageMSGImpl(this.zero, 0, null); // send the greeting |
|
From: Huston F. <hu...@us...> - 2003-06-03 02:53:31
|
Update of /cvsroot/beepcore-java/beepcore-java/test/org/beepcore/beep/core
In directory sc8-pr-cvs1:/tmp/cvs-serv10737/test/org/beepcore/beep/core
Modified Files:
TestStringOutputDataStream.java TestByteOutputDataStream.java
TestFileDataStream.java
Log Message:
imports cleanup
Index: TestStringOutputDataStream.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/test/org/beepcore/beep/core/TestStringOutputDataStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** TestStringOutputDataStream.java 10 Nov 2001 21:33:29 -0000 1.1
--- TestStringOutputDataStream.java 3 Jun 2003 02:53:28 -0000 1.2
***************
*** 19,24 ****
package org.beepcore.beep.core;
- import java.io.InputStream;
- import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
--- 19,22 ----
Index: TestByteOutputDataStream.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/test/org/beepcore/beep/core/TestByteOutputDataStream.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** TestByteOutputDataStream.java 2 Sep 2002 13:47:12 -0000 1.2
--- TestByteOutputDataStream.java 3 Jun 2003 02:53:28 -0000 1.3
***************
*** 18,23 ****
package org.beepcore.beep.core;
- import java.io.InputStream;
- import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
--- 18,21 ----
Index: TestFileDataStream.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/test/org/beepcore/beep/core/TestFileDataStream.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** TestFileDataStream.java 10 Nov 2001 21:33:29 -0000 1.3
--- TestFileDataStream.java 3 Jun 2003 02:53:28 -0000 1.4
***************
*** 17,20 ****
--- 17,21 ----
package org.beepcore.beep.core;
+ /*
import java.io.File;
import java.io.FileReader;
***************
*** 25,28 ****
--- 26,30 ----
import junit.framework.*;
+ */
public class TestFileDataStream /*extends TestDataStream*/ {
|