progress-jms-svn Mailing List for progress-jms (Page 2)
Status: Pre-Alpha
Brought to you by:
medu
You can subscribe to this list here.
| 2010 |
Jan
|
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(10) |
Sep
(56) |
Oct
(1) |
Nov
(8) |
Dec
(4) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <me...@us...> - 2010-11-16 16:27:04
|
Revision: 77
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=77&view=rev
Author: medu
Date: 2010-11-16 16:26:55 +0000 (Tue, 16 Nov 2010)
Log Message:
-----------
Only strings allowed as key.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-11-05 08:38:19 UTC (rev 76)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-11-16 16:26:55 UTC (rev 77)
@@ -118,6 +118,11 @@
end finally.
end method.
+ method override public Object put( k as Object, v as Object ):
+ if type-of(k, 'String':u) then
+ return this-object:put(k:toString(), v).
+ end method.
+
method public Object put( input k as character, input v as Object ):
define variable kStr as String no-undo.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-11-05 08:38:26
|
Revision: 76
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=76&view=rev
Author: medu
Date: 2010-11-05 08:38:19 +0000 (Fri, 05 Nov 2010)
Log Message:
-----------
Added extra Message types (Object, Map, Bytes).
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/MapMessage.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/ObjectMessage.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/TextMessage.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls 2010-10-01 08:06:53 UTC (rev 75)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls 2010-11-05 08:38:19 UTC (rev 76)
@@ -1,288 +1,339 @@
- /*------------------------------------------------------------------------
- File : BytesMessage
- Purpose :
- Syntax :
- Description : A BytesMessage object is used to send a message
- containing a stream of uninterpreted bytes. It inherits
- from the Message interface and adds a bytes message body.
- The receiver of the message supplies the interpretation
- of the bytes.
+/*------------------------------------------------------------------------
+ File : BytesMessage
+ Purpose :
+ Syntax :
+ Description : A BytesMessage object is used to send a message
+ containing a stream of uninterpreted bytes. It inherits
+ from the Message interface and adds a bytes message body.
+ The receiver of the message supplies the interpretation
+ of the bytes.
- Author(s) : Marian Edu
- Created : Thu Sep 23 18:44:35 EEST 2010
- Notes :
+ Author(s) : Marian Edu
+ Created : Thu Sep 23 18:44:35 EEST 2010
+ Notes :
- Email : mar...@gm...
- Website : www.ganimede.ro
+ Email : mar...@gm...
+ Website : www.ganimede.ro
- This program is free software: you can redistribute it and/or modify
- it under the terms of the Lesser GNU General Public License as published
- by the Free Software Foundation, either version 2.1 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Lesser GNU General Public License for more details.
- You should have received a copy of the Lesser GNU General Public License
- along with this program. If not, see < http://www.gnu.org/licenses/>.
- ----------------------------------------------------------------------*/
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+ ----------------------------------------------------------------------*/
using Progress.Lang.*.
using javax.jms.BytesMessage.
using javax.jms.Session.
-using net.sourceforge.progress.jms.Message.
+using net.sourceforge.progress.jms.*.
+using net.sourceforge.progress.io.*.
-
class net.sourceforge.progress.jms.BytesMessage inherits Message implements BytesMessage :
+ define private variable messageBody as memptr no-undo.
+ define private variable streamIn as ByteArrayInputStream no-undo.
+ define private variable streamOut as ByteArrayOutputStream no-undo.
+ define private variable dataIn as DataInputStream no-undo.
+ define private variable dataOut as DataOutputStream no-undo.
-
- constructor public BytesMessage ( input msgSession as Session ):
- super (input msgSession).
- end constructor.
+ constructor public BytesMessage ( input msgSession as Session, msgBody as memptr):
+ super (input msgSession).
+ writeBytes(msgBody).
+ end constructor.
+
+ constructor public BytesMessage ( input msgSession as Session ):
+ super (input msgSession).
+ end constructor.
- /* for unit testing only */
- constructor protected BytesMessage ( ):
+ /* for unit testing only */
+ constructor protected BytesMessage ( ):
- end constructor.
+ end constructor.
- method public logical readBoolean( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method override public void clearBody( ):
+ closeReadStream().
+ super:clearBody().
+ end method.
- end method.
+ method public int64 getBodyLength( ):
+ checkCanRead().
+ return get-size(messageBody).
+ end method.
-
+ method public logical readBoolean( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readBoolean().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public integer readByte( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public integer readByte( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readByte().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public integer readBytes( input val as memptr ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public integer readBytes( input val as memptr ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:read(val).
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public integer readBytes( input val as memptr, input length as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public integer readBytes( input val as memptr, input len as integer ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:read(val, 0, len).
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- end method.
-
-
-
+ method public character readChar( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readChar().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public character readChar( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public decimal readDouble( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readDouble().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- end method.
-
-
-
+ method public decimal readFloat( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readFloat().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public decimal readDouble( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public integer readInt( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readInt().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- end method.
-
-
-
+ method public int64 readLong( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readLong().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public decimal readFloat( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public integer readShort( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readShort().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public integer readInt( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public integer readUnsignedByte( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readUnsignedByte().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- end method.
-
-
-
+ method public integer readUnsignedShort( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readUnsignedShort().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public int64 readLong( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public character readUTF( ):
+ checkCanRead().
+ do on error undo, leave:
+ return dataIn:readUTFCharacter().
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new MessageEOFException().
+ end catch.
+ end.
+ end method.
- method public integer readShort( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public void reset( ):
+ if readOnlyBody eq false then
+ do:
+ if valid-object(streamOut) then
+ messageBody = streamOut:toByteArray().
+ closeWriteStream().
+ readOnlyBody = true.
+ end.
+ else
+ do:
+ if valid-object(dataIn) then
+ dataIn:reset().
+ end.
+ end method.
- method public integer readUnsignedByte( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public void writeBoolean( input val as logical ):
+ checkCanWrite().
+ dataOut:writeBoolean(val).
+ end method.
- end method.
-
-
-
+ method public void writeByte( input val as integer ):
+ checkCanWrite().
+ dataOut:writeByte(val).
+ end method.
- method public integer readUnsignedShort( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public void writeBytes( input val as memptr ):
+ checkCanWrite().
+ dataOut:write(val).
+ end method.
- method public character readUTF( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public void writeBytes( input val as memptr, input offset as integer, input len as integer ):
+ checkCanWrite().
+ dataOut:write(val, offset, len).
+ end method.
- end method.
+ method public void writeChar( input val as character ):
+ checkCanWrite().
+ dataOut:writeChar(val).
+ end method.
+ method public void writeDouble( input val as decimal ):
+ checkCanWrite().
+ dataOut:writeDouble(val).
+ end method.
-
+ method public void writeFloat( input val as decimal ):
+ checkCanWrite().
+ dataOut:writeFloat(val).
+ end method.
- method public void reset( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public void writeInt( input val as integer ):
+ checkCanWrite().
+ dataOut:writeInt(val).
+ end method.
- end method.
+ method public void writeLong( input val as int64 ):
+ checkCanWrite().
+ dataOut:writeLong(val).
+ end method.
-
-
+ method public void writeObject( input val as Progress.Lang.Object ):
+ undo, throw new JMSException ("METHOD NOT IMPLEMENTED").
+ end method.
- method public void writeBoolean( input val as logical ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
+ method public void writeShort( input val as integer ):
+ checkCanWrite().
+ dataOut:writeShort(val).
+ end method.
- method public void writeByte( input val as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method public void writeUTF( input val as character ):
+ checkCanWrite().
+ dataOut:writeUTF(val).
+ end method.
- end method.
+ destructor public BytesMessage ( ):
+ set-size(messageBody) = 0.
+ if readOnlyBody then
+ closeReadStream().
+ else
+ closeWriteStream().
+ end destructor.
-
-
- method public void writeBytes( input val as memptr ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method private void openReadStream ():
+ if not valid-object(streamIn) then
+ streamIn = new ByteArrayInputStream(messageBody).
+ if not valid-object(dataIn) then
+ dataIn = new DataInputStream(streamIn).
+ end.
+
+ method private void closeReadStream ():
+ if valid-object(dataIn) then
+ delete object dataIn.
+ if valid-object(streamIn) then
+ delete object streamIn.
+ end.
+
+ method private void openWriteStream ():
+ if not valid-object(streamOut) then
+ streamOut = new ByteArrayOutputStream().
+ if not valid-object(dataOut) then
+ dataOut = new DataOutputStream(streamOut).
+ end.
+
+ method private void closeWriteStream ():
+ if valid-object(dataOut) then
+ delete object dataOut.
+ if valid-object(streamOut) then
+ delete object streamOut.
+ end.
+
+ method private void checkCanRead ():
+ if readOnlyBody eq false then
+ undo, throw new MessageNotReadableException().
+ openReadStream().
+ if not valid-object(dataIn) then
+ undo, throw new JMSException().
+ end method.
- end method.
-
-
-
-
- method public void writeBytes( input val as memptr, input offset as integer, input length as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeChar( input val as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeDouble( input val as decimal ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeFloat( input val as decimal ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeInt( input val as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeLong( input val as int64 ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeObject( input val as Progress.Lang.Object ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeShort( input val as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- method public void writeUTF( input val as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
- end method.
-
-
-
-
- destructor public BytesMessage ( ):
-
- end destructor.
-
+ method private void checkCanWrite ():
+ if readOnlyBody eq true then
+ undo, throw new MessageNotWriteableException().
+ openWriteStream().
+ if not valid-object(dataOut) then
+ undo, throw new JMSException().
+ end method.
end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/MapMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/MapMessage.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/MapMessage.cls 2010-11-05 08:38:19 UTC (rev 76)
@@ -0,0 +1,268 @@
+/*------------------------------------------------------------------------
+ File : MapMessage
+ Purpose :
+ Syntax :
+ Description : A MapMessage object is used to send a set of name-value
+ pairs. The names are String objects, and the values are
+ primitive data types in the Java programming language.
+ The entries can be accessed sequentially or randomly
+ by name.
+
+ Author(s) : Marian Edu
+ Created : Thu Nov 04 13:23:14 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.*.
+using javax.jms.MapMessage.
+using java.util.Map.
+using net.sourceforge.progress.jms.*.
+using net.sourceforge.progress.lang.*.
+using net.sourceforge.progress.util.StringHashMap.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.jms.MapMessage inherits Message implements MapMessage :
+
+ define private variable messageMap as StringHashMap no-undo.
+
+ define private property messageBody as StringHashMap no-undo
+ get:
+ if not valid-object(messageMap) then
+ messageMap = new StringHashMap().
+ return messageMap.
+ end get.
+ set.
+
+ constructor public MapMessage ( input msgSession as javax.jms.Session, m as Map ):
+ super (input msgSession).
+ if valid-object(m) then
+ messageMap = new StringHashMap(m).
+ end constructor.
+
+ constructor public MapMessage ( input msgSession as javax.jms.Session ):
+ super (input msgSession).
+ end constructor.
+
+ constructor protected MapMessage ( ):
+ end constructor.
+
+ method override public void clearBody( ):
+ if valid-object (messageMap) then
+ messageMap:delete().
+ super:clearBody().
+ end method.
+
+ method public logical getBoolean( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Boolean':u) then
+ return cast(retObj, 'java.lang.Boolean':u):booleanValue().
+
+ undo, throw new MessageFormatException().
+
+ end method.
+
+ method public integer getByte( input name as character ):
+ return getInt(name).
+ end method.
+
+ method public memptr getBytes( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Byte':u) then
+ return cast(retObj, 'java.lang.Byte':u):byteValue().
+
+ undo, throw new MessageFormatException().
+ end method.
+
+ method public character getChar( input name as character ):
+ return getString(name).
+ end method.
+
+ method public decimal getDouble( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Number':u) then
+ return cast(retObj, 'java.lang.Number':u):doubleValue().
+
+ undo, throw new MessageFormatException().
+ end method.
+
+ method public decimal getFloat( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Number':u) then
+ return cast(retObj, 'java.lang.Number':u):floatValue().
+
+ undo, throw new MessageFormatException().
+ end method.
+
+ method public integer getInt( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Number':u) then
+ return cast(retObj, 'java.lang.Number':u):intValue().
+
+ undo, throw new MessageFormatException().
+ end method.
+
+ method public int64 getLong( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if type-of(retObj, 'java.lang.Number':u) then
+ return cast(retObj, 'java.lang.Number':u):longValue().
+
+ undo, throw new MessageFormatException().
+ end method.
+
+ method public java.util.Iterator getMapNames( ):
+ checkCanRead ().
+ return messageMap:keySet():iterator().
+ end method.
+
+ method public Progress.Lang.Object getObject( input name as character ):
+ checkCanRead ().
+ return messageMap:get(name).
+ end method.
+
+ method public integer getShort( input name as character ):
+ define variable retObj as Object no-undo.
+
+ checkCanRead ().
+ retObj = messageMap:get(name).
+ if not valid-object(retObj) then
+ return ?.
+
+ if not type-of(retObj, 'Number':u) then
+ undo, throw new MessageFormatException().
+
+ return cast(retObj, 'Number':u):shortValue().
+ end method.
+
+ method public character getString( input name as character ):
+ checkCanRead ().
+ return messageMap:get(name):toString().
+ end method.
+
+ method public logical itemExists( input name as character ):
+ return valid-object(messageMap) and messageMap:containsKey(name).
+ end method.
+
+ method public void setBoolean( input name as character, input val as logical ):
+ checkCanWrite ().
+ messageMap:put(name, new Boolean(val)).
+ end method.
+
+ method public void setByte( input name as character, input val as integer ):
+ setInt(name, val).
+ end method.
+
+ method public void setBytes( input name as character, input val as memptr ):
+ checkCanWrite ().
+ messageMap:put(name, new Byte(val)).
+ end method.
+
+ method public void setChar( input name as character, input val as character ):
+ setString(name, val).
+ end method.
+
+ method public void setDouble( input name as character, input val as decimal ):
+ checkCanWrite ().
+ messageMap:put(name, new Double(val)).
+ end method.
+
+ method public void setFloat( input name as character, input val as decimal ):
+ setDouble (name, val).
+ end method.
+
+ method public void setInt( input name as character, input val as integer ):
+ checkCanWrite ().
+ messageMap:put(name, new integer(val)).
+ end method.
+
+ method public void setLong( input name as character, input val as int64 ):
+ checkCanWrite ().
+ messageMap:put(name, new Long(val)).
+ end method.
+
+ method public void setObject( input name as character, input val as Progress.Lang.Object ):
+ checkCanWrite ().
+ messageMap:put(name, val).
+ end method.
+
+ method public void setShort( input name as character, input val as integer ):
+ setInt(name, val).
+ end method.
+
+ method public void setString( input name as character, input val as character ):
+ checkCanWrite ().
+ messageMap:put(name, new String(val)).
+ end method.
+
+
+ destructor public MapMessage ( ):
+ if valid-object(messageMap) then
+ do:
+ messageMap:delete().
+ delete object messageMap.
+ end.
+ end destructor.
+
+ method private void checkCanRead ():
+ if not valid-object(messageBody) then
+ undo, throw new JMSException().
+ end method.
+
+ method private void checkCanWrite ():
+ if readOnlyBody eq true then
+ undo, throw new MessageNotWriteableException().
+ if not valid-object(messageBody) then
+ undo, throw new JMSException().
+ end method.
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-10-01 08:06:53 UTC (rev 75)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-11-05 08:38:19 UTC (rev 76)
@@ -103,11 +103,15 @@
define public property JMSType as character no-undo
get.
set.
+
+ define protected property readOnlyBody as logical no-undo
+ get.
+ set.
+
+ define private variable readOnlyProperties as logical no-undo.
define private variable JMSSession as javax.jms.Session no-undo.
- define private variable readOnlyProperties as logical no-undo.
-
define private variable propertyMap_ as StringHashMap no-undo.
define private property propertyMap as StringHashMap no-undo
@@ -148,6 +152,7 @@
end method.
method public void clearBody( ):
+ readOnlyBody = false.
end method.
method public void clearProperties( ):
@@ -333,15 +338,11 @@
return false.
end method.
- method public void seal( ):
- readOnlyProperties = true.
- end method.
-
method public void setBooleanProperty( input name as character, input val as logical ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new Boolean(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -356,7 +357,7 @@
method public void setByteProperty( input name as character, input val as memptr ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new Byte(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -371,7 +372,7 @@
method public void setDoubleProperty( input name as character, input val as decimal ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new Double(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -390,7 +391,7 @@
method public void setIntProperty( input name as character, input val as integer ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new integer(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -418,7 +419,11 @@
end method.
method public void setJMSDestination( input destination as javax.jms.Destination ):
- JMSDestination = destination.
+ if valid-object(destination) then
+ assign
+ readOnlyBody = true
+ readOnlyProperties = true
+ JMSDestination = destination.
end method.
method public void setJMSExpiration( input expiration as int64 ):
@@ -452,7 +457,7 @@
method public void setLongProperty( input name as character, input val as int64 ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new Long(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -467,7 +472,7 @@
method public void setObjectProperty( input name as character, input val as Progress.Lang.Object ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, val).
if valid-object(o) then do:
@@ -491,7 +496,7 @@
method public void setStringProperty( input name as character, input val as character ):
define variable o as Progress.Lang.Object no-undo.
- checkWritable().
+ checkPropertyWriteable().
o = propertyMap:put(name, new String(val)).
if valid-object(o) and not objectArr:contains(o) then
@@ -503,7 +508,7 @@
end catch.
end method.
- method public void checkWritable ():
+ method private void checkPropertyWriteable ():
if readOnlyProperties then
undo, throw new MessageNotWriteableException().
end method.
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/ObjectMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/ObjectMessage.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/ObjectMessage.cls 2010-11-05 08:38:19 UTC (rev 76)
@@ -0,0 +1,57 @@
+/*------------------------------------------------------------------------
+ File : ObjectMessage
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Wed Nov 03 16:09:42 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+ ----------------------------------------------------------------------*/
+using java.io.Serializable.
+using javax.jms.ObjectMessage.
+using net.sourceforge.progress.jms.*.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.jms.ObjectMessage inherits Message implements ObjectMessage :
+
+ define private variable messageBody as Serializable no-undo.
+
+ constructor protected ObjectMessage ( ):
+ super ().
+ end constructor.
+
+ constructor public ObjectMessage ( input msgSession as javax.jms.Session ):
+ super (input msgSession).
+ end constructor.
+
+ constructor public ObjectMessage ( input msgSession as javax.jms.Session, input obj as Serializable ):
+ super (input msgSession).
+ setObject (obj).
+ end constructor.
+
+ method public Serializable getObject( ):
+ return messageBody.
+ end method.
+
+ method public void setObject( input obj as Serializable ):
+ if readOnlyBody eq true then
+ undo, throw new MessageNotWriteableException().
+ messageBody = obj.
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/TextMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/TextMessage.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/TextMessage.cls 2010-11-05 08:38:19 UTC (rev 76)
@@ -0,0 +1,59 @@
+/*------------------------------------------------------------------------
+ File : TextMessage
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Fri Oct 01 22:23:01 EEST 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.*.
+using javax.jms.TextMessage.
+using net.sourceforge.progress.jms.*.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.jms.TextMessage inherits Message implements TextMessage :
+
+ define private variable messageBody as character no-undo.
+
+ constructor public TextMessage ( input msgSession as javax.jms.Session, input str as character ):
+ super (input msgSession).
+ setText(str).
+ end constructor.
+
+ constructor public TextMessage ( input msgSession as javax.jms.Session ):
+ super (input msgSession).
+ end constructor.
+
+ constructor protected TextMessage ( ):
+ super ().
+ end constructor.
+
+ method public character getText( ):
+ return messageBody.
+ end method.
+
+ method public void setText( input str as character ):
+ if readOnlyBody eq true then
+ undo, throw new MessageNotWriteableException().
+ messageBody = str.
+ end method.
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-10-01 08:06:59
|
Revision: 75
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=75&view=rev
Author: medu
Date: 2010-10-01 08:06:53 +0000 (Fri, 01 Oct 2010)
Log Message:
-----------
Modified Paths:
--------------
net.sourceforge.progress.jms/src/javax/jms/Message.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
Modified: net.sourceforge.progress.jms/src/javax/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/javax/jms/Message.cls 2010-09-30 19:29:46 UTC (rev 74)
+++ net.sourceforge.progress.jms/src/javax/jms/Message.cls 2010-10-01 08:06:53 UTC (rev 75)
@@ -32,6 +32,7 @@
----------------------------------------------------------------------*/
using javax.jms.*.
+using Progress.Lang.Object.
interface javax.jms.Message:
@@ -231,6 +232,11 @@
Purpose: Returns the value of the double property.
------------------------------------------------------------------------------*/
method public decimal getDoubleProperty (name as character).
+
+ /*------------------------------------------------------------------------------
+ Purpose: Returns the value of the object property.
+ ------------------------------------------------------------------------------*/
+ method public Object getObjectProperty (name as character).
/*------------------------------------------------------------------------------
Purpose: Returns the value of the string property.
@@ -278,6 +284,11 @@
method public void setDoubleProperty (name as character, val as decimal).
/*------------------------------------------------------------------------------
+ Purpose: Sets a Object property value into the message.
+ ------------------------------------------------------------------------------*/
+ method public void setObjectProperty (name as character, val as Object).
+
+ /*------------------------------------------------------------------------------
Purpose: Sets a String property value into the message.
------------------------------------------------------------------------------*/
method public void setStringProperty (name as character, val as character).
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls 2010-09-30 19:29:46 UTC (rev 74)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls 2010-10-01 08:06:53 UTC (rev 75)
@@ -31,6 +31,7 @@
using net.sourceforge.progress.util.StringHashMap.
using net.sourceforge.progress.lang.String.
using javax.jms.*.
+using java.util.Iterator.
using net.sourceforge.progress.jms.provider.stomp.StompFrame.
@@ -116,12 +117,22 @@
delete object e.
end catch.
end method.
+
+ method public java.util.Iterator getHeaderNames( ):
+ return headerMap:keySet():iterator().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ end catch.
+ end method.
method static public StompFrame jmsToStomp (jms as javax.jms.Message):
define variable sFrame as StompFrame no-undo.
define variable byteMessage as BytesMessage no-undo.
+ define variable it as Iterator no-undo.
define variable len as int64 no-undo.
define variable msgBody as memptr no-undo.
+ define variable propName as character no-undo.
if valid-object(jms) then
do:
@@ -136,12 +147,31 @@
sFrame:setHeader('reply-to':u, jms:getJMSReplyTo():toString()).
sFrame:setHeader('type':u, jms:getJMSType()).
+ /* stream message properties in header section */
+ do on error undo, leave:
+ it = jms:getPropertyNames().
+
+ do while it:hasNext():
+ propName = it:next():toString().
+ sFrame:setHeader(propName, jms:getObjectProperty(propName):toString()).
+ end.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ end catch.
+ finally:
+ delete object it no-error.
+ end finally.
+ end.
+
/* message body */
- if type-of(jms, 'BytesMessage':u) then do:
+ if type-of(jms, 'BytesMessage':u) then
+ do:
assign
byteMessage = cast(jms, 'BytesMessage':u)
len = byteMessage:getBodyLength().
- if len gt 0 then do:
+ if len gt 0 then
+ do:
set-size(msgBody) = len.
byteMessage:readBytes(msgBody).
sFrame:setBody(msgBody).
@@ -154,7 +184,7 @@
return sFrame.
finally:
- set-size(msgBody) = 0.
+ set-size(msgBody) = 0.
end finally.
end method.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-30 19:29:52
|
Revision: 74
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=74&view=rev
Author: medu
Date: 2010-09-30 19:29:46 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Modified Paths:
--------------
net.sourceforge.progress.jms/src/javax/jms/BytesMessage.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls
Modified: net.sourceforge.progress.jms/src/javax/jms/BytesMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/javax/jms/BytesMessage.cls 2010-09-30 14:37:29 UTC (rev 73)
+++ net.sourceforge.progress.jms/src/javax/jms/BytesMessage.cls 2010-09-30 19:29:46 UTC (rev 74)
@@ -27,6 +27,12 @@
interface javax.jms.BytesMessage:
+ /*------------------------------------------------------------------------------
+ Purpose: Gets the number of bytes of the message body when the message
+ is in read-only mode.
+ ------------------------------------------------------------------------------*/
+ method public int64 getBodyLength().
+
/*------------------------------------------------------------------------------
Purpose: Reads a boolean from the bytes message stream.
------------------------------------------------------------------------------*/
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-30 14:37:29 UTC (rev 73)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-30 19:29:46 UTC (rev 74)
@@ -29,6 +29,8 @@
using net.sourceforge.progress.util.StringHashMap.
using net.sourceforge.progress.util.ArrayList.
+routine-level on error undo, throw.
+
class net.sourceforge.progress.jms.Message implements javax.jms.Message :
define static public property DEFAULT_DELIVERY_MODE as integer no-undo
@@ -126,7 +128,7 @@
destructor Message():
clearProperties().
-
+ clearBody().
delete object propertyMap_ no-error.
delete object objectArr_ no-error.
end destructor.
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls 2010-09-30 14:37:29 UTC (rev 73)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls 2010-09-30 19:29:46 UTC (rev 74)
@@ -2,7 +2,12 @@
File : StompFrame
Purpose :
Syntax :
- Description : Handler of read response client socket event.
+ Description : Stomp frame is the message serialization object for stomp
+ protocol. There are a number of different types of frames
+ that can be used but all have a frame type description, a
+ header section and optionally a body which can be text or
+ binary.
+
Author(s) : Marian Edu
Created : Thu Sep 30 19:49:38 EEST 2010
Notes :
@@ -23,9 +28,198 @@
----------------------------------------------------------------------*/
+using net.sourceforge.progress.util.StringHashMap.
+using net.sourceforge.progress.lang.String.
+using javax.jms.*.
+using net.sourceforge.progress.jms.provider.stomp.StompFrame.
-class net.sourceforge.progress.jms.provider.stomp.StompFrame :
+class net.sourceforge.progress.jms.provider.stomp.StompFrame :
+
+ define static public property COMMAND_CLIENT_SEND as character no-undo initial 'SEND':u
+ get.
+
+ define static public property COMMAND_CLIENT_SUBSCRIBE as character no-undo initial 'SUBSCRIBE':u
+ get.
+
+ define static public property COMMAND_CLIENT_UNSUBSCRIBE as character no-undo initial 'UNSUBSCRIBE':u
+ get.
+
+ define static public property COMMAND_CLIENT_BEGIN as character no-undo initial 'BEGIN':u
+ get.
+
+ define static public property COMMAND_CLIENT_COMMIT as character no-undo initial 'COMMIT':u
+ get.
+
+ define static public property COMMAND_CLIENT_ABORT as character no-undo initial 'ABORT':u
+ get.
+
+ define static public property COMMAND_CLIENT_ACK as character no-undo initial 'ACK':u
+ get.
+
+ define static public property COMMAND_CLIENT_DISCONNECT as character no-undo initial 'DISCONNECT':u
+ get.
+
+ define static public property COMMAND_SERVER_MESSAGE as character no-undo initial 'MESSAGE':u
+ get.
+
+ define static public property COMMAND_SERVER_RECEIPT as character no-undo initial 'RECEIPT':u
+ get.
+
+ define static public property COMMAND_SERVER_ERROR as character no-undo initial 'ERROR':u
+ get.
+
+ define public property frameType as character no-undo
+ get.
+ set.
+
+ define protected property frameBody as memptr no-undo
+ get.
+ private set.
+
+ define protected property headerMap as StringHashMap no-undo
+ get.
+ private set.
+ constructor public StompFrame ( ):
+ end constructor.
+
+ constructor public StompFrame ( frmType as character ):
+ frameType = frmType.
+ end constructor.
+ constructor public StompFrame ( frmType as character, frmBody as character ):
+ this-object(frmType).
+ setBody(frmBody).
+ end constructor.
+
+ constructor public StompFrame ( frmType as character, frmBody as longchar ):
+ this-object(frmType).
+ setBody(frmBody).
+ end constructor.
+
+ constructor public StompFrame ( frmType as character, frmBody as memptr ):
+ this-object(frmType).
+ setBody(frmBody).
+ end constructor.
+
+ method public memptr getBody ():
+ return frameBody.
+ end method.
+
+ method public character getHeader (name as character):
+
+ if valid-object(headerMap) then
+ return headerMap:get(name):toString().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ end catch.
+ end method.
+
+ method static public StompFrame jmsToStomp (jms as javax.jms.Message):
+ define variable sFrame as StompFrame no-undo.
+ define variable byteMessage as BytesMessage no-undo.
+ define variable len as int64 no-undo.
+ define variable msgBody as memptr no-undo.
+
+ if valid-object(jms) then
+ do:
+ sFrame = new StompFrame (StompFrame:COMMAND_CLIENT_SEND).
+
+ /* message header */
+ sFrame:setHeader('correlation-id':u, jms:getJMSCorrelationID()).
+ sFrame:setHeader('expires':u, jms:getJMSExpiration()).
+ sFrame:setHeader('persistent':u, jms:getJMSDeliveryMode() eq DeliveryMode:PERSISTENT).
+ sFrame:setHeader('priority':u, jms:getJMSPriority()).
+ if valid-object(jms:getJMSReplyTo()) then
+ sFrame:setHeader('reply-to':u, jms:getJMSReplyTo():toString()).
+ sFrame:setHeader('type':u, jms:getJMSType()).
+
+ /* message body */
+ if type-of(jms, 'BytesMessage':u) then do:
+ assign
+ byteMessage = cast(jms, 'BytesMessage':u)
+ len = byteMessage:getBodyLength().
+ if len gt 0 then do:
+ set-size(msgBody) = len.
+ byteMessage:readBytes(msgBody).
+ sFrame:setBody(msgBody).
+ set-size(msgBody) = 0.
+ end.
+ end.
+ if type-of(jms, 'TextMessage':u) then
+ sFrame:setBody(cast(jms, 'TextMessage':u):getText()).
+ end.
+ return sFrame.
+
+ finally:
+ set-size(msgBody) = 0.
+ end finally.
+ end method.
+
+ method public void setBody (body as character):
+ define variable str as longchar no-undo.
+
+ str = body.
+ setBody(str).
+ end method.
+
+ method public void setBody (body as longchar):
+ copy-lob body to frameBody convert target codepage 'utf-8':u.
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new net.sourceforge.progress.io.IOException().
+ end catch.
+ end method.
+
+ method public void setBody (body as memptr):
+ copy-lob body to frameBody convert target codepage 'utf-8':u.
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new net.sourceforge.progress.io.IOException().
+ end catch.
+ end method.
+
+ method public void setHeader (name as character, val as character):
+
+ if not valid-object(headerMap) then
+ headerMap = new StringHashMap().
+
+ headerMap:put(name, new String(val) ).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ end catch.
+ end method.
+
+ method public void setHeader (name as character, val as integer):
+ setHeader(name, string(val)).
+ end method.
+
+ method public void setHeader (name as character, val as decimal):
+ setHeader(name, string(val)).
+ end method.
+
+ method public void setHeader (name as character, val as logical):
+ setHeader(name, string(val, 'true/false':u)).
+ end method.
+
+ method public void setHeader (name as character, val as int64):
+ setHeader(name, string(val)).
+ end method.
+
+ method static public javax.jms.Message stompToJms (sFrame as StompFrame):
+ end method.
+
+ destructor public StompFrame ( ):
+ if valid-object(headerMap) then
+ do:
+ headerMap:delete().
+ delete object headerMap.
+ end.
+ end destructor.
+
end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls 2010-09-30 14:37:29 UTC (rev 73)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls 2010-09-30 19:29:46 UTC (rev 74)
@@ -26,6 +26,8 @@
using net.sourceforge.progress.io.*.
using net.sourceforge.progress.net.*.
+routine-level on error undo, throw.
+
class net.sourceforge.progress.net.BufferedSocketInputStream
inherits BufferedInputStream
implements ReadResponseHandler :
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-30 14:37:37
|
Revision: 73
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=73&view=rev
Author: medu
Date: 2010-09-30 14:37:29 +0000 (Thu, 30 Sep 2010)
Log Message:
-----------
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/AbstractConnection.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/Connection.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionFactory.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionMetaData.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnection.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnectionFactory.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/AbstractConnection.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/AbstractConnection.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/AbstractConnection.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -1,27 +1,27 @@
- /*------------------------------------------------------------------------
- File : AbstractConnection
- Purpose :
- Syntax :
- Description :
- Author(s) : Marian Edu
- Created : Mon Jan 04 20:13:09 EET 2010
- Notes :
+/*------------------------------------------------------------------------
+ File : AbstractConnection
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Mon Jan 04 20:13:09 EET 2010
+ Notes :
- Email : mar...@gm...
- Website : www.ganimede.ro
+ Email : mar...@gm...
+ Website : www.ganimede.ro
- This program is free software: you can redistribute it and/or modify
- it under the terms of the Lesser GNU General Public License as published
- by the Free Software Foundation, either version 2.1 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- Lesser GNU General Public License for more details.
- You should have received a copy of the Lesser GNU General Public License
- along with this program. If not, see < http://www.gnu.org/licenses/>.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
- ----------------------------------------------------------------------*/
+ ----------------------------------------------------------------------*/
using javax.jms.*.
@@ -40,42 +40,42 @@
end constructor.
/*------------------------------------------------------------------------------
- Purpose: Closes the connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Closes the connection.
+ ------------------------------------------------------------------------------*/
method public void close():
this-object:stop().
end method.
/*------------------------------------------------------------------------------
- Purpose: Gets the client identifier for this connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Gets the client identifier for this connection.
+ ------------------------------------------------------------------------------*/
method public character getClientID():
return clientId.
end method.
/*------------------------------------------------------------------------------
- Purpose: Gets the message consumer's MessageListener.
- ------------------------------------------------------------------------------*/
+ Purpose: Gets the message consumer's MessageListener.
+ ------------------------------------------------------------------------------*/
method public ExceptionListener getExceptionListener():
if not valid-object(exceptionListener) then
undo, throw new net.sourceforge.progress.jms.JMSException
- ('Invalid ExceptionListener.').
+ ('Invalid ExceptionListener.').
return exceptionListener.
end method.
/*------------------------------------------------------------------------------
- Purpose: Gets the metadata for this connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Gets the metadata for this connection.
+ ------------------------------------------------------------------------------*/
method public ConnectionMetaData getMetaData():
if not valid-object(metaData) then
undo, throw new net.sourceforge.progress.jms.JMSException
- ('Invalid ConnectionMetaData.').
+ ('Invalid ConnectionMetaData.').
return metaData.
end method.
/*------------------------------------------------------------------------------
- Purpose: Sets the client identifier for this connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Sets the client identifier for this connection.
+ ------------------------------------------------------------------------------*/
method public void setClientID(clientID as character):
define variable jmsConnection as Progress.Lang.Object no-undo.
@@ -84,11 +84,11 @@
if hadActivity then
undo, throw new net.sourceforge.progress.jms.IllegalStateException
- ('Can not set client identifier after action on connection has taken.').
+ ('Can not set client identifier after action on connection has taken.').
jmsConnection = session:first-object.
do while valid-object(jmsConnection):
if jmsConnection:GetClass():TypeName eq this-object:GetClass():TypeName and
- cast(jmsConnection, 'javax.jms.Connection':u):getClientID() eq clientId then
+ cast(jmsConnection, 'javax.jms.Connection':u):getClientID() eq clientId then
undo, throw new net.sourceforge.progress.jms.InvalidClientIDException
('Duplicate client identifier on other provider connection.').
jmsConnection = jmsConnection:next-sibling.
@@ -97,8 +97,8 @@
end method.
/*------------------------------------------------------------------------------
- Purpose: Gets the message consumer's MessageListener.
- ------------------------------------------------------------------------------*/
+ Purpose: Gets the message consumer's MessageListener.
+ ------------------------------------------------------------------------------*/
method public void setExceptionListener(listener as ExceptionListener):
if not valid-object(listener) then
return.
@@ -108,8 +108,8 @@
end method.
/*------------------------------------------------------------------------------
- Purpose: Starts (restarts) a connection's delivery of incoming messages.
- ------------------------------------------------------------------------------*/
+ Purpose: Starts (restarts) a connection's delivery of incoming messages.
+ ------------------------------------------------------------------------------*/
method public void start():
if isActive then
return.
@@ -121,8 +121,8 @@
end method.
/*------------------------------------------------------------------------------
- Purpose: Temporarily stops a connection's delivery of incoming messages.
- ------------------------------------------------------------------------------*/
+ Purpose: Temporarily stops a connection's delivery of incoming messages.
+ ------------------------------------------------------------------------------*/
method public void stop():
isActive = false.
end method.
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/Connection.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/Connection.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/Connection.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -1,46 +1,62 @@
- /*------------------------------------------------------------------------
- File : Connection
- Purpose :
- Syntax :
- Description :
- Author(s) : Marian Edu
- Created : Mon Jan 04 20:13:09 EET 2010
- Notes :
- ----------------------------------------------------------------------*/
+/*------------------------------------------------------------------------
+ File : Connection
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Mon Jan 04 20:13:09 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+
+ ----------------------------------------------------------------------*/
-using net.sourceforge.progress.jms.AbstractConnection.
+using net.sourceforge.progress.jms.*.
+using net.sourceforge.progress.net.Socket.
+using net.sourceforge.progress.jms.provider.stomp.*.
class net.sourceforge.progress.jms.provider.stomp.Connection
- inherits AbstractConnection:
+ inherits AbstractConnection
+ implements net.sourceforge.progress.net.ReadResponseHandler:
- define private variable stompSocket as handle no-undo.
+ define private variable connectionFactory as ConnectionFactory no-undo.
+ define private variable stompSocket as Socket no-undo.
- constructor public Connection ( serverHost as character, serverPort as character ):
- this-object(serverHost, serverPort, ?, ?).
+ constructor public Connection ( factory as ConnectionFactory ):
+ this-object(factory, ?, ?).
end constructor.
- constructor public Connection ( serverHost as character, serverPort as character,
+ constructor public Connection ( factory as ConnectionFactory,
userName as character, userPasswd as character):
-
- if serverHost ne ? and
- serverPort ne ? then do:
- create socket stompSocket.
-
- end.
-
+ super().
+ connectionFactory = factory.
end constructor.
/*------------------------------------------------------------------------------
- Purpose: Closes the connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Closes the connection.
+ ------------------------------------------------------------------------------*/
method override public void close():
super:close().
+ stompSocket:close().
+ delete object stompSocket.
end method.
/*------------------------------------------------------------------------------
- Purpose: Gets the metadata for this connection.
- ------------------------------------------------------------------------------*/
+ Purpose: Gets the metadata for this connection.
+ ------------------------------------------------------------------------------*/
method override public javax.jms.ConnectionMetaData getMetaData():
if not valid-object(metaData) then
metaData = new net.sourceforge.progress.jms.provider.stomp.ConnectionMetaData ().
@@ -48,15 +64,43 @@
end method.
/*------------------------------------------------------------------------------
- Purpose: Starts (restarts) a connection's delivery of incoming messages.
- ------------------------------------------------------------------------------*/
+ Purpose: Handle read-response events of the underlying socket.
+ ------------------------------------------------------------------------------*/
+ method public void handleReadResponse( input sock as net.sourceforge.progress.net.Socket ):
+
+ /* connection is stoped */
+ if not isActive then
+ return.
+
+ if not valid-object(sock) or not valid-object(stompSocket) or
+ sock ne stompSocket then
+ undo, throw new JMSException().
+
+
+ end method.
+
+
+ /*------------------------------------------------------------------------------
+ Purpose: Starts (restarts) a connection's delivery of incoming messages.
+ ------------------------------------------------------------------------------*/
method override public void start():
+ if not hadActivity then
+ do on error undo, leave:
+ stompSocket = new Socket(connectionFactory:serverHost, connectionFactory:serverPort).
+ stompSocket:setReadResponseHandler(this-object).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
+ end.
+
super:start().
end method.
/*------------------------------------------------------------------------------
- Purpose: Temporarily stops a connection's delivery of incoming messages.
- ------------------------------------------------------------------------------*/
+ Purpose: Temporarily stops a connection's delivery of incoming messages.
+ ------------------------------------------------------------------------------*/
method override public void stop():
super:stop().
end method.
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionFactory.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionFactory.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionFactory.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -1,42 +1,114 @@
- /*------------------------------------------------------------------------
- File : ConnectionFactory
- Purpose :
- Syntax :
- Description :
- Author(s) : Marian Edu
- Created : Sun Jan 03 20:52:40 EET 2010
- Notes :
- ----------------------------------------------------------------------*/
+/*------------------------------------------------------------------------
+ File : ConnectionFactory
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Sun Jan 03 20:52:40 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+
+ ----------------------------------------------------------------------*/
using net.sourceforge.progress.jms.provider.stomp.Connection.
+using net.sourceforge.progress.util.ArrayList.
+using java.util.Iterator.
+routine-level on error undo , throw.
+
class net.sourceforge.progress.jms.provider.stomp.ConnectionFactory implements javax.jms.ConnectionFactory:
- define public property serverHost as character no-undo initial 'localhost':u
- get.
- set.
+ define public property serverHost as character no-undo initial 'localhost':u
+ get.
+ private set.
- define public property serverPort as character no-undo initial '61613':u
- get.
- set.
-
- /*------------------------------------------------------------------------------
- Purpose: Creates a connection with the default user identity.
- ------------------------------------------------------------------------------*/
+ define public property serverPort as character no-undo initial '61613':u
+ get.
+ private set.
+
+ define private variable connectionPool as ArrayList no-undo.
+
+
+ constructor public ConnectionFactory ( ):
+ end constructor.
+
+ constructor public ConnectionFactory ( host as character ):
+ this-object(host, '':u).
+ end constructor.
+
+ constructor public ConnectionFactory ( host as character, port as integer ):
+ this-object(host, string(port)).
+ end constructor.
+
+ constructor public ConnectionFactory ( host as character, service as character ):
+ if host ne ? and host ne '':u then
+ serverHost = host.
+ if service ne ? and service ne '':u then
+ serverPort = service.
+ end constructor.
+
+ /*------------------------------------------------------------------------------
+ Purpose: Creates a connection with the default user identity.
+ ------------------------------------------------------------------------------*/
method public javax.jms.Connection createConnection ():
return createConnection(?, ?).
end method.
/*------------------------------------------------------------------------------
- Purpose: Creates a connection with the specified user identity.
- ------------------------------------------------------------------------------*/
+ Purpose: Creates a connection with the specified user identity.
+ ------------------------------------------------------------------------------*/
method public javax.jms.Connection createConnection (userName as character, userPasswd as character):
+ define variable conn as Connection no-undo.
- return new Connection(serverHost, serverPort, userName, userPasswd).
-
- catch eJmsError as net.sourceforge.progress.jms.JMSException:
- undo, throw eJmsError.
- end catch.
+ conn = new Connection(this-object, userName, userPasswd).
+ if valid-object(conn) then
+ do:
+ if not valid-object(connectionPool) then
+ connectionPool = new ArrayList().
+ connectionPool:add(conn).
+ return conn.
+ end.
+ return ?.
end method.
+
+ method public logical checkDuplicateClientId (clientId as character):
+ define variable conn as Connection no-undo.
+ define variable it as Iterator no-undo.
+ define variable ret as logical no-undo.
+
+ if valid-object(connectionPool) then
+ do:
+ it = connectionPool:iterator().
+ do while it:hasNext():
+ conn = cast(it:next(), 'Connection':u) no-error.
+ if valid-object(conn) and conn:getClientID() eq clientId then
+ do:
+ ret = true.
+ leave.
+ end.
+ end.
+ delete object it.
+ end.
+ return ret.
+ end method.
+
+ destructor public ConnectionFactory ( ):
+ if valid-object(connectionPool) then
+ delete object connectionPool.
+ end destructor.
+
end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionMetaData.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionMetaData.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/ConnectionMetaData.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -1,12 +1,27 @@
- /*------------------------------------------------------------------------
- File : ConnectionMetaData
- Purpose :
- Syntax :
- Description :
- Author(s) : Marian Edu
- Created : Mon Jan 04 20:16:59 EET 2010
- Notes :
- ----------------------------------------------------------------------*/
+/*------------------------------------------------------------------------
+ File : ConnectionMetaData
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Mon Jan 04 20:16:59 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+
+ ----------------------------------------------------------------------*/
using javax.jms.ConnectionMetaData.
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/StompFrame.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -0,0 +1,31 @@
+/*------------------------------------------------------------------------
+ File : StompFrame
+ Purpose :
+ Syntax :
+ Description : Handler of read response client socket event.
+ Author(s) : Marian Edu
+ Created : Thu Sep 30 19:49:38 EEST 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+
+ ----------------------------------------------------------------------*/
+
+
+class net.sourceforge.progress.jms.provider.stomp.StompFrame :
+
+
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnection.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnection.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnection.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -1,12 +1,26 @@
- /*------------------------------------------------------------------------
- File : TopicConnection
- Purpose :
- Syntax :
- Description :
- Author(s) : Marian Edu
- Created : Mon Jan 04 21:28:47 EET 2010
- Notes :
- ----------------------------------------------------------------------*/
+/*------------------------------------------------------------------------
+ File : TopicConnection
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian Edu
+ Created : Mon Jan 04 21:28:47 EET 2010
+ Notes :
+
+ Email : mar...@gm...
+ Website : www.ganimede.ro
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the Lesser GNU General Public License as published
+ by the Free Software Foundation, either version 2.1 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ Lesser GNU General Public License for more details.
+ You should have received a copy of the Lesser GNU General Public License
+ along with this program. If not, see < http://www.gnu.org/licenses/>.
+ ----------------------------------------------------------------------*/
using javax.jms.TopicConnection.
using net.sourceforge.progress.jms.provider.stomp.Connection.
@@ -14,19 +28,19 @@
class net.sourceforge.progress.jms.provider.stomp.TopicConnection inherits Connection implements TopicConnection :
- constructor public TopicConnection ( serverHost as character, serverPort as character):
- super (serverHost, serverPort).
- end constructor.
+ constructor public TopicConnection ( serverHost as character, serverPort as character):
+ super (serverHost, serverPort).
+ end constructor.
- constructor public TopicConnection ( serverHost as character, serverPort as character,
- userName as character, userPasswd as character):
- super (serverHost, serverPort, userName, userPasswd).
- end constructor.
+ constructor public TopicConnection ( serverHost as character, serverPort as character,
+ userName as character, userPasswd as character):
+ super (serverHost, serverPort, userName, userPasswd).
+ end constructor.
- method public javax.jms.TopicSession createTopicSession( input transacted as logical, input acknowledgeMode as integer ):
+ method public javax.jms.TopicSession createTopicSession( input transacted as logical, input acknowledgeMode as integer ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
- end method.
+ end method.
end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnectionFactory.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnectionFactory.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/provider/stomp/TopicConnectionFactory.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -0,0 +1,45 @@
+/*------------------------------------------------------------------------
+ File : TopicConnectionFactory
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : Marian
+ Created : Thu Sep 30 15:16:18 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using javax.jms.TopicConnectionFactory.
+using net.sourceforge.progress.jms.provider.stomp.ConnectionFactory.
+
+
+class net.sourceforge.progress.jms.provider.stomp.TopicConnectionFactory inherits ConnectionFactory implements TopicConnectionFactory :
+
+ constructor public TopicConnectionFactory ( input host as character, input service as character ):
+ super (input host, input service).
+ end constructor.
+
+ constructor public TopicConnectionFactory ( input host as character, input port as integer ):
+ super (input host, input port).
+ end constructor.
+
+
+ constructor public TopicConnectionFactory ( input host as character ):
+ super (input host).
+ end constructor.
+
+
+ constructor public TopicConnectionFactory ( ):
+ super ().
+ end constructor.
+
+ method public javax.jms.TopicConnection createTopicConnection( ):
+
+ end method.
+
+ method public javax.jms.TopicConnection createTopicConnection( input userName as character, input userPasswd as character ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls 2010-09-28 08:32:43 UTC (rev 72)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls 2010-09-30 14:37:29 UTC (rev 73)
@@ -83,7 +83,7 @@
if isConnected then
sock:disconnect().
- SocketEventHandler:unsetReadResponse(sock, this-object).
+ SocketEventHandler:unsetReadResponse(sock, this-object).
catch e as Progress.Lang.Error :
delete object e.
undo, throw new SocketException().
@@ -219,6 +219,12 @@
setOption(SO_KEEPALIVE, string(opt, 'true/false':u)).
end method.
+
+ method public void setReadResponseHandler( rspHandler as ReadResponseHandler ):
+ readResponseHandler = rspHandler.
+ end method.
+
+
method public void setSendBufferSize (opt as integer):
if opt le 0 then
undo, throw new IllegalArgumentException().
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 18:17:14
|
Revision: 71
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=71&view=rev
Author: medu
Date: 2010-09-26 18:17:08 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Test client socket communication.
Added Paths:
-----------
net.sourceforge.progress.jms/test/net/sourceforge/progress/net/
net.sourceforge.progress.jms/test/net/sourceforge/progress/net/ClientSocket.p
Added: net.sourceforge.progress.jms/test/net/sourceforge/progress/net/ClientSocket.p
===================================================================
--- net.sourceforge.progress.jms/test/net/sourceforge/progress/net/ClientSocket.p (rev 0)
+++ net.sourceforge.progress.jms/test/net/sourceforge/progress/net/ClientSocket.p 2010-09-26 18:17:08 UTC (rev 71)
@@ -0,0 +1,46 @@
+/*------------------------------------------------------------------------
+ File : Socket.p
+ Purpose :
+
+ Syntax :
+
+ Description :
+
+ Author(s) : medu
+ Created : Sun Sep 26 19:32:20 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+/* *************************** Definitions ************************** */
+
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.net.*.
+
+define variable socket as Socket no-undo.
+define variable dataOut as DataOutputStream no-undo.
+define variable dataIn as DataInputStream no-undo.
+
+
+socket = new Socket('www.google.com', 'www').
+
+dataOut = new DataOutputStream(socket:getOutputStream()).
+dataIn = new DataInputStream(socket:getInputStream()).
+
+dataOut:writeChars('GET http://www.google.com HTTP/1.1~r~n~r~n':u).
+socket:shutdownOutput().
+
+socket:waitForResponse(30).
+
+do while dataIn:available() gt 0:
+ message dataIn:readLineChars()
+ view-as alert-box.
+end.
+
+socket:close().
+
+finally:
+ delete object dataOut no-error.
+ delete object dataIn no-error.
+
+ delete object socket no-error.
+end finally.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 18:11:58
|
Revision: 70
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=70&view=rev
Author: medu
Date: 2010-09-26 18:11:51 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Initial implementation on client socket and socket event handler.
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectException.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectHandler.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ReadResponseHandler.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ServerSocket.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandler.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandlerHelper.p
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketException.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketImpl.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOptions.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOutputStream.cls
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/BufferedSocketInputStream.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,31 @@
+/*------------------------------------------------------------------------
+ File : BufferedSocketInputStream
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Sun Sep 26 18:37:08 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.net.*.
+
+class net.sourceforge.progress.net.BufferedSocketInputStream
+ inherits BufferedInputStream
+ implements ReadResponseHandler :
+
+ constructor public BufferedSocketInputStream ( input str as InputStream, input size as integer ):
+ super (input str, input size).
+ end constructor.
+
+ constructor public BufferedSocketInputStream ( input str as InputStream ):
+ super (input str).
+ end constructor.
+
+ method public void handleReadResponse( input socket as Socket ):
+ /* we have data, put incomming message in buffer */
+ fillBuffer().
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectException.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectException.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectException.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,29 @@
+/*------------------------------------------------------------------------
+ File : ConnectException
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Sat Sep 25 11:16:32 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.SocketException.
+
+
+class net.sourceforge.progress.net.ConnectException inherits SocketException :
+
+ constructor public ConnectException ( input p0 as character, input p1 as integer ):
+ super (input p0, input p1).
+ end constructor.
+
+ constructor public ConnectException ( input p0 as character ):
+ super (input p0).
+ end constructor.
+
+
+ constructor public ConnectException ( ):
+ super ().
+ end constructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectHandler.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectHandler.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ConnectHandler.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,17 @@
+/*------------------------------------------------------------------------
+ File : ConnectHandler
+ Purpose :
+ Syntax :
+ Description : Handler of connect server socket event.
+ Author(s) : medu
+ Created : Sun Sep 26 18:44:13 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.ServerSocket.
+
+interface net.sourceforge.progress.net.ConnectHandler:
+
+ method public void handleConnect(socket as ServerSocket).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ReadResponseHandler.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ReadResponseHandler.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ReadResponseHandler.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,17 @@
+/*------------------------------------------------------------------------
+ File : ReadResponseHandler
+ Purpose :
+ Syntax :
+ Description : Handler of read response client socket event.
+ Author(s) : medu
+ Created : Sun Sep 26 18:44:13 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.Socket.
+
+interface net.sourceforge.progress.net.ReadResponseHandler:
+
+ method public void handleReadResponse(socket as Socket).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ServerSocket.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ServerSocket.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/ServerSocket.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,19 @@
+ /*------------------------------------------------------------------------
+ File : ServerSocket
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Sat Sep 25 10:45:37 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.SocketImpl.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.net.ServerSocket inherits SocketImpl :
+
+
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/Socket.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,318 @@
+/*------------------------------------------------------------------------
+ File : Socket
+ Purpose :
+ Syntax :
+ Description : Client socket implementation.
+ Author(s) : medu
+ Created : Fri Sep 24 21:17:23 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.*.
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.*.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.net.Socket
+ inherits SocketImpl final:
+
+ define private variable isCreated as logical no-undo.
+ define private variable isConnected as logical no-undo.
+ define private variable isClosed as logical no-undo.
+ define private variable isInputClosed as logical no-undo.
+ define private variable isOutputClosed as logical no-undo.
+
+ define private property inStream as InputStream no-undo
+ get.
+ set.
+
+ define private property outStream as OutputStream no-undo
+ get.
+ set.
+
+ define public property readResponseHandler as ReadResponseHandler no-undo
+ get.
+ set.
+
+ constructor public Socket ( input remoteHost as character, input remotePort as integer, input timeOut as integer ):
+ connect(remoteHost, remotePort, timeOut).
+ end constructor.
+
+ constructor public Socket ( input remoteHost as character, input remotePort as integer ):
+ this-object(remoteHost, remotePort, ?).
+ end constructor.
+
+ constructor public Socket ( input remoteHost as character, input serviceName as character, input timeOut as integer ):
+ connect(remoteHost, serviceName, timeOut).
+ end constructor.
+
+ constructor public Socket ( input remoteHost as character, input serviceName as character ):
+ this-object(remoteHost, serviceName, ?).
+ end constructor.
+
+ constructor public Socket ( input sockImpl as handle ):
+ assign
+ sock = sockImpl
+ isCreated = true
+ isConnected = sock:connected().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end constructor.
+
+ method override public void close( ):
+ isClosed = true.
+
+ if isConnected then
+ sock:disconnect().
+ SocketEventHandler:unsetReadResponse(sock, this-object).
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+
+ end method.
+
+ method override public void connect( input remoteHost as character, input remotePort as integer, input timeOut as integer ):
+
+ if timeOut lt 0 then
+ undo, throw new IllegalArgumentException().
+ checkClosedAndCreate(true).
+ if timeOut ne ? then
+ receiveTimeout = timeOut.
+
+ sock:connect(substitute('-H &1 -S &2':u, remoteHost, remotePort)).
+ assign
+ address = sock:remote-host
+ port = sock:remote-port
+ localPort = sock:local-port.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new ConnectException().
+ end catch.
+ end method.
+
+ method override public void connect( input remoteHost as character, input serviceName as character, input timeOut as integer ):
+
+ if timeOut lt 0 then
+ undo, throw new IllegalArgumentException().
+
+ checkClosedAndCreate(true).
+
+ if timeOut ne ? then
+ receiveTimeout = timeOut.
+
+ sock:connect(substitute('-H &1 -S &2':u, remoteHost, serviceName)).
+ assign
+ address = sock:remote-host
+ port = sock:remote-port
+ localPort = sock:local-port.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new ConnectException().
+ end catch.
+ end method.
+
+ method override protected void create( ):
+ if not isCreated then
+ do:
+ create socket sock.
+ SocketEventHandler:setReadResponse(sock, this-object).
+ isCreated = true.
+ end.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+ method override public void evtReadResponse( input cliSock as handle ):
+ if cliSock eq ? or cliSock ne sock then
+ return.
+
+ if valid-object(readResponseHandler) then
+ readResponseHandler:handleReadResponse(this-object).
+ end method.
+
+ method override public InputStream getInputStream( ):
+ if not valid-object(inStream) then
+ inStream = new SocketInputStream(sock).
+ return inStream.
+ end method.
+
+ method override public integer getLocalPort( ):
+ if not isConnected then
+ return -1.
+ return super:getLocalPort().
+ end method.
+
+ method override public OutputStream getOutputStream( ):
+ if not valid-object(outStream) then
+ outStream = new SocketOutputStream(sock).
+ return outStream.
+ end method.
+
+ method public logical getKeepAlive ():
+ checkClosedAndCreate(true).
+ return logical(getOption(SO_KEEPALIVE)).
+ end method.
+
+ method override protected integer getPort( ):
+ if not isConnected then
+ return 0.
+ return super:getPort().
+ end method.
+
+ method public logical getSoLinger ():
+ checkClosedAndCreate(true).
+ return logical(getOption(SO_LINGER)).
+ end method.
+
+ method public integer getReceiveBufferSize ():
+ checkClosedAndCreate(true).
+ return integer(getOption(SO_RCVBUF)).
+ end method.
+
+ method public integer getSendBufferSize ():
+ checkClosedAndCreate(true).
+ return integer(getOption(SO_SNDBUF)).
+ end method.
+
+ method public integer getSoTimeout ():
+ checkClosedAndCreate(true).
+ return integer(getOption(SO_TIMEOUT)).
+ end method.
+
+ method public logical getTcpNoDelay ():
+ checkClosedAndCreate(true).
+ return logical(getOption(TCP_NODELAY)).
+ end method.
+
+ method public logical getReuseAddress ():
+ checkClosedAndCreate(true).
+ return logical(getOption(SO_REUSEADDR)).
+ end method.
+
+ method public void setKeepAlive (opt as logical):
+ checkClosedAndCreate(true).
+ setOption(SO_KEEPALIVE, string(opt, 'true/false':u)).
+ end method.
+
+ method public void setSendBufferSize (opt as integer):
+ if opt le 0 then
+ undo, throw new IllegalArgumentException().
+
+ checkClosedAndCreate(true).
+ setOption(SO_SNDBUF, string(opt)).
+ end method.
+
+ method public void setReceiveBufferSize (opt as integer):
+ if opt le 0 then
+ undo, throw new IllegalArgumentException().
+
+ checkClosedAndCreate(true).
+ setOption(SO_RCVBUF, string(opt)).
+ end method.
+
+ method public void setSoLinger (opt as logical, linger as integer):
+ if opt and linger lt 0 then
+ undo, throw new IllegalArgumentException().
+
+ checkClosedAndCreate(true).
+ linger = if opt then maximum(linger, 65535) else -1.
+ setOption(SO_LINGER, substitute('&1,&2', string(opt, 'true/false':u), linger)).
+ end method.
+
+ method public void setSoTimeout (opt as integer):
+ if opt lt 0 then
+ undo, throw new IllegalArgumentException().
+
+ checkClosedAndCreate(true).
+ setOption(SO_TIMEOUT, string(opt)).
+ end method.
+
+ method public void setTcpNoDelay (opt as logical):
+ checkClosedAndCreate(true).
+ setOption(TCP_NODELAY, string(opt, 'true/false':u)).
+ end method.
+
+ method public void setReuseAddress (opt as logical):
+ checkClosedAndCreate(true).
+ setOption(SO_REUSEADDR, string(opt, 'true/false':u)).
+ end method.
+
+ method public void shutdownInput ():
+ if isInputClosed then
+ undo, throw new SocketException().
+
+ checkClosedAndCreate(false).
+ inStream:close().
+ isInputClosed = true.
+ end method.
+
+ method public void shutdownOutput ():
+ if isOutputClosed then
+ undo, throw new SocketException().
+
+ checkClosedAndCreate(false).
+ outStream:close().
+ isOutputClosed = true.
+ end method.
+
+ method public logical isConnected ():
+ return isConnected.
+ end method.
+
+ method public logical isInputShutdown ():
+ return isInputClosed.
+ end method.
+
+ method public logical isOutputShutdown ():
+ return isOutputClosed.
+ end method.
+
+ method private void checkClosedAndCreate (doCreate as logical):
+ if isClosed then
+ undo, throw new SocketException().
+
+ if not isCreated then
+ do:
+ if not doCreate then
+ undo, throw new SocketException().
+ this-object:create().
+ end.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+
+ end method.
+
+ method public void waitForResponse( timeOut as integer ):
+
+ checkClosedAndCreate(false).
+
+ wait-for 'read-response':u of sock pause timeOut.
+ end method.
+
+ destructor public Socket ( ):
+ if valid-handle(sock) then
+ do:
+ sock:disconnect() no-error.
+ delete object sock.
+ end.
+
+ if valid-object(inStream) then
+ delete object inStream.
+ if valid-object(outStream) then
+ delete object outStream.
+ end destructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandler.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandler.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandler.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,155 @@
+/*------------------------------------------------------------------------
+ File : SocketEventHandler
+ Purpose :
+ Syntax :
+ Description : Handle all socket events and dispatch them back to the
+ SocketImpl object that owns them.
+
+ Author(s) : medu
+ Created : Sat Sep 25 11:27:08 EEST 2010
+ Notes : We need this only because we can't use class methods to
+ handle widget events.
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.util.StringHashMap.
+using net.sourceforge.progress.net.*.
+using net.sourceforge.progress.lang.NullPointerException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.net.SocketEventHandler final :
+
+ define static private property instance as SocketEventHandler no-undo
+ get.
+ set.
+
+ define static private property eventHndl as handle no-undo
+ get.
+ set.
+
+ define static private property socketMap as StringHashMap no-undo
+ get.
+ set.
+
+ define static private property myGuid as character no-undo
+ get:
+ if myGuid eq '':u then
+ myGuid = guid.
+ return myGuid.
+ end get.
+ set.
+
+ constructor private SocketEventHandler ( ):
+ run net/sourceforge/progress/net/SocketEventHandlerHelper.p
+ persistent set eventHndl (this-object, myGuid).
+
+ socketMap = new StringHashMap().
+
+ if not valid-handle(eventHndl) or not valid-object(socketMap) then
+ undo, throw new NullPointerException().
+
+ end constructor.
+
+ method static public SocketEventHandler getInstance ():
+ if not valid-object(instance) then
+ instance = new SocketEventHandler().
+ return instance.
+ end method.
+
+ method public void evtReadResponse (cliSock as handle, pass as character):
+ define variable sockImpl as SocketImpl no-undo.
+
+ if pass ne myGuid or
+ not valid-handle(cliSock) then
+ return.
+
+ sockImpl = cast(socketMap:get(string(cliSock:handle)), 'SocketImpl':u) no-error.
+
+ if valid-object(sockImpl) then
+ sockImpl:evtReadResponse(cliSock).
+
+ end method.
+
+ method public void evtConnect (srvSock as handle, cliSock as handle, pass as character):
+ define variable sockImpl as SocketImpl no-undo.
+
+ if pass ne myGuid or
+ not valid-handle(srvSock) or
+ not valid-handle(cliSock) then
+ return.
+
+ sockImpl = cast(socketMap:get(string(srvSock:handle)), 'SocketImpl':u) no-error.
+
+ if valid-object(sockImpl) then
+ sockImpl:evtConnect(srvSock, cliSock).
+
+ end method.
+
+ method static public void setReadResponse (cliSock as handle, sockImpl as SocketImpl):
+ if not valid-handle (cliSock) or
+ not valid-object (sockImpl) then
+ undo, throw new NullPointerException().
+
+ getInstance().
+
+ cliSock:set-read-response-procedure ('evtReadResponse':u, eventHndl).
+
+ socketMap:put(string(cliSock:handle), sockImpl).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+ method static public void setConnect (srvSock as handle, sockImpl as SocketImpl):
+ if not valid-handle (srvSock) or
+ not valid-object (sockImpl) then
+ undo, throw new NullPointerException().
+
+ getInstance().
+
+ srvSock:set-connect-procedure ('evtConnect':u, eventHndl).
+
+ socketMap:put(string(srvSock:handle), sockImpl).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+ method static public void unsetReadResponse (cliSock as handle, sockImpl as SocketImpl):
+ if not valid-handle (cliSock) or
+ not valid-object (sockImpl) then
+ undo, throw new NullPointerException().
+
+ if socketMap:get(string(cliSock:handle)) eq sockImpl then
+ socketMap:remove(string(cliSock:handle)).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+ method static public void unsetConnect (srvSock as handle, sockImpl as SocketImpl):
+ if not valid-handle (srvSock) or
+ not valid-object (sockImpl) then
+ undo, throw new NullPointerException().
+
+ if socketMap:get(string(srvSock:handle)) eq sockImpl then
+ socketMap:remove(string(srvSock:handle)).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+ destructor public SocketEventHandler ( ):
+ delete object socketMap no-error.
+ delete object eventHndl no-error.
+ end destructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandlerHelper.p
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandlerHelper.p (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketEventHandlerHelper.p 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,36 @@
+/*------------------------------------------------------------------------
+ File : SocketeventHandlerHelper.p
+ Purpose :
+
+ Syntax :
+
+ Description :
+
+ Author(s) : medu
+ Created : Sat Sep 25 11:43:46 EEST 2010
+ Notes : We need this only because we can't use class methods to
+ handle widget events.
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.SocketEventHandler.
+
+/* *************************** Definitions ************************** */
+
+routine-level on error undo, throw.
+
+/* ******************** Preprocessor Definitions ******************** */
+define input parameter evtHandler as SocketEventHandler no-undo.
+define input parameter passwd as character no-undo.
+
+if not valid-object(evtHandler) then
+ return error.
+
+procedure evtReadResponse:
+ evtHandler:evtReadResponse(self, passwd).
+end procedure.
+
+procedure evtConnect:
+ define input parameter cliSock as handle no-undo.
+
+ evtHandler:evtConnect(self, cliSock, passwd).
+end procedure.
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketException.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketException.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketException.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,28 @@
+ /*------------------------------------------------------------------------
+ File : SocketException
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Sat Sep 25 08:16:34 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.AppError.
+
+class net.sourceforge.progress.net.SocketException inherits AppError :
+
+ constructor public SocketException ( input p0 as character ):
+ super (input p0).
+ end constructor.
+
+
+ constructor public SocketException ( input p0 as character, input p1 as integer ):
+ super (input p0, input p1).
+ end constructor.
+
+ constructor public SocketException ( ):
+ super ().
+ end constructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketImpl.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketImpl.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketImpl.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,122 @@
+/*------------------------------------------------------------------------
+ File : SocketImpl
+ Purpose :
+ Syntax :
+ Description : This class is the base of all streaming socket
+ implementation classes. Streaming sockets are wrapped
+ by two classes, ServerSocket and Socket at the server
+ and client end of a connection.
+
+ Author(s) : medu
+ Created : Sat Sep 25 08:08:31 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.*.
+using net.sourceforge.progress.io.InputStream.
+using net.sourceforge.progress.io.OutputStream.
+
+class net.sourceforge.progress.net.SocketImpl
+ inherits net.sourceforge.progress.net.SocketOptions:
+
+ define protected property sock as handle no-undo
+ get.
+ set.
+
+ define protected property address as character no-undo
+ get.
+ set.
+
+ define protected property port as integer no-undo
+ get.
+ set.
+
+ define protected property localPort as integer no-undo
+ get.
+ set.
+
+ define protected property receiveTimeout as integer no-undo initial ?
+ get.
+ set (val as integer):
+ if val eq ? then
+ return.
+ setOption(SO_TIMEOUT, string(val)).
+ receiveTimeout = val.
+ catch e as Progress.Lang.Error :
+ delete object e.
+ end catch.
+ end.
+
+ constructor protected SocketImpl ( ):
+
+ end constructor.
+
+
+ method protected SocketImpl accept( ):
+ end method.
+
+ method protected void bind( lport as integer):
+ end method.
+
+ method protected void close( ):
+ end method.
+
+ method protected void connect( remoteHost as character, remotePort as integer ):
+ this-object:connect(remoteHost, remotePort, ?).
+ end method.
+
+ method protected void connect( remoteHost as character, remotePort as integer, timeOut as integer ):
+ end method.
+
+ method protected void connect( remoteHost as character, serviceName as character ):
+ this-object:connect(remoteHost, serviceName, ?).
+ end method.
+
+ method protected void connect( remoteHost as character, serviceName as character, timeOut as integer ):
+ end method.
+
+ method protected void create ():
+ end method.
+
+ method public void evtReadResponse (cliSock as handle):
+
+ end method.
+
+ method public void evtConnect (srvSock as handle, cliSock as handle):
+
+ end method.
+
+ method protected InputStream getInputStream ():
+ end method.
+
+ method protected integer getLocalPort( ):
+ return localPort.
+ end method.
+
+ method override public character getOption( input opt as character ):
+ if valid-handle(sock) then
+ return sock:get-socket-option(opt).
+ undo, throw new SocketException().
+ end method.
+
+ method protected OutputStream getOutputStream ():
+ end method.
+
+ method protected integer getPort( ):
+ return port.
+ end method.
+
+ method protected void listen (backlog as integer):
+ end method.
+
+ method override public void setOption( input opt as character, input val as character ):
+
+ sock:set-socket-option(opt, val).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new SocketException().
+ end catch.
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketInputStream.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,124 @@
+/*------------------------------------------------------------------------
+ File : SocketInputStream
+ Purpose :
+ Syntax :
+ Description : InputStream implementation used to read data from a
+ client socket.
+ Author(s) : medu
+ Created : Sun Sep 26 17:27:11 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.*.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.net.SocketInputStream inherits InputStream :
+
+ define protected property inSocket as handle no-undo
+ get.
+ private set.
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property isClosed as logical no-undo
+ get.
+ set.
+
+ constructor public SocketInputStream ( sock as handle ):
+ super ().
+ if not valid-handle(sock) then
+ undo, throw new NullPointerException().
+ if sock:type ne 'socket':u then
+ undo, throw new IllegalArgumentException().
+ inSocket = sock.
+ set-size(buf) = 1.
+ end constructor.
+
+ method override public integer available( ):
+ checkClosed().
+ return inSocket:get-bytes-available().
+ end method.
+
+ method override public void close( ):
+ isClosed = true.
+ end method.
+
+ method override public void mark( input limit as integer ):
+ undo, throw new IOException().
+ end method.
+
+ method override public integer read( ):
+ checkClosed().
+
+ inSocket:read(buf, 1, 1, read-available) no-error.
+ if inSocket:bytes-read eq 1 then
+ return get-byte(buf, 1).
+ return -1.
+ end method.
+
+ method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
+ define variable copyLen as integer no-undo.
+
+ if bytes eq ? or offset eq ? or len eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return 0.
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ checkClosed().
+
+ repeat while len gt 0:
+ inSocket:read(bytes, offset + 1, len, read-available) no-error.
+ if inSocket:bytes-read eq 0 then
+ leave.
+
+ assign
+ copyLen = copyLen + inSocket:bytes-read
+ offset = offset + copyLen
+ len = len - copyLen.
+ end.
+ return if copyLen eq 0 then -1 else copyLen.
+ end method.
+
+ method override public void reset( ):
+ undo, throw new IOException().
+ end method.
+
+ method override public int64 skip( input len as int64 ):
+ define variable skipped as int64 no-undo.
+
+ if len eq ? or len le 0 then
+ return 0.
+
+ checkClosed().
+
+ repeat while len gt 0 and this-object:read() ne -1:
+ assign
+ skipped = skipped + 1
+ len = len - 1.
+ end.
+ return skipped.
+ end method.
+
+ method private void checkClosed ():
+ if isClosed then
+ undo, throw new IOException().
+ if not valid-handle(inSocket) or not inSocket:connected() then
+ do:
+ isClosed = true.
+ undo, throw new IOException().
+ end.
+ end method.
+
+ destructor public SocketInputStream ( ):
+ set-size(buf) = 0.
+ end destructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOptions.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOptions.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOptions.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,53 @@
+ /*------------------------------------------------------------------------
+ File : SocketOptions
+ Purpose :
+ Syntax :
+ Description : Defines an interface for socket implementations to get
+ and set socket options.
+
+ Author(s) : medu
+ Created : Sat Sep 25 08:14:15 EEST 2010
+ Notes : Implemented as an abstract class since for now interface
+ properties do not support initial values.
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.net.SocketException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.net.SocketOptions:
+
+ define static public property SO_TIMEOUT as character no-undo initial 'SO-RCVTIMEO':u
+ get.
+
+ define static public property TCP_NODELAY as character no-undo initial 'TCP-NODELAY':u
+ get.
+
+ define static public property SO_LINGER as character no-undo initial 'SO-LINGER':u
+ get.
+
+ define static public property SO_KEEPALIVE as character no-undo initial 'SO-KEEPALIVE':u
+ get.
+
+ define static public property SO_REUSEADDR as character no-undo initial 'SO-REUSEADDR':u
+ get.
+
+ define static public property SO_RCVBUF as character no-undo initial 'SO-RCVBUF':u
+ get.
+
+ define static public property SO_SNDBUF as character no-undo initial 'SO-SNDBUF':u
+ get.
+
+
+ constructor protected SocketOptions ( ):
+ end constructor.
+
+ method public void setOption (opt as character, val as character):
+ undo, throw new SocketException().
+ end method.
+
+ method public character getOption (opt as character):
+ undo, throw new SocketException().
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/net/SocketOutputStream.cls 2010-09-26 18:11:51 UTC (rev 70)
@@ -0,0 +1,87 @@
+/*------------------------------------------------------------------------
+ File : SocketOutputStream
+ Purpose :
+ Syntax :
+ Description : OutputStream implementation used to write data to a
+ client socket.
+ Author(s) : medu
+ Created : Sun Sep 26 19:07:15 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.*.
+
+class net.sourceforge.progress.net.SocketOutputStream inherits OutputStream :
+
+ define protected property outSocket as handle no-undo
+ get.
+ private set.
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property isClosed as logical no-undo
+ get.
+ set.
+
+ constructor public SocketOutputStream ( sock as handle ):
+ super ().
+ if not valid-handle(sock) then
+ undo, throw new NullPointerException().
+ if sock:type ne 'socket':u then
+ undo, throw new IllegalArgumentException().
+ outSocket = sock.
+ set-size(buf) = 1.
+ end constructor.
+
+ method private void checkClosed ():
+ if isClosed then
+ undo, throw new IOException().
+ if not valid-handle(outSocket) or not outSocket:connected() then
+ do:
+ isClosed = true.
+ undo, throw new IOException().
+ end.
+ end method.
+
+ method override public void close( ):
+ isClosed = true.
+ end method.
+
+ method override public void flush( ):
+ /* not buffered, nothing to do */
+ end method.
+
+ method override public void write( input bit as integer ):
+ put-byte(buf, 1) = bit.
+ this-object:write(buf, 1, 1).
+ end method.
+
+ method override public void write( input bytes as memptr, input offset as integer, input len as integer ):
+ if bytes eq ? or offset eq ? or len eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return.
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ checkClosed().
+ do while len gt 0:
+ outSocket:write(bytes, offset + 1, len) no-error.
+ if outSocket:bytes-written eq 0 then
+ undo, throw new IOException().
+ assign
+ offset = offset + outSocket:bytes-written
+ len = len - outSocket:bytes-written.
+ end.
+ end method.
+
+ destructor public SocketOutputStream ( ):
+ set-size(buf) = 0.
+ end destructor.
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 18:05:52
|
Revision: 69
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=69&view=rev
Author: medu
Date: 2010-09-26 18:05:45 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Check for null arguments (offset and length).
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -51,7 +51,7 @@
constructor public BufferedInputStream ( str as InputStream, size as integer ):
super(str).
- if size le 0 then
+ if size eq ? or size le 0 then
undo, throw new IllegalArgumentException().
set-size(buf) = size.
end constructor.
@@ -70,9 +70,10 @@
end method.
method override public void mark( input limit as integer ):
- assign
- markLimit = limit
- markPos = pos.
+ if limit ne ? then
+ assign
+ markLimit = limit
+ markPos = pos.
end method.
method override public logical markSupported( ):
@@ -107,7 +108,7 @@
if len eq 0 then
return 0.
- if buf eq ? then
+ if buf eq ? or offset eq ? or len eq ? then
undo, throw new IOException().
if offset lt 0 or offset gt get-size(bytes) or len lt 0 or len gt get-size(bytes) - offset then
@@ -173,7 +174,7 @@
method override public int64 skip( input len as int64 ):
define variable read as int64 no-undo.
- if len lt 1 then
+ if len eq ? or len lt 1 then
return 0.
if buf eq ? or not valid-object(inStream) then
@@ -209,7 +210,7 @@
return read + inStream:skip(len - read).
end method.
- method private integer fillBuffer ():
+ method protected integer fillBuffer ():
define variable result as integer no-undo.
define variable len as integer no-undo.
define variable lbuf as memptr no-undo.
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -50,9 +50,8 @@
end constructor.
method override public void close( ):
- set-size(buf) = 0.
-
super:close().
+ set-size(buf) = 0.
end method.
method override public void flush( ):
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -69,7 +69,7 @@
method override public integer read (bytes as memptr, offset as integer, len as integer):
define variable copyLen as integer no-undo.
- if bytes eq ? then
+ if bytes eq ? or offset eq ? or len eq ? then
undo, throw new NullPointerException().
if len eq 0 then
@@ -95,7 +95,7 @@
method override public int64 skip (len as int64):
define variable tmp as integer no-undo.
- if len le 0 then
+ if len eq ? or len le 0 then
return 0.
assign
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -8,10 +8,8 @@
Created : Wed Sep 22 21:19:01 EEST 2010
Notes :
----------------------------------------------------------------------*/
-using net.sourceforge.progress.io.IOException.
-using net.sourceforge.progress.lang.IndexOutOfBoundsException.
-using net.sourceforge.progress.lang.IllegalArgumentException.
-using net.sourceforge.progress.io.OutputStream.
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.*.
routine-level on error undo, throw.
@@ -78,6 +76,9 @@
method override public void write (bytes as memptr, offset as integer, len as integer):
define variable idx as integer no-undo.
+ if bytes eq ? or offset eq ? or len eq ? then
+ undo, throw new NullPointerException().
+
if offset lt 0 or len lt 0 or
offset + len gt get-size(bytes) then
undo, throw new IndexOutOfBoundsException().
@@ -92,7 +93,8 @@
end method.
method public void writeTo (str as OutputStream):
-
+ if not valid-object(str) then
+ undo, throw new NullPointerException().
if count gt 0 then
str:write(buf, 0, integer(count)).
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -26,6 +26,7 @@
end method.
method public void close( ):
+ flush().
end method.
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls 2010-09-26 18:05:45 UTC (rev 69)
@@ -127,13 +127,10 @@
method override public int64 skip( input len as int64 ):
define variable numSkiped as int64 no-undo.
- if len eq ? then
- undo, throw new NullPointerException().
-
if buf eq ? then
undo, throw new IOException().
- if len le 0 then
+ if len eq ? or len le 0 then
return 0.
if pos lt blen then
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 13:15:34
|
Revision: 68
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=68&view=rev
Author: medu
Date: 2010-09-26 13:15:28 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Implement readLine method using PushbackInputStream as needed.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls 2010-09-26 13:14:38 UTC (rev 67)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls 2010-09-26 13:15:28 UTC (rev 68)
@@ -20,10 +20,12 @@
inherits FilterInputStream
implements DataInput, java.io.DataInput :
- define protected property buf as memptr no-undo
+ define protected property buf as memptr no-undo
get.
set.
-
+
+ define private variable pbStream as logical no-undo.
+
constructor public DataInputStream ( input str as InputStream ):
super (input str).
set-size(buf) = 8.
@@ -125,16 +127,56 @@
end method.
method public java.lang.String readLine( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ return new String(readLineChars()).
end method.
method public character readLineChars( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable ln as character no-undo.
+ define variable nl as logical no-undo.
+ define variable bit as integer no-undo.
+
+ do while true:
+ bit = inStream:read().
+ case bit:
+ /* EOF */
+ when -1 then
+ do:
+ if length(ln) eq 0 and not nl then
+ return ?.
+ return ln.
+ end.
+ /* LF - \n */
+ when 10 then
+ return ln.
+ /* CR - \r */
+ when 13 then
+ do:
+ if nl then
+ do:
+ cast(inStream, 'PushbackInputStream':u):unread(bit).
+ return ln.
+ end.
+ /* pushback stream might be needed */
+ if not type-of(inStream, 'PushbackInputStream':u) then
+ do:
+ pbStream = true.
+ inStream = new PushbackInputStream(inStream).
+ end.
+ nl = true.
+ end.
+ otherwise
+ do:
+ if nl then
+ do:
+ cast(inStream, 'PushbackInputStream':u):unread(bit).
+ return ln.
+ end.
+ ln = ln + chr(bit).
+ end.
+ end case.
+ end.
+
end method.
method public int64 readLong( ):
@@ -181,16 +223,22 @@
define variable skipped as integer no-undo.
define variable num as int64 no-undo.
- do while skipped lt offset:
- num = inStream:skip(offset - skipped).
- if num eq 0 then
+ do while skipped lt offset:
+ num = inStream:skip(offset - skipped).
+ if num eq 0 then
leave.
skipped = skipped + num.
- end.
- if skipped lt 0 then
+ end.
+ if skipped lt 0 then
undo, throw new EOFException().
return skipped.
end method.
+ destructor public DataInputStream ( ):
+ if pbStream then
+ delete object inStream no-error.
+ end destructor.
+
+
end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 13:14:45
|
Revision: 67
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=67&view=rev
Author: medu
Date: 2010-09-26 13:14:38 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Added PushbackInputStream.
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/PushbackInputStream.cls 2010-09-26 13:14:38 UTC (rev 67)
@@ -0,0 +1,185 @@
+/*------------------------------------------------------------------------
+ File : PushbackInputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing InputStream and adds functionality to
+ "push back" bytes that have been read, so that they can
+ be read again. Parsers may find this useful. The number
+ of bytes which may be pushed back can be specified during
+ construction. If the buffer of pushed back bytes is empty,
+ bytes are read from the underlying input stream.
+
+ Author(s) : medu
+ Created : Sun Sep 26 08:07:14 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using java.io.Closeable.
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
+using net.sourceforge.progress.lang.IllegalArgumentException.
+using net.sourceforge.progress.lang.NullPointerException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.PushbackInputStream inherits FilterInputStream implements Closeable :
+
+ define protected property buf as memptr no-undo
+ get.
+ private set.
+
+ define protected property blen as integer no-undo
+ get.
+ private set.
+
+ define protected property pos as integer no-undo
+ get.
+ set.
+
+ constructor public PushbackInputStream ( input str as InputStream ):
+ this-object (str, 1).
+ end constructor.
+
+ constructor public PushbackInputStream ( input str as InputStream, size as integer ):
+ super (input str).
+ if size eq ? or size le 0 then
+ undo, throw new IllegalArgumentException().
+ if valid-object(str) then assign
+ blen = size
+ pos = size
+ set-size(buf) = size.
+ end constructor.
+
+ method override public integer available( ):
+ if buf eq ? then
+ undo, throw new IOException().
+ return blen - pos + inStream:available().
+ end method.
+
+ method override public void close( ):
+
+ if valid-object(inStream) then
+ inStream:close().
+
+ assign
+ inStream = ?
+ set-size(buf) = 0
+ buf = ?.
+ end method.
+
+ method override public void mark( input limit as integer ):
+ end method.
+
+ method override public logical markSupported( ):
+ return false.
+ end method.
+
+ method override public integer read( ):
+ if buf eq ? then
+ undo, throw new IOException().
+
+ if pos lt blen then
+ do:
+ pos = pos + 1.
+ return get-byte(buf, pos).
+ end.
+ return inStream:read().
+ end method.
+
+ method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
+ define variable copiedBytes as integer no-undo.
+
+ if bytes eq ? or offset eq ? or len eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return 0.
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ if buf eq ? then
+ undo, throw new IOException().
+
+ if pos lt blen then
+ do:
+ copiedBytes = maximum(len, blen - pos).
+
+ put-bytes (bytes, offset + 1) = get-bytes(buf, pos + 1, copiedBytes).
+ assign
+ copiedBytes = maximum(len, blen - pos)
+ offset = offset + copiedBytes
+ pos = pos + copiedBytes.
+ end.
+ if copiedBytes eq len then
+ return len.
+
+ copiedBytes = copiedBytes + maximum(0, inStream:read(bytes, offset, len - copiedBytes)).
+
+ return copiedBytes.
+
+ end method.
+
+ method override public void reset( ):
+ undo, throw new IOException().
+ end method.
+
+ method override public int64 skip( input len as int64 ):
+ define variable numSkiped as int64 no-undo.
+
+ if len eq ? then
+ undo, throw new NullPointerException().
+
+ if buf eq ? then
+ undo, throw new IOException().
+
+ if len le 0 then
+ return 0.
+
+ if pos lt blen then
+ assign
+ numSkiped = maximum(blen - pos, len)
+ pos = pos + numSkiped.
+
+ if numSkiped lt len then
+ numSkiped = numSkiped + inStream:skip(len - numSkiped).
+
+ return numSkiped.
+ end method.
+
+ method public void unread (bit as integer):
+ if buf eq ? or bit eq ? or pos eq 0 then
+ undo, throw new IOException().
+ put-byte(buf, pos) = bit.
+ pos = pos - 1.
+ end method.
+
+ method public void unread(bytes as memptr):
+ if bytes eq ? then
+ undo, throw new NullPointerException().
+
+ unread(bytes, 0, integer(get-size(bytes))).
+ end method.
+
+ method public void unread (bytes as memptr, offset as integer, len as integer):
+ if bytes eq ? or offset eq ? or len eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return.
+
+ if buf eq ? or len gt pos then
+ undo, throw new IOException().
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ put-bytes(buf, pos - len + 1) = get-bytes(bytes, offset + 1, len).
+ pos = pos - len.
+ end method.
+
+ destructor public PushbackInputStream ( ):
+ set-size(buf) = 0.
+ end destructor.
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-26 13:13:44
|
Revision: 66
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=66&view=rev
Author: medu
Date: 2010-09-26 13:13:38 +0000 (Sun, 26 Sep 2010)
Log Message:
-----------
Check for null arguments (offset and length).
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls 2010-09-25 16:48:52 UTC (rev 65)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls 2010-09-26 13:13:38 UTC (rev 66)
@@ -46,6 +46,9 @@
end method.
method public integer read (bytes as memptr):
+ if bytes eq ? then
+ undo, throw new NullPointerException().
+
return read(bytes, 0, integer(get-size(bytes))).
end method.
@@ -53,7 +56,7 @@
define variable bits as integer no-undo.
define variable bit as integer no-undo.
- if bytes eq ? then
+ if bytes eq ? or offset eq ? or len eq ? then
undo, throw new NullPointerException().
if len eq 0 then
@@ -90,6 +93,9 @@
define variable read as integer no-undo.
define variable bufLen as integer no-undo.
+ if len eq ? then
+ undo, throw new NullPointerException().
+
if len le 0 then
return 0.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-25 16:48:58
|
Revision: 65
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=65&view=rev
Author: medu
Date: 2010-09-25 16:48:52 +0000 (Sat, 25 Sep 2010)
Log Message:
-----------
Added Remove method wrapper for character input.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-09-24 06:20:38 UTC (rev 64)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-09-25 16:48:52 UTC (rev 65)
@@ -111,5 +111,18 @@
return super:put(kStr, v).
end method.
+
+ method public Object remove( input k as character ):
+ define variable kStr as String no-undo.
+
+ if k ne ? then
+ kStr = new String(k).
+
+ return super:remove(kStr).
+
+ finally:
+ delete object kStr no-error.
+ end finally.
+ end method.
end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-24 06:20:44
|
Revision: 64
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=64&view=rev
Author: medu
Date: 2010-09-24 06:20:38 +0000 (Fri, 24 Sep 2010)
Log Message:
-----------
Added DataOutputStream.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutputStream.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls 2010-09-23 18:13:21 UTC (rev 63)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls 2010-09-24 06:20:38 UTC (rev 64)
@@ -39,7 +39,7 @@
define variable val as integer no-undo.
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
val = inStream:read().
if val lt 0 then
@@ -52,7 +52,7 @@
define variable val as integer no-undo.
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
val = inStream:read().
if val lt 0 then
@@ -67,7 +67,7 @@
method public decimal readDouble( ):
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if inStream:read(buf, 0, 8) lt 8 then
undo, throw new EOFException().
@@ -77,7 +77,7 @@
method public decimal readFloat( ):
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if inStream:read(buf, 0, 4) lt 4 then
undo, throw new EOFException().
@@ -99,7 +99,7 @@
return.
if not valid-object(inStream) or val eq ? then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if offset lt 0 or offset gt get-size(val) - len then
undo, throw new IndexOutOfBoundsException().
@@ -116,7 +116,7 @@
method public integer readInt( ):
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if inStream:read(buf, 0, 4) lt 4 then
undo, throw new EOFException().
@@ -139,7 +139,7 @@
method public int64 readLong( ):
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if inStream:read(buf, 0, 8) lt 8 then
undo, throw new EOFException().
@@ -149,7 +149,7 @@
method public integer readShort( ):
if not valid-object(inStream) then
- undo, throw new NullPointerException().
+ undo, throw new IOException().
if inStream:read(buf, 0, 2) lt 2 then
undo, throw new EOFException().
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutputStream.cls 2010-09-24 06:20:38 UTC (rev 64)
@@ -0,0 +1,167 @@
+/*------------------------------------------------------------------------
+ File : DataOutputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing OutputStream and writes typed data to it.
+ Typically, this stream can be read in by DataInputStream.
+
+ Author(s) : medu
+ Created : Thu Sep 23 18:59:48 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.DataOutput.
+using net.sourceforge.progress.io.FilterOutputStream.
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.NullPointerException.
+using java.lang.String.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.DataOutputStream
+ inherits FilterOutputStream
+ implements DataOutput, java.io.DataOutput :
+
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ constructor public DataOutputStream ( input str as net.sourceforge.progress.io.OutputStream ):
+ super (input str).
+ set-size(buf) = 0.
+ end constructor.
+
+ method public void writeBoolean( input val as logical ):
+
+ outStream:write(if val then 1 else 0).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+
+ end method.
+
+ method public void writeByte( input val as integer ):
+
+ outStream:write(val).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+
+ end method.
+
+ method public void writeBytes( input val as String ):
+ define variable idx as integer no-undo.
+ define variable len as integer no-undo.
+ define variable tmp as memptr no-undo.
+
+ assign
+ len = val:len()
+ set-size(tmp) = len * 2.
+
+ do idx = 0 to len - 1:
+ put-short(tmp, idx * 2 + 1) = asc(val:charAt(idx)).
+ end.
+
+ this-object:write(tmp, 0, len).
+
+ finally:
+ set-size(tmp) = 0.
+ end finally.
+
+ end method.
+
+ method public void writeChar( input val as character ):
+ writeShort(asc(val)).
+ end method.
+
+ method public void writeChars( input val as character ):
+ define variable str as longchar no-undo.
+
+ str = val.
+ writeChars(str).
+ end method.
+
+ method public void writeChars( input val as longchar ):
+ define variable tmp as memptr no-undo.
+
+ copy-lob val to tmp no-convert.
+
+ outStream:write(tmp, 0, integer(get-size(tmp))).
+
+ finally:
+ set-size(tmp) = 0.
+ end finally.
+ end method.
+
+ method public void writeChars( input val as String ):
+ if not valid-object(val) then
+ undo, throw new NullPointerException().
+ writeChars(val:toString()).
+ end method.
+
+ method public void writeDouble( input val as decimal ):
+ put-double(buf, 1) = val.
+
+ this-object:write(buf, 0, 8).
+ end method.
+
+ method public void writeFloat( input val as decimal ):
+ put-float(buf, 1) = val.
+
+ this-object:write(buf, 0, 4).
+ end method.
+
+ method public void writeInt( input val as integer ):
+ put-long(buf, 1) = val.
+
+ this-object:write(buf, 0, 4).
+ end method.
+
+ method public void writeLong( input val as int64 ):
+ put-int64(buf, 1) = val.
+
+ this-object:write(buf, 0, 8).
+ end method.
+
+ method public void writeShort( input val as integer ):
+ put-short(buf, 1) = val.
+
+ this-object:write(buf, 0, 2).
+ end method.
+
+ method public void writeUTF( input val as character ):
+ define variable str as longchar no-undo.
+
+ fix-codepage(str) = 'utf-8':u.
+ str = val.
+ this-object:writeUTF(str).
+ end method.
+
+ method public void writeUTF( input val as longchar ):
+ define variable tmp as memptr no-undo.
+
+ if get-codepage(val) ne 'utf-8':u then
+ copy-lob from val to tmp convert target codepage 'utf-8':u.
+ else
+ copy-lob from val to tmp no-convert.
+
+ this-object:write(tmp, 0, integer(get-size(tmp))).
+
+ finally:
+ set-size(tmp) = 0.
+ end finally.
+ end method.
+
+ method public void writeUTF( input val as String ):
+ if not valid-object(val) then
+ undo, throw new NullPointerException().
+
+ this-object:writeUTF(val:toString()).
+ end method.
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-23 18:13:27
|
Revision: 63
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=63&view=rev
Author: medu
Date: 2010-09-23 18:13:21 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Removed Paths:
-------------
net.sourceforge.progress.jms/src/MessageProperty.cls
Deleted: net.sourceforge.progress.jms/src/MessageProperty.cls
===================================================================
--- net.sourceforge.progress.jms/src/MessageProperty.cls 2010-09-23 18:08:00 UTC (rev 62)
+++ net.sourceforge.progress.jms/src/MessageProperty.cls 2010-09-23 18:13:21 UTC (rev 63)
@@ -1,21 +0,0 @@
-
- /*------------------------------------------------------------------------
- File : MessageProperty
- Purpose :
- Syntax :
- Description :
- Author(s) : placeholder
- Created : Tue Sep 21 21:27:18 EEST 2010
- Notes :
- ----------------------------------------------------------------------*/
-
-USING Progress.Lang.*.
-USING net.sourceforge.progress.jms.Message.
-
-
-
-CLASS MessageProperty INHERITS Message :
-
-
-
-END CLASS.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-23 18:08:07
|
Revision: 62
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=62&view=rev
Author: medu
Date: 2010-09-23 18:08:00 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Added BytesMessage.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/BytesMessage.cls 2010-09-23 18:08:00 UTC (rev 62)
@@ -0,0 +1,274 @@
+ /*------------------------------------------------------------------------
+ File : BytesMessage
+ Purpose :
+ Syntax :
+ Description : A BytesMessage object is used to send a message
+ containing a stream of uninterpreted bytes. It inherits
+ from the Message interface and adds a bytes message body.
+ The receiver of the message supplies the interpretation
+ of the bytes.
+
+ Author(s) : medu
+ Created : Thu Sep 23 18:44:35 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.*.
+using javax.jms.BytesMessage.
+using javax.jms.Session.
+using net.sourceforge.progress.jms.Message.
+
+
+class net.sourceforge.progress.jms.BytesMessage inherits Message implements BytesMessage :
+
+
+
+ constructor public BytesMessage ( input msgSession as Session ):
+ super (input msgSession).
+ end constructor.
+
+ /* for unit testing only */
+ constructor protected BytesMessage ( ):
+
+ end constructor.
+
+
+ method public logical readBoolean( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readByte( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readBytes( input val as memptr ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readBytes( input val as memptr, input length as integer ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public character readChar( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public decimal readDouble( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public decimal readFloat( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readInt( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public int64 readLong( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readShort( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readUnsignedByte( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public integer readUnsignedShort( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public character readUTF( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void reset( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeBoolean( input val as logical ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeByte( input val as integer ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeBytes( input val as memptr ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeBytes( input val as memptr, input offset as integer, input length as integer ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeChar( input val as character ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeDouble( input val as decimal ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeFloat( input val as decimal ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeInt( input val as integer ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeLong( input val as int64 ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeObject( input val as Progress.Lang.Object ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeShort( input val as integer ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ method public void writeUTF( input val as character ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+
+
+ destructor public BytesMessage ( ):
+
+ end destructor.
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-23 18:06:14 UTC (rev 61)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-23 18:08:00 UTC (rev 62)
@@ -16,22 +16,22 @@
class net.sourceforge.progress.jms.Message implements javax.jms.Message :
- define static public property DEFAULT_DELIVERY_MODE as integer no-undo
+ define static public property DEFAULT_DELIVERY_MODE as integer no-undo
get:
return javax.jms.DeliveryMode:PERSISTENT.
end get.
- define static public property DEFAULT_PRIORITY as integer no-undo initial 4
+ define static public property DEFAULT_PRIORITY as integer no-undo initial 4
get.
- define static public property DEFAULT_TIME_TO_LIVE as int64 no-undo initial 0
+ define static public property DEFAULT_TIME_TO_LIVE as int64 no-undo initial 0
get.
- define public property JMSCorrelationID as character no-undo
+ define public property JMSCorrelationID as character no-undo
get.
set.
- define public property JMSDeliveryMode as integer no-undo
+ define public property JMSDeliveryMode as integer no-undo
get.
set (deliveryMode as integer):
if deliveryMode eq javax.jms.DeliveryMode:NON_PERSISTENT then
@@ -44,7 +44,7 @@
get.
set.
- define public property JMSExpiration as int64 no-undo
+ define public property JMSExpiration as int64 no-undo
get.
set (expiration as int64):
if expiration eq ? then
@@ -53,11 +53,11 @@
JMSExpiration = expiration.
end set.
- define public property JMSMessageID as character no-undo
+ define public property JMSMessageID as character no-undo
get.
set.
- define public property JMSPriority as integer no-undo
+ define public property JMSPriority as integer no-undo
get.
set (priority as integer):
if priority eq ? or priority lt 0 or priority gt 9 then
@@ -66,7 +66,7 @@
JMSPriority = priority.
end set.
- define public property JMSRedelivered as logical no-undo
+ define public property JMSRedelivered as logical no-undo
get.
set (redelivered as logical):
if redelivered eq ? then
@@ -75,25 +75,25 @@
JMSRedelivered = redelivered.
end set.
- define public property JMSReplyTo as javax.jms.Destination no-undo
+ define public property JMSReplyTo as javax.jms.Destination no-undo
get.
set.
- define public property JMSTimestamp as int64 no-undo
+ define public property JMSTimestamp as int64 no-undo
get.
set.
- define public property JMSType as character no-undo
+ define public property JMSType as character no-undo
get.
set.
- define private variable JMSSession as Session no-undo.
+ define private variable JMSSession as javax.jms.Session no-undo.
- define private variable readOnlyProperties as logical no-undo.
+ define private variable readOnlyProperties as logical no-undo.
- define private variable propertyMap_ as StringHashMap no-undo.
+ define private variable propertyMap_ as StringHashMap no-undo.
- define private property propertyMap as StringHashMap no-undo
+ define private property propertyMap as StringHashMap no-undo
get:
if not valid-object(propertyMap_) then
propertyMap_ = new StringHashMap().
@@ -120,20 +120,17 @@
constructor protected Message():
end.
- constructor public Message(msgSession as Session, received as logical):
+ constructor public Message(msgSession as javax.jms.Session):
if not valid-object(msgSession) then
undo, throw new net.sourceforge.progress.jms.JMSException("Invalid session.").
assign
- JMSSession = msgSession
- readOnlyProperties = received.
+ JMSSession = msgSession.
end constructor.
method public void acknowledge( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
end method.
method public void clearBody( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
end method.
method public void clearProperties( ):
@@ -141,6 +138,7 @@
propertyMap_:delete().
if valid-object(objectArr_) then
objectArr_:clear().
+ readOnlyProperties = false.
end method.
method public logical getBooleanProperty( input name as character ):
@@ -318,15 +316,20 @@
return false.
end method.
+ method public void seal( ):
+ readOnlyProperties = true.
+ end method.
+
+
method public void setBooleanProperty( input name as character, input val as logical ):
define variable o as Progress.Lang.Object no-undo.
-
+
checkWritable().
-
+
o = propertyMap:put(name, new Boolean(val)).
if valid-object(o) and not objectArr:contains(o) then
delete object o.
-
+
catch e as Progress.Lang.Error :
delete object e.
undo, throw new JMSException().
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-23 18:06:20
|
Revision: 61
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=61&view=rev
Author: medu
Date: 2010-09-23 18:06:14 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Added DataInputStream.
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/EOFException.cls
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInputStream.cls 2010-09-23 18:06:14 UTC (rev 61)
@@ -0,0 +1,196 @@
+/*------------------------------------------------------------------------
+ File : DataInputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing InputStream and reads typed data from
+ it. Typically, this stream has been written by a
+ DataOutputStream.
+
+ Author(s) : medu
+ Created : Thu Sep 23 18:59:48 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.*.
+using net.sourceforge.progress.lang.*.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.DataInputStream
+ inherits FilterInputStream
+ implements DataInput, java.io.DataInput :
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ constructor public DataInputStream ( input str as InputStream ):
+ super (input str).
+ set-size(buf) = 8.
+ end constructor.
+
+ method override public void close( ):
+ super:close().
+ set-size(buf) = 0.
+ buf = ?.
+ end method.
+
+ method public logical readBoolean( ):
+ define variable val as integer no-undo.
+
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ val = inStream:read().
+ if val lt 0 then
+ undo, throw new EOFException().
+
+ return val ne 0.
+ end method.
+
+ method public integer readByte( ):
+ define variable val as integer no-undo.
+
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ val = inStream:read().
+ if val lt 0 then
+ undo, throw new EOFException().
+
+ return val.
+ end method.
+
+ method public character readChar( ):
+ return chr(readShort()).
+ end method.
+
+ method public decimal readDouble( ):
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ if inStream:read(buf, 0, 8) lt 8 then
+ undo, throw new EOFException().
+
+ return get-double(buf, 1).
+ end method.
+
+ method public decimal readFloat( ):
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ if inStream:read(buf, 0, 4) lt 4 then
+ undo, throw new EOFException().
+
+ return get-float(buf, 1).
+ end method.
+
+ method public void readFully( input val as memptr ):
+ readFully(val, 0, integer(get-size(val))).
+ end method.
+
+ method public void readFully( input val as memptr, input offset as integer, input len as integer ):
+ define variable read as integer no-undo.
+
+ if len lt 0 then
+ undo, throw new IndexOutOfBoundsException().
+
+ if len eq 0 then
+ return.
+
+ if not valid-object(inStream) or val eq ? then
+ undo, throw new NullPointerException().
+
+ if offset lt 0 or offset gt get-size(val) - len then
+ undo, throw new IndexOutOfBoundsException().
+
+ do while len gt 0:
+ read = inStream:read(val, offset, len).
+ if read lt 0 then
+ undo, throw new EOFException().
+ assign
+ offset = offset + read
+ len = len - read.
+ end.
+ end method.
+
+ method public integer readInt( ):
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ if inStream:read(buf, 0, 4) lt 4 then
+ undo, throw new EOFException().
+
+ return get-long(buf, 1).
+ end method.
+
+ method public java.lang.String readLine( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+
+ method public character readLineChars( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+ method public int64 readLong( ):
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ if inStream:read(buf, 0, 8) lt 8 then
+ undo, throw new EOFException().
+
+ return get-int64(buf, 1).
+ end method.
+
+ method public integer readShort( ):
+ if not valid-object(inStream) then
+ undo, throw new NullPointerException().
+
+ if inStream:read(buf, 0, 2) lt 2 then
+ undo, throw new EOFException().
+
+ return get-short(buf, 1).
+ end method.
+
+ method public integer readUnsignedByte( ):
+ return readByte().
+ end method.
+
+ method public integer readUnsignedShort( ):
+ return readShort().
+ end method.
+
+ method public java.lang.String readUTF( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+ method public longchar readUTFChars( ):
+
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+
+ end method.
+
+ method public integer skipBytes( input offset as integer ):
+ define variable skipped as integer no-undo.
+ define variable num as int64 no-undo.
+
+ do while skipped lt offset:
+ num = inStream:skip(offset - skipped).
+ if num eq 0 then
+ leave.
+ skipped = skipped + num.
+ end.
+ if skipped lt 0 then
+ undo, throw new EOFException().
+ return skipped.
+
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/EOFException.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/EOFException.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/EOFException.cls 2010-09-23 18:06:14 UTC (rev 61)
@@ -0,0 +1,21 @@
+ /*------------------------------------------------------------------------
+ File : EOFException
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Wed Sep 22 19:56:09 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.AppError.
+
+class net.sourceforge.progress.io.EOFException
+ inherits net.sourceforge.progress.io.IOException:
+
+ constructor public EOFException():
+ end constructor.
+
+ constructor public EOFException ( reason as character ):
+ end constructor.
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-23 13:16:13
|
Revision: 60
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=60&view=rev
Author: medu
Date: 2010-09-23 13:16:06 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Added Input/Output Streams.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterOutputStream.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -16,6 +16,7 @@
using net.sourceforge.progress.io.InputStream.
using net.sourceforge.progress.io.IOException.
using net.sourceforge.progress.lang.IllegalArgumentException.
+using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
routine-level on error undo, throw.
@@ -79,23 +80,133 @@
end method.
method override public integer read( ):
- return super:read().
+ if buf eq ? or not valid-object(inStream) then
+ undo, throw new IOException().
+
+ /* no more buffered bytes available */
+ if pos ge count and fillBuffer() eq -1 then
+ return -1.
+
+ if count - pos gt 0 then
+ do:
+ pos = pos + 1.
+ return get-byte(buf, pos). /* no need for & 0xFF, handled by get-byte */
+ end.
+ return -1.
end method.
+
+ method override public integer read (bytes as memptr):
+ return read(bytes, 0, integer(get-size(bytes))).
+ end method.
- method override public integer read( input bytes as memptr ):
- return super:read(bytes).
- end method.
-
method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
- return super:read(bytes, offset, len).
+ define variable required as integer no-undo.
+ define variable copyLen as integer no-undo.
+ define variable read as integer no-undo.
+
+ if len eq 0 then
+ return 0.
+
+ if buf eq ? then
+ undo, throw new IOException().
+
+ if offset lt 0 or offset gt get-size(bytes) or len lt 0 or len gt get-size(bytes) - offset then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ if not valid-object(inStream) then
+ undo, throw new IOException().
+
+ if pos lt count then
+ do:
+ copyLen = minimum(count - pos, len).
+ put-bytes(bytes, offset + 1) = get-bytes(buf, pos + 1, copyLen).
+ pos = pos + copyLen.
+ if copyLen eq len or inStream:available() eq 0 then
+ return copyLen.
+
+ assign
+ offset = offset + copyLen
+ required = len - copyLen.
+ end.
+ else
+ required = len.
+
+ do while true:
+ /*
+ * If we're not marked and the required size is greater than the
+ * buffer, simply read the bytes directly bypassing the buffer.
+ */
+ if markPos eq -1 and required ge get-size(buf) then
+ do:
+ read = inStream:read(bytes, offset, required).
+ if read eq -1 then
+ return if required eq len then -1 else len - required.
+ end.
+ else
+ do:
+ if fillBuffer() eq -1 then
+ return if required eq len then -1 else len - required.
+
+ read = minimum(required, count - pos).
+ put-bytes(bytes, offset + 1) = get-bytes(buf, pos + 1, read).
+ pos = pos + read.
+ end.
+
+ required = required - read.
+ if required eq 0 then
+ return len.
+
+ if inStream:available() eq 0 then
+ return len - required.
+ offset = offset + read.
+ end.
end method.
method override public void reset( ):
- super:reset().
+ if buf eq ? then
+ undo, throw new IOException().
+ if markPos eq -1 then
+ undo, throw new IOException().
+ pos = markPos.
end method.
method override public int64 skip( input len as int64 ):
- return super:skip(len).
+ define variable read as int64 no-undo.
+
+ if len lt 1 then
+ return 0.
+
+ if buf eq ? or not valid-object(inStream) then
+ undo, throw new IOException().
+
+ if count - pos ge len then
+ do:
+ pos = pos + len.
+ return len.
+ end.
+
+ assign
+ read = count - pos
+ pos = count.
+
+ if markPos ne -1 and len le markLimit then
+ do:
+ if fillBuffer() eq -1 then
+ return read.
+
+ if count - pos gt len - read then
+ do:
+ pos = pos + len - read.
+ return len.
+ end.
+ /* Couldn't get all the bytes, skip what we read */
+ assign
+ read = read + count - pos
+ pos = count.
+ return read.
+ end.
+
+ return read + inStream:skip(len - read).
end method.
method private integer fillBuffer ():
@@ -103,7 +214,8 @@
define variable len as integer no-undo.
define variable lbuf as memptr no-undo.
- if markPos eq -1 or pos - markPos ge markLimit then do:
+ if markPos eq -1 or pos - markPos ge markLimit then
+ do:
/* Mark position not set or exceeded readlimit */
result = inStream:read(buf).
if result gt 0 then
@@ -114,7 +226,8 @@
return result.
end.
- if markPos eq 0 and markLimit gt get-size(buf) then do:
+ if markPos eq 0 and markLimit gt get-size(buf) then
+ do:
/* Increase buffer size to accommodate the readlimit */
len = minimum(markLimit, get-size(buf) * 2).
copy-lob buf to lbuf no-convert.
@@ -125,7 +238,8 @@
end.
else if markPos gt 0 then
- copy-lob buf starting at markPos + 1 for get-size(buf) - markPos to buf.
+ put-bytes(buf, 1) = get-bytes(buf, markPos + 1, get-size(buf) - markPos).
+
/* Set the new position and mark position */
assign
pos = pos - markPos
@@ -139,7 +253,7 @@
end method.
destructor public BufferedInputStream ( ):
- set-size(buf) = 0.
+ close().
end destructor.
end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedOutputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -0,0 +1,103 @@
+/*------------------------------------------------------------------------
+ File : BufferedOutputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing OutputStream and buffers the output.
+ Expensive interaction with the underlying input stream is
+ minimized, since most (smaller) requests can be satisfied
+ by accessing the buffer alone. The drawback is that some
+ extra space is required to hold the buffer and that
+ copying takes place when flushing that buffer, but this
+ is usually outweighed by the performance benefits.
+
+ Author(s) : medu
+ Created : Wed Sep 22 21:19:01 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.io.FilterOutputStream.
+using net.sourceforge.progress.io.OutputStream.
+using net.sourceforge.progress.lang.IllegalArgumentException.
+using net.sourceforge.progress.lang.NullPointerException.
+using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.BufferedOutputStream
+ inherits FilterOutputStream :
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property count as int64 no-undo
+ get.
+ set.
+
+ constructor public BufferedOutputStream ( str as OutputStream ):
+ this-object(str, 8192).
+ end constructor.
+
+ constructor public BufferedOutputStream ( str as OutputStream, size as integer ):
+ this-object(str, int64(size)).
+ end constructor.
+
+ constructor public BufferedOutputStream ( str as OutputStream, size as int64 ):
+ super(str).
+ if size le 0 then
+ undo, throw new IllegalArgumentException().
+ set-size(buf) = size.
+ end constructor.
+
+ method override public void close( ):
+ set-size(buf) = 0.
+
+ super:close().
+ end method.
+
+ method override public void flush( ):
+ internalFlush().
+ outStream:flush().
+ end method.
+
+ method override public void write (bit as integer):
+
+ if buf eq ? then
+ undo, throw new NullPointerException().
+
+ if count eq get-size(buf) then
+ internalFlush().
+
+ count = count + 1.
+ put-byte(buf, count) = bit.
+ end method.
+
+ method override public void write (bytes as memptr, offset as integer, len as integer):
+
+ if buf eq ? then
+ undo, throw new NullPointerException().
+
+ if len ge get-size(buf) then do:
+ internalFlush().
+ outStream:write(bytes, offset, len).
+ return.
+ end.
+
+ if offset lt 0 or len lt 0 or offset gt get-size(bytes) - len then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ if len ge get-size(buf) - count then
+ internalFlush().
+
+ put-bytes(buf, count) = get-bytes(bytes, offset + 1, len).
+ count = count + len.
+ end method.
+
+ method private void internalFlush( ):
+ if count gt 0 then do:
+ outStream:write(buf, 0, integer(count)).
+ count = 0.
+ end.
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayInputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -0,0 +1,108 @@
+/*------------------------------------------------------------------------
+ File : ByteArrayInputStream
+ Purpose :
+ Syntax :
+ Description : The base class for all input streams. An input stream is
+ a means of reading data from a source in a byte-wise manner.
+ Author(s) : placeholder
+ Created : Wed Sep 22 19:55:19 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
+using net.sourceforge.progress.lang.NullPointerException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.ByteArrayInputStream
+ inherits net.sourceforge.progress.io.InputStream :
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property count as integer no-undo
+ get.
+ set.
+
+ define protected property mark as integer no-undo
+ get.
+ set.
+
+ define protected property pos as integer no-undo
+ get.
+ set.
+
+ constructor public ByteArrayInputStream ( bytes as memptr ):
+ set-pointer-value(buf) = get-pointer-value(bytes).
+ count = get-size(bytes).
+ end constructor.
+
+ constructor public ByteArrayInputStream ( bytes as memptr, offset as integer, len as integer ):
+ this-object(bytes).
+ assign
+ pos = offset
+ mark = offset
+ count = minimum(count, offset + len).
+ end constructor.
+
+ method override public integer available ():
+ return count - pos.
+ end method.
+
+ method override public void mark (limit as integer):
+ mark = pos.
+ end method.
+
+ method override public logical markSupported ():
+ return true.
+ end method.
+
+ method override public integer read ():
+ if pos ge count then
+ return -1.
+ pos = pos + 1.
+ return get-byte(buf, pos).
+ end method.
+
+ method override public integer read (bytes as memptr, offset as integer, len as integer):
+ define variable copyLen as integer no-undo.
+
+ if bytes eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return 0.
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ if pos ge count then
+ return -1.
+
+ copyLen = minimum(count - pos, len).
+ put-bytes(bytes, offset + 1) = get-bytes(buf, pos + 1, copyLen).
+ pos = pos + copyLen.
+ return copyLen.
+
+ end method.
+
+ method override public void reset ():
+ pos = mark.
+ end method.
+
+ method override public int64 skip (len as int64):
+ define variable tmp as integer no-undo.
+
+ if len le 0 then
+ return 0.
+
+ assign
+ tmp = pos
+ pos = if count - pos lt len then count else integer(pos + len).
+
+ return pos - tmp.
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/ByteArrayOutputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -0,0 +1,115 @@
+/*------------------------------------------------------------------------
+ File : ByteArrayOutputStream
+ Purpose :
+ Syntax :
+ Description : The base class for all output streams. An output stream is
+ a means of writing data to a target in a byte-wise manner.
+ Author(s) : medu
+ Created : Wed Sep 22 21:19:01 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.IndexOutOfBoundsException.
+using net.sourceforge.progress.lang.IllegalArgumentException.
+using net.sourceforge.progress.io.OutputStream.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.ByteArrayOutputStream
+ inherits OutputStream :
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property count as int64 no-undo
+ get.
+ set.
+
+ define private variable bufSize as int64 no-undo.
+
+ constructor public ByteArrayOutputStream ( ):
+ this-object(32).
+ end constructor.
+
+ constructor public ByteArrayOutputStream ( size as integer ):
+ this-object(int64(size)).
+ end constructor.
+
+ constructor public ByteArrayOutputStream ( size as int64 ):
+ super().
+
+ if size lt 0 then
+ undo, throw new IllegalArgumentException().
+
+ assign
+ set-size(buf) = size
+ bufSize = size.
+ end constructor.
+
+ method override public void close( ):
+ set-size(buf) = 0.
+ buf = ?.
+ end method.
+
+ method public void reset( ):
+ count = 0.
+ end method.
+
+ method public int64 size( ):
+ return count.
+ end method.
+
+ method public memptr toByteArray( ):
+ define variable result as memptr no-undo.
+
+ set-size(result) = count.
+ put-bytes(result, 1) = get-bytes(buf, 1, count).
+ return result.
+ end method.
+
+ method override public void write (bit as integer):
+ expand(1).
+
+ count = count + 1.
+ put-byte(buf, count) = bit.
+ end method.
+
+ method override public void write (bytes as memptr, offset as integer, len as integer):
+ define variable idx as integer no-undo.
+
+ if offset lt 0 or len lt 0 or
+ offset + len gt get-size(bytes) then
+ undo, throw new IndexOutOfBoundsException().
+
+ if len eq 0 then
+ return.
+
+ expand(len).
+
+ put-bytes(buf, count + 1) = get-bytes(bytes, offset + 1, len).
+ count = count + len.
+ end method.
+
+ method public void writeTo (str as OutputStream):
+
+ if count gt 0 then
+ str:write(buf, 0, integer(count)).
+
+ end method.
+
+ method private void expand(len as integer):
+ define variable tmp as memptr no-undo.
+
+ if count + len le bufSize then
+ return.
+
+ bufSize = (count + len) * 2.
+ set-size(tmp) = bufSize.
+ put-bytes(tmp, 1) = get-bytes(buf, 1, count).
+
+ set-size(buf) = 0.
+ set-pointer-value(buf) = get-pointer-value(tmp).
+ end method.
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -16,6 +16,7 @@
Notes :
----------------------------------------------------------------------*/
using net.sourceforge.progress.io.InputStream.
+using net.sourceforge.progress.io.IOException.
routine-level on error undo, throw.
@@ -33,39 +34,75 @@
end constructor.
method override public integer available( ):
- inStream:available().
+ return inStream:available().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
method override public void close( ):
inStream:close().
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
method override public void mark( input limit as integer ):
inStream:mark(limit).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
method override public logical markSupported( ):
return inStream:markSupported().
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ return false.
+ end catch.
end method.
method override public integer read( ):
return inStream:read().
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
- method override public integer read( input bytes as memptr ):
- return inStream:read(bytes).
- end method.
-
method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
return inStream:read(bytes, offset, len).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
method override public void reset( ):
inStream:reset().
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
method override public int64 skip( input len as int64 ):
return inStream:skip(len).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
end method.
end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterOutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterOutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterOutputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -0,0 +1,66 @@
+/*------------------------------------------------------------------------
+ File : FilterOutputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing OutputStream and performs some
+ transformation on the output data while it is being
+ written.
+
+ Author(s) : medu
+ Created : Wed Sep 22 21:19:01 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.io.OutputStream.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.FilterOutputStream
+ inherits OutputStream :
+
+
+ define protected property outStream as OutputStream no-undo
+ get.
+ set.
+
+ constructor public FilterOutputStream ( str as OutputStream ):
+ outStream = str.
+ end constructor.
+
+ method override public void close( ):
+ flush().
+ outStream:close().
+ catch e as Progress.Lang.SysError:
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+ end method.
+
+ method override public void flush( ):
+ outStream:flush().
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+ end method.
+
+ method override public void write (bit as integer):
+ outStream:write(bit).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+ end method.
+
+ method override public void write (bytes as memptr, offset as integer, len as integer):
+ outStream:write(bytes, offset, len).
+
+ catch e as Progress.Lang.SysError :
+ delete object e.
+ undo, throw new IOException().
+ end catch.
+ end method.
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -11,6 +11,7 @@
using net.sourceforge.progress.io.IOException.
using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
+using net.sourceforge.progress.lang.NullPointerException.
routine-level on error undo, throw.
@@ -42,7 +43,6 @@
end method.
method public integer read ():
- undo, throw new IOException().
end method.
method public integer read (bytes as memptr):
@@ -53,10 +53,14 @@
define variable bits as integer no-undo.
define variable bit as integer no-undo.
- if offset lt 0 or offset gt get-size(bytes) then
- undo, throw new ArrayIndexOutOfBoundsException().
- if len lt 0 or len gt get-size(bytes) - offset then
- undo, throw new ArrayIndexOutOfBoundsException().
+ if bytes eq ? then
+ undo, throw new NullPointerException().
+
+ if len eq 0 then
+ return 0.
+
+ if offset lt 0 or len lt 0 or offset + len gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
do bits = 1 to len
on error undo, leave:
@@ -79,7 +83,6 @@
end method.
method public void reset ():
- undo, throw new IOException().
end method.
method public int64 skip (len as int64):
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls 2010-09-23 13:16:06 UTC (rev 60)
@@ -33,7 +33,6 @@
end method.
method public void write (bit as integer):
- undo, throw new IOException().
end method.
method public void write (bytes as memptr):
@@ -44,13 +43,12 @@
define variable idx as integer no-undo.
if offset lt 0 or len lt 0 or
- offset gt get-size(bytes) or len gt get-size(bytes) - offset then
+ offset + len gt get-size(bytes) then
undo, throw new IndexOutOfBoundsException().
do idx = 1 to len:
this-object:write(get-byte(bytes, offset + idx)).
end.
end method.
-
end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-22 19:28:08
|
Revision: 59
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=59&view=rev
Author: medu
Date: 2010-09-22 19:28:02 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
Added InputStream, BufferedInputStream, OutputStream.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Arrays.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/BitWise.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/MessageProperty.cls
net.sourceforge.progress.jms/src/java/io/Closeable.cls
net.sourceforge.progress.jms/src/java/io/Flushable.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/IOException.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
Added: net.sourceforge.progress.jms/src/MessageProperty.cls
===================================================================
--- net.sourceforge.progress.jms/src/MessageProperty.cls (rev 0)
+++ net.sourceforge.progress.jms/src/MessageProperty.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,21 @@
+
+ /*------------------------------------------------------------------------
+ File : MessageProperty
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : placeholder
+ Created : Tue Sep 21 21:27:18 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+USING Progress.Lang.*.
+USING net.sourceforge.progress.jms.Message.
+
+
+
+CLASS MessageProperty INHERITS Message :
+
+
+
+END CLASS.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/Closeable.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/Closeable.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/Closeable.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,17 @@
+/*------------------------------------------------------------------------
+ File : Closeable
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that can (or need to)
+ be closed once they are not used any longer.
+ Author(s) : medu
+ Created : Wed Sep 22 19:56:09 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+
+interface java.io.Closeable:
+
+ method public void close().
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/Flushable.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/Flushable.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/Flushable.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,19 @@
+/*------------------------------------------------------------------------
+ File : Flushable
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that can (or need to)
+ be flushed, typically before some output processing is
+ considered to be finished and the object gets closed.
+ Author(s) : medu
+ Created : Wed Sep 22 21:19:43 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.*.
+
+interface java.io.Flushable:
+
+ method public void flush().
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/BufferedInputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,145 @@
+/*------------------------------------------------------------------------
+ File : BufferedInputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing InputStream and buffers the input.
+ Expensive interaction with the underlying input stream is
+ minimized, since most (smaller) requests can be satisfied
+ by accessing the buffer alone. The drawback is that some
+ extra space is required to hold the buffer and that
+ copying takes place when filling that buffer, but this is
+ usually outweighed by the performance benefits.
+ Author(s) : medu
+ Created : Wed Sep 22 21:36:14 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.InputStream.
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.IllegalArgumentException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.BufferedInputStream
+ inherits net.sourceforge.progress.io.FilterInputStream
+ implements java.io.Closeable :
+
+ define protected property buf as memptr no-undo
+ get.
+ set.
+
+ define protected property count as integer no-undo
+ get.
+ set.
+
+ define protected property markLimit as integer no-undo
+ get.
+ set.
+
+ define protected property markPos as integer no-undo initial -1
+ get.
+ set.
+
+ define protected property pos as integer no-undo
+ get.
+ set.
+
+ constructor public BufferedInputStream ( str as InputStream ):
+ super(str).
+ set-size(buf) = 8192.
+ end constructor.
+
+ constructor public BufferedInputStream ( str as InputStream, size as integer ):
+ super(str).
+ if size le 0 then
+ undo, throw new IllegalArgumentException().
+ set-size(buf) = size.
+ end constructor.
+
+ method override public integer available( ):
+ if buf eq ? or not valid-object(inStream) then
+ undo, throw new IOException().
+ return count - pos + inStream:available().
+ end method.
+
+ method override public void close( ):
+ set-size(buf) = 0.
+ if valid-object(inStream) then
+ inStream:close().
+ inStream = ?.
+ end method.
+
+ method override public void mark( input limit as integer ):
+ assign
+ markLimit = limit
+ markPos = pos.
+ end method.
+
+ method override public logical markSupported( ):
+ return true.
+ end method.
+
+ method override public integer read( ):
+ return super:read().
+ end method.
+
+ method override public integer read( input bytes as memptr ):
+ return super:read(bytes).
+ end method.
+
+ method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
+ return super:read(bytes, offset, len).
+ end method.
+
+ method override public void reset( ):
+ super:reset().
+ end method.
+
+ method override public int64 skip( input len as int64 ):
+ return super:skip(len).
+ end method.
+
+ method private integer fillBuffer ():
+ define variable result as integer no-undo.
+ define variable len as integer no-undo.
+ define variable lbuf as memptr no-undo.
+
+ if markPos eq -1 or pos - markPos ge markLimit then do:
+ /* Mark position not set or exceeded readlimit */
+ result = inStream:read(buf).
+ if result gt 0 then
+ assign
+ markPos = -1
+ pos = 0
+ count = result.
+ return result.
+ end.
+
+ if markPos eq 0 and markLimit gt get-size(buf) then do:
+ /* Increase buffer size to accommodate the readlimit */
+ len = minimum(markLimit, get-size(buf) * 2).
+ copy-lob buf to lbuf no-convert.
+ set-size(buf) = 0.
+ set-size(buf) = len.
+ copy-lob lbuf to buf no-convert.
+ set-size(lbuf) = 0.
+
+ end.
+ else if markPos gt 0 then
+ copy-lob buf starting at markPos + 1 for get-size(buf) - markPos to buf.
+ /* Set the new position and mark position */
+ assign
+ pos = pos - markPos
+ count = 0
+ markPos = 0.
+
+ result = inStream:read(buf, pos, integer(get-size(buf) - pos)).
+ count = if result le 0 then pos else pos + result.
+
+ return result.
+ end method.
+
+ destructor public BufferedInputStream ( ):
+ set-size(buf) = 0.
+ end destructor.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/FilterInputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,71 @@
+/*------------------------------------------------------------------------
+ File : FilterInputStream
+ Purpose :
+ Syntax :
+ Description : Wraps an existing InputStream and performs some
+ transformation on the input data while it is being read.
+ Transformations can be anything from a simple byte-wise
+ filtering input data to an on-the-fly compression or
+ decompression of the underlying stream. Input streams
+ that wrap another input stream and provide some
+ additional functionality on top of it usually inherit
+ from this class.
+
+ Author(s) : medu
+ Created : Wed Sep 22 21:43:47 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.InputStream.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.FilterInputStream
+ inherits InputStream
+ implements java.io.Closeable :
+
+ define protected property inStream as InputStream no-undo
+ get.
+ set.
+
+ constructor public FilterInputStream ( str as InputStream ):
+ super().
+ inStream = str.
+ end constructor.
+
+ method override public integer available( ):
+ inStream:available().
+ end method.
+
+ method override public void close( ):
+ inStream:close().
+ end method.
+
+ method override public void mark( input limit as integer ):
+ inStream:mark(limit).
+ end method.
+
+ method override public logical markSupported( ):
+ return inStream:markSupported().
+ end method.
+
+ method override public integer read( ):
+ return inStream:read().
+ end method.
+
+ method override public integer read( input bytes as memptr ):
+ return inStream:read(bytes).
+ end method.
+
+ method override public integer read( input bytes as memptr, input offset as integer, input len as integer ):
+ return inStream:read(bytes, offset, len).
+ end method.
+
+ method override public void reset( ):
+ inStream:reset().
+ end method.
+
+ method override public int64 skip( input len as int64 ):
+ return inStream:skip(len).
+ end method.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/IOException.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/IOException.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/IOException.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,22 @@
+ /*------------------------------------------------------------------------
+ File : IOException
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Wed Sep 22 19:56:09 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.AppError.
+
+class net.sourceforge.progress.io.IOException
+ inherits AppError:
+
+ constructor public IOException():
+ end constructor.
+
+ constructor public IOException ( reason as character ):
+ ReturnValue = reason.
+ end constructor.
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/InputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,119 @@
+ /*------------------------------------------------------------------------
+ File : InputStream
+ Purpose :
+ Syntax :
+ Description : The base class for all input streams. An input stream is
+ a means of reading data from a source in a byte-wise manner.
+ Author(s) : placeholder
+ Created : Wed Sep 22 19:55:19 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.ArrayIndexOutOfBoundsException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.InputStream
+ implements java.io.Closeable:
+
+ define protected static variable skipBuffer_ as memptr no-undo.
+
+ constructor public InputStream ( ):
+ end constructor.
+
+ destructor public InputStream ( ):
+ set-size(skipBuffer_) = 0.
+ end destructor.
+
+ method public integer available ():
+ return 0.
+ end method.
+
+ method public void close():
+ set-size(skipBuffer_) = 0.
+ end method.
+
+ method public void mark (limit as integer):
+ end method.
+
+ method public logical markSupported ():
+ return false.
+ end method.
+
+ method public integer read ():
+ undo, throw new IOException().
+ end method.
+
+ method public integer read (bytes as memptr):
+ return read(bytes, 0, integer(get-size(bytes))).
+ end method.
+
+ method public integer read (bytes as memptr, offset as integer, len as integer):
+ define variable bits as integer no-undo.
+ define variable bit as integer no-undo.
+
+ if offset lt 0 or offset gt get-size(bytes) then
+ undo, throw new ArrayIndexOutOfBoundsException().
+ if len lt 0 or len gt get-size(bytes) - offset then
+ undo, throw new ArrayIndexOutOfBoundsException().
+
+ do bits = 1 to len
+ on error undo, leave:
+ bit = read().
+ if bit eq -1 then
+ return if bits eq 0 then -1 else bits.
+
+ put-byte(bytes, offset + bits) = bit.
+
+ catch e as Progress.Lang.Error :
+ if bits gt 0 then do:
+ delete object e.
+ return bits.
+ end.
+ undo, throw e.
+ end catch.
+
+ end.
+ return len.
+ end method.
+
+ method public void reset ():
+ undo, throw new IOException().
+ end method.
+
+ method public int64 skip (len as int64):
+ define variable skiped as integer no-undo.
+ define variable read as integer no-undo.
+ define variable bufLen as integer no-undo.
+
+ if len le 0 then
+ return 0.
+
+ bufLen = minimum(len, 4096).
+ setSkipBuffer(bufLen).
+
+ do while skiped lt len:
+ read = read(skipBuffer_, 0, bufLen).
+ if read eq -1 then
+ return skiped.
+ skiped = skiped + read.
+
+ if read lt bufLen then
+ return skiped.
+
+ if len - skiped lt bufLen then
+ bufLen = integer(len - skiped).
+ end.
+ return skiped.
+ end method.
+
+ method protected static void setSkipBuffer (len as integer):
+ if get-size(skipBuffer_) ge len then
+ return.
+
+ set-size(skipBuffer_) = 0.
+ set-size(skipBuffer_) = len.
+ end.
+
+end class.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/OutputStream.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -0,0 +1,56 @@
+/*------------------------------------------------------------------------
+ File : OutputStream
+ Purpose :
+ Syntax :
+ Description : The base class for all output streams. An output stream is
+ a means of writing data to a target in a byte-wise manner.
+ Author(s) : medu
+ Created : Wed Sep 22 21:19:01 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.io.IOException.
+using net.sourceforge.progress.lang.IndexOutOfBoundsException.
+
+routine-level on error undo, throw.
+
+class net.sourceforge.progress.io.OutputStream
+ implements java.io.Closeable, java.io.Flushable :
+
+
+ constructor public OutputStream ( ):
+ end constructor.
+
+
+ method public logical checkError ():
+ return false.
+ end method.
+
+ method public void close( ):
+ end method.
+
+
+ method public void flush( ):
+ end method.
+
+ method public void write (bit as integer):
+ undo, throw new IOException().
+ end method.
+
+ method public void write (bytes as memptr):
+ this-object:write(bytes, 0, integer(get-size(bytes))).
+ end method.
+
+ method public void write (bytes as memptr, offset as integer, len as integer):
+ define variable idx as integer no-undo.
+
+ if offset lt 0 or len lt 0 or
+ offset gt get-size(bytes) or len gt get-size(bytes) - offset then
+ undo, throw new IndexOutOfBoundsException().
+
+ do idx = 1 to len:
+ this-object:write(get-byte(bytes, offset + idx)).
+ end.
+ end method.
+
+
+end class.
\ No newline at end of file
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Arrays.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Arrays.cls 2010-09-22 14:58:55 UTC (rev 58)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Arrays.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -18,6 +18,8 @@
using net.sourceforge.progress.lang.IndexOutOfBoundsException.
using net.sourceforge.progress.lang.NullPointerException.
+routine-level on error undo, throw.
+
class net.sourceforge.progress.lang.Arrays use-widget-pool final :
method static public void fill (arr as Object extent, fromIdx as integer, toIdx as integer, obj as Object):
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/BitWise.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/BitWise.cls 2010-09-22 14:58:55 UTC (rev 58)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/BitWise.cls 2010-09-22 19:28:02 UTC (rev 59)
@@ -11,6 +11,8 @@
using net.sourceforge.progress.lang.BitWise.
using net.sourceforge.progress.lang.NullPointerException.
+routine-level on error undo, throw.
+
class net.sourceforge.progress.lang.BitWise final :
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-22 14:59:01
|
Revision: 58
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=58&view=rev
Author: medu
Date: 2010-09-22 14:58:55 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-22 14:03:55 UTC (rev 57)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-22 14:58:55 UTC (rev 58)
@@ -16,8 +16,10 @@
class net.sourceforge.progress.jms.Message implements javax.jms.Message :
- define static public property DEFAULT_DELIVERY_MODE as integer no-undo initial 2
- get.
+ define static public property DEFAULT_DELIVERY_MODE as integer no-undo
+ get:
+ return javax.jms.DeliveryMode:PERSISTENT.
+ end get.
define static public property DEFAULT_PRIORITY as integer no-undo initial 4
get.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-22 14:04:02
|
Revision: 57
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=57&view=rev
Author: medu
Date: 2010-09-22 14:03:55 +0000 (Wed, 22 Sep 2010)
Log Message:
-----------
Added interfaces for base IO objects.
Added Paths:
-----------
net.sourceforge.progress.jms/src/java/io/DataInput.cls
net.sourceforge.progress.jms/src/java/io/DataOutput.cls
net.sourceforge.progress.jms/src/java/io/Externalizable.cls
net.sourceforge.progress.jms/src/java/io/ObjectInput.cls
net.sourceforge.progress.jms/src/java/io/ObjectOutput.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInput.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutput.cls
Added: net.sourceforge.progress.jms/src/java/io/DataInput.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/DataInput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/DataInput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,46 @@
+/*------------------------------------------------------------------------
+ File : DataInput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that are able to read
+ typed data from some source. Typically, this data has
+ been written by a class which implements DataOutput .
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface java.io.DataInput:
+
+ method public logical readBoolean().
+
+ method public integer readByte().
+
+ method public void readFully(val as memptr).
+
+ method public void readFully(val as memptr, offset as integer, len as integer).
+
+ method public character readChar().
+
+ method public decimal readDouble().
+
+ method public decimal readFloat().
+
+ method public integer readInt().
+
+ method public String readLine().
+
+ method public int64 readLong().
+
+ method public integer readShort().
+
+ method public integer readUnsignedByte().
+
+ method public integer readUnsignedShort().
+
+ method public String readUTF().
+
+ method public integer skipBytes(offset as integer).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/DataOutput.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/DataOutput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/DataOutput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,44 @@
+/*------------------------------------------------------------------------
+ File : DataOutput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that are able to write
+ typed data to some target. Typically, this data can be
+ read in by a class which implements DataInput.
+
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface java.io.DataOutput:
+
+ method public void write(val as integer).
+
+ method public void write(val as memptr).
+
+ method public void write(val as memptr, offset as integer, length as integer).
+
+ method public void writeBoolean(val as logical).
+
+ method public void writeByte(val as integer).
+
+ method public void writeBytes(val as String).
+
+ method public void writeChar(val as character).
+
+ method public void writeChars(val as String).
+
+ method public void writeDouble(val as decimal).
+
+ method public void writeFloat(val as decimal).
+
+ method public void writeInt(val as integer).
+
+ method public void writeLong(val as int64).
+
+ method public void writeShort(val as integer).
+
+ method public void writeUTF(val as String).
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/Externalizable.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/Externalizable.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/Externalizable.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,18 @@
+/*------------------------------------------------------------------------
+ File : Externalizable
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that want to be
+ serializable, but have their own binary representation.
+ Author(s) : medu
+ Created : Tue Sep 21 21:39:47 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+interface java.io.Externalizable:
+
+ method public void readExternal(objIn as java.io.ObjectInput).
+
+ method public void writeExternal(objOut as java.io.ObjectOutput).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/ObjectInput.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/ObjectInput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/ObjectInput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,57 @@
+/*------------------------------------------------------------------------
+ File : ObjectInput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that allow reading
+ serialized objects.
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface java.io.ObjectInput:
+
+ method public integer available().
+
+ method public void close().
+
+ method public integer read().
+
+ method public integer read(val as memptr).
+
+ method public integer read(val as memptr, offset as integer, len as integer).
+
+ method public logical readBoolean().
+
+ method public integer readByte().
+
+ method public void readFully(val as memptr).
+
+ method public void readFully(val as memptr, offset as integer, len as integer).
+
+ method public character readChar().
+
+ method public decimal readDouble().
+
+ method public decimal readFloat().
+
+ method public integer readInt().
+
+ method public String readLine().
+
+ method public int64 readLong().
+
+ method public integer readShort().
+
+ method public integer readUnsignedByte().
+
+ method public integer readUnsignedShort().
+
+ method public String readUTF().
+
+ method public integer skipBytes(offset as integer).
+
+ method public int64 skip(offset as int64).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/java/io/ObjectOutput.cls
===================================================================
--- net.sourceforge.progress.jms/src/java/io/ObjectOutput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/java/io/ObjectOutput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,49 @@
+/*------------------------------------------------------------------------
+ File : ObjectOutput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that allow reading
+ serialized objects.
+
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface java.io.ObjectOutput:
+
+ method public void close().
+
+ method public void flush().
+
+ method public void writeObject (val as Progress.Lang.Object).
+
+ method public void write(val as integer).
+
+ method public void write(val as memptr).
+
+ method public void write(val as memptr, offset as integer, length as integer).
+
+ method public void writeBoolean(val as logical).
+
+ method public void writeByte(val as integer).
+
+ method public void writeBytes(val as String).
+
+ method public void writeChar(val as character).
+
+ method public void writeChars(val as String).
+
+ method public void writeDouble(val as decimal).
+
+ method public void writeFloat(val as decimal).
+
+ method public void writeInt(val as integer).
+
+ method public void writeLong(val as int64).
+
+ method public void writeShort(val as integer).
+
+ method public void writeUTF(val as String).
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInput.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataInput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,50 @@
+/*------------------------------------------------------------------------
+ File : DataInput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that are able to read
+ typed data from some source. Typically, this data has
+ been written by a class which implements DataOutput .
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface net.sourceforge.progress.io.DataInput:
+
+ method public logical readBoolean().
+
+ method public integer readByte().
+
+ method public void readFully(val as memptr).
+
+ method public void readFully(val as memptr, offset as integer, len as integer).
+
+ method public character readChar().
+
+ method public decimal readDouble().
+
+ method public decimal readFloat().
+
+ method public integer readInt().
+
+ method public String readLine().
+
+ method public character readLineChars().
+
+ method public int64 readLong().
+
+ method public integer readShort().
+
+ method public integer readUnsignedByte().
+
+ method public integer readUnsignedShort().
+
+ method public String readUTF().
+
+ method public longchar readUTFChars().
+
+ method public integer skipBytes(offset as integer).
+
+end interface.
\ No newline at end of file
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutput.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutput.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/io/DataOutput.cls 2010-09-22 14:03:55 UTC (rev 57)
@@ -0,0 +1,52 @@
+/*------------------------------------------------------------------------
+ File : DataOutput
+ Purpose :
+ Syntax :
+ Description : Defines an interface for classes that are able to write
+ typed data to some target. Typically, this data can be
+ read in by a class which implements DataInput.
+
+ Author(s) : medu
+ Created : Tue Sep 21 20:31:04 EET 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using java.lang.String.
+
+interface net.sourceforge.progress.io.DataOutput:
+
+ method public void write(val as integer).
+
+ method public void write(val as memptr).
+
+ method public void write(val as memptr, offset as integer, length as integer).
+
+ method public void writeBoolean(val as logical).
+
+ method public void writeByte(val as integer).
+
+ method public void writeBytes(val as String).
+
+ method public void writeChar(val as character).
+
+ method public void writeChars(val as String).
+
+ method public void writeChars (val as character).
+
+ method public void writeChars (val as longchar).
+
+ method public void writeDouble(val as decimal).
+
+ method public void writeFloat(val as decimal).
+
+ method public void writeInt(val as integer).
+
+ method public void writeLong(val as int64).
+
+ method public void writeShort(val as integer).
+
+ method public void writeUTF(val as String).
+
+ method public void writeUTF(val as character).
+
+ method public void writeUTF(val as longchar).
+end interface.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-21 18:32:59
|
Revision: 56
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=56&view=rev
Author: medu
Date: 2010-09-21 18:32:52 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Add protected constructor to facilitate unit testing.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p
Added Paths:
-----------
net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/MessageUnitTest.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-21 18:16:11 UTC (rev 55)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-21 18:32:52 UTC (rev 56)
@@ -114,8 +114,9 @@
delete object objectArr_ no-error.
end destructor.
- constructor public Message():
- end .
+ /* for unit testing only */
+ constructor protected Message():
+ end.
constructor public Message(msgSession as Session, received as logical):
if not valid-object(msgSession) then
@@ -369,7 +370,7 @@
checkWritable().
- o = propertyMap:put(name, new Integer(val)).
+ o = propertyMap:put(name, new integer(val)).
if valid-object(o) and not objectArr:contains(o) then
delete object o.
Modified: net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p
===================================================================
--- net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p 2010-09-21 18:16:11 UTC (rev 55)
+++ net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p 2010-09-21 18:32:52 UTC (rev 56)
@@ -10,15 +10,15 @@
Created : Mon Sep 20 20:19:36 EEST 2010
Notes :
----------------------------------------------------------------------*/
-using net.sourceforge.progress.jms.Message.
+using net.sourceforge.progress.jms.MessageUnitTest.
define input parameter o as Progress.Lang.Object no-undo.
define output parameter ret as logical no-undo.
-define variable msg as Message no-undo.
+define variable msg as MessageUnitTest no-undo.
define variable idx as integer no-undo.
-msg = new Message().
+msg = new MessageUnitTest().
msg:setIntProperty('int', 3).
msg:setLongProperty('long', 3).
@@ -27,11 +27,11 @@
msg:setBooleanProperty('boolean', true).
msg:setObjectProperty('object', o).
-ret = msg:getIntProperty('int') eq 3 and
- msg:getLongProperty('long') = 3 and
- msg:getFloatProperty('float') = 3.5 and
- msg:getDoubleProperty('double') = 3.6 and
- msg:getBooleanProperty('boolean') = true and
- msg:getObjectProperty('object') = o.
-
+ret = msg:getIntProperty('int') eq 3 and
+ msg:getLongProperty('long') eq 3 and
+ msg:getFloatProperty('float') eq 3.5 and
+ msg:getDoubleProperty('double') eq 3.6 and
+ msg:getBooleanProperty('boolean') eq true and
+ msg:getObjectProperty('object') eq o.
+
delete object msg.
\ No newline at end of file
Added: net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/MessageUnitTest.cls
===================================================================
--- net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/MessageUnitTest.cls (rev 0)
+++ net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/MessageUnitTest.cls 2010-09-21 18:32:52 UTC (rev 56)
@@ -0,0 +1,16 @@
+ /*------------------------------------------------------------------------
+ File : MessageUnitTest
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Tue Sep 21 21:28:52 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using net.sourceforge.progress.jms.Message.
+
+class net.sourceforge.progress.jms.MessageUnitTest inherits Message final :
+
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-21 18:16:18
|
Revision: 55
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=55&view=rev
Author: medu
Date: 2010-09-21 18:16:11 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Added number base class and basic get value methods for numbers classes.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Double.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Integer.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Long.cls
Added Paths:
-----------
net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Number.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Double.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Double.cls 2010-09-21 13:30:22 UTC (rev 54)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Double.cls 2010-09-21 18:16:11 UTC (rev 55)
@@ -18,7 +18,7 @@
using net.sourceforge.progress.lang.NumberFormatException.
class net.sourceforge.progress.lang.Double
- inherits net.sourceforge.progress.lang.Object
+ inherits net.sourceforge.progress.lang.Number
implements Double, Number:
define private variable internNumber as decimal no-undo.
@@ -35,7 +35,7 @@
end constructor.
- method public memptr byteValue( ):
+ method override public memptr byteValue( ):
define variable m as memptr no-undo.
assign
@@ -45,19 +45,15 @@
return m.
end method.
- method public decimal doubleValue( ):
+ method override public decimal doubleValue( ):
return internNumber.
end method.
- method public decimal floatValue( ):
- return internNumber.
- end method.
-
- method public integer intValue( ):
+ method override public integer intValue( ):
return integer(round(internNumber, 0)).
end method.
- method public int64 longValue( ):
+ method override public int64 longValue( ):
undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
end method.
@@ -74,11 +70,6 @@
internNumber = val.
end method.
-
- method public integer shortValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
- end method.
-
method override public logical equals (obj as Progress.Lang.Object):
if valid-object(obj) and
type-of(obj, 'java.lang.Double':u) then
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Integer.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Integer.cls 2010-09-21 13:30:22 UTC (rev 54)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Integer.cls 2010-09-21 18:16:11 UTC (rev 55)
@@ -19,7 +19,7 @@
routine-level on error undo, throw.
class net.sourceforge.progress.lang.Integer
- inherits net.sourceforge.progress.lang.Object
+ inherits net.sourceforge.progress.lang.Number
implements java.lang.Integer, java.lang.Number:
define static public property MIN_VALUE as integer no-undo initial ?
@@ -75,7 +75,7 @@
internNumber = parseInt(val).
end constructor.
- method public memptr byteValue( ):
+ method override public memptr byteValue( ):
define variable m as memptr no-undo.
assign
@@ -85,24 +85,19 @@
return m.
end method.
- method public decimal doubleValue( ):
+ method override public decimal doubleValue( ):
return decimal(internNumber).
end method.
- method public decimal floatValue( ):
- return decimal(internNumber).
- end method.
-
method override public integer hashCode( ):
return internNumber.
end method.
-
- method public integer intValue( ):
+ method override public integer intValue( ):
return internNumber.
end method.
- method public int64 longValue( ):
+ method override public int64 longValue( ):
return internNumber.
end method.
@@ -173,10 +168,6 @@
internNumber = val no-error.
end method.
- method public integer shortValue( ):
- return internNumber.
- end method.
-
method override public logical equals (obj as Progress.Lang.Object):
if valid-object(obj) and
type-of(obj, 'java.lang.Integer':u) then
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Long.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Long.cls 2010-09-21 13:30:22 UTC (rev 54)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Long.cls 2010-09-21 18:16:11 UTC (rev 55)
@@ -20,24 +20,38 @@
routine-level on error undo, throw.
class net.sourceforge.progress.lang.Long
- inherits net.sourceforge.progress.lang.Object
+ inherits net.sourceforge.progress.lang.Number
implements Long, Number:
define private variable internNumber as int64 no-undo.
-
constructor public Long ( val as int64 ):
internNumber = val.
end constructor.
+ constructor public Long ( val as integer ):
+ internNumber = val.
+ end constructor.
+
constructor public Long ( val as character ):
- internNumber = int64(val) no-error.
- if error-status:error or error-status:num-messages gt 0 then
- undo, throw new NumberFormatException ('The string does not contain a parsable number.':u).
+ internNumber = int64(val).
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new NumberFormatException ('The string does not contain a parsable number.':u).
+ end catch.
end constructor.
+
+ constructor public Long ( val as longchar ):
+ internNumber = int64(val).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new NumberFormatException ('The string does not contain a parsable number.':u).
+ end catch.
+ end constructor.
- method public memptr byteValue( ):
+ method override public memptr byteValue( ):
define variable m as memptr no-undo.
assign
@@ -47,22 +61,28 @@
return m.
end method.
- method public decimal doubleValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method override public decimal doubleValue( ):
+ return decimal(internNumber).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ return ?.
+ end catch.
end method.
- method public decimal floatValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method override public integer intValue( ):
+ return integer(internNumber).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ return ?.
+ end catch.
end method.
- method public integer intValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ method override public int64 longValue( ):
+ return internNumber.
end method.
- method public int64 longValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
- end method.
-
method public void setValue( input val as integer ):
internNumber = val.
end method.
@@ -72,10 +92,6 @@
end method.
- method public integer shortValue( ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
- end method.
-
method override public logical equals (obj as Progress.Lang.Object):
if valid-object(obj) and
type-of(obj, 'java.lang.Long':u) then
Added: net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Number.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Number.cls (rev 0)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/lang/Number.cls 2010-09-21 18:16:11 UTC (rev 55)
@@ -0,0 +1,45 @@
+ /*------------------------------------------------------------------------
+ File : Number
+ Purpose :
+ Syntax :
+ Description :
+ Author(s) : medu
+ Created : Tue Sep 21 21:06:04 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+
+using Progress.Lang.*.
+using java.lang.Number.
+using net.sourceforge.progress.lang.Object.
+
+
+class net.sourceforge.progress.lang.Number inherits Object implements Number :
+
+ constructor protected Number ( ):
+ end constructor.
+
+ method public memptr byteValue( ):
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ end method.
+
+ method public decimal doubleValue( ):
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ end method.
+
+ method public decimal floatValue( ):
+ return doubleValue().
+ end method.
+
+ method public integer intValue( ):
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ end method.
+
+ method public int64 longValue( ):
+ undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ end method.
+
+ method public integer shortValue( ):
+ return intValue().
+ end method.
+
+end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-21 13:30:33
|
Revision: 54
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=54&view=rev
Author: medu
Date: 2010-09-21 13:30:22 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Added test procedure for JMS.Message implementation.
Added Paths:
-----------
net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/
net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p
Added: net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p
===================================================================
--- net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p (rev 0)
+++ net.sourceforge.progress.jms/test/net/sourceforge/progress/jms/Message.p 2010-09-21 13:30:22 UTC (rev 54)
@@ -0,0 +1,37 @@
+/*------------------------------------------------------------------------
+ File : Message.p
+ Purpose :
+
+ Syntax : Message.p (obj, OUTPUT ret).
+
+ Description : Test for Message.
+
+ Author(s) : Marian
+ Created : Mon Sep 20 20:19:36 EEST 2010
+ Notes :
+ ----------------------------------------------------------------------*/
+using net.sourceforge.progress.jms.Message.
+
+define input parameter o as Progress.Lang.Object no-undo.
+define output parameter ret as logical no-undo.
+
+define variable msg as Message no-undo.
+define variable idx as integer no-undo.
+
+msg = new Message().
+
+msg:setIntProperty('int', 3).
+msg:setLongProperty('long', 3).
+msg:setFloatProperty('float', 3.5).
+msg:setDoubleProperty('double', 3.6).
+msg:setBooleanProperty('boolean', true).
+msg:setObjectProperty('object', o).
+
+ret = msg:getIntProperty('int') eq 3 and
+ msg:getLongProperty('long') = 3 and
+ msg:getFloatProperty('float') = 3.5 and
+ msg:getDoubleProperty('double') = 3.6 and
+ msg:getBooleanProperty('boolean') = true and
+ msg:getObjectProperty('object') = o.
+
+delete object msg.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-21 13:29:33
|
Revision: 53
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=53&view=rev
Author: medu
Date: 2010-09-21 13:29:23 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Complete Message implementation using StringHashMap for properties.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/JMSException.cls
net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/JMSException.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/JMSException.cls 2010-09-21 13:28:28 UTC (rev 52)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/JMSException.cls 2010-09-21 13:29:23 UTC (rev 53)
@@ -15,7 +15,6 @@
define private variable exceptionError as Progress.Lang.Error no-undo.
constructor public JMSException ( ):
- this-object(?, ?).
end constructor.
constructor public JMSException ( reason as character ):
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-21 13:28:28 UTC (rev 52)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/jms/Message.cls 2010-09-21 13:29:23 UTC (rev 53)
@@ -11,7 +11,8 @@
using net.sourceforge.progress.jms.*.
using java.util.Iterator.
using net.sourceforge.progress.lang.*.
-using net.sourceforge.progress.util.HashMap.
+using net.sourceforge.progress.util.StringHashMap.
+using net.sourceforge.progress.util.ArrayList.
class net.sourceforge.progress.jms.Message implements javax.jms.Message :
@@ -88,36 +89,33 @@
define private variable readOnlyProperties as logical no-undo.
- define private variable propertyMap_ as HashMap no-undo.
+ define private variable propertyMap_ as StringHashMap no-undo.
- define private property propertyMap as HashMap no-undo
+ define private property propertyMap as StringHashMap no-undo
get:
if not valid-object(propertyMap_) then
- propertyMap_ = new HashMap().
+ propertyMap_ = new StringHashMap().
return propertyMap_.
end get.
- define private variable objectMap_ as HashMap no-undo.
+ define private variable objectArr_ as ArrayList no-undo.
- define private property objectMap as HashMap no-undo
+ define private property objectArr as ArrayList no-undo
get:
- if not valid-object(objectMap_) then
- objectMap_ = new HashMap().
- return objectMap_.
+ if not valid-object(objectArr_) then
+ objectArr_ = new ArrayList().
+ return objectArr_.
end get.
destructor Message():
- if valid-object(propertyMap_) then
- do:
- propertyMap_:delete().
- delete object propertyMap_.
- end.
- if valid-object(objectMap_) then
- do:
- objectMap_:deleteKeys().
- delete object objectMap_.
- end.
+ clearProperties().
+
+ delete object propertyMap_ no-error.
+ delete object objectArr_ no-error.
end destructor.
+
+ constructor public Message():
+ end .
constructor public Message(msgSession as Session, received as logical):
if not valid-object(msgSession) then
@@ -138,57 +136,74 @@
method public void clearProperties( ):
if valid-object(propertyMap_) then
propertyMap_:delete().
- if valid-object(objectMap_) then
- objectMap_:deleteKeys().
+ if valid-object(objectArr_) then
+ objectArr_:clear().
end method.
method public logical getBooleanProperty( input name as character ):
- define variable s as String no-undo.
define variable p as Progress.Lang.Object no-undo.
- if valid-object(propertyMap_) and propertyMap_:size() gt 0 then
- do:
- s = new String(name).
- p = propertyMap_:get(s).
- delete object s.
+ p = propertyMap_:get(name).
+ if type-of(p, 'Boolean':u) then
+ return cast(p, 'Boolean':u):booleanValue().
+ else
+ undo, throw new MessageFormatException().
- if valid-object(p) then
- do:
- if type-of(p, 'Boolean':u) then
- return cast(p, 'Boolean':u):booleanValue().
- else
- undo, throw new MessageFormatException().
- end.
- end.
- undo, throw new JMSException().
-
- finally:
- delete object s no-error.
- delete object p no-error.
- end finally.
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public memptr getByteProperty( input name as character ):
+ define variable p as Progress.Lang.Object no-undo.
+ p = propertyMap_:get(name).
+ if type-of(p, 'Byte':u) then
+ return cast(p, 'Byte':u):byteValue().
+ else
+ undo, throw new MessageFormatException().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public decimal getDoubleProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ define variable p as Progress.Lang.Object no-undo.
+ p = propertyMap_:get(name).
+ if type-of(p, 'Double':u) then
+ return cast(p, 'Double':u):doubleValue().
+ else
+ undo, throw new MessageFormatException().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public decimal getFloatProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ return getDoubleProperty(name).
end method.
method public integer getIntProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ define variable p as Progress.Lang.Object no-undo.
+ p = propertyMap_:get(name).
+ if type-of(p, 'Integer':u) then
+ return cast(p, 'Integer':u):intValue().
+ else
+ undo, throw new MessageFormatException().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
+
end method.
method public character getJMSCorrelationID( ):
@@ -241,103 +256,127 @@
end method.
method public int64 getLongProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ define variable p as Progress.Lang.Object no-undo.
+ p = propertyMap_:get(name).
+ if type-of(p, 'Long':u) then
+ return cast(p, 'Long':u):longValue().
+ else
+ undo, throw new MessageFormatException().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
-
-
method public Progress.Lang.Object getObjectProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
+ return propertyMap_:get(name).
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
-
method public java.util.Iterator getPropertyNames( ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ return propertyMap_:keySet():iterator().
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public integer getShortProperty( input name as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ return getIntProperty(name).
end method.
method public character getStringProperty( input name as character ):
- define variable s as String no-undo.
define variable p as Progress.Lang.Object no-undo.
+
+ p = propertyMap_:get(name).
+ if type-of(p, 'String':u) then
+ return cast(p, 'String':u):toString().
+ else
+ undo, throw new MessageFormatException().
- if valid-object(propertyMap_) and propertyMap_:size() gt 0 then
- do:
- s = new String(name).
- p = propertyMap_:get(s).
- delete object s.
-
- if valid-object(p) then
- do:
- if type-of(p, 'String':u) then
- return p:toString().
- else
- undo, throw new MessageFormatException().
- end.
- end.
- undo, throw new JMSException().
-
- finally:
- delete object s no-error.
- delete object p no-error.
- end finally.
-
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public logical propertyExists( input name as character ):
- define variable s as String no-undo.
-
- if valid-object(propertyMap_) and propertyMap_:size() gt 0 then
- do:
- s = new String(name).
- return propertyMap_:containsKey(s).
- end.
+ if valid-object(propertyMap_) then
+ return propertyMap_:containsKey(name).
+
return false.
-
- finally:
- delete object s no-error.
- end finally.
-
end method.
method public void setBooleanProperty( input name as character, input val as logical ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new Boolean(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public void setByteProperty( input name as character, input val as memptr ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new Byte(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public void setDoubleProperty( input name as character, input val as decimal ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new Double(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public void setFloatProperty( input name as character, input val as decimal ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ setDoubleProperty(name, val).
end method.
method public void setIntProperty( input name as character, input val as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new Integer(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
method public void setJMSCorrelationID( input correlationID as character ):
@@ -352,7 +391,7 @@
end method.
method public void setJMSDeliveryMode( input deliveryMode as integer ):
- JMSDeliveryMode = DEFAULT_DELIVERY_MODE.
+ JMSDeliveryMode = deliveryMode.
end method.
method public void setJMSDestination( input destination as javax.jms.Destination ):
@@ -368,8 +407,7 @@
end method.
method public void setJMSPriority( input priority as integer ):
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ JMSPriority = priority.
end method.
method public void setJMSRedelivered( input redelivered as logical ):
@@ -389,27 +427,62 @@
end method.
method public void setLongProperty( input name as character, input val as int64 ):
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new Long(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
-
-
method public void setObjectProperty( input name as character, input val as Progress.Lang.Object ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, val).
+ if valid-object(o) then do:
+ if not objectArr:contains(o) then
+ delete object o.
+ else
+ objectArr:remove(o).
+ end.
+
+ objectArr:add(val).
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
-
method public void setShortProperty( input name as character, input val as integer ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ setIntProperty(name, val).
end method.
method public void setStringProperty( input name as character, input val as character ):
-
- undo, throw new Progress.Lang.AppError("METHOD NOT IMPLEMENTED").
-
+ define variable o as Progress.Lang.Object no-undo.
+
+ checkWritable().
+
+ o = propertyMap:put(name, new String(val)).
+ if valid-object(o) and not objectArr:contains(o) then
+ delete object o.
+
+ catch e as Progress.Lang.Error :
+ delete object e.
+ undo, throw new JMSException().
+ end catch.
end method.
+
+ method public void checkWritable ():
+ if readOnlyProperties then
+ undo, throw new MessageNotWriteableException().
+ end method.
end class.
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <me...@us...> - 2010-09-21 13:28:40
|
Revision: 52
http://progress-jms.svn.sourceforge.net/progress-jms/?rev=52&view=rev
Author: medu
Date: 2010-09-21 13:28:28 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
Added overload for containsKey with input character data type.
Modified Paths:
--------------
net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
Modified: net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls
===================================================================
--- net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-09-21 13:24:42 UTC (rev 51)
+++ net.sourceforge.progress.jms/src/net/sourceforge/progress/util/StringHashMap.cls 2010-09-21 13:28:28 UTC (rev 52)
@@ -37,11 +37,30 @@
deleteKeys().
end method.
+ method public logical containsKey( input k as character ):
+ define variable kStr as String no-undo.
+
+ if k ne ? then
+ kStr = new String(k).
+
+ return super:containsKey(kStr).
+
+ finally:
+ delete object kStr no-error.
+ end finally.
+ end method.
+
+
method override public void delete( ):
define variable idx as integer no-undo.
+ define variable len as integer no-undo.
define variable ent as Entry no-undo.
- if (elementCount gt 0) then do idx = 1 to elementData:length():
+ if elementCount eq 0 then
+ return.
+
+ len = elementData:length().
+ do idx = 1 to len:
ent = elementData:Array[idx].
if not valid-object(ent) then
next.
@@ -54,9 +73,14 @@
method override public void deleteKeys( ):
define variable idx as integer no-undo.
+ define variable len as integer no-undo.
define variable ent as Entry no-undo.
- if (elementCount gt 0) then do idx = 1 to elementData:length():
+ if elementCount eq 0 then
+ return.
+
+ len = elementData:length().
+ do idx = 1 to len:
ent = elementData:Array[idx].
if not valid-object(ent) then
next.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|