Fixes to make the JavaOne 7400 Darkmud example source code compatable with sgs-0.9.9 client and server.
1. com.sun.sgs.darkmud.client
MapFrame.java
import com.sun.sgs.client.SessionId; Not used
anymore??
class MapFrame implements ClientChannelListener and defines the receivedMessage()
method.
This methods prototype does not use SessionId. It only has two parameters,
not three.
Also, sessionId is not used by the method for anything. Therefore, removing
it.
Added import java.nio.ByteBuffer;
Change receivedMessage to match ClientChannelListener abstract by using
ByteBuffer and
then used byte[] b = message.array(); so the rest of the code would work
unchanged.
2a. com.sun.sgs.darkmud.client
MudClient.java
Same type of problem as #1.
Changed receivedMessage to use ByteBuffer. This does nothing now. See what
happens later.
2b. com.sun.sgs.darkmud.client
MudClient.java
send() method doesn't match SimpleClient.send(). It uses ByteBuffer instead
of byte[]
txtInput is a JTextField and .getText().getBytes() returns a byte array,
so use ByteBuffer.wrap()
to convert array into ByteBuffer.
2c. com.sun.sgs.darkmud.client
MudClient.java
receivedMessage( byte[] ) method doesn't match ServerSessionListener method.
It now uses ByteBuffer.
Use ByteBuffer and then cast into byte[] for use with code.
3a. com.sun.sgs.darkmud.core
MudObject.java
getInventory() errors because MugObject.class is not compatable for ref.get()
Never seen this code construct before
for (ManagedReference ref : inventory) {
}
So changed
code to use Iterator to pull itmes out of inventory.
3b. com.sun.sgs.darkmud.core
MudObject.java
isInInventory() error same as #3a.
3c. com.sun.sgs.darkmud.core
MudObject.java
parse() error
Use (MudObject)container.get() instead on container.get(MudObject.class)
Use Iterator to get objects to check OuterCommands.
3d. com.sun.sgs.darkmud.core
MudObject.java
getContainer() error
Use (MudObject)containerRef.get() instead on containerRef.get(MudObject.class)
4a. com.sun.sgs.darkmud
MudMain.java
loggedIn() error
Use (Room)startRoomRef.getForUpdate() instead on startRoomRef.getForUpdate(Room.class)
Added import java.nio.ByteBuffer;
Changes bcast.send() to use ByteBuffer and session instead of only byte[].
4b. com.sun.sgs.darkmud
MudMain.java
lookupUser() error
Use (MudUser) AppContext. instead of .getBinding(.., MudUser.class)
4c. com.sun.sgs.darkmud
MudMain.java
registerHelpCommain() error
getHelpCommands() error
getHelpDescription() error
All of these are fixed by casting return to (HelpCommands) and removeing
the HelpCommand.class parameter from the call.
5. com.sun.sgs.darkmud
SimpleServer.java
Abstracts receivedMessage() with byte[] instead of ByteBuffer.
Change declaration to use ByteBuffer
6. com.sun.sgs.darkmud.ambiance
Ambiance.java
run() changed to walk through all ClientSessions to send ambiance message
out
7. com.sun.sgs.darkmud.chasm
FlightSpell.java
run() error
Change to get FlightSpell then call cancelSpell()
8a. com.sun.sgs.darkmud.core
Door.java
commitCommand() error same as #4a
Use (Room) cast
ArrivalTask class
run() error
Usse (MudObject) cast
8b. com.sun.sgs.darkmud.core
IdManager.java
getBinding() error
Remove IdManager.class parameter from .get call
9. com.sun.sgs.darkmud.core
MudUser.java
joinChannel() error
Remove null parameter from .leave() call
sendToUser() error
Convert text to ByteBuffer to use .send() and add session.
Add import java.nio.ByteBuffer;
Remove session.disconnect()..not supported and not needed. leaveChannel()
does it.
recievedMessage() error
Use ByteBuffer instead of byte[] and convert byte[] with .array() method.
10a. com.sun.sgs.darkmud.map
Mapper.java
run() error
User (Room) cast and remove Room.class parameter.
Change channel.send() to use Iterator and send to all channel sessions.
10b. com.sun.sgs.darkmud.map
Mapper.java
buildDoorModle() error
Use (Room) cast for .get()
10c. com.sun.sgs.darkmud.map
Mapper.java
walkModle() error
Use (Room) cast for .get() then use Room object for getInventory()
11a. com.sun.sgs.darkmud.trapdoor
TrapDoor.java
run() error
Use Rug object for access to .attachToTrapDoor()
11b. com.sun.sgs.darkmud.trapdoor
TrapDoor.java
setDestination() error
Same as #3a, use Iterator to walk though inventory.
11c. com.sun.sgs.darkmud.trapdoor
TrapDoor.java
cover() error
Use TrapDoor object explicitly.
Use Rope object explicitly.
11d. com.sun.sgs.darkmud.trapdoor
TrapDoor.java
uncover() error
Use TrapDoor object explicitly.
Use Rope object explicitly.
11e. com.sun.sgs.darkmud.trapdoor
TrapDoor.java
tieRope() error
untieRope() error
addAnnotation() error
removeAnnotation() error
Use TrapDoor object explicitly.
That's it.