jetrix-cvs Mailing List for Jetrix TetriNET Server (Page 6)
Brought to you by:
smanux
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(47) |
Dec
(39) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(11) |
Feb
(34) |
Mar
(52) |
Apr
(79) |
May
(14) |
Jun
(41) |
Jul
(19) |
Aug
(44) |
Sep
(36) |
Oct
(36) |
Nov
(6) |
Dec
(58) |
2004 |
Jan
(23) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(91) |
2005 |
Jan
(137) |
Feb
(10) |
Mar
(2) |
Apr
(41) |
May
(62) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(39) |
Sep
(18) |
Oct
|
Nov
(9) |
Dec
|
2009 |
Jan
|
Feb
(27) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
(3) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(15) |
Jun
|
Jul
|
Aug
(9) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sm...@us...> - 2008-08-28 07:41:57
|
Revision: 750 http://jetrix.svn.sourceforge.net/jetrix/?rev=750&view=rev Author: smanux Date: 2008-08-28 07:41:53 +0000 (Thu, 28 Aug 2008) Log Message: ----------- Fixed a bug in TetrinetProtocol.encode() with some IP addresses like 195.139.204.206 (tetrinet.no) Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 17:45:22 UTC (rev 749) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-28 07:41:53 UTC (rev 750) @@ -940,7 +940,7 @@ public static String encode(String nickname, String version, byte[] ip, boolean tetrifast) { // compute the pattern - int p = 54 * ip[0] + 41 * ip[1] + 29 * ip[2] + 17 * ip[3]; + int p = 54 * (ip[0] & 0xFF) + 41 * (ip[1] & 0xFF) + 29 * (ip[2] & 0xFF) + 17 * (ip[3] & 0xFF); char[] pattern = String.valueOf(p).toCharArray(); // build the string to encode Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-27 17:45:22 UTC (rev 749) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-28 07:41:53 UTC (rev 750) @@ -279,4 +279,18 @@ assertEquals("decoded string", "tetrisstart Smanux 1.13", decode(init)); } + + public void testEncodeDecode() + { + byte[] ip = {(byte) 195, (byte) 139, (byte) 204, (byte) 206}; + + String nickname = "Smanux"; + String version = "1.13"; + + String init = encode(nickname, version, ip, false); + + assertNotNull(init); + + assertEquals("decoded", "tetrisstart Smanux 1.13", decode(init)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 17:45:26
|
Revision: 749 http://jetrix.svn.sourceforge.net/jetrix/?rev=749&view=rev Author: smanux Date: 2008-08-27 17:45:22 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Implemented the parsing of speclist messages for tspec agents Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java Modified: jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java 2008-08-27 17:44:12 UTC (rev 748) +++ jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java 2008-08-27 17:45:22 UTC (rev 749) @@ -101,7 +101,16 @@ message = smsg; } + else if (line.startsWith("speclist")) + { + SpectatorListMessage slist = new SpectatorListMessage(); + String[] tokens = line.split(" "); + slist.setChannel(tokens[1].substring(1)); + slist.setSpectators(Arrays.asList(tokens).subList(2, tokens.length)); + message = slist; + } + return message != null ? message : super.getMessage(line); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 17:44:15
|
Revision: 748 http://jetrix.svn.sourceforge.net/jetrix/?rev=748&view=rev Author: smanux Date: 2008-08-27 17:44:12 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Implemented the parsing of winlist messages for tetrinet agents Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/java/net/jetrix/winlist/Score.java jetrix/trunk/src/test/net/jetrix/winlist/ScoreTest.java jetrix/trunk/src/test/net/jetrix/winlist/SimpleWinlistTest.java jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 15:07:12 UTC (rev 747) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 17:44:12 UTC (rev 748) @@ -315,7 +315,29 @@ noconnecting.setText(line.substring(cmd.length() + 1)); m = noconnecting; } + else if ("winlist".equals(cmd)) + { + WinlistMessage winlist = new WinlistMessage(); + winlist.setRawMessage(this, line); + List<Score> scores = new ArrayList<Score>(); + String[] tokens = line.split(" "); + for (int i = 1; i < tokens.length; i++) + { + String token = tokens[i]; + String[] values = token.split(";"); + Score score = new Score(); + score.setName(values[0].substring(1)); + score.setType(values[0].charAt(0) == 'p' ? Score.TYPE_PLAYER : Score.TYPE_TEAM); + score.setScore(Long.parseLong(values[1])); + + scores.add(score); + } + winlist.setScores(scores); + + m = winlist; + } + return m; } Modified: jetrix/trunk/src/java/net/jetrix/winlist/Score.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/winlist/Score.java 2008-08-27 15:07:12 UTC (rev 747) +++ jetrix/trunk/src/java/net/jetrix/winlist/Score.java 2008-08-27 17:44:12 UTC (rev 748) @@ -34,6 +34,17 @@ public static final int TYPE_PLAYER = 0; public static final int TYPE_TEAM = 1; + public Score() + { + } + + public Score(String name, int type, long score) + { + this.name = name; + this.type = type; + this.score = score; + } + public String getName() { return name; Modified: jetrix/trunk/src/test/net/jetrix/winlist/ScoreTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/winlist/ScoreTest.java 2008-08-27 15:07:12 UTC (rev 747) +++ jetrix/trunk/src/test/net/jetrix/winlist/ScoreTest.java 2008-08-27 17:44:12 UTC (rev 748) @@ -31,21 +31,10 @@ { public void testEquals() { - Score score1 = new Score(); - score1.setName("user1"); - score1.setType(Score.TYPE_PLAYER); - score1.setScore(1000); + Score score1 = new Score("user1", Score.TYPE_PLAYER, 1000); + Score score2 = new Score("user1", Score.TYPE_PLAYER, 2000); + Score score3 = new Score("user1", Score.TYPE_TEAM, 2000); - Score score2 = new Score(); - score2.setName("user1"); - score2.setType(Score.TYPE_PLAYER); - score2.setScore(2000); - - Score score3 = new Score(); - score3.setName("user1"); - score3.setType(Score.TYPE_TEAM); - score3.setScore(2000); - assertTrue("score value not ignored", score1.equals(score2) && score2.equals(score1)); assertFalse("score type ignored", score2.equals(score3) || score3.equals(score2)); } Modified: jetrix/trunk/src/test/net/jetrix/winlist/SimpleWinlistTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/winlist/SimpleWinlistTest.java 2008-08-27 15:07:12 UTC (rev 747) +++ jetrix/trunk/src/test/net/jetrix/winlist/SimpleWinlistTest.java 2008-08-27 17:44:12 UTC (rev 748) @@ -140,15 +140,9 @@ winlist.init(config); // add two scores to the list - Score score1 = new Score(); - score1.setName("LFJR"); - score1.setScore(4321); - score1.setType(Score.TYPE_TEAM); + Score score1 = new Score("LFJR", Score.TYPE_TEAM, 4321); - Score score2 = new Score(); - score2.setName("Smanux"); - score2.setScore(1234); - score2.setType(Score.TYPE_PLAYER); + Score score2 = new Score("Smanux", Score.TYPE_PLAYER, 1234); winlist.scores.add(score1); winlist.scores.add(score2); @@ -174,10 +168,7 @@ winlist.init(new WinlistConfig()); // add two scores to the list - Score score = new Score(); - score.setName("LFJR"); - score.setScore(4321); - score.setType(Score.TYPE_TEAM); + Score score = new Score("LFJR", Score.TYPE_TEAM, 4321); winlist.scores.add(score); @@ -193,10 +184,7 @@ SimpleWinlist winlist = getWinlist(); // add two scores to the list - Score score = new Score(); - score.setName("LFJR"); - score.setScore(4321); - score.setType(Score.TYPE_TEAM); + Score score = new Score("LFJR", Score.TYPE_TEAM, 4321); winlist.scores.add(score); Modified: jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java 2008-08-27 15:07:12 UTC (rev 747) +++ jetrix/trunk/src/test/net/jetrix/winlist/TetrixWinlistTest.java 2008-08-27 17:44:12 UTC (rev 748) @@ -37,10 +37,7 @@ public void setUp() { super.setUp(); - score = new Score(); - score.setScore(1418); - score.setName("hell's_players\x86"); - score.setType(Score.TYPE_TEAM); + score = new Score("hell's_players\x86", Score.TYPE_TEAM, 1418); } public void testBuildScore() throws Exception This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 15:07:16
|
Revision: 747 http://jetrix.svn.sourceforge.net/jetrix/?rev=747&view=rev Author: smanux Date: 2008-08-27 15:07:12 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Added the Jetrix SVG Icon Added Paths: ----------- jetrix/trunk/src/etc/icons/jetrix.svg Added: jetrix/trunk/src/etc/icons/jetrix.svg =================================================================== --- jetrix/trunk/src/etc/icons/jetrix.svg (rev 0) +++ jetrix/trunk/src/etc/icons/jetrix.svg 2008-08-27 15:07:12 UTC (rev 747) @@ -0,0 +1,40 @@ +<?xml version="1.0" standalone="no"?> +<!-- Derived from the Tetrominoes SVG by Damian Yerrick on the Tetris Wikipedia article --> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="96" height="96"> +<defs> +<style> +.blue rect {color: #0000f0} +.blue .top {color: #99f} +.blue .side {color: #0000d8} +.blue .bottom {color: #000078} + +.red rect {color: #f00000} +.red .top {color: #f99} +.red .side {color: #d80000} +.red .bottom {color: #780000} +</style> +<g id="block"> + <rect fill="currentColor" width="18" height="18" x="3" y="3"/> + <path fill="currentColor" d="M 0,0 L 0,0 C 0,0 0,0 0,0 L 3,3 L 21,3 L 24,0 L 0,0 z" class="top"/> + <path fill="currentColor" d="M 0,0 L 0,24 L 3,21 L 3,3 L 0,0 z" class="side"/> + <path fill="currentColor" d="M 24,0 L 24,24 L 21,21 L 21,3 L 24,0 z" class="side"/> + <path fill="currentColor" d="M 0,24 L 24,24 L 21,21 L 3,21 L 0,24 z" class="bottom"/> +</g> +<g id="S" class="blue"> + <use x="0" y="0" xlink:href="#block"/> + <use x="24" y="0" xlink:href="#block"/> + <use x="24" y="-24" xlink:href="#block"/> + <use x="48" y="-24" xlink:href="#block"/> +</g> +<g id="Z" class="red"> + <use x="0" y="0" xlink:href="#block"/> + <use x="24" y="0" xlink:href="#block"/> + <use x="24" y="24" xlink:href="#block"/> + <use x="48" y="24" xlink:href="#block"/> +</g> +</defs> + +<use x="0" y="0" xlink:href="#Z"/> +<use x="24" y="72" xlink:href="#S"/> + +</svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 14:44:50
|
Revision: 746 http://jetrix.svn.sourceforge.net/jetrix/?rev=746&view=rev Author: smanux Date: 2008-08-27 14:44:44 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Added TetrinetAgent to write tetrinet bots or clients Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java jetrix/trunk/src/test/net/jetrix/agent/TSpecAgentTest.java Added Paths: ----------- jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java Modified: jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java 2008-08-27 14:39:18 UTC (rev 745) +++ jetrix/trunk/src/java/net/jetrix/agent/TSpecAgent.java 2008-08-27 14:44:44 UTC (rev 746) @@ -19,216 +19,49 @@ package net.jetrix.agent; -import net.jetrix.*; -import net.jetrix.messages.*; -import net.jetrix.protocols.*; +import java.io.IOException; -import java.io.*; -import java.net.*; -import java.util.*; +import net.jetrix.messages.PlayerNumMessage; +import net.jetrix.messages.TeamMessage; +import net.jetrix.protocols.TspecProtocol; /** - * A TSpec agent to log on a TetriNET server as a spectator. + * TSpec agent to log on a TetriNET server as a spectator. * * @author Emmanuel Bourg * @version $Revision$, $Date$ */ -public class TSpecAgent implements Agent +public class TSpecAgent extends TetrinetAgent { - private String name; private String password; - private Socket socket; - private BufferedReader in; - private Writer out; - private TspecProtocol protocol = new TspecProtocol(); - private boolean running; public TSpecAgent(String name, String password) { - this.name = name; + super(name); this.password = password; + this.protocol = new TspecProtocol(); } public void connect(String hostname) throws IOException { - socket = new Socket(hostname, 31458); - in = new BufferedReader(new InputStreamReader(socket.getInputStream())); - out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); - - send(TetrinetProtocol.encode(name, password, socket.getInetAddress().getAddress(), false)); - running = true; - - Thread t = new Thread() - { - public void run() - { - try - { - while (running) - { - String line = protocol.readLine(in); - Message message = protocol.getMessage(line); - - receive(message); - } - } - catch (IOException e) - { - e.printStackTrace(); - running = false; - } - } - }; - - t.start(); + connect(hostname, 31458, password); } - public void disconnect() throws IOException + public void onMessage(PlayerNumMessage m) { - if (socket != null) + super.onMessage(m); + + // send the tspec password as the team name + TeamMessage team = new TeamMessage(); + team.setSlot(m.getSlot()); + team.setName(password); + try { - running = false; - socket.close(); + send(team); } - } - - private void send(String message) throws IOException - { - out.write(message); - out.write(protocol.getEOL()); - out.flush(); - } - - public void send(Message message) throws IOException - { - send(protocol.translate(message, Locale.getDefault())); - } - - public final void receive(Message m) - { - // overwritable pre processing - onMessage(m); - - // message dispatching - if (m instanceof SpecialMessage) { onMessage((SpecialMessage) m); } - else if (m instanceof FieldMessage) { onMessage((FieldMessage) m); } - else if (m instanceof CommandMessage) { onMessage((CommandMessage) m); } - else if (m instanceof PlineMessage) { onMessage((PlineMessage) m); } - else if (m instanceof LevelMessage) { onMessage((LevelMessage) m); } - else if (m instanceof PlayerLostMessage) { onMessage((PlayerLostMessage) m); } - else if (m instanceof PlineActMessage) { onMessage((PlineActMessage) m); } - else if (m instanceof TeamMessage) { onMessage((TeamMessage) m); } - else if (m instanceof JoinMessage) { onMessage((JoinMessage) m); } - else if (m instanceof LeaveMessage) { onMessage((LeaveMessage) m); } - else if (m instanceof PlayerNumMessage) { onMessage((PlayerNumMessage) m); } - else if (m instanceof StartGameMessage) { onMessage((StartGameMessage) m); } - else if (m instanceof StopGameMessage) { onMessage((StopGameMessage) m); } - else if (m instanceof NewGameMessage) { onMessage((NewGameMessage) m); } - else if (m instanceof EndGameMessage) { onMessage((EndGameMessage) m); } - else if (m instanceof PauseMessage) { onMessage((PauseMessage) m); } - else if (m instanceof ResumeMessage) { onMessage((ResumeMessage) m); } - else if (m instanceof GmsgMessage) { onMessage((GmsgMessage) m); } - else if (m instanceof PlayerWonMessage) { onMessage((PlayerWonMessage) m); } - else + catch (IOException e) { - // nothing, log an error ? + e.printStackTrace(); } - - // todo add onMessage(DisconnectedMessage) } - - /** - * Message pre-processing. This method is called at the beginning of the - * <tt>process(Message m, List out)</tt> method and allow custom - * processing for all filtered messages. - */ - public void onMessage(Message m) { } - - public void onMessage(PlineMessage m) { } - - public void onMessage(PlineActMessage m) { } - - public void onMessage(TeamMessage m) { } - - public void onMessage(JoinMessage m) { } - - public void onMessage(LeaveMessage m) { } - - public void onMessage(PlayerNumMessage m) { } - - public void onMessage(StartGameMessage m) { } - - public void onMessage(StopGameMessage m) { } - - public void onMessage(NewGameMessage m) { } - - public void onMessage(EndGameMessage m) { } - - public void onMessage(PauseMessage m) { } - - public void onMessage(ResumeMessage m) { } - - public void onMessage(GmsgMessage m) { } - - private void onMessage(SpecialMessage m) - { - // message pre-processing - onSpecial(m); - - // message dispatching - if (m instanceof OneLineAddedMessage) { onMessage((OneLineAddedMessage) m); } - else if (m instanceof TwoLinesAddedMessage) { onMessage((TwoLinesAddedMessage) m); } - else if (m instanceof FourLinesAddedMessage) { onMessage((FourLinesAddedMessage) m); } - else if (m instanceof AddLineMessage) { onMessage((AddLineMessage) m); } - else if (m instanceof ClearLineMessage) { onMessage((ClearLineMessage) m); } - else if (m instanceof ClearSpecialsMessage) { onMessage((ClearSpecialsMessage) m); } - else if (m instanceof RandomClearMessage) { onMessage((RandomClearMessage) m); } - else if (m instanceof BlockQuakeMessage) { onMessage((BlockQuakeMessage) m); } - else if (m instanceof BlockBombMessage) { onMessage((BlockBombMessage) m); } - else if (m instanceof GravityMessage) { onMessage((GravityMessage) m); } - else if (m instanceof NukeFieldMessage) { onMessage((NukeFieldMessage) m); } - else if (m instanceof SwitchFieldsMessage) { onMessage((SwitchFieldsMessage) m); } - } - - /** - * Special block message pre-processing. This method is called for all - * specials filtered and allow custom processing for all specials - * (lines added, blockbomb switchs, etc...). - */ - public void onSpecial(SpecialMessage m) { } - - public void onMessage(LevelMessage m) { } - - public void onMessage(FieldMessage m) { } - - public void onMessage(PlayerLostMessage m) { } - - public void onMessage(PlayerWonMessage m) { } - - public void onMessage(CommandMessage m) { } - - public void onMessage(OneLineAddedMessage m) { } - - public void onMessage(TwoLinesAddedMessage m) { } - - public void onMessage(FourLinesAddedMessage m) { } - - public void onMessage(AddLineMessage m) { } - - public void onMessage(ClearLineMessage m) { } - - public void onMessage(NukeFieldMessage m) { } - - public void onMessage(RandomClearMessage m) { } - - public void onMessage(SwitchFieldsMessage m) { } - - public void onMessage(ClearSpecialsMessage m) { } - - public void onMessage(GravityMessage m) { } - - public void onMessage(BlockQuakeMessage m) { } - - public void onMessage(BlockBombMessage m) { } - } Added: jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java 2008-08-27 14:44:44 UTC (rev 746) @@ -0,0 +1,302 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.agent; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.net.Socket; +import java.util.Locale; + +import net.jetrix.Message; +import net.jetrix.Protocol; +import net.jetrix.protocols.TetrinetProtocol; +import net.jetrix.messages.*; + +/** + * Tetrinet agent to log on a server as a player. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetAgent implements Agent +{ + private String name; + private String hostname; + + private int slot; + + private Socket socket; + private BufferedReader in; + private Writer out; + + protected Protocol protocol = new TetrinetProtocol(); + private boolean running; + + public TetrinetAgent(String name) + { + this.name = name; + } + + public String getHostname() + { + return hostname; + } + + public void connect(String hostname) throws IOException + { + connect(hostname, 31457, "1.13"); + } + + protected void connect(String hostname, int port, String version) throws IOException + { + if (running) + { + return; + } + + socket = new Socket(hostname, port); + this.hostname = hostname; + in = new BufferedReader(new InputStreamReader(socket.getInputStream())); + out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + + send(TetrinetProtocol.encode(name, version, socket.getInetAddress().getAddress(), false)); + + // block until the playernum message is received + String line = protocol.readLine(in); + Message message = protocol.getMessage(line); + receive(message); + + if (message instanceof NoConnectingMessage) + { + throw new IOException("Connexion rejected (noconnecting) : " + ((NoConnectingMessage) message).getText()); + } + + running = true; + + // start the message listener + new MessageListener().start(); + } + + private class MessageListener extends Thread + { + private MessageListener() + { + setName("listener"); + } + + public void run() + { + try + { + while (running) + { + String line = protocol.readLine(in); + + Message message = protocol.getMessage(line); + + receive(message); + } + } + catch (IOException e) + { + if (running) + { + e.printStackTrace(); + running = false; + } + } + } + } + + public void disconnect() throws IOException + { + if (socket != null) + { + running = false; + socket.close(); + } + } + + protected void send(String message) throws IOException + { + out.write(message); + out.write(protocol.getEOL()); + out.flush(); + } + + public void send(Message message) throws IOException + { + // set the slot for channel messages + if (message instanceof ChannelMessage) + { + ((ChannelMessage) message).setSlot(slot); + } + + send(protocol.translate(message, Locale.getDefault())); + } + + /** + * Join the specified channel + * + * @param channel + */ + public void join(String channel) throws IOException + { + send(new PlineMessage("/join " + channel)); + } + + public final void receive(Message m) + { + // overwritable pre processing + onMessage(m); + + // message dispatching + if (m instanceof SpecialMessage) { onMessage((SpecialMessage) m); } + else if (m instanceof FieldMessage) { onMessage((FieldMessage) m); } + else if (m instanceof CommandMessage) { onMessage((CommandMessage) m); } + else if (m instanceof PlineMessage) { onMessage((PlineMessage) m); } + else if (m instanceof LevelMessage) { onMessage((LevelMessage) m); } + else if (m instanceof PlayerLostMessage) { onMessage((PlayerLostMessage) m); } + else if (m instanceof PlineActMessage) { onMessage((PlineActMessage) m); } + else if (m instanceof TeamMessage) { onMessage((TeamMessage) m); } + else if (m instanceof JoinMessage) { onMessage((JoinMessage) m); } + else if (m instanceof LeaveMessage) { onMessage((LeaveMessage) m); } + else if (m instanceof PlayerNumMessage) { onMessage((PlayerNumMessage) m); } + else if (m instanceof StartGameMessage) { onMessage((StartGameMessage) m); } + else if (m instanceof StopGameMessage) { onMessage((StopGameMessage) m); } + else if (m instanceof NewGameMessage) { onMessage((NewGameMessage) m); } + else if (m instanceof EndGameMessage) { onMessage((EndGameMessage) m); } + else if (m instanceof PauseMessage) { onMessage((PauseMessage) m); } + else if (m instanceof ResumeMessage) { onMessage((ResumeMessage) m); } + else if (m instanceof GmsgMessage) { onMessage((GmsgMessage) m); } + else if (m instanceof PlayerWonMessage) { onMessage((PlayerWonMessage) m); } + else if (m instanceof NoConnectingMessage) { onMessage((NoConnectingMessage) m); } + else + { + // nothing, log an error ? + } + + // todo add onMessage(DisconnectedMessage) + } + + /** + * Message pre-processing. This method is called at the beginning of the + * <tt>process(Message m, List out)</tt> method and allow custom + * processing for all filtered messages. + */ + public void onMessage(Message m) { } + + public void onMessage(PlineMessage m) { } + + public void onMessage(PlineActMessage m) { } + + public void onMessage(NoConnectingMessage m) { } + + public void onMessage(TeamMessage m) { } + + public void onMessage(JoinMessage m) { } + + public void onMessage(LeaveMessage m) { } + + public void onMessage(PlayerNumMessage m) + { + this.slot = m.getSlot(); + } + + public void onMessage(StartGameMessage m) { } + + public void onMessage(StopGameMessage m) { } + + public void onMessage(NewGameMessage m) { } + + public void onMessage(EndGameMessage m) { } + + public void onMessage(PauseMessage m) { } + + public void onMessage(ResumeMessage m) { } + + public void onMessage(GmsgMessage m) { } + + private void onMessage(SpecialMessage m) + { + // message pre-processing + onSpecial(m); + + // message dispatching + if (m instanceof OneLineAddedMessage) { onMessage((OneLineAddedMessage) m); } + else if (m instanceof TwoLinesAddedMessage) { onMessage((TwoLinesAddedMessage) m); } + else if (m instanceof FourLinesAddedMessage) { onMessage((FourLinesAddedMessage) m); } + else if (m instanceof AddLineMessage) { onMessage((AddLineMessage) m); } + else if (m instanceof ClearLineMessage) { onMessage((ClearLineMessage) m); } + else if (m instanceof ClearSpecialsMessage) { onMessage((ClearSpecialsMessage) m); } + else if (m instanceof RandomClearMessage) { onMessage((RandomClearMessage) m); } + else if (m instanceof BlockQuakeMessage) { onMessage((BlockQuakeMessage) m); } + else if (m instanceof BlockBombMessage) { onMessage((BlockBombMessage) m); } + else if (m instanceof GravityMessage) { onMessage((GravityMessage) m); } + else if (m instanceof NukeFieldMessage) { onMessage((NukeFieldMessage) m); } + else if (m instanceof SwitchFieldsMessage) { onMessage((SwitchFieldsMessage) m); } + } + + /** + * Special block message pre-processing. This method is called for all + * specials filtered and allow custom processing for all specials + * (lines added, blockbomb switchs, etc...). + */ + public void onSpecial(SpecialMessage m) { } + + public void onMessage(LevelMessage m) { } + + public void onMessage(FieldMessage m) { } + + public void onMessage(PlayerLostMessage m) { } + + public void onMessage(PlayerWonMessage m) { } + + public void onMessage(CommandMessage m) { } + + public void onMessage(OneLineAddedMessage m) { } + + public void onMessage(TwoLinesAddedMessage m) { } + + public void onMessage(FourLinesAddedMessage m) { } + + public void onMessage(AddLineMessage m) { } + + public void onMessage(ClearLineMessage m) { } + + public void onMessage(NukeFieldMessage m) { } + + public void onMessage(RandomClearMessage m) { } + + public void onMessage(SwitchFieldsMessage m) { } + + public void onMessage(ClearSpecialsMessage m) { } + + public void onMessage(GravityMessage m) { } + + public void onMessage(BlockQuakeMessage m) { } + + public void onMessage(BlockBombMessage m) { } + +} Property changes on: jetrix/trunk/src/java/net/jetrix/agent/TetrinetAgent.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2008-08-27 14:39:18 UTC (rev 745) +++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2008-08-27 14:44:44 UTC (rev 746) @@ -26,7 +26,6 @@ import java.util.logging.*; import net.jetrix.*; -import net.jetrix.protocols.AbstractProtocol; import net.jetrix.config.*; import net.jetrix.messages.*; @@ -132,6 +131,8 @@ // discard unknown messages if (message == null) continue; + // todo check the slot on channel messages + if (message.getDestination() != null) { message.getDestination().send(message); @@ -249,7 +250,7 @@ public Message receive() throws IOException { // read raw message from socket - String line = ((AbstractProtocol) protocol).readLine(in); + String line = protocol.readLine(in); lastMessageTime = System.currentTimeMillis(); if (log.isLoggable(Level.FINER)) { Modified: jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java 2008-08-27 14:39:18 UTC (rev 745) +++ jetrix/trunk/src/test/net/jetrix/agent/QueryAgentTest.java 2008-08-27 14:44:44 UTC (rev 746) @@ -19,13 +19,9 @@ package net.jetrix.agent; -import junit.framework.TestCase; - import java.util.List; -import net.jetrix.agent.ChannelInfo; -import net.jetrix.agent.PlayerInfo; -import net.jetrix.agent.QueryAgent; +import junit.framework.TestCase; /** * @author Emmanuel Bourg Modified: jetrix/trunk/src/test/net/jetrix/agent/TSpecAgentTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/agent/TSpecAgentTest.java 2008-08-27 14:39:18 UTC (rev 745) +++ jetrix/trunk/src/test/net/jetrix/agent/TSpecAgentTest.java 2008-08-27 14:44:44 UTC (rev 746) @@ -30,11 +30,14 @@ { public void testConnect() throws Exception { - TSpecAgent agent = new TSpecAgent("SmanuxBot", "none"); + TSpecAgent agent = new TSpecAgent("JetrixSpec", "rien"); agent.connect("tetrinet.fr"); - agent.send(new PlineMessage("// Waza !!!")); + agent.send(new PlineMessage("// Hi!")); + agent.send(new PlineMessage("Hello there!")); + Thread.sleep(1000); + agent.disconnect(); } } Added: jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java (rev 0) +++ jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java 2008-08-27 14:44:44 UTC (rev 746) @@ -0,0 +1,43 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.agent; + +import junit.framework.TestCase; + +import net.jetrix.messages.PlineMessage; +import net.jetrix.messages.TeamMessage; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetAgentTest extends TestCase +{ + public void testConnect() throws Exception + { + TetrinetAgent agent = new TetrinetAgent("JetrixBot"); + agent.connect("tetrinet.fr"); + + agent.send(new TeamMessage()); + agent.send(new PlineMessage("Hi there!")); + + agent.disconnect(); + } +} Property changes on: jetrix/trunk/src/test/net/jetrix/agent/TetrinetAgentTest.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 14:39:20
|
Revision: 745 http://jetrix.svn.sourceforge.net/jetrix/?rev=745&view=rev Author: smanux Date: 2008-08-27 14:39:18 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Fixed the format of team messages (trailing space required when no team is specified) Implemented the parsing of the noconnecting message for the agents Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java Modified: jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/java/net/jetrix/messages/TeamMessage.java 2008-08-27 14:39:18 UTC (rev 745) @@ -30,6 +30,15 @@ /** the name of the team */ private String name; + public TeamMessage() + { + } + + public TeamMessage(String name) + { + this.name = name; + } + public String getName() { return name; Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2008-08-27 14:39:18 UTC (rev 745) @@ -309,6 +309,12 @@ leave.setRawMessage(this, line); m = leave; } + else if ("noconnecting".equals(cmd)) + { + NoConnectingMessage noconnecting = new NoConnectingMessage(); + noconnecting.setText(line.substring(cmd.length() + 1)); + m = noconnecting; + } return m; } @@ -412,9 +418,9 @@ StringBuilder message = new StringBuilder(); message.append("team "); message.append(m.getSlot()); + message.append(" "); if (m.getName() != null) { - message.append(" "); message.append(m.getName()); } return message.toString(); @@ -827,7 +833,7 @@ // check the size of the init string if (initString.length() % 2 != 0) { - throw new IllegalArgumentException("Invalid initialization string, the length is not even"); + throw new IllegalArgumentException("Invalid initialization string, the length is not even (" + initString + ")"); } // parse the hex values from the init string @@ -842,7 +848,7 @@ } catch (NumberFormatException e) { - throw new IllegalArgumentException("Invalid initialization string, illegal characters found", e); + throw new IllegalArgumentException("Invalid initialization string, illegal characters found (" + initString + ")", e); } // find the hash pattern for a tetrinet client @@ -857,7 +863,7 @@ // check the size of the pattern found if (pattern.length() == 0) { - throw new IllegalArgumentException("Invalid initialization string, unable to find the pattern"); + throw new IllegalArgumentException("Invalid initialization string, unable to find the pattern (" + initString + ")"); } // decode the string Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-27 14:36:45 UTC (rev 744) +++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2008-08-27 14:39:18 UTC (rev 745) @@ -155,7 +155,7 @@ { TeamMessage msg2 = new TeamMessage(); msg2.setSlot(1); - assertEquals("team 1", protocol.translate(msg2, locale)); + assertEquals("team 1 ", protocol.translate(msg2, locale)); } public void testGetMessageTeam1() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 14:36:48
|
Revision: 744 http://jetrix.svn.sourceforge.net/jetrix/?rev=744&view=rev Author: smanux Date: 2008-08-27 14:36:45 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Implemented the TServ mode of the tspec protocol Modified Paths: -------------- jetrix/trunk/doc/changelog.txt jetrix/trunk/src/java/net/jetrix/clients/TSpecClient.java jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java Modified: jetrix/trunk/doc/changelog.txt =================================================================== --- jetrix/trunk/doc/changelog.txt 2008-08-27 09:22:05 UTC (rev 743) +++ jetrix/trunk/doc/changelog.txt 2008-08-27 14:36:45 UTC (rev 744) @@ -10,6 +10,7 @@ - Implemented the channel operator access level. It's now possible to restrict some commands to the first player in the channel (/move, /start...) - Added support for the client identification protocol (i.e lvl 0 0 request, clientinfo response) - The number of players and spectators currently online is now displayed on logging in +- The 'TServ' mode of TSpec is now supported Admin visible changes - Jetrix now requires Java 6 Modified: jetrix/trunk/src/java/net/jetrix/clients/TSpecClient.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/clients/TSpecClient.java 2008-08-27 09:22:05 UTC (rev 743) +++ jetrix/trunk/src/java/net/jetrix/clients/TSpecClient.java 2008-08-27 14:36:45 UTC (rev 744) @@ -19,6 +19,11 @@ package net.jetrix.clients; +import java.io.IOException; + +import net.jetrix.Message; +import net.jetrix.messages.SmsgMessage; + /** * Spectator client. * @@ -27,8 +32,40 @@ */ public class TSpecClient extends TetrinetClient { + public static final int TETRIX_MODE = 0; + public static final int TSERV_MODE = 1; + + private int mode; + + public void setMode(int mode) + { + this.mode = mode; + } + + public int getMode() + { + return mode; + } + protected boolean isAsynchronous() { return false; } + + public Message receive() throws IOException + { + Message message = super.receive(); + + if (message instanceof SmsgMessage && mode == TSERV_MODE) + { + SmsgMessage smsg = (SmsgMessage) message; + if (smsg.isPrivate()) + { + // echo the message to the player + send(message); + } + } + + return message; + } } Modified: jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2008-08-27 09:22:05 UTC (rev 743) +++ jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2008-08-27 14:36:45 UTC (rev 744) @@ -21,7 +21,6 @@ import java.io.*; import java.net.*; -import java.util.*; import net.jetrix.*; import net.jetrix.protocols.TspecProtocol; import net.jetrix.protocols.TetrinetProtocol; @@ -51,38 +50,38 @@ TetrinetProtocol protocol = ProtocolManager.getInstance().getProtocol(TetrinetProtocol.class); String init = protocol.readLine(new InputStreamReader(socket.getInputStream())); - String dec = TetrinetProtocol.decode(init); + TSpecClient client = new TSpecClient(); + client.setProtocol(ProtocolManager.getInstance().getProtocol(TspecProtocol.class)); + client.setSocket(socket); - // init string parsing "tetristart <nickname> <version>" - StringTokenizer st = new StringTokenizer(dec, " "); - List<String> tokens = new ArrayList<String>(); + User user = new User(); + user.setSpectator(); + client.setUser(user); - while (st.hasMoreTokens()) + // test if the client is using the tspec protocol (<nickname> <encoded password>) + if (init.contains(" ")) { - tokens.add(st.nextToken()); + client.setMode(TSpecClient.TSERV_MODE); + user.setName(init.substring(0, init.indexOf(" "))); } - - if (tokens.size() > 3) + else { - return null; - } + client.setMode(TSpecClient.TETRIX_MODE); + String dec = TetrinetProtocol.decode(init); - TSpecClient client = new TSpecClient(); - User user = new User(); - user.setName(tokens.get(1)); - user.setSpectator(); - client.setSocket(socket); - client.setUser(user); - client.setProtocol(ProtocolManager.getInstance().getProtocol(TspecProtocol.class)); + // init string parsing "tetristart <nickname> <version>" + String[] tokens = dec.split(" "); - if (tokens.size() > 3) - { - Message m = new NoConnectingMessage("No space allowed in nickname !"); - client.send(m); - return null; + if (tokens.length > 3) + { + Message m = new NoConnectingMessage("No space allowed in nickname !"); + client.send(m); + return null; + } + + user.setName(tokens[1]); } return client; } - } Modified: jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java 2008-08-27 09:22:05 UTC (rev 743) +++ jetrix/trunk/src/java/net/jetrix/protocols/TspecProtocol.java 2008-08-27 14:36:45 UTC (rev 744) @@ -50,6 +50,8 @@ if (line.startsWith("pline") && !line.startsWith("plineact")) { + // pline message with the tetrix mode + SmsgMessage smsg = new SmsgMessage(); smsg.setSlot(Integer.parseInt(line.substring(6, 7))); @@ -76,7 +78,30 @@ message = smsg; } } + else if (line.startsWith("/pline")) + { + // pline message with the tserv mode + SmsgMessage smsg = new SmsgMessage(); + smsg.setText(line.substring("/pline".length())); + smsg.setPrivate(false); + message = smsg; + } + else if (line.startsWith("/")) + { + // direct command in tserv mode + line = "pline 1 " + line; + } + else if (line.startsWith("<") && line.contains(">")) + { + // private comment in tserv mode + SmsgMessage smsg = new SmsgMessage(); + smsg.setText(line.substring(line.indexOf(">") + 1).trim()); + smsg.setPrivate(true); + + message = smsg; + } + return message != null ? message : super.getMessage(line); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-27 09:22:19
|
Revision: 743 http://jetrix.svn.sourceforge.net/jetrix/?rev=743&view=rev Author: smanux Date: 2008-08-27 09:22:05 +0000 (Wed, 27 Aug 2008) Log Message: ----------- Full documentation of the tetrinet 1.14 extension Implemented the tetrinet random number generator Modified Paths: -------------- jetrix/trunk/pom.xml jetrix/trunk/project.properties jetrix/trunk/project.xml jetrix/trunk/src/etc/README jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java jetrix/trunk/src/java/net/jetrix/filter/package.html jetrix/trunk/src/site/dev-guide.php jetrix/trunk/src/site/index.php jetrix/trunk/src/site/menu.inc.php Added Paths: ----------- jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java jetrix/trunk/src/site/images/blocks/ jetrix/trunk/src/site/images/blocks/halfcross1.png jetrix/trunk/src/site/images/blocks/halfcross2.png jetrix/trunk/src/site/images/blocks/halfcross3.png jetrix/trunk/src/site/images/blocks/halfcross4.png jetrix/trunk/src/site/images/blocks/leftl1.png jetrix/trunk/src/site/images/blocks/leftl2.png jetrix/trunk/src/site/images/blocks/leftl3.png jetrix/trunk/src/site/images/blocks/leftl4.png jetrix/trunk/src/site/images/blocks/leftz1.png jetrix/trunk/src/site/images/blocks/leftz2.png jetrix/trunk/src/site/images/blocks/line1.png jetrix/trunk/src/site/images/blocks/line2.png jetrix/trunk/src/site/images/blocks/rightl1.png jetrix/trunk/src/site/images/blocks/rightl2.png jetrix/trunk/src/site/images/blocks/rightl3.png jetrix/trunk/src/site/images/blocks/rightl4.png jetrix/trunk/src/site/images/blocks/rightz1.png jetrix/trunk/src/site/images/blocks/rightz2.png jetrix/trunk/src/site/images/blocks/square.png jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java Modified: jetrix/trunk/pom.xml =================================================================== --- jetrix/trunk/pom.xml 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/pom.xml 2008-08-27 09:22:05 UTC (rev 743) @@ -12,7 +12,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and @@ -126,12 +126,14 @@ <groupId>jetty</groupId> <artifactId>jetty</artifactId> <version>4.1-rc1</version> + <optional>true</optional> </dependency> <dependency> <groupId>jcrontab</groupId> <artifactId>jcrontab</artifactId> <version>1.4.1</version> + <optional>true</optional> </dependency> <!-- Needed for testing --> @@ -139,7 +141,7 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.2</version> - <scope>tests</scope> + <scope>test</scope> </dependency> </dependencies> Modified: jetrix/trunk/project.properties =================================================================== --- jetrix/trunk/project.properties 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/project.properties 2008-08-27 09:22:05 UTC (rev 743) @@ -1,5 +1,5 @@ version=0.3-dev -version.stable=0.2.2 +version.stable=0.2.3 maven.junit.fork=true maven.junit.dir=target/test-classes Modified: jetrix/trunk/project.xml =================================================================== --- jetrix/trunk/project.xml 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/project.xml 2008-08-27 09:22:05 UTC (rev 743) @@ -19,7 +19,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and Modified: jetrix/trunk/src/etc/README =================================================================== --- jetrix/trunk/src/etc/README 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/etc/README 2008-08-27 09:22:05 UTC (rev 743) @@ -6,7 +6,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API - to let developpers add custom commands or change the channels' + to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and @@ -14,8 +14,8 @@ Installing & Running Jetrix - You need a JRE 1.5 or higher installed on your server to run Jetrix. - You can download it here : http://java.sun.com/j2se/1.5.0/download.jsp + You need Java 6 or higher installed on your server to run Jetrix. + You can download it here : http://java.sun.com/j2se/1.6.0/download.jsp Unix @@ -23,7 +23,7 @@ JAVA_HOME environnement variable pointing to your Java directory. For example on Linux you can add this line to your /etc/profile file: - export JAVA_HOME=/usr/java/jre_1.5.0 + export JAVA_HOME=/usr/java/jre_1.6.0 Then decompress the Jetrix archive to the installation directory: Modified: jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/java/net/jetrix/filter/GenericFilter.java 2008-08-27 09:22:05 UTC (rev 743) @@ -26,7 +26,7 @@ import net.jetrix.messages.*; /** - * Defines a generic filter to be used and extended by filter developpers. + * Defines a generic filter to be used and extended by filter developers. * GenericFilter makes writing filters easier by dispatching messages to an * appropriate method according to the type of this message (onPline(), * onStartGame(), etc...). Modified: jetrix/trunk/src/java/net/jetrix/filter/package.html =================================================================== --- jetrix/trunk/src/java/net/jetrix/filter/package.html 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/java/net/jetrix/filter/package.html 2008-08-27 09:22:05 UTC (rev 743) @@ -3,7 +3,7 @@ Contains concrete {@link net.jetrix.filter.MessageFilter} implementations. {@link net.jetrix.filter.GenericFilter} provides a high level implementation ready to handle all Jetrix messages. For more information regarding filters get -a look at the <a href="http://jetrix.sourceforge.net/dev-guide.php">Developper +a look at the <a href="http://jetrix.sourceforge.net/dev-guide.php">Developer Guide</a> available on the website. </body> </html> Added: jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java (rev 0) +++ jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java 2008-08-27 09:22:05 UTC (rev 743) @@ -0,0 +1,55 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.tools; + +/** + * Random number generator used by Tetrinet (ie. the Random() function in Delphi) + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetRandomGenerator +{ + private static final int INCREMENT = 1; + private static final int MULTIPLIER = 0x08088405; + private static final long MODULUS = 0x100000000L; + + private long value; + + public TetrinetRandomGenerator(int seed) + { + this.value = seed; + } + + public long getValue() + { + return value; + } + + public synchronized int nextInt(int L) { + nextValue(); + + return (int) (value * L >> 32); + } + + void nextValue() { + value = (MULTIPLIER * value + INCREMENT) % MODULUS; + } +} Property changes on: jetrix/trunk/src/java/net/jetrix/tools/TetrinetRandomGenerator.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: jetrix/trunk/src/site/dev-guide.php =================================================================== --- jetrix/trunk/src/site/dev-guide.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/dev-guide.php 2008-08-27 09:22:05 UTC (rev 743) @@ -1,17 +1,19 @@ <? include("header.inc.php") ?> -<h1>Developper Guide</h1> +<h1>Developer Guide</h1> <h2>Table of Contents</h2> <ol> + <!--<li><a href="#section0">Developing with Jetrix</a></li>--> <li><a href="#section1">Architecture</a></li> <li><a href="#section2">Protocols</a> <ul> - <li><a href="#section2-1">TetriNET</a></li> - <li><a href="#section2-2">TetriFast</a></li> - <li><a href="#section2-3">TSpec</a></li> - <li><a href="#section2-4">Query</a></li> + <li><a href="#section2-1">TetriNET 1.13</a></li> + <li><a href="#section2-2">TetriNET 1.14</a></li> + <li><a href="#section2-3">TetriFast</a></li> + <li><a href="#section2-4">TSpec</a></li> + <li><a href="#section2-5">Query</a></li> </ul> </li> <li><a href="#section3">Customization</a> @@ -23,7 +25,16 @@ </li> </ol> +<!-- +<h1><a id="section0"></a>Developing with Jetrix</h1> +@todo + +installing the JDK + +installing & using Apache Ant +--> + <h1><a id="section1"></a>Architecture</h1> Jetrix is designed around the concept of independant threads communicating asynchronously with messages. The three main entities are : @@ -39,21 +50,300 @@ <h1><a id="section2"></a>Protocols</h1> -<h2><a id="section2-1"></a>TetriNET</h2> +<h2><a id="section2-1"></a>TetriNET 1.13</h2> -<h3>Login</h3> +External references: -<h3>Channel Messages</h3> +<ul> + <li><a href="http://knarf2.cheztaz.com/tetrinet.html">Description du protocole TetriNET par knarf2 (french)</a></li> + <li><a href="http://web.archive.org/web/20040413185025/home.planetinternet.be/~m0217000/tsrv/tetrinetproto.htm">Tetrinet protocol on TSRV.COM (archived)</a></li> +</ul> -<h3>Game Messages</h3> +<h2><a id="section2-2"></a>TetriNET 1.14</h2> -<h2><a id="section2-2"></a>TetriFast</h2> +The version 1.14 of the TetriNET protocol is an extension introduced by +Olivier Vidal in August 2003 allowing players to get the same sequence of +blocks. This protocol was first integrated to a server in Jetrix 0.1.3. It +works by adding an extra parameter at the end of the newgame command: -The TetriFast protocol is quite similar to the TetriNET protocol, it has just -been slightly modified to prevent TetriFast clients to connect and cheat on -regular TetriNET servers. +<div class="code">newgame 0 1 2 1 2 1 18 <blocks frequency array> <specials frequency array> 1 1 <b>2A1C21B6</b></div> +The parameter <tt>2A1C21B6</tt> is actually the hexadecimal representation of a +32 bits integer. It determines the seed of the random number generator used by +TetriNET to generate the blocks (see bellow). The number must be zero padded +to 8 digits and use the little endian format. For example <tt>0x123</tt> will +be added as <tt>00000123</tt>. + + +<h3>TetriNET Pseudo Random Number Generator</h3> + +<p>The original TetriNET client designed by St0rmCat uses the standard random +function available in Delphi. It's basically a <a href="http://en.wikipedia.org/wiki/Linear_congruential_generator">linear congruential generator</a>, +the recursive sequence is defined by:</p> + +<div class="code">s<sub>n+1</sub> = (a.s<sub>n</sub> + c) mod M</div> + +<p>with the following parameters:</p> + +<div class="code">a = 0x08088405 +c = 1 +M = 2<sup>32</sup> +</div> + +<p>The seed s<sub><small>0</small></sub> is determined by the last parameter of +the <tt>newgame</tt> message. This sequence gives pseudo random integers between +0 and 2<sup><small>32</small></sup> - 1, but an integer in the [0, 100[ +range is required for selecting the block, and an integer in the [0, 4[ range +for the orientation of the block. So the result is multiplied by the length of +the range and divided by 2<sup><small>32</small></sup>:</p> + +<div class="code">I<sub>n</sub> = s<sub>n</sub> * L / 2<sup><small>32</small></sup></div> + +<p>Where L=100 to select the block and L=4 to select its orientation. The +sequence s<sub><small>n</small></sub> is evaluated twice to determine each block, first for the block +and then for its orientation.</p> + +<p>The following table defines the orientations for each type of block :</p> + +<table class="thin"> + <tr> + <th width="100">Orientation</th> + <th width="75">0</th> + <th width="75">1</th> + <th width="75">2</th> + <th width="75">3</th> + </tr> + <tr> + <th>Line</th> + <td><img src="images/blocks/line1.png" alt="Line"/></td> + <td><img src="images/blocks/line2.png" alt="Line"/></td> + <td><img src="images/blocks/line1.png" alt="Line"/></td> + <td><img src="images/blocks/line2.png" alt="Line"/></td> + </tr> + <tr> + <th>Square</th> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + <td><img src="images/blocks/square.png" alt="Square"/></td> + </tr> + <tr> + <th>Left L</th> + <td><img src="images/blocks/leftl1.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl2.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl3.png" alt="Left L"/></td> + <td><img src="images/blocks/leftl4.png" alt="Left L"/></td> + </tr> + <tr> + <th>Right L</th> + <td><img src="images/blocks/rightl1.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl2.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl3.png" alt="Right L"/></td> + <td><img src="images/blocks/rightl4.png" alt="Right L"/></td> + </tr> + <tr> + <th>Left Z</th> + <td><img src="images/blocks/leftz1.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz2.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz1.png" alt="Left Z"/></td> + <td><img src="images/blocks/leftz2.png" alt="Left Z"/></td> + </tr> + <tr> + <th>Right Z</th> + <td><img src="images/blocks/rightz1.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz2.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz1.png" alt="Right Z"/></td> + <td><img src="images/blocks/rightz2.png" alt="Right Z"/></td> + </tr> + <tr> + <th>Half Cross</th> + <td><img src="images/blocks/halfcross1.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross2.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross3.png" alt="Half Cross"/></td> + <td><img src="images/blocks/halfcross4.png" alt="Half Cross"/></td> + </tr> +</table> + + + +<h3>Examples</h3> + +<p>Here are some examples of block sequences for different seed values. This might +help client programmers to validate their random number generator. The frequencies +for these examples are :</p> + +<table class="thin" style="width: 300px"> + <tr> + <th align="center" colspan="2">Block</th> + <th align="center" width="30%">Frequency</th> + </tr> + <tr> + <td align="center" width="10%">1</td> + <td align="center"><img src="/images/blocks/small/line.png" alt="Line" /></td> + <td align="center">15 %</td> + </tr> + <tr> + <td align="center">2</td> + <td align="center"><img src="/images/blocks/small/square.png" alt="Square" /></td> + <td align="center">15 %</td> + </tr> + <tr> + <td align="center">3</td> + <td align="center"><img src="/images/blocks/small/leftl.png" alt="Left L" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">4</td> + <td align="center"><img src="/images/blocks/small/rightl.png" alt="Right L" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">5</td> + <td align="center"><img src="/images/blocks/small/leftz.png" alt="Left Z" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">6</td> + <td align="center"><img src="/images/blocks/small/rightz.png" alt="Right Z" /></td> + <td align="center">14 %</td> + </tr> + <tr> + <td align="center">7</td> + <td align="center"><img src="/images/blocks/small/halfcross.png" alt="Half Cross" /></td> + <td align="center">14 %</td> + </tr> +</table> + +<br /> + +The corresponding frequency table is : + +<div class="code">F = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, + 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,4,4,4,4,4,4, + 5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7]</div> + +<p>For this example the value of the seed is 0.</p> + +<table class="thin"> + <tr> + <th width="100">Blocks</th> + <th width="150">Sequence</th> + <th width="100">Index</th> + <th width="100">Result</th> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 1</td> + <td>s1 = 0x00000001</td> + <td>0</td> + <td rowspan="2" valign="middle"><img src="images/blocks/line1.png" alt="Line"/></td> + </tr> + <tr> + <td>s2 = 0x08088406</td> + <td>0</td> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 2</td> + <td>s3 = 0xDC6DAC1F</td> + <td>86</td> + <td rowspan="2" valign="middle"><img src="images/blocks/halfcross1.png" alt="Half Cross"/></td> + </tr> + <tr> + <td>s4 = 0x33DC589C</td> + <td>0</td> + </tr> + <tr> + <td rowspan="2" valign="middle">Block 3</td> + <td>s5 = 0x45DE2B0D</td> + <td>27</td> + <td rowspan="2" valign="middle"><img src="images/blocks/square.png" alt="Square"/></td> + </tr> + <tr> + <td>s6 = 0xABF18B42</td> + <td>2</td> + </tr> + + <tr> + <td rowspan="2" valign="middle">Block 4</td> + <td>s7 = 0x5195C04B</td> + <td>31</td> + <td rowspan="2" valign="middle"><img src="images/blocks/leftl1.png" alt="Left L"/></td> + </tr> + <tr> + <td>s8 = 0x296B6D78</td> + <td>0</td> + </tr> +</table> + + +<p>Here are the 10 first blocks for different seed values:</p> + +<table class="thin" cellspacing="1"> + <tbody> + <tr> + <th>Seed</th> + <th>Sequence</th> + </tr> + <tr> + <td>0x00000000</td> + <td> + <img src="images/blocks/line1.png"/> + <img src="images/blocks/halfcross1.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/leftl1.png"/> + <img src="images/blocks/leftl4.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/halfcross4.png"/> + <img src="images/blocks/leftz2.png"/> + </td> + </tr> + <tr> + <td>0xAABBCCDD</td> + <td> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/leftl1.png"/> + <img src="images/blocks/leftl3.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/square.png"/> + <img src="images/blocks/rightl4.png"/> + <img src="images/blocks/halfcross3.png"/> + <img src="images/blocks/rightl1.png"/> + </td> + </tr> + <tr> + <td>0x12345678</td> + <td> + <img src="images/blocks/leftz2.png"/> + <img src="images/blocks/leftz2.png"/> + <img src="images/blocks/halfcross2.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/leftl2.png"/> + <img src="images/blocks/rightz1.png"/> + <img src="images/blocks/rightz2.png"/> + <img src="images/blocks/halfcross1.png"/> + <img src="images/blocks/line2.png"/> + <img src="images/blocks/rightl1.png"/> + </td> + </tr> + </tbody> +</table> + + +<h2><a id="section2-3"></a>TetriFast</h2> + +TetriFast is a modified TetriNET client that removes the delay between the +block fall and the showing of next block. The TetriFast protocol is quite +similar to the TetriNET protocol, it has just been slightly modified to prevent +TetriFast clients to connect and cheat on regular TetriNET servers. + <h3>Login</h3> TetriFast clients connect on the same port as TetriNET client, that's 31457. The @@ -72,10 +362,10 @@ -<h2><a id="section2-3"></a>TSpec</h2> +<h2><a id="section2-4"></a>TSpec</h2> -<h2><a id="section2-4"></a>Query</h2> +<h2><a id="section2-5"></a>Query</h2> Tetrix first introduced a query protocol to get easily a list of players and channels on TetriNET servers. This protocol consists in 4 commands : Property changes on: jetrix/trunk/src/site/images/blocks/halfcross1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/halfcross4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftl4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftz1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/leftz2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/line1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/line2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl3.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightl4.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightz1.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/rightz2.png ___________________________________________________________________ Added: svn:mime-type + image/png Property changes on: jetrix/trunk/src/site/images/blocks/square.png ___________________________________________________________________ Added: svn:mime-type + image/png Modified: jetrix/trunk/src/site/index.php =================================================================== --- jetrix/trunk/src/site/index.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/index.php 2008-08-27 09:22:05 UTC (rev 743) @@ -5,7 +5,7 @@ Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability, extensibility and ease of use. It features a web based administration console and a simple API -to let developpers add custom commands or change the channels' +to let developers add custom commands or change the channels' behavior with little knowledge of the server's inner functioning. The ambitious goal of this project is to create the ideal plateform for server side TetriNET programmers. Jetrix is open source and Modified: jetrix/trunk/src/site/menu.inc.php =================================================================== --- jetrix/trunk/src/site/menu.inc.php 2008-08-26 13:31:14 UTC (rev 742) +++ jetrix/trunk/src/site/menu.inc.php 2008-08-27 09:22:05 UTC (rev 743) @@ -19,7 +19,7 @@ <h1>Documentation</h1> <ul> <li><a href="user-guide.php">User Guide</a></li> - <li><a href="dev-guide.php">Developper Guide</a></li> + <li><a href="dev-guide.php">Developer Guide</a></li> <li><a href="javadoc.php">Javadoc</a></li> <li><a href="docs/project-reports.html">Project Reports</a></li> </ul> Added: jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java =================================================================== --- jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java (rev 0) +++ jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java 2008-08-27 09:22:05 UTC (rev 743) @@ -0,0 +1,68 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.tools; + +import junit.framework.TestCase; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class TetrinetRandomGeneratorTest extends TestCase +{ + public void testRandom() { + TetrinetRandomGenerator generator = new TetrinetRandomGenerator(0); + + assertEquals("s0", 0x00000000L, generator.getValue()); + generator.nextValue(); + assertEquals("s1", 0x00000001L, generator.getValue()); + generator.nextValue(); + assertEquals("s2", 0x08088406L, generator.getValue()); + generator.nextValue(); + assertEquals("s3", 0xDC6DAC1FL, generator.getValue()); + generator.nextValue(); + assertEquals("s4", 0x33DC589CL, generator.getValue()); + generator.nextValue(); + assertEquals("s5", 0x45DE2B0DL, generator.getValue()); + } + + public void testNextInt() { + TetrinetRandomGenerator generator = new TetrinetRandomGenerator(0); + + assertEquals("i1", 0x00, generator.nextInt(100)); + assertEquals("i2", 0x00, generator.nextInt(4)); + assertEquals("i3", 0x56, generator.nextInt(100)); + assertEquals("i4", 0x00, generator.nextInt(4)); + assertEquals("i5", 0x1B, generator.nextInt(100)); + assertEquals("i6", 0x02, generator.nextInt(4)); + assertEquals("i7", 0x1F, generator.nextInt(100)); + assertEquals("i8", 0x00, generator.nextInt(4)); + assertEquals("i9", 0x25, generator.nextInt(100)); + assertEquals("i10", 0x01, generator.nextInt(4)); + assertEquals("i11", 0x08, generator.nextInt(100)); + assertEquals("i12", 0x01, generator.nextInt(4)); + assertEquals("i13", 0x07, generator.nextInt(100)); + assertEquals("i14", 0x03, generator.nextInt(4)); + assertEquals("i15", 0x05, generator.nextInt(100)); + assertEquals("i16", 0x01, generator.nextInt(4)); + assertEquals("i17", 0x5B, generator.nextInt(100)); + assertEquals("i18", 0x01, generator.nextInt(4)); + } +} Property changes on: jetrix/trunk/src/test/net/jetrix/tools/TetrinetRandomGeneratorTest.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-26 13:31:19
|
Revision: 742 http://jetrix.svn.sourceforge.net/jetrix/?rev=742&view=rev Author: smanux Date: 2008-08-26 13:31:14 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Added the player stats Modified Paths: -------------- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java monitor/trunk/src/main/resources/applicationContext.xml monitor/trunk/src/main/resources/hibernate-mapping.xml monitor/trunk/src/main/webapp/server.jsp Added Paths: ----------- monitor/trunk/src/main/java/net/jetrix/monitor/PlayerStats.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/PlayerStatsDao.java monitor/trunk/src/main/webapp/player.jsp Added: monitor/trunk/src/main/java/net/jetrix/monitor/PlayerStats.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/PlayerStats.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/PlayerStats.java 2008-08-26 13:31:14 UTC (rev 742) @@ -0,0 +1,115 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.Date; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class PlayerStats +{ + private String name; + private String team; + private String channel; + private Date firstSeen; + private Date lastSeen; + private Date lastPlayed; + private ServerInfo lastServer; + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getTeam() + { + return team; + } + + public void setTeam(String team) + { + this.team = team; + } + + public String getChannel() + { + return channel; + } + + public void setChannel(String channel) + { + this.channel = channel; + } + + public Date getFirstSeen() + { + return firstSeen; + } + + public void setFirstSeen(Date firstSeen) + { + this.firstSeen = firstSeen; + } + + public Date getLastSeen() + { + return lastSeen; + } + + public void setLastSeen(Date lastSeen) + { + this.lastSeen = lastSeen; + } + + public Date getLastPlayed() + { + return lastPlayed; + } + + public void setLastPlayed(Date lastPlayed) + { + this.lastPlayed = lastPlayed; + } + + public ServerInfo getLastServer() + { + return lastServer; + } + + public void setLastServer(ServerInfo lastServer) + { + this.lastServer = lastServer; + } + + /** + * Tells if the player has been active in the last 15 minutes. + */ + public boolean isActive() + { + return lastPlayed != null && lastPlayed.getTime() > System.currentTimeMillis() - 15 * 60 * 1000; + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/PlayerStats.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-26 13:28:21 UTC (rev 741) +++ monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-26 13:31:14 UTC (rev 742) @@ -91,4 +91,24 @@ return result.toString(); } + + /** + * Remove the style markers from the specified string. + * + * @param text + */ + public static String strip(String text) + { + StringBuilder result = new StringBuilder(); + + for (char c : text.toCharArray()) + { + if (!STYLES.keySet().contains(c)) + { + result.append(c); + } + } + + return result.toString(); + } } Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/PlayerStatsDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/PlayerStatsDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/PlayerStatsDao.java 2008-08-26 13:31:14 UTC (rev 742) @@ -0,0 +1,41 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import net.jetrix.monitor.PlayerStats; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class PlayerStatsDao extends HibernateDaoSupport +{ + public PlayerStats getStats(String name) + { + return (PlayerStats) getSession().get(PlayerStats.class, name); + } + + public void save(PlayerStats stats) + { + getSession().saveOrUpdate(stats); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/PlayerStatsDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Modified: monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java 2008-08-26 13:28:21 UTC (rev 741) +++ monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java 2008-08-26 13:31:14 UTC (rev 742) @@ -37,11 +37,14 @@ import net.jetrix.agent.QueryAgent; import net.jetrix.agent.QueryInfo; +import net.jetrix.agent.PlayerInfo; import net.jetrix.monitor.NetworkUtils; import net.jetrix.monitor.ServerInfo; import net.jetrix.monitor.ServerStats; +import net.jetrix.monitor.PlayerStats; import net.jetrix.monitor.dao.ServerInfoDao; import net.jetrix.monitor.dao.ServerStatsDao; +import net.jetrix.monitor.dao.PlayerStatsDao; /** * Job polling the tetrinet servers. @@ -56,6 +59,7 @@ ApplicationContext context = (ApplicationContext) jobExecutionContext.getMergedJobDataMap().get("applicationContext"); ServerInfoDao serverInfoDao = (ServerInfoDao) context.getBean("serverInfoDao"); ServerStatsDao serverStatsDao = (ServerStatsDao) context.getBean("serverStatsDao"); + PlayerStatsDao playerStatsDao = (PlayerStatsDao) context.getBean("playerStatsDao"); List<ServerInfo> servers = serverInfoDao.getServers(); @@ -76,10 +80,16 @@ for (Future<ServerInfo> result : results) { - try { + try + { ServerInfo server = result.get(); + if (!server.isOnline()) + { + server.getPlayers().clear(); + } serverInfoDao.save(server); + // update the server stats for the activity graph ServerStats stats = server.getStats(); stats.setServerId(server.getId()); stats.setDate(server.getLastChecked()); @@ -87,9 +97,35 @@ { serverStatsDao.save(stats); } - } catch (ExecutionException e) { + + // update the player stats + for (PlayerInfo player : server.getPlayers()) + { + PlayerStats playerStats = playerStatsDao.getStats(player.getNick()); + if (playerStats == null) + { + playerStats = new PlayerStats(); + playerStats.setName(player.getNick()); + playerStats.setFirstSeen(server.getLastOnline()); + } + + playerStats.setTeam(player.getTeam()); + playerStats.setLastSeen(server.getLastOnline()); + playerStats.setLastServer(server); + if (player.isPlaying()) + { + playerStats.setLastPlayed(server.getLastOnline()); + } + + playerStatsDao.save(playerStats); + } + } + catch (ExecutionException e) + { log.log(Level.WARNING, "Error when checking the server", e); - } catch (CancellationException e) { + } + catch (CancellationException e) + { log.log(Level.WARNING, "Server survey task cancelled", e); } } Modified: monitor/trunk/src/main/resources/applicationContext.xml =================================================================== --- monitor/trunk/src/main/resources/applicationContext.xml 2008-08-26 13:28:21 UTC (rev 741) +++ monitor/trunk/src/main/resources/applicationContext.xml 2008-08-26 13:31:14 UTC (rev 742) @@ -37,6 +37,7 @@ <bean id="serverInfoDao" class="net.jetrix.monitor.dao.ServerInfoDao"/> <bean id="serverStatsDao" class="net.jetrix.monitor.dao.ServerStatsDao"/> + <bean id="playerStatsDao" class="net.jetrix.monitor.dao.PlayerStatsDao"/> <bean id="ipToCountryDao" class="net.jetrix.monitor.dao.IpToCountryDao"/> </beans> Modified: monitor/trunk/src/main/resources/hibernate-mapping.xml =================================================================== --- monitor/trunk/src/main/resources/hibernate-mapping.xml 2008-08-26 13:28:21 UTC (rev 741) +++ monitor/trunk/src/main/resources/hibernate-mapping.xml 2008-08-26 13:31:14 UTC (rev 742) @@ -11,9 +11,10 @@ <property name="IP" column="ip"/> <property name="version" column="version"/> <property name="description" column="description"/> - <property name="spectate" column="spec" not-null="true"/> <property name="country" column="country"/> <property name="website" column="website"/> + <property name="spectate" column="spec" not-null="true"/> + <property name="spectatorPassword" column="spec_pass"/> <property name="dateAdded" column="date_added"/> <property name="lastChecked" column="last_checked"/> @@ -77,4 +78,17 @@ <property name="activeChannelCount" column="active_channel_count" not-null="true"/> </class> + <class name="net.jetrix.monitor.PlayerStats" table="player_stat"> + <id name="name" column="name"> + <generator class="assigned"/> + </id> + <many-to-one name="lastServer" column="server"/> + <property name="channel" column="channel"/> + <property name="team" column="team"/> + + <property name="firstSeen" column="first_seen"/> + <property name="lastSeen" column="last_seen"/> + <property name="lastPlayed" column="last_played"/> + </class> + </hibernate-mapping> Added: monitor/trunk/src/main/webapp/player.jsp =================================================================== --- monitor/trunk/src/main/webapp/player.jsp (rev 0) +++ monitor/trunk/src/main/webapp/player.jsp 2008-08-26 13:31:14 UTC (rev 742) @@ -0,0 +1,52 @@ +<%@ page import="org.springframework.web.context.ContextLoader" %> +<%@ page import="org.springframework.web.context.WebApplicationContext" %> +<%@ page import="net.jetrix.monitor.PlayerStats" %> +<%@ page import="net.jetrix.monitor.dao.PlayerStatsDao" %> +<%@ page import="net.jetrix.monitor.StyleUtils" %> +<% + WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); + PlayerStatsDao dao = (PlayerStatsDao) context.getBean("playerStatsDao"); + + PlayerStats player = dao.getStats(request.getParameter("id")); + +%> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <title>TetriNET Player - <%= StyleUtils.strip(player.getName()) %></title> + <link rel="stylesheet" type="text/css" href="stylesheets/style.css"> + <link rel="Shorcut Icon" href="favicon.ico"> +</head> +<body> + +<h1>TetriNET Player - <%= StyleUtils.strip(player.getName()) %></h1> + +<table class="thin" border="1" cellspacing="0" style="min-width: 40%"> + <tr> + <th width="25%">First Seen</th> + <td><%= player.getFirstSeen() %></td> + </tr> + <tr> + <th>Last Seen</th> + <td><%= player.getLastSeen() %></td> + </tr> + <tr> + <th>Last Played</th> + <td><%= player.getLastPlayed() != null ? player.getLastPlayed() : "-" %></td> + </tr> + <tr> + <th>Server</th> + <td><a href="server.jsp?id=<%= player.getLastServer().getId() %>"><%= player.getLastServer().getHostname() %></a></td> + </tr> + <tr> + <th>Channel</th> + <td><%= player.getChannel() != null ? player.getChannel() : "" %></td> + </tr> + <tr> + <th>Team</th> + <td><%= player.getTeam() != null ? player.getTeam() : "" %></td> + </tr> +</table> + +</body> +</html> Modified: monitor/trunk/src/main/webapp/server.jsp =================================================================== --- monitor/trunk/src/main/webapp/server.jsp 2008-08-26 13:28:21 UTC (rev 741) +++ monitor/trunk/src/main/webapp/server.jsp 2008-08-26 13:31:14 UTC (rev 742) @@ -130,7 +130,7 @@ <tbody> <% for (PlayerInfo player : server.getPlayers()) { %> <tr> - <td<%= player.getAuthenticationLevel() > 1 ? " style=\"font-weight: bold\"" : "" %>><%= StyleUtils.toHTML(player.getNick()) %></td> + <td<%= player.getAuthenticationLevel() > 1 ? " style=\"font-weight: bold\"" : "" %>><a style="text-decoration: none; color: black" href="player.jsp?id=<%= player.getNick() %>"><%= StyleUtils.toHTML(player.getNick()) %></a></td> <td><%= StyleUtils.toHTML(player.getTeam()) %></td> <td><%= player.getChannel() %></td> <td><%= player.getSlot() %></td> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-26 13:28:24
|
Revision: 741 http://jetrix.svn.sourceforge.net/jetrix/?rev=741&view=rev Author: smanux Date: 2008-08-26 13:28:21 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Offline servers are no longer listed Modified Paths: -------------- monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java monitor/trunk/src/main/webapp/index.jsp monitor/trunk/src/main/webapp/servers-xml.jsp Modified: monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java 2008-08-26 07:36:28 UTC (rev 740) +++ monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java 2008-08-26 13:28:21 UTC (rev 741) @@ -39,9 +39,10 @@ private String IP; private String version; private String description; - private boolean spectate; private String country; private String website; + private boolean spectate; + private String spectatorPassword; private Date dateAdded; private Date lastChecked; @@ -110,16 +111,6 @@ this.description = description; } - public boolean isSpectate() - { - return spectate; - } - - public void setSpectate(boolean spectate) - { - this.spectate = spectate; - } - public String getCountry() { return country; @@ -140,6 +131,26 @@ this.website = website; } + public boolean isSpectate() + { + return spectate; + } + + public void setSpectate(boolean spectate) + { + this.spectate = spectate; + } + + public String getSpectatorPassword() + { + return spectatorPassword; + } + + public void setSpectatorPassword(String spectatorPassword) + { + this.spectatorPassword = spectatorPassword; + } + public Date getDateAdded() { return dateAdded; @@ -249,4 +260,12 @@ { this.aliases = aliases; } + + /** + * Tells if the server has been online in the last 15 minutes. + */ + public boolean isOnline() + { + return lastOnline != null && lastOnline.getTime() > System.currentTimeMillis() - 15 * 60 * 1000; + } } Modified: monitor/trunk/src/main/webapp/index.jsp =================================================================== --- monitor/trunk/src/main/webapp/index.jsp 2008-08-26 07:36:28 UTC (rev 740) +++ monitor/trunk/src/main/webapp/index.jsp 2008-08-26 13:28:21 UTC (rev 741) @@ -5,7 +5,6 @@ <%@ page import="org.springframework.web.context.WebApplicationContext" %> <%@ page import="net.jetrix.monitor.ServerInfo" %> <%@ page import="net.jetrix.monitor.dao.ServerInfoDao" %> -<%@ page import="java.util.TimeZone" %> <% WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); @@ -14,8 +13,13 @@ List<ServerInfo> servers = dao.getServers(); int totalPlayerCount = 0; + int serverCount = 0; Date lastChecked = null; for (ServerInfo server : servers) { + if (server.isOnline()) { + serverCount++; + } + totalPlayerCount += server.getStats().getPlayerCount(); if (lastChecked == null || (server.getLastChecked() != null && server.getLastChecked().after(lastChecked))) { lastChecked = server.getLastChecked(); @@ -39,7 +43,7 @@ <p>This is a list of the public TetriNET servers. The list is refreshed every 5 minutes. Feel free to add your favorite server if it's not in the list.</p> -<p>There are currently <b><%= totalPlayerCount %></b> players online on <b><%= servers.size() %></b> servers. The +<p>There are currently <b><%= totalPlayerCount %></b> players online on <b><%= serverCount %></b> servers. The servers were last checked on <%= lastChecked %>.</p> <table class="thin sortable" id="serverlist" border="1" align="center"> @@ -55,7 +59,12 @@ </tr> </thead> <tbody> -<% for (ServerInfo server : servers) { %> +<% for (ServerInfo server : servers) { + // skip offline servers + if (!server.isOnline()) { + continue; + } +%> <tr> <td><a href="server.jsp?id=<%= server.getId() %>"><%= server.getHostname() %></a></td> <td align="center"> Modified: monitor/trunk/src/main/webapp/servers-xml.jsp =================================================================== --- monitor/trunk/src/main/webapp/servers-xml.jsp 2008-08-26 07:36:28 UTC (rev 740) +++ monitor/trunk/src/main/webapp/servers-xml.jsp 2008-08-26 13:28:21 UTC (rev 741) @@ -14,7 +14,12 @@ List<ServerInfo> servers = dao.getServers(); %> <tetrinet-servers> -<% for (ServerInfo server : servers) { %> +<% for (ServerInfo server : servers) { + // skip offline servers + if (!server.isOnline()) { + continue; + } +%> <server id="<%= server.getId() %>" name="<%= server.getHostname() %>" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-26 07:36:30
|
Revision: 740 http://jetrix.svn.sourceforge.net/jetrix/?rev=740&view=rev Author: smanux Date: 2008-08-26 07:36:28 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Tagging release 0.2.3 Added Paths: ----------- jetrix/tags/0.2.3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-26 07:33:12
|
Revision: 739 http://jetrix.svn.sourceforge.net/jetrix/?rev=739&view=rev Author: smanux Date: 2008-08-26 07:33:09 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Updated the changelog for Jetrix 0.2.3 Modified Paths: -------------- jetrix/branches/0.2.x/doc/changelog.txt Modified: jetrix/branches/0.2.x/doc/changelog.txt =================================================================== --- jetrix/branches/0.2.x/doc/changelog.txt 2008-08-26 07:31:46 UTC (rev 738) +++ jetrix/branches/0.2.x/doc/changelog.txt 2008-08-26 07:33:09 UTC (rev 739) @@ -34,7 +34,13 @@ - partial name matching for /goto - cheat control: count the specials seen in the field and check the specials sent +Changes in version 0.2.3 (2008-08-22) +------------------------------------- +- Fixed a bug in the mode 4 (25% pure) of the #custom channel that was causing a crash of the classic tnet 1.13 client +- The address of the server is now published to http://servers.tetrinet.fr instead of tsrv.com, tetrinet.org and tfast.org + + Changes in version 0.2.2 (2005-04-07) ------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-26 07:31:51
|
Revision: 738 http://jetrix.svn.sourceforge.net/jetrix/?rev=738&view=rev Author: smanux Date: 2008-08-26 07:31:46 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Updated the changelog for Jetrix 0.2.3 Modified Paths: -------------- jetrix/trunk/doc/changelog.txt jetrix/trunk/src/site/changelog.php Modified: jetrix/trunk/doc/changelog.txt =================================================================== --- jetrix/trunk/doc/changelog.txt 2008-08-22 15:27:52 UTC (rev 737) +++ jetrix/trunk/doc/changelog.txt 2008-08-26 07:31:46 UTC (rev 738) @@ -24,12 +24,20 @@ - removed the dependency on JDIC +Changes in version 0.2.3 (2008-08-23) +------------------------------------- + +- Fixed a bug in the mode 4 (25% pure) of the #custom channel that was causing a crash of the classic tnet 1.13 client +- The address of the server is now published to http://servers.tetrinet.fr instead of tsrv.com, tetrinet.org and tfast.org + + Changes in version 0.2.2 (2005-04-07) ------------------------------------- - Fixed a bug preventing the clients from connecting to a server with a default charset different from ISO-8859-1 - The configuration is no longer broken by a "&" char in the description of a channel + Changes in version 0.2.1 (2005-02-18) ------------------------------------- @@ -39,6 +47,7 @@ - Running Jetrix with jetrix.exe no longer saturate the CPU - Fixed a bug preventing the execution of several query commands with the same connection + Changes in version 0.2.1 (2005-02-18) ------------------------------------- Modified: jetrix/trunk/src/site/changelog.php =================================================================== --- jetrix/trunk/src/site/changelog.php 2008-08-22 15:27:52 UTC (rev 737) +++ jetrix/trunk/src/site/changelog.php 2008-08-26 07:31:46 UTC (rev 738) @@ -3,12 +3,20 @@ <h1>Changelog</h1> <pre> +Changes in version 0.2.3 (2008-08-23) +------------------------------------- + +- Fixed a bug in the mode 4 (25% pure) of the #custom channel that was causing a crash of the classic tnet 1.13 client +- The address of the server is now published to http://servers.tetrinet.fr instead of tsrv.com, tetrinet.org and tfast.org + + Changes in version 0.2.2 (2005-04-07) ------------------------------------- - Fixed a bug preventing the clients from connecting to a server with a default charset different from ISO-8859-1 - The configuration is no longer broken by a "&" char in the description of a channel + Changes in version 0.2.1 (2005-02-18) ------------------------------------- @@ -18,6 +26,7 @@ - Running Jetrix with jetrix.exe no longer saturate the CPU - Fixed a bug preventing the execution of several query commands with the same connection + Changes in version 0.2 (2005-01-18) ----------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 15:27:55
|
Revision: 737 http://jetrix.svn.sourceforge.net/jetrix/?rev=737&view=rev Author: smanux Date: 2008-08-22 15:27:52 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Publish the server address to servers.tetrinet.fr only since the other directories are no longer available Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/services/PublishingService.java Modified: jetrix/trunk/src/java/net/jetrix/services/PublishingService.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2008-08-22 15:11:15 UTC (rev 736) +++ jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2008-08-22 15:27:52 UTC (rev 737) @@ -60,7 +60,7 @@ public PublishingService() { setDelay(1000); - setPeriod(24 * 3600 * 1000); + setPeriod(24 * 3600 * 1000); // 24 hours } public void setHost(String host) @@ -91,32 +91,18 @@ log.info("Publishing server address to online directories... (" + host + ")"); - // publishing to tetrinet.org + // publishing to servers.tetrinet.fr try { - String url = "http://slummy.tetrinet.org/grav/slummy_addsvr.pl"; + String url = "http://servers.tetrinet.fr/server-add.jsp"; Map<String, String> params = new HashMap<String, String>(); - params.put("qname", host); - params.put("submit_bt", "Add Server"); - post(url, params); - } - catch (IOException e) - { - e.printStackTrace(); - } - - // publishing to tsrv.com - try - { - String url = "http://dieterdhoker.mine.nu:8280/cgi-bin/TSRV/submitserver.pl"; - Map<String, String> params = new HashMap<String, String>(); params.put("hostname", host); params.put("description", Server.getInstance().getConfig().getName()); post(url, params); } catch (IOException e) { - e.printStackTrace(); + log.log(Level.WARNING, "Unable to publish the server on http://servers.tetrinet.fr", e); } } @@ -168,7 +154,7 @@ // send the request conn.connect(); - if (log.isLoggable(Level.FINE)) + if (log.isLoggable(Level.FINE) && conn.getResponseCode() >= 400) { log.fine("Response: " + conn.getResponseCode() + " - " + conn.getResponseMessage()); @@ -182,7 +168,6 @@ in.close(); } - } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 15:11:22
|
Revision: 736 http://jetrix.svn.sourceforge.net/jetrix/?rev=736&view=rev Author: smanux Date: 2008-08-22 15:11:15 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Site update Modified Paths: -------------- jetrix/trunk/build.xml jetrix/trunk/src/site/changelog.php jetrix/trunk/src/site/features.php jetrix/trunk/src/site/header.inc.php jetrix/trunk/src/site/menu.inc.php jetrix/trunk/src/site/style.css Added Paths: ----------- jetrix/trunk/src/site/favicon.ico jetrix/trunk/src/site/jetrix-rss.xsl Removed Paths: ------------- jetrix/trunk/src/site/images/favicon.gif Modified: jetrix/trunk/build.xml =================================================================== --- jetrix/trunk/build.xml 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/build.xml 2008-08-22 15:11:15 UTC (rev 736) @@ -360,7 +360,64 @@ <fileset dir="${deploy}/jetrix-${version}"/> </ftp> </target> + + <target name="site" description="Generate and publish the web site to SourceForge"> + <!-- Create the site distribution directory --> + <mkdir dir="${dist}/site/docs"/> + <!-- Build the project reports --> + <property environment="env"/> + <exec executable="${env.MAVEN2_HOME}/bin/mvn.bat"> + <arg line="site"/> + </exec> + + <!-- Copy the project reports --> + <copy todir="${dist}/site/docs"> + <fileset dir="target/site"/> + </copy> + + <!-- Copy the site --> + <property file="project.properties"/> + <filter token="version.stable" value="${version.stable}"/> + <filter token="version" value="${version}"/> + <copy todir="${dist}/site" filtering="true" overwrite="true"> + <fileset dir="src/site"> + <exclude name="**/*.png"/> + <exclude name="**/*.ico"/> + </fileset> + </copy> + <copy todir="${dist}/site" overwrite="true"> + <fileset dir="src/site"> + <include name="**/*.png"/> + <include name="**/*.ico"/> + </fileset> + </copy> + + <!-- Update the news from the RSS feed --> + <get src="http://sourceforge.net/export/rss2_projnews.php?group_id=52188&rss_fulltext=1" + dest="${dist}/site/jetrix-rss.xml"/> + <xslt in="${dist}/site/jetrix-rss.xml" out="${dist}/site//news.html" style="src/site/jetrix-rss.xsl"/> + <replace file="${dist}/site/news.html"> + <replacefilter token="&gt;" value=">"/> + <replacefilter token="&lt;" value="<"/> + <replacefilter token="<br>" value="<br />"/> + </replace> + <replaceregexp file="${dist}/site/news.html" byline="true"> + <regexp pattern="\(<a href=.*comments</a>\)"/> + <substitution expression=" "/> + </replaceregexp> + + <tar destfile="${dist}/site.tar.bz2" compression="bzip2"> + <tarfileset dir="${dist}/site"/> + </tar> + + <input addproperty="password" message="Password:"/> + + <scp file="${dist}/site.tar.bz2" todir="smanux:${password}@shell.sf.net:/home/users/s/sm/smanux" trust="true"/> + + <sshexec host="shell.sf.net" username="smanux" password="${password}" trust="true" command="tar -jxf site.tar.bz2 --directory=/home/groups/j/je/jetrix/htdocs "/> + </target> + <target name="clean"> <!-- Delete the ${build} directory tree --> <delete dir="${dist}"/> Modified: jetrix/trunk/src/site/changelog.php =================================================================== --- jetrix/trunk/src/site/changelog.php 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/src/site/changelog.php 2008-08-22 15:11:15 UTC (rev 736) @@ -7,7 +7,7 @@ ------------------------------------- - Fixed a bug preventing the clients from connecting to a server with a default charset different from ISO-8859-1 -- The configuration is no longer broken by a "&" char in the description of a channel +- The configuration is no longer broken by a "&" char in the description of a channel Changes in version 0.2.1 (2005-02-18) ------------------------------------- Modified: jetrix/trunk/src/site/features.php =================================================================== --- jetrix/trunk/src/site/features.php 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/src/site/features.php 2008-08-22 15:11:15 UTC (rev 736) @@ -1,11 +1,5 @@ <? include("header.inc.php") ?> -<style type="text/css"> -.done { list-style-image: url("images/done.png") } -.planned { list-style-image: url("images/planned.png") } -.partial { list-style-image: url("images/partial.png") } -</style> - <h1>Features</h1> <b>Legend:</b> @@ -42,7 +36,7 @@ <li class="done"> TetriFast clients</li> <li class="done"> Block synchronization protocol (1.14)</li> <li class="done"> TSpec clients</li> - <li class="planned"> Flash clients</li> + <!--<li class="planned"> Flash clients</li>--> <li class="done"> Query protocol</li> <li class="partial"> IRC clients</li> </ul> Modified: jetrix/trunk/src/site/header.inc.php =================================================================== --- jetrix/trunk/src/site/header.inc.php 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/src/site/header.inc.php 2008-08-22 15:11:15 UTC (rev 736) @@ -15,7 +15,7 @@ <meta name="description" content="Jetrix is a new generation TetriNET server written in Java and designed for maximum scalability and extensibility." /> <meta name="keywords" content="jetrix, tetrinet, server, tnet, tetrifast, tfast, tspec, tetris, tetrix, java" /> <link rel="stylesheet" href="style.css" /> - <link rel="shortcut icon" href="images/favicon.gif" /> + <link rel="shorcut icon" type="image/x-icon" href="favicon.ico" /> <link rel="alternate" type="application/rss+xml" title="RSS" href="http://sourceforge.net/export/rss2_projnews.php?group_id=52188&rss_fulltext=1" /> <title>Jetrix TetriNET Server</title> </head> Added: jetrix/trunk/src/site/jetrix-rss.xsl =================================================================== --- jetrix/trunk/src/site/jetrix-rss.xsl (rev 0) +++ jetrix/trunk/src/site/jetrix-rss.xsl 2008-08-22 15:11:15 UTC (rev 736) @@ -0,0 +1,14 @@ +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:output method="html" indent="yes"/> + + <xsl:template match="item"> + <div class="news"> + <h2><xsl:value-of select="title"/></h2> + <div class="newsdate"><xsl:value-of select="pubDate"/></div> + <div class="newstext"><xsl:value-of select="description"/></div> + </div> + </xsl:template> + + <xsl:template match="text()"/> + +</xsl:stylesheet> Modified: jetrix/trunk/src/site/menu.inc.php =================================================================== --- jetrix/trunk/src/site/menu.inc.php 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/src/site/menu.inc.php 2008-08-22 15:11:15 UTC (rev 736) @@ -21,7 +21,7 @@ <li><a href="user-guide.php">User Guide</a></li> <li><a href="dev-guide.php">Developper Guide</a></li> <li><a href="javadoc.php">Javadoc</a></li> - <li><a href="docs/maven-reports.html">Project Reports</a></li> + <li><a href="docs/project-reports.html">Project Reports</a></li> </ul> <h1>Project</h1> @@ -31,7 +31,7 @@ <li><a href="http://sourceforge.net/tracker/?group_id=52188&atid=466002">Bugs</a></li> <li><a href="http://sourceforge.net/tracker/?group_id=52188&atid=466005">Feature Requests</a></li> <li><a href="changelog.php">Changelog</a></li> - <li><a href="docs/statcvs/commit_log.html">Commits</a></li> + <li><a href="docs/changelog.html">Commits</a></li> <li><a href="docs/team-list.html">Contributors</a></li> </ul> </div> Modified: jetrix/trunk/src/site/style.css =================================================================== --- jetrix/trunk/src/site/style.css 2008-08-22 14:56:48 UTC (rev 735) +++ jetrix/trunk/src/site/style.css 2008-08-22 15:11:15 UTC (rev 736) @@ -37,3 +37,8 @@ .newsdate { font-size: 9pt; font-style: italic; } .newstext { margin-top: 1em; } + +/* Features */ +.done { list-style-image: url("images/done.png") } +.planned { list-style-image: url("images/planned.png") } +.partial { list-style-image: url("images/partial.png") } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 14:56:51
|
Revision: 735 http://jetrix.svn.sourceforge.net/jetrix/?rev=735&view=rev Author: smanux Date: 2008-08-22 14:56:48 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fixed the mode 4 that was causing a crash of the classic tnet client Modified Paths: -------------- jetrix/branches/0.2.x/src/java/net/jetrix/commands/ModeCommand.java Modified: jetrix/branches/0.2.x/src/java/net/jetrix/commands/ModeCommand.java =================================================================== --- jetrix/branches/0.2.x/src/java/net/jetrix/commands/ModeCommand.java 2008-08-22 14:55:50 UTC (rev 734) +++ jetrix/branches/0.2.x/src/java/net/jetrix/commands/ModeCommand.java 2008-08-22 14:56:48 UTC (rev 735) @@ -41,7 +41,7 @@ {10, 15, 15, 15, 15, 15, 15, 1, 1}, {20, 14, 13, 13, 13, 13, 14, 1, 0}, {10, 15, 15, 15, 15, 15, 15, 2, 1}, - {25, 10, 10, 10, 10, 10, 11, 1, 0}, + {25, 12, 13, 13, 12, 12, 13, 1, 0}, {0, 17, 17, 17, 16, 16, 17, 1, 0}, {100, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 50, 50, 0, 1, 1}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 14:55:53
|
Revision: 734 http://jetrix.svn.sourceforge.net/jetrix/?rev=734&view=rev Author: smanux Date: 2008-08-22 14:55:50 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fixed the mode 4 that was causing a crash of the classic tnet client Modified Paths: -------------- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java Modified: jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java =================================================================== --- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2008-08-22 13:15:00 UTC (rev 733) +++ jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2008-08-22 14:55:50 UTC (rev 734) @@ -41,7 +41,7 @@ {10, 15, 15, 15, 15, 15, 15, 1, 1}, {20, 14, 13, 13, 13, 13, 14, 1, 0}, {10, 15, 15, 15, 15, 15, 15, 2, 1}, - {25, 10, 10, 10, 10, 10, 11, 1, 0}, + {25, 12, 13, 13, 12, 12, 13, 1, 0}, {0, 17, 17, 17, 16, 16, 17, 1, 0}, {100, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 50, 50, 0, 1, 1}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 13:15:03
|
Revision: 733 http://jetrix.svn.sourceforge.net/jetrix/?rev=733&view=rev Author: smanux Date: 2008-08-22 13:15:00 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Change the version to 0.2.3 Set the build to target Java 5 Modified Paths: -------------- jetrix/branches/0.2.x/build.xml jetrix/branches/0.2.x/project.properties Modified: jetrix/branches/0.2.x/build.xml =================================================================== --- jetrix/branches/0.2.x/build.xml 2008-08-22 13:13:53 UTC (rev 732) +++ jetrix/branches/0.2.x/build.xml 2008-08-22 13:15:00 UTC (rev 733) @@ -43,7 +43,7 @@ <target name="compile" depends="prepare"> <!-- Compile the java code from ${src} into ${build} --> - <javac srcdir="${build}/java" destdir="${build}/classes" debug="${compile.debug}" optimize="${compile.optimize}"> + <javac srcdir="${build}/java" destdir="${build}/classes" debug="${compile.debug}" optimize="${compile.optimize}" source="1.5" target="1.5"> <classpath> <path refid="classpath.main"/> </classpath> @@ -59,7 +59,7 @@ <target name="compile.servlet" depends="compile" description="Compile the Servlets"> <mkdir dir="${build}/jsp"/> - <javac destdir="${build}/jsp" debug="yes"> + <javac destdir="${build}/jsp" debug="yes" source="1.5" target="1.5"> <classpath> <pathelement path="${build}/classes/"/> <path refid="classpath.main"/> @@ -76,7 +76,7 @@ <pathelement location="${ant.home}/lib/ant.jar"/> </classpath> </jspc> - <javac destdir="${build}/jsp" debug="yes"> + <javac destdir="${build}/jsp" debug="yes" source="1.5" target="1.5"> <classpath> <pathelement path="${build}/classes/"/> <path refid="classpath.main"/> Modified: jetrix/branches/0.2.x/project.properties =================================================================== --- jetrix/branches/0.2.x/project.properties 2008-08-22 13:13:53 UTC (rev 732) +++ jetrix/branches/0.2.x/project.properties 2008-08-22 13:15:00 UTC (rev 733) @@ -1,5 +1,5 @@ -version=0.2.2 -version.stable=0.2.2 +version=0.2.3 +version.stable=0.2.3 maven.junit.fork=true maven.junit.dir=target This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 13:13:56
|
Revision: 732 http://jetrix.svn.sourceforge.net/jetrix/?rev=732&view=rev Author: smanux Date: 2008-08-22 13:13:53 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Publish the server address to servers.tetrinet.fr only since the other directories are no longer available Modified Paths: -------------- jetrix/branches/0.2.x/src/java/net/jetrix/services/PublishingService.java Modified: jetrix/branches/0.2.x/src/java/net/jetrix/services/PublishingService.java =================================================================== --- jetrix/branches/0.2.x/src/java/net/jetrix/services/PublishingService.java 2008-08-22 08:29:00 UTC (rev 731) +++ jetrix/branches/0.2.x/src/java/net/jetrix/services/PublishingService.java 2008-08-22 13:13:53 UTC (rev 732) @@ -60,7 +60,7 @@ public PublishingService() { setDelay(1000); - setPeriod(24 * 3600 * 1000); + setPeriod(24 * 3600 * 1000); // 24 hours } public void setHost(String host) @@ -91,46 +91,18 @@ log.info("Publishing server address to online directories... (" + host + ")"); - // publishing to tfast.org + // publishing to servers.tetrinet.fr try { - String url = "http://www.tfast.org/en/add.php"; + String url = "http://servers.tetrinet.fr/server-add.jsp"; Map<String, String> params = new HashMap<String, String>(); - params.put("ip", host); - params.put("desc", Server.getInstance().getConfig().getName()); - post(url, params); - } - catch (IOException e) - { - e.printStackTrace(); - } - - // publishing to tetrinet.org - try - { - String url = "http://slummy.tetrinet.org/grav/slummy_addsvr.pl"; - Map<String, String> params = new HashMap<String, String>(); - params.put("qname", host); - params.put("submit_bt", "Add Server"); - post(url, params); - } - catch (IOException e) - { - e.printStackTrace(); - } - - // publishing to tsrv.com - try - { - String url = "http://dieterdhoker.mine.nu:8280/cgi-bin/TSRV/submitserver.pl"; - Map<String, String> params = new HashMap<String, String>(); params.put("hostname", host); params.put("description", Server.getInstance().getConfig().getName()); post(url, params); } catch (IOException e) { - e.printStackTrace(); + log.log(Level.WARNING, "Unable to publish the server on http://servers.tetrinet.fr", e); } } @@ -182,7 +154,7 @@ // send the request conn.connect(); - if (log.isLoggable(Level.FINE)) + if (log.isLoggable(Level.FINE) && conn.getResponseCode() >= 400) { log.fine("Response: " + conn.getResponseCode() + " - " + conn.getResponseMessage()); @@ -196,7 +168,6 @@ in.close(); } - } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 08:29:06
|
Revision: 731 http://jetrix.svn.sourceforge.net/jetrix/?rev=731&view=rev Author: smanux Date: 2008-08-22 08:29:00 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Fixed the mapping between Tetrinet color codes and HTML colors Modified Paths: -------------- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java Removed Paths: ------------- monitor/trunk/src/main/webapp/images/flags/24/Thumbs.db Modified: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-22 06:39:58 UTC (rev 730) +++ monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-22 08:29:00 UTC (rev 731) @@ -37,17 +37,19 @@ STYLES.put('\u0014', "color: red"); STYLES.put('\u0004', "color: black"); STYLES.put('\u000c', "color: green"); - STYLES.put('\u000e', "color: lightgreen"); - STYLES.put('\u0011', "color: darkblue"); + STYLES.put('\u000e', "color: lime"); + STYLES.put('\u0011', "color: navy"); STYLES.put('\u0005', "color: blue"); - STYLES.put('\u0003', "color: cyan"); - STYLES.put('\u0017', "color: aqua"); + STYLES.put('\u0003', "color: aqua"); + STYLES.put('\u0017', "color: teal"); STYLES.put('\u0019', "color: yellow"); - STYLES.put('\u0012', "color: kaki"); - STYLES.put('\u0010', "color: brown"); - STYLES.put('\u000f', "color: lightgray"); + STYLES.put('\u0012', "color: olive"); + STYLES.put('\u0010', "color: maroon"); + STYLES.put('\u000f', "color: silver"); + STYLES.put('\u0015', "color: silver"); + STYLES.put('\u000b', "color: gray"); STYLES.put('\u0006', "color: gray"); - STYLES.put('\u0008', "color: magenta"); + STYLES.put('\u0008', "color: fuchsia"); STYLES.put('\u0013', "color: purple"); STYLES.put('\u0002', "font-weight: bold"); STYLES.put('\u0016', "font-style: italic"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-22 06:40:00
|
Revision: 730 http://jetrix.svn.sourceforge.net/jetrix/?rev=730&view=rev Author: smanux Date: 2008-08-22 06:39:58 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Updated the changelog Modified Paths: -------------- jetrix/trunk/doc/changelog.txt jetrix/trunk/src/site/changelog.php Modified: jetrix/trunk/doc/changelog.txt =================================================================== --- jetrix/trunk/doc/changelog.txt 2008-08-18 16:35:43 UTC (rev 729) +++ jetrix/trunk/doc/changelog.txt 2008-08-22 06:39:58 UTC (rev 730) @@ -1,7 +1,7 @@ Jetrix Changelog ================ -Changes in version 0.3 (2005-??-??) +Changes in version 0.3 (20??-??-??) ----------------------------------- Player visible changes @@ -24,10 +24,25 @@ - removed the dependency on JDIC +Changes in version 0.2.2 (2005-04-07) +------------------------------------- + +- Fixed a bug preventing the clients from connecting to a server with a default charset different from ISO-8859-1 +- The configuration is no longer broken by a "&" char in the description of a channel + Changes in version 0.2.1 (2005-02-18) ------------------------------------- - Fixed the Shutdown button on the server administration page +- Fixed a bug preventing the configuration files from being saved if the server was installed in a path containing + a space character +- Running Jetrix with jetrix.exe no longer saturate the CPU +- Fixed a bug preventing the execution of several query commands with the same connection + +Changes in version 0.2.1 (2005-02-18) +------------------------------------- + +- Fixed the Shutdown button on the server administration page - Fixed a bug preventing the configuration files from being saved if the server was installed in a path containing a space character - Running Jetrix with jetrix.exe no longer saturate the CPU - Fixed a bug preventing the execution of several query commands with the same connection Modified: jetrix/trunk/src/site/changelog.php =================================================================== --- jetrix/trunk/src/site/changelog.php 2008-08-18 16:35:43 UTC (rev 729) +++ jetrix/trunk/src/site/changelog.php 2008-08-22 06:39:58 UTC (rev 730) @@ -3,6 +3,21 @@ <h1>Changelog</h1> <pre> +Changes in version 0.2.2 (2005-04-07) +------------------------------------- + +- Fixed a bug preventing the clients from connecting to a server with a default charset different from ISO-8859-1 +- The configuration is no longer broken by a "&" char in the description of a channel + +Changes in version 0.2.1 (2005-02-18) +------------------------------------- + +- Fixed the Shutdown button on the server administration page +- Fixed a bug preventing the configuration files from being saved if the server was installed in a path containing + a space character +- Running Jetrix with jetrix.exe no longer saturate the CPU +- Fixed a bug preventing the execution of several query commands with the same connection + Changes in version 0.2 (2005-01-18) ----------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-18 16:37:07
|
Revision: 729 http://jetrix.svn.sourceforge.net/jetrix/?rev=729&view=rev Author: smanux Date: 2008-08-18 16:35:43 +0000 (Mon, 18 Aug 2008) Log Message: ----------- New project: Jetrix Monitor Added Paths: ----------- monitor/trunk/lib/ monitor/trunk/lib/geoip-1.2.2.jar monitor/trunk/pom.xml monitor/trunk/src/ monitor/trunk/src/main/ monitor/trunk/src/main/java/ monitor/trunk/src/main/java/net/ monitor/trunk/src/main/java/net/jetrix/ monitor/trunk/src/main/java/net/jetrix/monitor/ monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java monitor/trunk/src/main/java/net/jetrix/monitor/job/ monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java monitor/trunk/src/main/java/net/jetrix/monitor/job/TransactionalQuartzJob.java monitor/trunk/src/main/resources/ monitor/trunk/src/main/resources/GeoIP.dat monitor/trunk/src/main/resources/applicationContext.xml monitor/trunk/src/main/resources/hibernate-mapping.xml monitor/trunk/src/main/resources/hibernate.cfg.xml monitor/trunk/src/main/resources/quartzContext.xml monitor/trunk/src/main/webapp/ monitor/trunk/src/main/webapp/META-INF/ monitor/trunk/src/main/webapp/META-INF/context.xml monitor/trunk/src/main/webapp/WEB-INF/ monitor/trunk/src/main/webapp/WEB-INF/classes/ monitor/trunk/src/main/webapp/WEB-INF/classes/logging.properties monitor/trunk/src/main/webapp/WEB-INF/lib/ monitor/trunk/src/main/webapp/WEB-INF/web.xml monitor/trunk/src/main/webapp/favicon.ico monitor/trunk/src/main/webapp/images/ monitor/trunk/src/main/webapp/images/flags/ monitor/trunk/src/main/webapp/images/flags/24/ monitor/trunk/src/main/webapp/images/flags/24/ASEAN.png monitor/trunk/src/main/webapp/images/flags/24/Afghanistan.png monitor/trunk/src/main/webapp/images/flags/24/African Union(OAS).png monitor/trunk/src/main/webapp/images/flags/24/Albania.png monitor/trunk/src/main/webapp/images/flags/24/Algeria.png monitor/trunk/src/main/webapp/images/flags/24/American Samoa.png monitor/trunk/src/main/webapp/images/flags/24/Andorra.png monitor/trunk/src/main/webapp/images/flags/24/Angola.png monitor/trunk/src/main/webapp/images/flags/24/Anguilla.png monitor/trunk/src/main/webapp/images/flags/24/Antarctica.png monitor/trunk/src/main/webapp/images/flags/24/Antigua & Barbuda.png monitor/trunk/src/main/webapp/images/flags/24/Arab League.png monitor/trunk/src/main/webapp/images/flags/24/Argentina.png monitor/trunk/src/main/webapp/images/flags/24/Armenia.png monitor/trunk/src/main/webapp/images/flags/24/Aruba.png monitor/trunk/src/main/webapp/images/flags/24/Australia.png monitor/trunk/src/main/webapp/images/flags/24/Austria.png monitor/trunk/src/main/webapp/images/flags/24/Azerbaijan.png monitor/trunk/src/main/webapp/images/flags/24/Bahamas.png monitor/trunk/src/main/webapp/images/flags/24/Bahrain.png monitor/trunk/src/main/webapp/images/flags/24/Bangladesh.png monitor/trunk/src/main/webapp/images/flags/24/Barbados.png monitor/trunk/src/main/webapp/images/flags/24/Belarus.png monitor/trunk/src/main/webapp/images/flags/24/Belgium.png monitor/trunk/src/main/webapp/images/flags/24/Belize.png monitor/trunk/src/main/webapp/images/flags/24/Benin.png monitor/trunk/src/main/webapp/images/flags/24/Bermuda.png monitor/trunk/src/main/webapp/images/flags/24/Bhutan.png monitor/trunk/src/main/webapp/images/flags/24/Bolivia.png monitor/trunk/src/main/webapp/images/flags/24/Bosnia & Herzegovina.png monitor/trunk/src/main/webapp/images/flags/24/Botswana.png monitor/trunk/src/main/webapp/images/flags/24/Brazil.png monitor/trunk/src/main/webapp/images/flags/24/Brunei.png monitor/trunk/src/main/webapp/images/flags/24/Bulgaria.png monitor/trunk/src/main/webapp/images/flags/24/Burkina Faso.png monitor/trunk/src/main/webapp/images/flags/24/Burundi.png monitor/trunk/src/main/webapp/images/flags/24/CARICOM.png monitor/trunk/src/main/webapp/images/flags/24/CIS.png monitor/trunk/src/main/webapp/images/flags/24/Cambodja.png monitor/trunk/src/main/webapp/images/flags/24/Cameroon.png monitor/trunk/src/main/webapp/images/flags/24/Canada.png monitor/trunk/src/main/webapp/images/flags/24/Cape Verde.png monitor/trunk/src/main/webapp/images/flags/24/Cayman Islands.png monitor/trunk/src/main/webapp/images/flags/24/Central African Republic.png monitor/trunk/src/main/webapp/images/flags/24/Chad.png monitor/trunk/src/main/webapp/images/flags/24/Chile.png monitor/trunk/src/main/webapp/images/flags/24/China.png monitor/trunk/src/main/webapp/images/flags/24/Colombia.png monitor/trunk/src/main/webapp/images/flags/24/Commonwealth.png monitor/trunk/src/main/webapp/images/flags/24/Comoros.png monitor/trunk/src/main/webapp/images/flags/24/Congo-Brazzaville.png monitor/trunk/src/main/webapp/images/flags/24/Congo-Kinshasa.png monitor/trunk/src/main/webapp/images/flags/24/Cook Islands.png monitor/trunk/src/main/webapp/images/flags/24/Costa Rica.png monitor/trunk/src/main/webapp/images/flags/24/Cote d'Ivoire.png monitor/trunk/src/main/webapp/images/flags/24/Croatia.png monitor/trunk/src/main/webapp/images/flags/24/Cuba.png monitor/trunk/src/main/webapp/images/flags/24/Cyprus.png monitor/trunk/src/main/webapp/images/flags/24/Czech Republic.png monitor/trunk/src/main/webapp/images/flags/24/Denmark.png monitor/trunk/src/main/webapp/images/flags/24/Djibouti.png monitor/trunk/src/main/webapp/images/flags/24/Dominica.png monitor/trunk/src/main/webapp/images/flags/24/Dominican Republic.png monitor/trunk/src/main/webapp/images/flags/24/East Timor.png monitor/trunk/src/main/webapp/images/flags/24/Egypt.png monitor/trunk/src/main/webapp/images/flags/24/El Salvador.png monitor/trunk/src/main/webapp/images/flags/24/England.png monitor/trunk/src/main/webapp/images/flags/24/Equador.png monitor/trunk/src/main/webapp/images/flags/24/Equatorial Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Eritrea.png monitor/trunk/src/main/webapp/images/flags/24/Estonia.png monitor/trunk/src/main/webapp/images/flags/24/Ethiopia.png monitor/trunk/src/main/webapp/images/flags/24/European Union.png monitor/trunk/src/main/webapp/images/flags/24/Faroes.png monitor/trunk/src/main/webapp/images/flags/24/Fiji.png monitor/trunk/src/main/webapp/images/flags/24/Finland.png monitor/trunk/src/main/webapp/images/flags/24/France.png monitor/trunk/src/main/webapp/images/flags/24/Gabon.png monitor/trunk/src/main/webapp/images/flags/24/Gambia.png monitor/trunk/src/main/webapp/images/flags/24/Georgia.png monitor/trunk/src/main/webapp/images/flags/24/Germany.png monitor/trunk/src/main/webapp/images/flags/24/Ghana.png monitor/trunk/src/main/webapp/images/flags/24/Gibraltar.png monitor/trunk/src/main/webapp/images/flags/24/Greece.png monitor/trunk/src/main/webapp/images/flags/24/Greenland.png monitor/trunk/src/main/webapp/images/flags/24/Grenada.png monitor/trunk/src/main/webapp/images/flags/24/Guadeloupe.png monitor/trunk/src/main/webapp/images/flags/24/Guam.png monitor/trunk/src/main/webapp/images/flags/24/Guatemala.png monitor/trunk/src/main/webapp/images/flags/24/Guernsey.png monitor/trunk/src/main/webapp/images/flags/24/Guinea-Bissau.png monitor/trunk/src/main/webapp/images/flags/24/Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Guyana.png monitor/trunk/src/main/webapp/images/flags/24/Haiti.png monitor/trunk/src/main/webapp/images/flags/24/Honduras.png monitor/trunk/src/main/webapp/images/flags/24/Hong Kong.png monitor/trunk/src/main/webapp/images/flags/24/Hungary.png monitor/trunk/src/main/webapp/images/flags/24/Iceland.png monitor/trunk/src/main/webapp/images/flags/24/India.png monitor/trunk/src/main/webapp/images/flags/24/Indonesia.png monitor/trunk/src/main/webapp/images/flags/24/Iran.png monitor/trunk/src/main/webapp/images/flags/24/Iraq.png monitor/trunk/src/main/webapp/images/flags/24/Ireland.png monitor/trunk/src/main/webapp/images/flags/24/Islamic Conference.png monitor/trunk/src/main/webapp/images/flags/24/Israel.png monitor/trunk/src/main/webapp/images/flags/24/Italy.png monitor/trunk/src/main/webapp/images/flags/24/Jamaica.png monitor/trunk/src/main/webapp/images/flags/24/Jersey.png monitor/trunk/src/main/webapp/images/flags/24/Jordan.png monitor/trunk/src/main/webapp/images/flags/24/Kazakhstan.png monitor/trunk/src/main/webapp/images/flags/24/Kenya.png monitor/trunk/src/main/webapp/images/flags/24/Kiribati.png monitor/trunk/src/main/webapp/images/flags/24/Kosovo.png monitor/trunk/src/main/webapp/images/flags/24/Kuwait.png monitor/trunk/src/main/webapp/images/flags/24/Kyrgyzstan.png monitor/trunk/src/main/webapp/images/flags/24/Laos.png monitor/trunk/src/main/webapp/images/flags/24/Latvia.png monitor/trunk/src/main/webapp/images/flags/24/Lebanon.png monitor/trunk/src/main/webapp/images/flags/24/Lesotho.png monitor/trunk/src/main/webapp/images/flags/24/Liberia.png monitor/trunk/src/main/webapp/images/flags/24/Libya.png monitor/trunk/src/main/webapp/images/flags/24/Liechtenstein.png monitor/trunk/src/main/webapp/images/flags/24/Lithuania.png monitor/trunk/src/main/webapp/images/flags/24/Luxembourg.png monitor/trunk/src/main/webapp/images/flags/24/Macao.png monitor/trunk/src/main/webapp/images/flags/24/Macedonia.png monitor/trunk/src/main/webapp/images/flags/24/Madagascar.png monitor/trunk/src/main/webapp/images/flags/24/Malawi.png monitor/trunk/src/main/webapp/images/flags/24/Malaysia.png monitor/trunk/src/main/webapp/images/flags/24/Maldives.png monitor/trunk/src/main/webapp/images/flags/24/Mali.png monitor/trunk/src/main/webapp/images/flags/24/Malta.png monitor/trunk/src/main/webapp/images/flags/24/Marshall Islands.png monitor/trunk/src/main/webapp/images/flags/24/Martinique.png monitor/trunk/src/main/webapp/images/flags/24/Mauritania.png monitor/trunk/src/main/webapp/images/flags/24/Mauritius.png monitor/trunk/src/main/webapp/images/flags/24/Mexico.png monitor/trunk/src/main/webapp/images/flags/24/Micronesia.png monitor/trunk/src/main/webapp/images/flags/24/Moldova.png monitor/trunk/src/main/webapp/images/flags/24/Monaco.png monitor/trunk/src/main/webapp/images/flags/24/Mongolia.png monitor/trunk/src/main/webapp/images/flags/24/Montenegro.png monitor/trunk/src/main/webapp/images/flags/24/Montserrat.png monitor/trunk/src/main/webapp/images/flags/24/Morocco.png monitor/trunk/src/main/webapp/images/flags/24/Mozambique.png monitor/trunk/src/main/webapp/images/flags/24/Myanmar(Burma).png monitor/trunk/src/main/webapp/images/flags/24/NATO.png monitor/trunk/src/main/webapp/images/flags/24/Namibia.png monitor/trunk/src/main/webapp/images/flags/24/Nauru.png monitor/trunk/src/main/webapp/images/flags/24/Nepal.png monitor/trunk/src/main/webapp/images/flags/24/Netherlands Antilles.png monitor/trunk/src/main/webapp/images/flags/24/Netherlands.png monitor/trunk/src/main/webapp/images/flags/24/New Caledonia.png monitor/trunk/src/main/webapp/images/flags/24/New Zealand.png monitor/trunk/src/main/webapp/images/flags/24/Nicaragua.png monitor/trunk/src/main/webapp/images/flags/24/Niger.png monitor/trunk/src/main/webapp/images/flags/24/Nigeria.png monitor/trunk/src/main/webapp/images/flags/24/North Korea.png monitor/trunk/src/main/webapp/images/flags/24/Northern Cyprus.png monitor/trunk/src/main/webapp/images/flags/24/Northern Ireland.png monitor/trunk/src/main/webapp/images/flags/24/Norway.png monitor/trunk/src/main/webapp/images/flags/24/OPEC.png monitor/trunk/src/main/webapp/images/flags/24/Olimpic Movement.png monitor/trunk/src/main/webapp/images/flags/24/Oman.png monitor/trunk/src/main/webapp/images/flags/24/Pakistan.png monitor/trunk/src/main/webapp/images/flags/24/Palau.png monitor/trunk/src/main/webapp/images/flags/24/Palestine.png monitor/trunk/src/main/webapp/images/flags/24/Panama.png monitor/trunk/src/main/webapp/images/flags/24/Papua New Guinea.png monitor/trunk/src/main/webapp/images/flags/24/Paraguay.png monitor/trunk/src/main/webapp/images/flags/24/Peru.png monitor/trunk/src/main/webapp/images/flags/24/Philippines.png monitor/trunk/src/main/webapp/images/flags/24/Poland.png monitor/trunk/src/main/webapp/images/flags/24/Portugal.png monitor/trunk/src/main/webapp/images/flags/24/Puerto Rico.png monitor/trunk/src/main/webapp/images/flags/24/Qatar.png monitor/trunk/src/main/webapp/images/flags/24/Red Cross.png monitor/trunk/src/main/webapp/images/flags/24/Reunion.png monitor/trunk/src/main/webapp/images/flags/24/Romania.png monitor/trunk/src/main/webapp/images/flags/24/Russia.png monitor/trunk/src/main/webapp/images/flags/24/Rwanda.png monitor/trunk/src/main/webapp/images/flags/24/Saint Lucia.png monitor/trunk/src/main/webapp/images/flags/24/Samoa.png monitor/trunk/src/main/webapp/images/flags/24/San Marino.png monitor/trunk/src/main/webapp/images/flags/24/Sao Tome & Principe.png monitor/trunk/src/main/webapp/images/flags/24/Saudi Arabia.png monitor/trunk/src/main/webapp/images/flags/24/Scotland.png monitor/trunk/src/main/webapp/images/flags/24/Senegal.png monitor/trunk/src/main/webapp/images/flags/24/Serbia(Yugoslavia).png monitor/trunk/src/main/webapp/images/flags/24/Seyshelles.png monitor/trunk/src/main/webapp/images/flags/24/Sierra Leone.png monitor/trunk/src/main/webapp/images/flags/24/Singapore.png monitor/trunk/src/main/webapp/images/flags/24/Slovakia.png monitor/trunk/src/main/webapp/images/flags/24/Slovenia.png monitor/trunk/src/main/webapp/images/flags/24/Solomon Islands.png monitor/trunk/src/main/webapp/images/flags/24/Somalia.png monitor/trunk/src/main/webapp/images/flags/24/Somaliland.png monitor/trunk/src/main/webapp/images/flags/24/South Africa.png monitor/trunk/src/main/webapp/images/flags/24/South Korea.png monitor/trunk/src/main/webapp/images/flags/24/Spain.png monitor/trunk/src/main/webapp/images/flags/24/Sri Lanka.png monitor/trunk/src/main/webapp/images/flags/24/St Kitts & Nevis.png monitor/trunk/src/main/webapp/images/flags/24/St Vincent & the Grenadines.png monitor/trunk/src/main/webapp/images/flags/24/Sudan.png monitor/trunk/src/main/webapp/images/flags/24/Suriname.png monitor/trunk/src/main/webapp/images/flags/24/Swaziland.png monitor/trunk/src/main/webapp/images/flags/24/Sweden.png monitor/trunk/src/main/webapp/images/flags/24/Switzerland.png monitor/trunk/src/main/webapp/images/flags/24/Syria.png monitor/trunk/src/main/webapp/images/flags/24/Tahiti(French Polinesia).png monitor/trunk/src/main/webapp/images/flags/24/Taiwan.png monitor/trunk/src/main/webapp/images/flags/24/Tajikistan.png monitor/trunk/src/main/webapp/images/flags/24/Tanzania.png monitor/trunk/src/main/webapp/images/flags/24/Thailand.png monitor/trunk/src/main/webapp/images/flags/24/Thumbs.db monitor/trunk/src/main/webapp/images/flags/24/Timor-Leste.png monitor/trunk/src/main/webapp/images/flags/24/Togo.png monitor/trunk/src/main/webapp/images/flags/24/Tonga.png monitor/trunk/src/main/webapp/images/flags/24/Trinidad & Tobago.png monitor/trunk/src/main/webapp/images/flags/24/Tunisia.png monitor/trunk/src/main/webapp/images/flags/24/Turkey.png monitor/trunk/src/main/webapp/images/flags/24/Turkmenistan.png monitor/trunk/src/main/webapp/images/flags/24/Turks and Caicos Islands.png monitor/trunk/src/main/webapp/images/flags/24/Tuvalu.png monitor/trunk/src/main/webapp/images/flags/24/Uganda.png monitor/trunk/src/main/webapp/images/flags/24/Ukraine.png monitor/trunk/src/main/webapp/images/flags/24/United Arab Emirates.png monitor/trunk/src/main/webapp/images/flags/24/United Kingdom(Great Britain).png monitor/trunk/src/main/webapp/images/flags/24/United Nations.png monitor/trunk/src/main/webapp/images/flags/24/United States.png monitor/trunk/src/main/webapp/images/flags/24/Uruguay.png monitor/trunk/src/main/webapp/images/flags/24/Uzbekistan.png monitor/trunk/src/main/webapp/images/flags/24/Vanuatu.png monitor/trunk/src/main/webapp/images/flags/24/Vatican City.png monitor/trunk/src/main/webapp/images/flags/24/Venezuela.png monitor/trunk/src/main/webapp/images/flags/24/Viet Nam.png monitor/trunk/src/main/webapp/images/flags/24/Virgin Islands British.png monitor/trunk/src/main/webapp/images/flags/24/Virgin Islands US.png monitor/trunk/src/main/webapp/images/flags/24/Wales.png monitor/trunk/src/main/webapp/images/flags/24/Western Sahara.png monitor/trunk/src/main/webapp/images/flags/24/Yemen.png monitor/trunk/src/main/webapp/images/flags/24/Zambia.png monitor/trunk/src/main/webapp/images/flags/24/Zimbabwe.png monitor/trunk/src/main/webapp/images/flags/24/japan.png monitor/trunk/src/main/webapp/images/flags/NOTICE.txt monitor/trunk/src/main/webapp/index.jsp monitor/trunk/src/main/webapp/scripts/ monitor/trunk/src/main/webapp/scripts/sortable.js monitor/trunk/src/main/webapp/server-add.jsp monitor/trunk/src/main/webapp/server.jsp monitor/trunk/src/main/webapp/servers-xml.jsp monitor/trunk/src/main/webapp/stylesheets/ monitor/trunk/src/main/webapp/stylesheets/style.css monitor/trunk/src/test/ monitor/trunk/src/test/java/ monitor/trunk/src/test/java/net/ monitor/trunk/src/test/java/net/jetrix/ monitor/trunk/src/test/java/net/jetrix/monitor/ monitor/trunk/src/test/java/net/jetrix/monitor/SpringTestCase.java monitor/trunk/src/test/java/net/jetrix/monitor/StyleUtilsTest.java monitor/trunk/src/test/java/net/jetrix/monitor/dao/ monitor/trunk/src/test/java/net/jetrix/monitor/dao/IpToCountryDaoTest.java monitor/trunk/src/test/java/net/jetrix/monitor/dao/ServerInfoDaoTest.java monitor/trunk/src/test/java/net/jetrix/monitor/job/ monitor/trunk/src/test/java/net/jetrix/monitor/job/GraphGenerationJobTest.java monitor/trunk/src/test/resources/ monitor/trunk/src/test/resources/testContext.xml Property Changed: ---------------- monitor/trunk/ Property changes on: monitor/trunk ___________________________________________________________________ Added: svn:ignore + target Property changes on: monitor/trunk/lib/geoip-1.2.2.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: monitor/trunk/pom.xml =================================================================== --- monitor/trunk/pom.xml (rev 0) +++ monitor/trunk/pom.xml 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,273 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>jetrix</groupId> + <artifactId>monitor</artifactId> + <name>Jetrix Monitor</name> + <version>1.0-SNAPSHOT</version> + <packaging>war</packaging> + + <inceptionYear>2001</inceptionYear> + + <description> + Jetrix monitor is a service monitoring the state of online TetriNET servers. + </description> + <url>http://jetrix.sourceforge.net</url> + + <licenses> + <license> + <name>GNU General Public License v2</name> + <url>http://www.gnu.org/licenses/gpl-2.0.txt</url> + <distribution>manual</distribution> + </license> + </licenses> + + <scm> + <connection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/monitor/trunk/</connection> + <developerConnection>scm:svn:https://jetrix.svn.sourceforge.net/svnroot/jetrix/monitor/trunk/</developerConnection> + <url>http://jetrix.svn.sourceforge.net/viewvc/jetrix/monitor/trunk</url> + </scm> + + <mailingLists> + <mailingList> + <name>Jetrix Commits</name> + <subscribe>http://lists.sourceforge.net/lists/listinfo/jetrix-cvs</subscribe> + <unsubscribe>http://lists.sourceforge.net/lists/listinfo/jetrix-cvs</unsubscribe> + <archive>https://sourceforge.net/mailarchive/forum.php?forum_id=12998</archive> + </mailingList> + </mailingLists> + + <developers> + <developer> + <id>smanux</id> + <name>Emmanuel Bourg</name> + <email>eb...@ap...</email> + <timezone>+1</timezone> + </developer> + </developers> + + <repositories> + <repository> + <id>java.net</id> + <url>http://download.java.net/maven/2/</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + <repository> + <id>opennms-repo</id> + <name>OpenNMS Repository</name> + <url>http://repo.opennms.org/maven2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <dependencies> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate</artifactId> + <version>3.2.6.ga</version> + </dependency> + + <dependency> + <groupId>org.springframework </groupId> + <artifactId>spring</artifactId> + <version>2.5.5</version> + </dependency> + + <dependency> + <groupId>opensymphony</groupId> + <artifactId>quartz</artifactId> + <version>1.6.0</version> + </dependency> + + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.3</version> + </dependency> + + <dependency> + <groupId>commons-collections</groupId> + <artifactId>commons-collections</artifactId> + <version>3.2.1</version> + </dependency> + + <dependency> + <groupId>maxmind</groupId> + <artifactId>geoip</artifactId> + <version>1.2.2</version> + </dependency> + + <dependency> + <groupId>org.jrobin</groupId> + <artifactId>jrobin</artifactId> + <version>1.5.8</version> + </dependency> + + <dependency> + <groupId>jetrix</groupId> + <artifactId>jetrix</artifactId> + <version>0.3-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + <version>2.4</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>jsp-api</artifactId> + <version>2.1</version> + <scope>provided</scope> + </dependency> + + <!-- Needed for testing --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>5.1.6</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <testSourceDirectory>src/test/java</testSourceDirectory> + + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <includes> + <include>**/*Test.java</include> + </includes> + <excludes> + <exclude>**/Abstract*</exclude> + </excludes> + <testFailureIgnore>true</testFailureIgnore> + <skip>false</skip> + </configuration> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <configuration> + <file>lib/geoip-1.2.2.jar</file> + <groupId>maxmind</groupId> + <artifactId>geoip</artifactId> + <version>1.2.2</version> + <packaging>jar</packaging> + <generatePom>true</generatePom> + <createChecksum>true</createChecksum> + </configuration> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>install-file</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <linksource>true</linksource> + <links> + <link>http://java.sun.com/javase/6/docs/api</link> + </links> + <quiet>true</quiet> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>javadoc</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <artifactId>maven-pmd-plugin</artifactId> + <configuration> + <targetJdk>1.5</targetJdk> + </configuration> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <reportSets> + <reportSet> + <reports> + <report>project-team</report> + <report>dependencies</report> + <report>license</report> + <report>scm</report> + </reports> + </reportSet> + </reportSets> + </plugin> + <plugin> + <artifactId>maven-surefire-report-plugin</artifactId> + <version>2.0</version> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jxr-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>taglist-maven-plugin</artifactId> + <version>2.0</version> + <configuration> + <tags> + <tag>todo</tag> + </tags> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-changelog-plugin</artifactId> + <configuration> + <range>365</range> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>changelog</report> + <report>file-activity</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> + +</project> Property changes on: monitor/trunk/pom.xml ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,78 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.UnknownHostException; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class NetworkUtils +{ + public static boolean isPortOpen(String address, int port) + { + try + { + return isPortOpen(InetAddress.getByName(address), port); + } + catch (UnknownHostException e) + { + return false; + } + } + + /** + * Check if the specified port is open. + * + * @param address + * @param port + */ + public static boolean isPortOpen(InetAddress address, int port) + { + Socket socket = new Socket(); + + try + { + socket.connect(new InetSocketAddress(address, port), 5000); + socket.close(); + return true; + } + catch (IOException e) + { + return false; + } + finally + { + try + { + socket.close(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/NetworkUtils.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,252 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import net.jetrix.agent.ChannelInfo; +import net.jetrix.agent.PlayerInfo; + +/** + * Information about a TetriNET server. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerInfo +{ + private long id; + private String hostname; + private String IP; + private String version; + private String description; + private boolean spectate; + private String country; + private String website; + + private Date dateAdded; + private Date lastChecked; + private Date lastOnline; + + private ServerStats stats = new ServerStats(); + + private int maxPlayerCount; + private Date maxPlayerDate; + + private int maxActivePlayerCount; + private Date maxActivePlayerDate; + + private List<ChannelInfo> channels; + private List<PlayerInfo> players; + + private Collection<String> aliases; + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public String getHostname() + { + return hostname; + } + + public void setHostname(String hostname) + { + this.hostname = hostname; + } + + public String getIP() + { + return IP; + } + + public void setIP(String IP) + { + this.IP = IP; + } + + public String getVersion() + { + return version; + } + + public void setVersion(String version) + { + this.version = version; + } + + public String getDescription() + { + return description; + } + + public void setDescription(String description) + { + this.description = description; + } + + public boolean isSpectate() + { + return spectate; + } + + public void setSpectate(boolean spectate) + { + this.spectate = spectate; + } + + public String getCountry() + { + return country; + } + + public void setCountry(String country) + { + this.country = country; + } + + public String getWebsite() + { + return website; + } + + public void setWebsite(String website) + { + this.website = website; + } + + public Date getDateAdded() + { + return dateAdded; + } + + public void setDateAdded(Date dateAdded) + { + this.dateAdded = dateAdded; + } + + public Date getLastChecked() + { + return lastChecked; + } + + public void setLastChecked(Date lastChecked) + { + this.lastChecked = lastChecked; + } + + public Date getLastOnline() + { + return lastOnline; + } + + public void setLastOnline(Date lastOnline) + { + this.lastOnline = lastOnline; + } + + public ServerStats getStats() + { + return stats; + } + + public void setStats(ServerStats stats) + { + this.stats = stats; + } + + public int getMaxPlayerCount() + { + return maxPlayerCount; + } + + public void setMaxPlayerCount(int maxPlayerCount) + { + this.maxPlayerCount = maxPlayerCount; + } + + public Date getMaxPlayerDate() + { + return maxPlayerDate; + } + + public void setMaxPlayerDate(Date maxPlayerDate) + { + this.maxPlayerDate = maxPlayerDate; + } + + public int getMaxActivePlayerCount() + { + return maxActivePlayerCount; + } + + public void setMaxActivePlayerCount(int maxActivePlayerCount) + { + this.maxActivePlayerCount = maxActivePlayerCount; + } + + public Date getMaxActivePlayerDate() + { + return maxActivePlayerDate; + } + + public void setMaxActivePlayerDate(Date maxActivePlayerDate) + { + this.maxActivePlayerDate = maxActivePlayerDate; + } + + public List<ChannelInfo> getChannels() + { + return channels; + } + + public void setChannels(List<ChannelInfo> channels) + { + this.channels = channels; + } + + public List<PlayerInfo> getPlayers() + { + return players; + } + + public void setPlayers(List<PlayerInfo> players) + { + this.players = players; + } + + public Collection<String> getAliases() + { + return aliases; + } + + public void setAliases(Collection<String> aliases) + { + this.aliases = aliases; + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/ServerInfo.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,168 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.Date; + +import net.jetrix.agent.ChannelInfo; +import net.jetrix.agent.PlayerInfo; +import net.jetrix.agent.QueryInfo; + +/** + * Server stats at a given time. + * + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerStats +{ + private long id; + private long serverId; + private Date date; + private int ping; + private int playerCount; + private int activePlayerCount; + private int channelCount; + private int activeChannelCount; + + public void update(QueryInfo info) + { + date = new Date(); + ping = (int) info.getPing(); + playerCount = info.getPlayers().size(); + channelCount = info.getChannels().size(); + + int activePlayerCount = 0; + int activeChannelCount = 0; + + for (PlayerInfo player : info.getPlayers()) + { + if (player.isPlaying()) + { + activePlayerCount++; + } + } + + for (ChannelInfo channel : info.getChannels()) + { + if (channel.isPlaying()) + { + activeChannelCount++; + } + } + + this.activePlayerCount = activePlayerCount; + this.activeChannelCount = activeChannelCount; + } + + /** + * Merge the best player/channel count into the current ServerStat instance. + * + * @param stats + */ + public void merge(ServerStats stats) + { + playerCount = Math.max(playerCount, stats.playerCount); + activePlayerCount = Math.max(activePlayerCount, stats.activePlayerCount); + + channelCount = Math.max(channelCount, stats.channelCount); + activeChannelCount = Math.max(activeChannelCount, stats.activeChannelCount); + } + + public long getId() + { + return id; + } + + public void setId(long id) + { + this.id = id; + } + + public long getServerId() + { + return serverId; + } + + public void setServerId(long serverId) + { + this.serverId = serverId; + } + + public Date getDate() + { + return date; + } + + public void setDate(Date date) + { + this.date = date; + } + + public int getPing() + { + return ping; + } + + public void setPing(int ping) + { + this.ping = ping; + } + + public int getPlayerCount() + { + return playerCount; + } + + public void setPlayerCount(int playerCount) + { + this.playerCount = playerCount; + } + + public int getActivePlayerCount() + { + return activePlayerCount; + } + + public void setActivePlayerCount(int activePlayerCount) + { + this.activePlayerCount = activePlayerCount; + } + + public int getChannelCount() + { + return channelCount; + } + + public void setChannelCount(int channelCount) + { + this.channelCount = channelCount; + } + + public int getActiveChannelCount() + { + return activeChannelCount; + } + + public void setActiveChannelCount(int activeChannelCount) + { + this.activeChannelCount = activeChannelCount; + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/ServerStats.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,92 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Map; +import java.util.HashMap; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class StyleUtils +{ + /** TetriNET to CSS style mapping */ + private static final Map<Character, String> STYLES = new HashMap<Character, String>(); + static + { + STYLES.put('\u0014', "color: red"); + STYLES.put('\u0004', "color: black"); + STYLES.put('\u000c', "color: green"); + STYLES.put('\u000e', "color: lightgreen"); + STYLES.put('\u0011', "color: darkblue"); + STYLES.put('\u0005', "color: blue"); + STYLES.put('\u0003', "color: cyan"); + STYLES.put('\u0017', "color: aqua"); + STYLES.put('\u0019', "color: yellow"); + STYLES.put('\u0012', "color: kaki"); + STYLES.put('\u0010', "color: brown"); + STYLES.put('\u000f', "color: lightgray"); + STYLES.put('\u0006', "color: gray"); + STYLES.put('\u0008', "color: magenta"); + STYLES.put('\u0013', "color: purple"); + STYLES.put('\u0002', "font-weight: bold"); + STYLES.put('\u0016', "font-style: italic"); + STYLES.put('\u001f', "text-decoration: underlined"); + STYLES.put('\u0018', "color: white"); + } + + public static String toHTML(String text) + { + StringBuilder result = new StringBuilder(); + + Deque<Character> styleStack = new ArrayDeque<Character>(); + + for (char c : text.toCharArray()) + { + if (STYLES.keySet().contains(c)) + { + if (styleStack.isEmpty() || styleStack.peek().charValue() != c) + { + styleStack.push(c); + result.append("<span style=\"" + STYLES.get(c) + "\">"); + } + else + { + styleStack.pop(); + result.append("</span>"); + } + } + else + { + result.append(c); + } + } + + while (styleStack.pollFirst() != null) + { + result.append("</span>"); + } + + return result.toString(); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/StyleUtils.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,61 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.io.IOException; +import java.io.File; +import java.net.InetAddress; +import java.net.URL; + +import com.maxmind.geoip.Country; +import com.maxmind.geoip.LookupService; +import static com.maxmind.geoip.LookupService.GEOIP_CHECK_CACHE; +import static com.maxmind.geoip.LookupService.GEOIP_MEMORY_CACHE; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class IpToCountryDao +{ + private LookupService service; + + public IpToCountryDao() throws Exception + { + URL url = getClass().getResource("/GeoIP.dat"); + File file = new File(url.toURI()); + String fileName = file.getAbsolutePath(); + + this.service = new LookupService(fileName, GEOIP_MEMORY_CACHE | GEOIP_CHECK_CACHE); + } + + /** + * Returns the country code matching this address, or null if the country can't be found. + * + * @param address + */ + public String getCountry(InetAddress address) + { + Country country = service.getCountry(address); + + return country != null && !"--".equals(country.getCode()) ? country.getCode() : null; + } + +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/IpToCountryDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,78 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.util.List; + +import org.hibernate.Query; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import net.jetrix.monitor.ServerInfo; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerInfoDao extends HibernateDaoSupport +{ + public ServerInfo getServer(long id) + { + return (ServerInfo) getSession().get(ServerInfo.class, id); + } + + public ServerInfo getServer(String hostname) + { + Query query = getSession().createQuery("FROM ServerInfo WHERE hostname = :hostname"); + query.setParameter("hostname", hostname); + + return (ServerInfo) query.uniqueResult(); + } + + public List<ServerInfo> getServers() + { + return getSession().createQuery("FROM ServerInfo ORDER BY stats.playerCount DESC, hostname").list(); + } + + public void save(ServerInfo server) + { + getSession().saveOrUpdate(server); + } + + public void remove(long id) + { + Object server = getSession().load(ServerInfo.class, id); + getSession().delete(server); + } + + /** + * Check if the hostname or IP address of the specified server already exist in the database. + * + * @param server + */ + public boolean exists(ServerInfo server) + { + Query query = getSession().createQuery("FROM ServerInfo WHERE IP = :ip OR hostname = :name"); + query.setParameter("ip", server.getIP()); + query.setParameter("name", server.getHostname()); + List result = query.list(); + + return !result.isEmpty(); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerInfoDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,47 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.dao; + +import java.util.List; + +import org.hibernate.Query; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import net.jetrix.monitor.ServerStats; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class ServerStatsDao extends HibernateDaoSupport +{ + public List<ServerStats> getStats(long serverId) + { + Query query = getSession().createQuery("FROM ServerStats WHERE serverId=:id ORDER BY date"); + query.setParameter("id", serverId); + + return (List<ServerStats>) query.list(); + } + + public void save(ServerStats stats) + { + getSession().saveOrUpdate(stats); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/dao/ServerStatsDao.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java =================================================================== --- monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java (rev 0) +++ monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java 2008-08-18 16:35:43 UTC (rev 729) @@ -0,0 +1,213 @@ +/** + * Jetrix TetriNET Server + * Copyright (C) 2008 Emmanuel Bourg + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.jetrix.monitor.job; + +import java.awt.Color; +import java.io.File; +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.logging.Level; +import javax.servlet.ServletContext; + +import org.jrobin.core.RrdDb; +import org.jrobin.core.RrdDef; +import org.jrobin.core.RrdException; +import org.jrobin.core.Sample; +import org.jrobin.core.Util; +import org.jrobin.graph.RrdGraph; +import org.jrobin.graph.RrdGraphDef; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.ContextLoader; + +import net.jetrix.monitor.ServerInfo; +import net.jetrix.monitor.ServerStats; +import net.jetrix.monitor.dao.ServerInfoDao; +import net.jetrix.monitor.dao.ServerStatsDao; + +/** + * @author Emmanuel Bourg + * @version $Revision$, $Date$ + */ +public class GraphGenerationJob extends TransactionalQuartzJob +{ + public static final String DEFAULT_DATAPATH = System.getProperty("user.home") + "/.jetrix"; + + private String dataPath = DEFAULT_DATAPATH; + private String outpoutPath = DEFAULT_DATAPATH; + + public void setDataPath(String dataPath) + { + this.dataPath = dataPath; + } + + public void setOutpoutPath(String outpoutPath) + { + this.outpoutPath = outpoutPath; + } + + protected void executeTransactional(JobExecutionContext jobExecutionContext) throws JobExecutionException + { + log.info("Generating graphs..."); + + ApplicationContext context = (ApplicationContext) jobExecutionContext.getMergedJobDataMap().get("applicationContext"); + + ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); + setOutpoutPath(servletContext.getRealPath("/images/graphs")); + + ServerInfoDao serverInfoDao = (ServerInfoDao) context.getBean("serverInfoDao"); + ServerStatsDao serverStatsDao = (ServerStatsDao) context.getBean("serverStatsDao"); + + List<ServerInfo> servers = serverInfoDao.getServers(); + + for (ServerInfo server : servers) + { + try + { + List<ServerStats> stats = serverStatsDao.getStats(server.getId()); + generateGraph(server, stats); + } + catch (Exception e) + { + log.log(Level.WARNING, "Unable to draw the activity graph for " + server.getHostname() + " (" + server.getId() + ")", e); + } + } + } + + private File getRRDFile(ServerInfo server) + { + return new File(dataPath, "server-" + server.getId() + ".rrd"); + } + + protected void generateGraph(ServerInfo server, List<ServerStats> stats) throws RrdException, IOException + { + boolean update= updateDatabase(server,stats); + if (update) + { + generateGraph(server, 1); + } + } + + private boolean updateDatabase(ServerInfo server, List<ServerStats> stats) throws IOException, RrdException + { + if (stats.isEmpty()) + { + return false; + } + + File file = getRRDFile(server); + if (!file.exists()) + { + createDatabase(server, stats.get(0).getDate()); + } + + RrdDb rrdDb = new RrdDb(file.getAbsolutePath()); + + try + { + Sample sample = rrdDb.createSample(); + for (ServerStats stat : stats) + { + long timestamp = Util.getTimestamp(stat.getDate()); + if (timestamp > rrdDb.getLastUpdateTime()) + { + sample.setTime(timestamp); + sample.setValue("players", stat.getPlayerCount()); + sample.setValue("activePlayers", stat.getActivePlayerCount()); + sample.update(); + } + } + } + finally + { + rrdDb.close(); + } + + return true; + } + + private void createDatabase(ServerInfo server, Date startDate) throws IOException, RrdException + { + File file = getRRDFile(server); + file.getParentFile().mkdirs(); + + RrdDef def = new RrdDef(file.getAbsolutePath()); + def.setStartTime(Util.getTimestamp(startDate) - 1); + def.setStep(300); + + def.addDatasource("players", "GAUGE", 600, 0, Double.NaN); + def.addDatasource("activePlayers", "GAUGE", 600, 0, Double.NaN); + def.addArchive("AVERAGE", 0.5, 1, 1000000); + + RrdDb rrdDb = new RrdDb(def); + rrdDb.close(); + } + + private void generateGraph(ServerInfo server, int days) throws IOException, RrdException + { + RrdGraphDef graph = new RrdGraphDef(); + + // scale + graph.setStartTime(System.currentTimeMillis() / 1000 - days * 24 * 3600); + graph.setEndTime(System.currentTimeMillis() / 1000); + graph.setMinValue(0); + if (server.getMaxPlayerCount() < 10) + { + graph.setValueAxis(1, 1); + graph.setMaxValue(10); + } + + // data + File file = getRRDFile(server); + graph.datasource("players", file.getAbsolutePath(), "players", "AVERAGE"); + graph.datasource("activePlayers", file.getAbsolutePath(), "activePlayers", "AVERAGE"); + graph.area("players", new Color(141, 255, 141), "Players"); + graph.area("activePlayers", Color.GREEN, "Active Players"); + graph.hrule(server.getMaxPlayerCount(), Color.RED, "Max players"); + + // style + //graph.setTitle(server.getHostname().toUpperCase()); + graph.setVerticalLabel("Players"); + graph.setUnitsLength(7); + graph.setAntiAliasing(true); + graph.setShowSignature(false); + graph.setSignature(server.getHostname()); + graph.setNoLegend(true); + graph.setColor(RrdGraph.COLOR_SHADEA, Color.WHITE); + graph.setColor(RrdGraph.COLOR_SHADEB, Color.WHITE); + graph.setColor(RrdGraph.COLOR_BACK, Color.WHITE); + graph.setColor(RrdGraph.COLOR_ARROW, Color.WHITE); + + // output + File gfile = new File(outpoutPath, "server-" + server.getId() + ".png"); + gfile.getParentFile().mkdirs(); + graph.setWidth(400); + graph.setHeight(300); + graph.setFilename(gfile.getAbsolutePath()); + graph.setImageFormat("png"); + graph.setPoolUsed(false); + + new RrdGraph(graph); + + log.fine("Done generating " + gfile); + } +} Property changes on: monitor/trunk/src/main/java/net/jetrix/monitor/job/GraphGenerationJob.java ___________________________________________________________________ Added: svn:keywords + Date Author Id Revision HeadURL Added: svn:eol-style + native Added: monitor/trunk/src/main/java/net/jetrix/monitor/job/ServerSurveyJob.java ==... [truncated message content] |
From: <sm...@us...> - 2008-08-18 16:11:15
|
Revision: 728 http://jetrix.svn.sourceforge.net/jetrix/?rev=728&view=rev Author: smanux Date: 2008-08-18 16:11:10 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Added Paths: ----------- monitor/branches/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-18 16:10:52
|
Revision: 727 http://jetrix.svn.sourceforge.net/jetrix/?rev=727&view=rev Author: smanux Date: 2008-08-18 16:10:47 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Added Paths: ----------- monitor/tags/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sm...@us...> - 2008-08-18 16:10:30
|
Revision: 726 http://jetrix.svn.sourceforge.net/jetrix/?rev=726&view=rev Author: smanux Date: 2008-08-18 16:10:24 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Added Paths: ----------- monitor/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |